Hi, could someone help why I did not get the initial condition that I want as specified in the attached PDF file? The code I used as below. Thanks for your time! hzh

H=0.25
Calpha0=0.002
Cimc0=0.4105
Cliq0=0.9769

nx=16
ny=90
dx=H
dy=dx

from fipy.meshes.grid2D import Grid2D
mesh=Grid2D(dx=dx, dy=dy, nx=nx, ny=ny)

from fipy.variables.cellVariable import CellVariable

c=CellVariable(name="Concentration",
              mesh=mesh,
              value=Calpha0)

y=mesh.getCellCenters()[...,1]

c.setValue(Cimc0, where=(41*H<y) & (y<45*H))
c.setValue(Cliq0, where=(y>45*H))

from fipy import viewers
viewer=viewers.make(vars=c,
                   limits={'datamin':0., 'datamax':1.})
viewer.plot()

Attachment: Q061004.pdf
Description: Adobe PDF document

Reply via email to