-
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
[Feature] Replace python funcion with sympy expression #507
[Feature] Replace python funcion with sympy expression #507
Conversation
Thanks for your contribution! |
efaf5e4
to
be67fb4
Compare
ppsci/equation/pde/navier_stokes.py
Outdated
def __init__(self, nu: Union[float, Callable], rho: float, dim: int, time: bool): | ||
def __init__( | ||
self, | ||
nu: Union[float, Callable], |
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.
后面代码中 nu 允许类型为 str, 类型提示需要修改下。其他变量也检查下有没有类似情况
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/equation/pde/navier_stokes.py
Outdated
invars = (t,) + invars | ||
if dim == 3: | ||
invars += (z,) | ||
|
||
self.nu = nu | ||
self.rho = rho |
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.
这两行代码中用的的 nu, rho 在后续代码中有修改,看是否需要把这两行放到修改后面
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.
已修改
@@ -33,15 +35,15 @@ class Poisson(base.PDE): | |||
>>> pde = ppsci.equation.Poisson(2) | |||
""" | |||
|
|||
def __init__(self, dim: int): | |||
def __init__(self, dim: int, detach_keys: Optional[Tuple[str, ...]] = None): |
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.
更新docstring
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.
已修改
@@ -61,214 +62,114 @@ def __init__( | |||
rho: float = 1, | |||
dim: int = 3, | |||
time: bool = False, | |||
detach_keys: Optional[Tuple[str, ...]] = None, |
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.
更新docstring
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.
已修改
dim: int, | ||
q: float, | ||
D: float, | ||
detach_keys: Optional[Tuple[str, ...]] = None, |
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.
更新docstring, 检查类型提示
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.
LGTM
) * 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>
PR types
Others
PR changes
Others
Describe
主要修改点:
Solver
和expression
其他:
normal_dot_vel
为normal_dot_vec
sp_parser
的相关无用代码