Implicitsourceterm multiplies scalarsource by the dependent variable. http://www.ctcms.nist.gov/fipy/documentation/numerical/discret.html#source-term
Kris -----Original Message----- From: Richard Gillilan <[email protected]> Sender: <[email protected]> Date: Sat, 24 Jan 2015 15:48:40 To: [email protected]<[email protected]> Reply-To: <[email protected]> Subject: Solved! hints on creating a Source in simple convection diffusion problem Ah ha! It seems the solution was to replace "ImplicitSourceTerm(scalarSource)" with just “scalarSource”. So, I apparently don’t understand the difference between an implicit and explicit source. Anyone care to clarify? Richard On Jan 23, 2015, at 3:49 PM, Richard Gillilan <[email protected]> wrote: > Doing simple convection diffusion in a narrow channel: simulating the > accumulation of damaged solute in a dilute solution as a result of x-ray > exposure. I’m having trouble getting a Source term to work the way I think it > should. I want a strip of volume elements in the middle of the channel (the > x-ray illuminated volume) to act as a source of “damaged” solute. So any > solution that convects into those pixels should have the concentration of > damaged material increased at a constant rate. Note vel is simple Poiseuille > flow, but set to zero for testing purposes. > > Can anyone spot any obvious errors? Here’s what I tried: > > <I’m only showing some of the code here for brevity> > > print "volume element size: ",dx,"x",dy > > Lx = dx*nx > Ly = dy*ny > > mesh = Grid2D(dx=dx, dy=dy, nx=nx, ny=ny) > > print "dimensions of capillary: ",Lx,Ly > ... > xc,yx = mesh.cellCenters > ... > scalarSource = CellVariable(mesh, value=0.0, rank=0) > strip = ((xc>Lx/3) & (xc<2*Lx/3)) > scalarSource.setValue([100.0], where=strip) > > eq = TransientTerm() == > (DiffusionTerm(coeff=D)+VanLeerConvectionTerm(coeff=vel))+ImplicitSourceTerm(scalarSource) _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
