bte.dvm.solver#

Module Contents#

Classes#

Grid_onDVDis_NU

A grid class that stores the details and solution of the

BGKSolver

Base class for all neural network modules.

Functions#

F_pm_2(f, vp, vm, dx, dt[, limiter])

F_plm(f, vp, vm, dx, dt[, limiter])

linear_reconstruction_VanLeer(fL, f, fR)

linear_reconstruction using VanLeer limiter

linear_reconstruction_MinMod(fL, f, fR)

linear_reconstruction using MinMod limiter

linear_reconstruction(fL, f, fR[, limiter])

get_reflecting_bdv(dis, BV, xi, side[, no_linear])

[summary]

Attributes#

EPS

bte.dvm.solver.EPS = 1e-08[source]#
bte.dvm.solver.F_pm_2(f, vp, vm, dx, dt, limiter=limiter_minmod)[source]#
bte.dvm.solver.F_plm(f, vp, vm, dx, dt, limiter=limiter_minmod)[source]#
bte.dvm.solver.linear_reconstruction_VanLeer(fL, f, fR)[source]#

linear_reconstruction using VanLeer limiter

Parameters:
  • fL (torch.Tensor) – left cell

  • f (torch.Tensor) – cell

  • fR (torch.Tensor) – right cell

Returns:

leftRec, rightRec

Return type:

torch.Tensor

bte.dvm.solver.linear_reconstruction_MinMod(fL, f, fR)[source]#

linear_reconstruction using MinMod limiter

Parameters:
  • fL (torch.Tensor) – left cell

  • f (torch.Tensor) – cell

  • fR (torch.Tensor) – right cell

Returns:

leftRec, rightRec

Return type:

torch.Tensor

bte.dvm.solver.linear_reconstruction(fL, f, fR, limiter=limiter_minmod)[source]#
bte.dvm.solver.get_reflecting_bdv(dis, BV, xi, side, no_linear=False)[source]#

[summary]

Parameters:
  • dis (DVDis) – [description]

  • BV ([type]) – [description]

  • xi ([type]) – [description]

  • side ([type]) – side=-1 for left BV, side=1 for right BV

  • no_linear (bool, optional) – [description]. Defaults to False.

Raises:

ValueError – [description]

Returns:

[description]

Return type:

[type]

class bte.dvm.solver.Grid_onDVDis_NU(xmin, xmax, nx, vmin, vmax, nv, v_discrete='uni', device='cpu')[source]#

Bases: bte.dvm.distribution.DVDis

A grid class that stores the details and solution of the computational grid.

class bte.dvm.solver.BGKSolver(xmin, xmax, nx, vmin, vmax, nv, v_discrete='uni', BC_type='constant', bgk_simple_kn='simple', device='cpu')[source]#

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing to nest them in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F

class Model(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will have their parameters converted too when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

property f[source]#
set_order(space_order, time_order, time_stiff=False)[source]#
set_space_order(order)[source]#
set_time_stepper(method)[source]#

set time stepper

Parameters:
  • method (str) – can be “bgk-RK1”,”bgk-RK2”,”bgk-RK3”,”bgk-RKs1”,”bgk-RKs2”

  • "Euler"

  • "IMEX-1"

  • "IMEX-2"

  • "IMEX"

set_collisioner(collision_type, **args)[source]#

set collision type

Parameters:

collision_type (str) – “BGK” or “FFT”

Raises:

ValueError – _description_

set_initial(kn, f0)[source]#
set_BC(BC)[source]#
set_BC_Value(LV, RV)[source]#
padding_periodic(f)[source]#
padding_replicate(f)[source]#
padding_constant(f)[source]#
get_reflecting_bdv(fb, side)[source]#
getTau(U)[source]#
update(qP, qN)[source]#
padding_reflecting_linear(f)[source]#
padding_reflecting(f)[source]#
padding_evaporation(f)[source]#
padding_evaporation2(f)[source]#
upwind(fl, fr, direction=0)[source]#
_grad_vf_constant(f, dt)[source]#
_grad_vf_2(f, dt)[source]#
_grad_vf_weno(f, dt)[source]#
_grad_vf_plm(f, dt)[source]#
step_rk(dt)[source]#
step_imex(dt)[source]#
solve_to(tmax, max_dt=None)[source]#
step_euler(dt)[source]#
get_gas_macro()[source]#

返回(rho, m, E)

Returns:

(rho, m, E)

Return type:

torch.array

get_hermite_moments(M_order)[source]#
get_f()[source]#
get_entropy()[source]#