mindflow.pde.Burgers

View Source On Gitee
class mindflow.pde.Burgers(model, loss_fn='mse')[source]

Base class for Burgers 1-D problem based on PDEWithLoss.

Parameters
  • model (mindspore.nn.Cell) – Network for training.

  • loss_fn (Union[str, Cell]) – Define the loss function. Default: "mse".

Supported Platforms:

Ascend GPU

Examples

>>> from mindflow.pde import Burgers
>>> from mindspore import nn, ops
>>> class Net(nn.Cell):
...     def __init__(self, cin=2, cout=1, hidden=10):
...         super().__init__()
...         self.fc1 = nn.Dense(cin, hidden)
...         self.fc2 = nn.Dense(hidden, hidden)
...         self.fcout = nn.Dense(hidden, cout)
...         self.act = ops.Tanh()
...
...     def construct(self, x):
...         x = self.act(self.fc1(x))
...         x = self.act(self.fc2(x))
...         x = self.fcout(x)
...         return x
>>> model = Net()
>>> problem = Burgers(model)
>>> print(problem.pde())
burgers: u(x, t)Derivative(u(x, t), x) + Derivative(u(x, t), t) - 0.00318309897556901Derivative(u(x, t), (x, 2))
    Item numbers of current derivative formula nodes: 3
{'burgers': u(x, t)Derivative(u(x, t), x) + Derivative(u(x, t), t) - 0.00318309897556901Derivative(u(x, t),
(x, 2))}
pde()[source]

Define Burgers 1-D governing equations based on sympy, abstract method.

Returns

dict, user defined sympy symbolic equations.