bte.dvm.distribution#
Module Contents#
Classes#
The base class for gas distribution. |
|
Base class for all neural network modules. |
|
Base class for all neural network modules. |
|
The gas distribution for discrete velocity method. |
|
Base class for all neural network modules. |
Functions#
|
return a discrete of velocity with uniform partition. |
|
return a discrete of velocity with points on legendre-gauss points. |
|
|
|
|
|
|
|
|
|
Attributes#
- class bte.dvm.distribution.DVDisMeta(v, v_w, gamma=5 / 3, *args)[source]#
Bases:
torch.nn.Module,DVDisMetaBaseBase 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.dvm.distribution.DVDisMeta_Grid(vL, v_wL, *args)[source]#
Bases:
torch.nn.Module,DVDisMetaBaseBase 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.dvm.distribution.DVDis(v_meta, data)[source]#
Bases:
torch.nn.Module,distributionBaseThe gas distribution for discrete velocity method.
- Parameters:
v_meta (DVDisMetaBase) –
- 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:
- bte.dvm.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.dvm.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.dvm.distribution.ND_velocity(func)[source]#
- Parameters:
func (Callable[[int, int, int], bte.utils.indexs.Tuple]) –
- bte.dvm.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.dvm.distribution.product_meshgrid(vL, wL)[source]#
- Parameters:
vL (bte.utils.indexs.List) –
wL (bte.utils.indexs.List) –
- class bte.dvm.distribution.DVDis_Chu(v_meta, data_g, data_h, ndim=3)[source]#
Bases:
torch.nn.Module,distributionBaseBase 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.