我有一个 1 个空间维度的耦合非线性 PDE 系统,我想使用 FiPy 来解决这个问题。因变量是和:
到目前为止,和都是简单的数值参数。
我在表示方程中的第二项时遇到了严重的麻烦,因为似乎没有很好的写法。它应该写成对流项还是源项?
这是到目前为止的代码,省略了一些内容:
L = 5.0
nx = 100
mesh = Grid1D(nx=nx, dx=L/nx)
x = mesh.cellCenters[0]
density = CellVariable(name=r"$n$", mesh=mesh) # The n dependent variable
temperature = CellVariable(name=r"$T$", mesh=mesh) # The T dependent variable
D = 5.0
zeta = 0.5
density_equation = TransientTerm(var=density) == \
DiffusionTerm(coeff=D, var=density)
temp_equation = TransientTerm(var=temperature) == \
DiffusionTerm(coeff= D / zeta, var=temperature) \
+ S_T # <- What should be filled in for this?
semifull_eq = density_equation & temp_equation
if __name__ == '__main__':
viewer = Viewer((density, temperature))
timeStepDuration = dx**2 / (2*diffusivity)
for steps in range(100):
semifull_eq.solve(dt=timeStepDuration)
if __name__ == '__main__':
viewer.plot()
为简洁起见,我省略了边界和初始条件。