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.15-16】 #875

Merged
merged 14 commits into from
May 7, 2024
Merged

【PPSCI Export&Infer No.15-16】 #875

merged 14 commits into from
May 7, 2024

Conversation

wufei2
Copy link
Contributor

@wufei2 wufei2 commented May 2, 2024

PR types

Others

PR changes

Others

Describe

#788
为ldc2d_steady和ldc2d_unsteady两个案例添加了export和inference功能

Copy link

paddle-bot bot commented May 2, 2024

Thanks for your contribution!

Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

辛苦修改一下

Comment on lines 380 to 401

unique_t_values = np.unique(input_dict["t"])
segmented_input_dict = {}
segmented_output_dict = {}
for idx, t_value in enumerate(unique_t_values):
# Find the indices corresponding to the current t value
indices = np.where(input_dict["t"] == t_value)[0]
# Extract the corresponding x and y values based on the indices
x_values = input_dict["x"][indices]
y_values = input_dict["y"][indices]
u_values = output_dict["u"][indices]
v_values = output_dict["v"][indices]
p_values = output_dict["p"][indices]
# Construct segmented dictionaries
segmented_input_dict = {"x": x_values, "y": y_values}
segmented_output_dict = {"u": u_values, "v": v_values, "p": p_values}
ppsci.visualize.save_vtu_from_dict(
"./ldc2d_unsteady_Re10_pred_" + str(idx) + ".vtu",
{**segmented_input_dict, **segmented_output_dict},
input_dict.keys(),
cfg.MODEL.output_keys,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ppsci.visualize.save_vtu_from_dict可以通过指定num_timestamps参数来保存多个时刻的数据。不用手写for循环

@wufei2 wufei2 requested a review from HydrogenSulfate May 6, 2024 08:56
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label May 6, 2024
@HydrogenSulfate HydrogenSulfate merged commit dbd9234 into PaddlePaddle:develop May 7, 2024
2 of 4 checks passed
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
* fix doc bugs

* fix codestyle bugs

* 【PPSCI Export&Infer No.15-16】

* fix codestyle bug for PPSCI Export&Infer No.15-16】

* fix codestyle bugs for 【PPSCI Export&Infer No.15-16】

* fix codestyle bugs for 【PPSCI Export&Infer No.15-16】

* fix codestyle bugs for 【PPSCI Export&Infer No.15-16】

* fix bugs for 【PPSCI Export&Infer No.15-16】

* fix codestyle bugs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants