-
Notifications
You must be signed in to change notification settings - Fork 184
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
Conversation
… into my-cool-stuff
… into my-cool-stuff
… into my-cool-stuff
Thanks for your contribution! |
… into my-cool-stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
辛苦修改一下
examples/ldc/ldc2d_unsteady_Re10.py
Outdated
|
||
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, | ||
) |
There was a problem hiding this comment.
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循环
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* 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
PR types
Others
PR changes
Others
Describe
#788
为ldc2d_steady和ldc2d_unsteady两个案例添加了export和inference功能