fipy

How to Couple Advection Diffusion Reaction PDEs with FiPy

孤者浪人 提交于 2019-12-11 10:04:09
问题 I tried to solve 1D coupled PDEs for an advection-diffusion-reaction problem with the Matlab function Pdepe (https://www.mathworks.com/help/matlab/ref/pdepe.html). This function is not working properly in my case of a high advection term as compared to the diffusion term. Therefore, I searched and found this option of using the Python library FiPy to solve my PDEs system. My initial conditions are u1=1 for 4*L/10 My coupled equations are of the following form: du1/dt = d/dx(D1 * du1/dx) + g *

How to extract a plane from a 3D variable in FiPy (3D to 2D)

倖福魔咒の 提交于 2019-12-11 02:18:38
问题 I have a variable on a 3D mesh and I am trying to cut a plan. I am surprised this question hasn't been asked before, it looks an easy and common problem but I haven't found any good way. I would appreciate any advice. Let's say that I have a parallelepiped 3x3x5 and that I am trying to extract a z-plane. from fipy import * from numpy import * #Describes a 3x3x5 mesh nx = 3 ny = 3 nz = 5 dx = 1 dy = 1 dz = 1 #Creates a 3D mesh and a 2D mesh to store the plane mesh3D = Grid3D(dx, dy, dz, nx, ny

store old values FiPy

…衆ロ難τιáo~ 提交于 2019-12-08 07:10:38
问题 I'm trying to solve some differential equations using FiPy in Python and as a newbie, I still have some problems. What I do is the following: I define a cell variable, I solve an equation for this variable and I update it. I want to store its values after each time iteration. Here is an example: a = CellVariable(mesh,name='a', value=0., hasOld=True) # eq is an equation involving 'a' # define an array to store the values of 'a' after solving 'eq' a_tt = [] for t in range(10): eq.sweep(dt=0.01)

store old values FiPy

与世无争的帅哥 提交于 2019-12-06 16:45:21
I'm trying to solve some differential equations using FiPy in Python and as a newbie, I still have some problems. What I do is the following: I define a cell variable, I solve an equation for this variable and I update it. I want to store its values after each time iteration. Here is an example: a = CellVariable(mesh,name='a', value=0., hasOld=True) # eq is an equation involving 'a' # define an array to store the values of 'a' after solving 'eq' a_tt = [] for t in range(10): eq.sweep(dt=0.01) a.updateOld() a_tt.append(a) I realize my mistake - the values in 'a_tt' are updated every time I