Hi all, I've successfully simulated a fixed point convection-diffusion problem in 1-D whereby the velocity is a function of the position (attached). The script I used is the following:
>>> mesh = Grid1D(nx = nx, dx = dx) >>> pos = FaceVariable(mesh=mesh, value=mesh.getFaceCenters(), rank=1) >>> eq = TransientTerm() == DiffusionTerm(coeff = 1.) + convection(coeff=(np.tanh(pos))) * The tanh is used to ensure that when the solution is positive, it convects to the left; when negative, then to the right. However, I ran into problems trying to do the same for 2-D. Using the same template, I have >>> mesh = Grid2D(nx=nx, ny=ny, dx=dx, dy=dy) >>> pos = FaceVariable(mesh=mesh, value=mesh.getFaceCenters(), rank=1) >>> pos_x = pos[0] >>> pos_y = pos[1] >>> eq = TransientTerm() == DiffusionTerm(coeff=1.0) + convection(coeff=((np.tanh(pos[0])),(np.tanh(pos[0])))) I know it likely has to do with the way I defined pos_x and pos_y. But I can't figure out how to convert them into the usable MeshVariable for this case. Yun -- Graduate Group of Ecology Doctoral Candidate Department of Environmental Science and Policy Center for Population Biology University of California, Davis
s-cd1dx.py
Description: Binary data
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
