bte.grad.distribution#
Module Contents#
Classes#
The base class for gas distribution. |
|
HermiteDis: Gas distribution in Hermite form. |
|
Base class for all neural network modules. |
|
Base class for all neural network modules. |
|
The gas distribution for discrete velocity method. |
|
The base class for gas distribution. |
|
HermiteDis: Gas distribution in Hermite form. |
Functions#
|
|
|
|
|
|
|
Project_RK4 使用R-K4格式对分布函数进行投影 |
|
|
|
|
|
|
|
|
|
|
|
return a discrete of velocity with uniform partition. |
|
return a discrete of velocity with points on legendre-gauss points. |
|
|
|
|
|
|
|
|
|
Attributes#
- class bte.grad.distribution.HermiteDis(u, theta, coef)[source]#
Bases:
HermitedistributionBaseHermiteDis: Gas distribution in Hermite form.
- Parameters:
u (bte.utils.indexs.torch.Tensor) –
theta (bte.utils.indexs.torch.Tensor) –
coef (bte.utils.indexs.torch.Tensor) –
- Project_2B(dest, STEP=1)[source]#
Project_A2B 将分布投影到dest对应的参数上
- Parameters:
dest (HermiteDis) –
STEP (int) –
- Return type:
- bte.grad.distribution.Project_RK4_step(dis, u0, theta0, u, theta, h)[source]#
- Parameters:
h (float) –
- bte.grad.distribution.Project_RK4(dis, u, theta, STEP=1)[source]#
Project_RK4 使用R-K4格式对分布函数进行投影
- Parameters:
dis (torch.Tensor) – 分布函数
u (torch.Tensor) – 分布中心
theta (torch.Tensor) – 分布宽度
STEP (int, optional) – RK方法的步数, by default 1
- Returns:
投影后的分布函数
- Return type:
torch.Tensor
- bte.grad.distribution.Project_RK4_stepT(dis, u0, theta0, u, theta, h=1)[source]#
- Parameters:
h (float) –
- bte.grad.distribution.Project_RK4T(dis, u0, theta0, u, theta, STEP=1)[source]#
- Parameters:
STEP (int) –
- bte.grad.distribution.eval_hermitenorm(n, x)[source]#
- Parameters:
n (int) –
x (bte.utils.indexs.torch.Tensor) –
- bte.grad.distribution.eval_hermitenorm_seq(n, x)[source]#
- Parameters:
n (int) –
x (bte.utils.indexs.torch.Tensor) –
- class bte.grad.distribution.DVDisMeta(v, v_w, *args)[source]#
Bases:
torch.nn.ModuleBase 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.
- class bte.grad.distribution.DVDisMeta_Grid(vL, v_wL, *args)[source]#
Bases:
DVDisMetaBase 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.
- Parameters:
vL (bte.utils.indexs.List) –
v_wL (bte.utils.indexs.List) –
- class bte.grad.distribution.DVDis(v_meta, data)[source]#
Bases:
distributionBaseThe gas distribution for discrete velocity method.
- Parameters:
v_meta (DVDisMeta) –
- static empty(nv, vmin, vmax, method='uni', device='cpu')[source]#
An empty new distribution. with velocity grid created by method ‘uni’ or ‘leg’.
- Parameters:
nv (int) – Numbers of grid
vmin (float) – vmin
vmax (float) – vmax
method (str, optional) – ‘uni’ for uniform_velocity, ‘leg’ for legendre_velocity. Defaults to ‘uni’.
- Raises:
ValueError – [description]
- Returns:
[description]
- Return type:
- from_HermiteDis(dis)[source]#
- Parameters:
dis (HermiteDis) –
- Return type:
- bte.grad.distribution.uniform_velocity(nv, vmin, vmax)[source]#
return a discrete of velocity with uniform partition.
v_0=vmin+0.5*(vmax-vmin)/nv v_{nv-1}=vmax-0.5*(vmax-vmin)/nv
- Parameters:
nv (int) – Numbers of grid
vmin (float) – vmin
vmax (float) – vmax
- Returns:
v, weight of v
- Return type:
Tuple[torch.Tensor,torch.Tensor]
- bte.grad.distribution.legendre_velocity(nv, vmin, vmax)[source]#
return a discrete of velocity with points on legendre-gauss points.
- Parameters:
nv (int) – Numbers of grid
vmin (float) – vmin
vmax (float) – vmax
- Returns:
v, weight of v
- Return type:
Tuple[torch.Tensor,torch.Tensor]
- bte.grad.distribution.ND_velocity(func)[source]#
- Parameters:
func (Callable[[int, int, int], bte.utils.indexs.Tuple]) –
- bte.grad.distribution.velocity_list(func, nvT, vminT, vmaxT)[source]#
- Parameters:
nvT (bte.utils.indexs.Tuple) –
vminT (bte.utils.indexs.Tuple) –
vmaxT (bte.utils.indexs.Tuple) –
- bte.grad.distribution.product_meshgrid(vL, wL)[source]#
- Parameters:
vL (bte.utils.indexs.List) –
wL (bte.utils.indexs.List) –
- class bte.grad.distribution.DVDis_Chu(v_meta, data_g, data_h, ndim=3)[source]#
Bases:
distributionBaseThe base class for gas distribution.
- class bte.grad.distribution.HermiteDisND(u, theta, coef, indt)[source]#
Bases:
HermitedistributionBaseHermiteDis: Gas distribution in Hermite form.
- Parameters:
u (bte.utils.indexs.torch.Tensor) –
theta (bte.utils.indexs.torch.Tensor) –
coef (bte.utils.indexs.torch.Tensor) –
indt (bte.utils.indexs.index_table) –
- Project_2B(dest, STEP=1)[source]#
Project_A2B 将分布投影到dest对应的参数上
- Parameters:
dest (HermiteDisND) –
STEP (int) –
- Return type: