Skip to content

Commit

Permalink
update success reprod code
Browse files Browse the repository at this point in the history
  • Loading branch information
HydrogenSulfate committed May 28, 2023
1 parent a7b7ffe commit 2793096
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion examples/bracket/bracket.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from ppsci.utils import logger

if __name__ == "__main__":
# fluid.core.set_prim_eager_enabled(True)
args = config.parse_args()
# set random seed for reproducibility
ppsci.utils.misc.set_random_seed(42)
Expand Down
4 changes: 3 additions & 1 deletion ppsci/geometry/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@ def random_boundary_points(self, n, random="pseudo", criteria=None):
face_points = sample_in_triangle(
self.v0[i], self.v1[i], self.v2[i], npoint, random, criteria
)
face_normal = np.tile(self.face_normal[i], [npoint, 1])
face_normal = np.tile(self.face_normal[i], [npoint, 1]).astype(
paddle.get_default_dtype()
)
valid_area = np.full(
[npoint, 1],
valid_areas[i] / npoint,
Expand Down
8 changes: 8 additions & 0 deletions ppsci/utils/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def train_forward(
else:
raise TypeError(f"expr type({type(expr)}) is invalid")

# put field 'area' into output_dict
if "area" in input_dicts[i]:
output_dict["area"] = input_dicts[i]["area"]

output_dicts.append(output_dict)

# clear differentiation cache
Expand Down Expand Up @@ -104,6 +108,10 @@ def eval_forward(
else:
raise TypeError(f"expr type({type(expr)}) is invalid")

# put field 'area' into output_dict
if "area" in input_dict:
output_dict["area"] = input_dict["area"]

# clear differentiation cache
clear()

Expand Down

0 comments on commit 2793096

Please sign in to comment.