如何在 py-pde (python) 中输入一般非线性 pde?

发布于 2025-01-20 17:02:25 字数 742 浏览 1 评论 0原文

我正在尝试使用 py-pde 来模拟 2d 图 z=u(x,y) 的平均曲率流。

平均曲率流方程有一个函数 u 的 Hessian 项 请参阅此处的方程(D_i 表示相对于 x 和 y 的导数,其中 i = 1和 2 ,分别)

我尝试将 Hessian 写为梯度的梯度,但没有成功。下面的代码展示了一种尝试:

from pde import PDE, ScalarField, UnitGrid, CartesianGrid

grid = CartesianGrid([[0, 100], [0, 100]], [100, 100], periodic=[True, True])  # generate grid
state = ScalarField.from_expression(grid, "x/4 + y/4")  # generate initial condition

eq = PDE({"u": "laplace(u)-(1/(1+dot(gradient(u),gradient(u))))*dot(gradient(u),gradient(gradient(u))*gradient(u))"})  # define the pde
result = eq.solve(state, t_range=1, dt=0.1)
result.plot()

是否可以使用 py-pde 来求解这个方程?怎么可能呢?

I'm trying to use py-pde to simulate the mean curvature flow for a 2d-graph z=u(x,y).

The equation for the Mean Curvature Flow has a term with the Hessian of the function u
see the equations here (D_i denotes the derivatives with respect to x and y, for i = 1 and 2 , respectively)

I tried to write the Hessian as the gradient of the gradient, but without success. The following code shows an attempt:

from pde import PDE, ScalarField, UnitGrid, CartesianGrid

grid = CartesianGrid([[0, 100], [0, 100]], [100, 100], periodic=[True, True])  # generate grid
state = ScalarField.from_expression(grid, "x/4 + y/4")  # generate initial condition

eq = PDE({"u": "laplace(u)-(1/(1+dot(gradient(u),gradient(u))))*dot(gradient(u),gradient(gradient(u))*gradient(u))"})  # define the pde
result = eq.solve(state, t_range=1, dt=0.1)
result.plot()

Is it possible to use py-pde to solve this equation? How could it be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文