Skip to content

Conversation

@HydrogenSulfate
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate commented Aug 26, 2023

PR types

Others

PR changes

Others

Describe

主要修改点:

  1. 基于 [Feature&Fix] Add sympy_to_func #505,将所有内置方程从 python function 替换为 smypy expression,并修改相关模块的代码,包括 Solverexpression
    • examples/aneurysm/aneurysm_flow.py
    • examples/aneurysm/aneurysm.py
    • examples/bracket/bracket.py
    • examples/cylinder/2d_unsteady/cylinder2d_unsteady_Re100.py
    • examples/darcy/darcy2d.py
    • examples/euler_beam/euler_beam.py
    • examples/fsi/viv.py
    • examples/laplace/laplace2d.py
    • examples/ldc/ldc2d_steady_Re10.py
    • examples/ldc/ldc2d_unsteady_Re10.py
    • examples/pipe/poiseuille_flow.py

其他:

  1. 修改 laplace2d 案例的输出目录,从二级目录改为一级目录
  2. 完善 Probability 文档
  3. 更改 aneurysm 案例中,normal_dot_velnormal_dot_vec
  4. 更改 bracket 案例中的 label 顺序,与对应公式在方程中的初始化顺序保持一致
  5. 删除所有关于 sp_parser 的相关无用代码
  6. 更改 initializer.py 内 liner_init 和 conv_init 的初始化方式为 kaiming 初始化
@paddle-bot
Copy link

paddle-bot bot commented Aug 26, 2023

Thanks for your contribution!

@HydrogenSulfate HydrogenSulfate changed the title [WIP][Feature] Replace python funcion with sympy expression Sep 10, 2023
def __init__(self, nu: Union[float, Callable], rho: float, dim: int, time: bool):
def __init__(
self,
nu: Union[float, Callable],
Copy link
Collaborator

Choose a reason for hiding this comment

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

后面代码中 nu 允许类型为 str, 类型提示需要修改下。其他变量也检查下有没有类似情况

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

invars += (z,)

self.nu = nu
self.rho = rho
Copy link
Collaborator

Choose a reason for hiding this comment

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

这两行代码中用的的 nu, rho 在后续代码中有修改,看是否需要把这两行放到修改后面

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

"""

def __init__(self, dim: int):
def __init__(self, dim: int, detach_keys: Optional[Tuple[str, ...]] = None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

更新docstring

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

rho: float = 1,
dim: int = 3,
time: bool = False,
detach_keys: Optional[Tuple[str, ...]] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

更新docstring

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

dim: int,
q: float,
D: float,
detach_keys: Optional[Tuple[str, ...]] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

更新docstring, 检查类型提示

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

@zhiminzhang0830 zhiminzhang0830 merged commit 8b8eae6 into PaddlePaddle:develop Sep 13, 2023
@HydrogenSulfate HydrogenSulfate deleted the cvt_pyfunc_to_sym branch September 13, 2023 12:25
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

* replace sympy PDE for biharmonic and laplace

* refine sym_to_func.py

* fix bug in _cvt_to_key

* refine sym_to_func and expression code

* add euler_beam static code(WIP, can not running, to be debug)

* wip code

* temporary code(need to be refined)

* update solver code

* replace more pdes with sympy

* simplify code in solver

* update code

* rename 'normal_dot_vel' to 'normal_dot_vec'

* fix bug

* update unitest

* remove redundant unitest

* remove unnecessary code

* remove unnecessary more code

* use DETACH_FUNC_NAME instead of 'detach'

* add derivatives for sdf function

* replace .diff.diff with .diff(, 2)

* support exporting expression to .dot and .png file for visualizing and DEBUG

* remove compute_sdf_derivatives for next PR

* refine docstring of ppsci/data/dataset/array_dataset.py

* remove sdf_derivatives code in geometry for next PR

* remove print code in solver

* rename sympy_to_function to lambdify and add it in ppsci.*

* rename for test files

* rename sym_to_func.py to symbolic.py

* update linear_init_ and conv_init_ to kaiming style

* refine probability document

* change list to tuple

* update docstrings of equations

* larger atol to 1e-7 for test_linear_elasticity

* fix seed to 42 for test_linear_elasticity

---------

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

3 participants