Skip to content

Commit 08f45e3

Browse files
[Fix] Correct desciprtion of epsilon of AllenCahn equation (#911)
* Correct desciprtion of epsilon of AllenCahn equation * fix seed for test_detach
1 parent c769302 commit 08f45e3

File tree

7 files changed

+10
-6
lines changed

7 files changed

+10
-6
lines changed

docs/zh/api/equation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
options:
66
members:
77
- PDE
8-
- FractionalPoisson
8+
- AllenCahn
99
- Biharmonic
10+
- FractionalPoisson
1011
- HeatExchanger
1112
- Laplace
1213
- LinearElasticity

examples/allen_cahn/allen_cahn_causal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def train(cfg: DictConfig):
6363
model = ppsci.arch.MLP(**cfg.MODEL)
6464

6565
# set equation
66-
equation = {"AllenCahn": ppsci.equation.AllenCahn(0.01**2)}
66+
equation = {"AllenCahn": ppsci.equation.AllenCahn(eps=0.01)}
6767

6868
data = sio.loadmat(cfg.DATA_PATH)
6969
u_ref = data["usol"].astype(dtype) # (nt, nx)

examples/allen_cahn/allen_cahn_default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def train(cfg: DictConfig):
6464
model = ppsci.arch.MLP(**cfg.MODEL)
6565

6666
# set equation
67-
equation = {"AllenCahn": ppsci.equation.AllenCahn(0.01**2)}
67+
equation = {"AllenCahn": ppsci.equation.AllenCahn(eps=0.01)}
6868

6969
# set constraint
7070
data = sio.loadmat(cfg.DATA_PATH)

examples/allen_cahn/allen_cahn_piratenet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def train(cfg: DictConfig):
6464
model = ppsci.arch.PirateNet(**cfg.MODEL)
6565

6666
# set equation
67-
equation = {"AllenCahn": ppsci.equation.AllenCahn(0.01**2)}
67+
equation = {"AllenCahn": ppsci.equation.AllenCahn(eps=0.01)}
6868

6969
# set constraint
7070
data = sio.loadmat(cfg.DATA_PATH)

examples/allen_cahn/allen_cahn_plain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def train(cfg: DictConfig):
6363
model = ppsci.arch.MLP(**cfg.MODEL)
6464

6565
# set equation
66-
equation = {"AllenCahn": ppsci.equation.AllenCahn(0.01**2)}
66+
equation = {"AllenCahn": ppsci.equation.AllenCahn(eps=0.01)}
6767

6868
data = sio.loadmat(cfg.DATA_PATH)
6969
u_ref = data["usol"].astype(dtype) # (nt, nx)

ppsci/equation/pde/allen_cahn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ def allen_cahn(out):
6060
u__t, u__x = jacobian(u, [t, x])
6161
u__x__x = jacobian(u__x, x)
6262

63-
return u__t - self.eps * u__x__x + 5 * u * u * u - 5 * u
63+
return u__t - (self.eps**2) * u__x__x + 5 * u * u * u - 5 * u
6464

6565
self.add_equation("allen_cahn", allen_cahn)

test/equation/test_detach.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
import ppsci
66

7+
paddle.seed(42)
8+
np.random.seed(42)
9+
710

811
def test_equation_detach():
912
# use N-S equation for test

0 commit comments

Comments
 (0)