-
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
update PhyGeoNet #731
update PhyGeoNet #731
Conversation
Thanks for your contribution! |
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.
code部分形如:XXX = cfg.xxx
的冗余代码可以都优化一下,直接用cfg.xxx
即可
examples/phygeonet/heat_equation.py
Outdated
"iters_per_epoch": iters_per_epoch, | ||
"num_workers": 0, | ||
}, | ||
ppsci.loss.FunctionalLoss(lambda out, label, weught: out["mRes"]), |
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.
weught->weight
examples/phygeonet/heat_equation.py
Outdated
) | ||
sup_constraint = {sup_constraint_mres.name: sup_constraint_mres} | ||
|
||
def _transform_out(_input, _output, pad_singleside=pad_singleside): |
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.
加一下type-hint以及docstring
examples/phygeonet/heat_equation.py
Outdated
from utils import dfdx | ||
from utils import dfdy | ||
from utils import setAxisLabel | ||
from utils import visualize |
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.
改为import util
+utils.xxx
的调用方式
examples/phygeonet/heat_equation.py
Outdated
|
||
def _transform_out(_input, _output, pad_singleside=pad_singleside): | ||
output_v = _output["outputV"] | ||
Jinv = _input["jinvs"] |
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.
Jinv变量改为小写
examples/phygeonet/utils.py
Outdated
return dfdx | ||
|
||
|
||
def dfdy(f, dxdxi, dxdeta, Jinv, h=0.01): |
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/phygeonet/utils.py
Outdated
return dfdy | ||
|
||
|
||
def setAxisLabel(ax, type): |
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/phygeonet/utils.py
Outdated
raise ValueError("The axis type only can be reference or physical") | ||
|
||
|
||
def gen_e2vcg(x): |
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.
e2vcg意义不明,在docstring中补上说明
examples/phygeonet/utils.py
Outdated
return ax, cbar | ||
|
||
|
||
def tikzplotlib_fix_ncols(obj): |
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/phygeonet/utils.py
Outdated
e2vcg[:, j * nelemx + i] = np.asarray( | ||
[j * nnx + i, j * nnx + i + 1, (j + 1) * nnx + i, (j + 1) * nnx + i + 1] | ||
) | ||
return e2vcg.astype("int") |
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.
改为"int64"
@HydrogenSulfate done |
examples/phygeonet/heat_equation.py
Outdated
# initiallizer | ||
ppsci.utils.misc.set_random_seed(cfg.seed) | ||
logger.init_logger("ppsci", osp.join(cfg.output_dir, "train.log"), "info") |
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/phygeonet/heat_equation.py
Outdated
logger.init_logger("ppsci", osp.join(cfg.output_dir, "eval.log"), "info") | ||
ppsci.utils.misc.set_random_seed(cfg.seed) | ||
|
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.
同上
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.
2个py文件修改一下
@HydrogenSulfate done |
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
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
* Change the directory structure * update phygeonet code * update heat equation code * update heat equation with bc code * refine phygeonet code * add callback for seed and logger
PR types
Others
PR changes
Others
Describe
更新PhyGeoNet案例代码
TODO:更新案例文档