Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【PPSCI Export&Infer No.24】 biharmonic2d #858

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
P[PSCI Export&Infer No.724] biharmonic2d fix
smallpoxscattered committed Apr 22, 2024
commit 4bf0622b1085a81889965d50673ee3907a18684c
11 changes: 3 additions & 8 deletions examples/biharmonic2d/biharmonic2d.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
from os import path as osp

import hydra
@@ -32,8 +31,6 @@


def plotting(figname, output_dir, data, griddata_points, griddata_xi, boundary):
if not osp.exists(output_dir):
os.makedirs(output_dir)
plt.clf()
fig = plt.figure(figname, figsize=(15, 12))
gs = gridspec.GridSpec(2, 3)
@@ -42,9 +39,7 @@ def plotting(figname, output_dir, data, griddata_points, griddata_xi, boundary):
for i, key in enumerate(data):
plot_data = griddata(
griddata_points,
data[key].flatten()
if isinstance(data[key], np.ndarray)
else data[key].numpy().flatten(),
data[key].flatten(),
griddata_xi,
method="cubic",
)
@@ -348,7 +343,7 @@ def compute_outs(w, x, y):
plotting(
"eval_Mx_Mxy_My_Qx_Qy_w",
cfg.output_dir,
outs,
{k: v.numpy() for k, v in outs.items()},
griddata_points,
griddata_xi,
boundary,
@@ -434,7 +429,7 @@ def inference(cfg: DictConfig):
boundary = [0, cfg.LENGTH, 0, cfg.WIDTH]
plotting(
"eval_Mx_Mxy_My_Qx_Qy_w",
"./biharmonic2d_pred",
cfg.output_dir,
output_dict,
griddata_points,
griddata_xi,