Hi, > > On Fri, Aug 5, 2011 at 9:50 AM, Fadoua El Moustaid <[email protected]> > wrote: >> Hi All, >> >> I am trying to solve a system of pdes, I get an error about the use of >> the >> operator *. >> Can you please look at my code and see the error I get?? > > A few things, the equation is written as > > eqB = TransientTerm() == (1/r.getFaceValue()**2) * > DiffusionTerm(coeff=Db * r.getFaceValue()**2) - xi * (B.getFaceGrad() > * S.getFaceGrad() + B.getFaceValue() * r.getFaceValue() * > (r.getFaceValue()**2 * S.getFaceGrad()).getDivergence())
I did that and my equation becomes eqB = TransientTerm(coeff=r.getFaceValue()**2) == DiffusionTerm(coeff=Db * r.getFaceValue()**2) - xi * r.getFaceValue()**2 * (B.getFaceGrad() * S.getFaceGrad() + B.getFaceValue() * r.getFaceValue() * (r.getFaceValue()**2 * S.getFaceGrad()).getDivergence()) after running the code I get an error saying "The coefficient must be a rank-0 CellVariable or a scalar value" I am defining r as r = mesh.getCellCenters()[0] is this wrong or right? > > Firstly, FiPy can't deal with a varying coefficient outside the > operator. So you need to multiply through by r**2 and rearrange. Also > the r**2 can act as a coefficient for the transient term as it is not > time dependent. > >> Also, I have in my equations a singularity problem at r=0, is it fine >> for >> fipy to treat this type of problems? > > Why is there a singularity at r=0? It's a regular 1D mesh, not > cylindrical. Yes, I agree with that, I was just confused about the 1/r in my equations. > > > > -- > Daniel Wheeler > > Thank you, Fadoua
