#82: Some combinations of DiffusionTerm and ConvectionTerm do not work
-------------------+--------------------------------------------------------
Reporter:  wd15    |       Owner:      
    Type:  defect  |      Status:  new 
Priority:  1       |   Component:  None
 Version:          |    Severity:  Bugs
Keywords:          |  
-------------------+--------------------------------------------------------
 The following combinations seem to work correctly:

 ## works

 eqn = UpwindConvectionTerm(coeff=convCoeff, diffusionTerm=-dTerm) == dTerm

 ##eqn = TransientTerm(1e-10) == UpwindConvectionTerm(coeff=-convCoeff,
 diffusionTerm=dTerm) +  dTerm

 ##eqn = 0 == UpwindConvectionTerm(coeff=-convCoeff, diffusionTerm=dTerm) +
 dTerm

 ##eqn = 0 == -UpwindConvectionTerm(coeff=convCoeff, diffusionTerm=dTerm) +
 dTerm

 This is broken:

 eqn = UpwindConvectionTerm(coeff=convCoeff, diffusionTerm=dTerm) == dTerm

 It appears that the DiffusionTerm and ConvectionTerm need to be on the
 same side of the equation. The following code demonstrates the problem:


 from fipy import TransientTerm, UpwindConvectionTerm, DiffusionTerm,
 Grid1D, CellVariable, VectorFaceVariable, numerix

 from fipy import FixedValue, FaceVariable

 mesh = Grid1D(nx=10, dx=1.)

 var = CellVariable(mesh=mesh)

 convCoeff = VectorFaceVariable(mesh=mesh)

 convCoeff[:6]=-1e+6

 diffCoeff = FaceVariable(mesh=mesh)

 diffCoeff[6:]=1e+3

 print convCoeff

 print diffCoeff

 BCs = (FixedValue(value=1., faces=mesh.getFacesRight()),
 FixedValue(value=0., faces=mesh.getFacesLeft()))

 dTerm = DiffusionTerm(1000)

 ## broken

 ##eqn = UpwindConvectionTerm(coeff=convCoeff, diffusionTerm=dTerm) ==
 dTerm

 ## works

 eqn = UpwindConvectionTerm(coeff=convCoeff, diffusionTerm=-dTerm) == dTerm

 ##eqn = TransientTerm(1e-10) == UpwindConvectionTerm(coeff=-convCoeff,
 diffusionTerm=dTerm) +  dTerm

 ##eqn = 0 == UpwindConvectionTerm(coeff=-convCoeff, diffusionTerm=dTerm) +
 dTerm

 ##eqn = 0 == -UpwindConvectionTerm(coeff=convCoeff, diffusionTerm=dTerm) +
 dTerm

 eqn.solve(var, dt = 1e+10, boundaryConditions=BCs)

 print var

-- 
Ticket URL: <http://matdl-osi.org:9000/fipy/ticket/82>
FiPy <http://www.ctcms.nist.gov/fipy>
A Finite Volume PDE Solver Using Python

Reply via email to