bte.dvm.distribution#

Module Contents#

Classes#

distributionBase

The base class for gas distribution.

DVDisMetaBase

DVDisMeta

Base class for all neural network modules.

DVDisMeta_Grid

Base class for all neural network modules.

DVDis

The gas distribution for discrete velocity method.

DVDis_Chu

Base class for all neural network modules.

Functions#

uniform_velocity(nv, vmin, vmax)

return a discrete of velocity with uniform partition.

legendre_velocity(nv, vmin, vmax)

return a discrete of velocity with points on legendre-gauss points.

uniform_velocity_2d(nv, vmin, vmax)

legendre_velocity_2d(nv, vmin, vmax)

ND_velocity(func)

velocity_list(func, nvT, vminT, vmaxT)

product_meshgrid(vL, wL)

Attributes#

class bte.dvm.distribution.distributionBase[source]#

The base class for gas distribution.

abstract density()[source]#
abstract velocity()[source]#
abstract temperature()[source]#
abstract __add__(anotherDis)[source]#
abstract __radd__(anotherDis)[source]#
abstract __sub__(anotherDis)[source]#
abstract __mul__(multiplier)[source]#
abstract __rmul__(multiplier)[source]#
abstract __truediv__(divider)[source]#
class bte.dvm.distribution.DVDisMetaBase[source]#
class bte.dvm.distribution.DVDisMeta(v, v_w, gamma=5 / 3, *args)[source]#

Bases: torch.nn.Module, DVDisMetaBase

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.

class bte.dvm.distribution.DVDisMeta_Grid(vL, v_wL, *args)[source]#

Bases: torch.nn.Module, DVDisMetaBase

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.

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, distributionBase

The gas distribution for discrete velocity method.

Parameters:

v_meta (DVDisMetaBase) –

property v[source]#
property v2[source]#
property v3[source]#
property w[source]#
__add__(anotherDis)[source]#
Parameters:

anotherDis (DVDis) –

__radd__(anotherDis)[source]#
Parameters:

anotherDis (DVDis) –

__sub__(anotherDis)[source]#
__mul__(multiplier)[source]#
__rmul__(multiplier)[source]#
__truediv__(divider)[source]#
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:

DVDis

sum(f)[source]#
Parameters:

f (bte.utils.indexs.torch.Tensor) –

density(f=None)[source]#

Compute the macro quantity: density

velocity(f=None)[source]#

Compute the macro quantity: velocity

temperature(f=None)[source]#

Compute the macro quantity: temperature

_m0(f=None)[source]#

0-th order momentum of f

_m1(f=None)[source]#

1st order momentum of f

_m2(f=None)[source]#

2nd order momentum of f

_m3(f=None)[source]#

3nd order momentum of f

_m(alpha, i, j, k, f=None)[source]#

ijk order momentum of f

_M(alpha, i, j, k, f=None)[source]#

ijk order momentum of f

heatflux(f=None)[source]#
rho_u_theta(f=None)[source]#
maxwellian(rho_u_theta=None)[source]#
maxwellian_half(rho_u_theta=None, sign=0)[source]#
one_side(f=None, sign=0)[source]#
reverse(f=None)[source]#
from_HermiteDis(dis)[source]#
Return type:

DVDis

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.uniform_velocity_2d(nv, vmin, vmax)[source]#
bte.dvm.distribution.legendre_velocity_2d(nv, vmin, vmax)[source]#
bte.dvm.distribution.ND_velocity(func)[source]#
Parameters:

func (Callable[[int, int, int], bte.utils.indexs.Tuple]) –

bte.dvm.distribution.uniform_velocity_nd[source]#
bte.dvm.distribution.legendre_velocity_nd[source]#
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, distributionBase

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 v[source]#
property v2[source]#
property v3[source]#
property w[source]#
__add__(another)[source]#
__radd__(another)[source]#
__sub__(another)[source]#
__mul__(multiplier)[source]#
__rmul__(multiplier)[source]#
__truediv__(divider)[source]#
density(g=None, h=None)[source]#
velocity(g=None, h=None)[source]#
temperature(g=None, h=None)[source]#
rho_u_theta(g=None, h=None)[source]#
maxwellian(g=None, h=None, rho_u_theta=None)[source]#