Hello! I'm new to FiPy and I'm trying to solve a 2-dimensional problem of 2 coupled equations with 2 variables. I'm having troubles with the boundary conditions. I checked the examples, but all examples containing convection are 1d. I'd be very thankful for some tips on how I can make this work!
The equations I want to solve: \partial_x A + \partial_z B = 0 \partial_x B - \partial_z A = 0 on a box with 0<x<L and 0<z<H. Boundary conditions are A(x,0) = B(x,0) = 0 A(L,z) = B(L,z) = 0 B(0,z) = z I tried rewriting my problem in terms of convection terms. Introducing the vectors u = (1,0),v = (0,1) the equations above can be written as convection terms: \nabla \cdot (u A) + \nabla \cdot (v B) = 0 \nabla \cdot (u B) - \nabla \cdot (v A) = 0 My attempt to solve this with FiPy: # Define the domain and make a mesh H = 50.0 L = H nx = 20 nz = nx dx = L / nx dz = H / nz mesh = Grid2D(dx=dx, dy=dz, nx=nx, ny=nz) # Create two CellVariable and initialize it to zero: A = CellVariable(name = "normal stress",mesh = mesh,value = 0.) B = CellVariable(name = "shear stress",mesh = mesh,value = 0.) # apply boundary conditions X, Z = mesh.faceCenters B.constrain(Z,mesh.facesRight) B.constrain(0.,mesh.facesTop) B.constrain(0.,mesh.facesLeft) A.constrain(0.,mesh.facesTop) A.constrain(0.,mesh.facesLeft) # define the system of equations eq1 = (ConvectionTerm(var=A,coeff=(1.,0.)) + ConvectionTerm(var=B,coeff=(0.,1.))) == 0. eq2 = (ConvectionTerm(var=B,coeff=(1.,0.)) + ConvectionTerm(var=A,coeff=(0.,-1.))) == 0. coupled = eq1 & eq2 # solve coupled.solve() # view solution viewer = Viewer(vars=A) viewer.plot() viewer = Viewer(vars=B) viewer.plot() The solution I get is zero everywhere. It doesn't even fulfill the boundary conditions... I experimented with some other boundary conditions (setting some to 0. and some to 1.), the results were somewhat different, but the resulting solution never quite fulfilled the boundary conditions. So I feel like I'm missing something vital about how boundary conditions work with convection terms. Can someone give me a hint how it works and what I'm doign wrong? Kind regards Tanja _______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]