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

[Feature&Fix] Add sympy_to_func #505

Merged
merged 20 commits into from
Aug 30, 2023

Conversation

HydrogenSulfate
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate commented Aug 24, 2023

PR types

New features

PR changes

APIs

Describe

主要修改点:

  1. 初步添加对sympy表达式的支持(设计方案:sympy_to_func
  2. 添加在 LinearElasticityNavierStokes 上的单测,测试结果如下
>>> pytest test/utils/test_linear_elasticity_sympy.py

test/utils/test_linear_elasticity_sympy.py ........                                                                                                                                                                                                        [100%]
Results (12.47s):
         8 passed

>>> pytest test/utils/test_navier_stokes_sympy.py

test/utils/test_navier_stokes_sympy.py ....                                                                                                                                                                                                                [100%]
Results (17.04s):
         4 passed

>>> python test/utils/speed_test_navier_stokes.py

compute_with_sympy overhead: 0.01575
compute_with_pyfunc overhead: 0.01501
u check pass
v check pass
p check pass
continuity check pass
momentum_x check pass
momentum_y check pass

其他:

  1. 修复 LinearElasticity 内,未正确处理dim=2而可能导致KeyError的情况;删除无用的 navier_x/y/z 系列表达式,并修改相关单测

@AndPuQing 有空可以review一下

@HydrogenSulfate HydrogenSulfate force-pushed the feature-sympy branch 2 times, most recently from 3be132b to 97513c3 Compare August 26, 2023 05:43
@HydrogenSulfate HydrogenSulfate changed the title [WIP][Feature&Fix] Add sympy_to_func [Feature&Fix] Add sympy_to_func Aug 26, 2023


class ConstantNode(Node):
""" "Class for constant variable node in converted expression tree.
Copy link
Collaborator

Choose a reason for hiding this comment

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

多了一个 "

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

Copy link
Collaborator

@zhiminzhang0830 zhiminzhang0830 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 mentioned this pull request Aug 30, 2023
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
* add sympy2func

* fix node

* fix var name

* fix implementation

* add sympy to func module

* add type hint and clean code

* update unitest for N-S equation with sympy-base 'nu'

* delete redundant sympy2func.py

* remove sympy to function code from expression.py to sym_to_func.py

* update type hint in expression

* update code

* update code

* update code

* refine sym_to_func.py

* fix bug in _cvt_to_key

* remove navier equations from LinearElasticity and delete related unitests

* refine sym_to_func.py
:

* remove redundant '"' in docstring

---------

Co-authored-by: PuQing <me@puqing.work>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants