Thanks again for your help,
but I still have one error message that I cannot understand, this my code
**************************************************************************************************
rom __future__ import division
L=1.
nx=400
dx=L/nx
timeStepDuration=0.012
from fipy.meshes.grid1D import Grid1D
mesh=Grid1D(dx=dx, nx=nx)
from fipy.variables.cellVariable import CellVariable
phi=CellVariable(name="saturation", mesh=mesh)
p=CellVariable(name="pressure",mesh=mesh)
x=mesh.getCellCenters()[...,0]
phi.setValue(.9, where=x<.5)
phi.setValue(.3, where=x>=.5)
p.setValue(1.)
pcs=0
qin=40*((x>=.1)&(x<=.3))+20*((x>=.7)&(x<=.9))
qout=60*((x>=.4)&(x<=.6))
sin=.8
pin=0
q1s=sin*qin+phi*qout
q2s=(1-sin)*qin+(1-phi)*qout
if __name__=='__main__':
import fipy.viewers
phiviewer=fipy.viewers.make(vars=(phi), limits={'ymin':.2, 'ymax':1.1})
pviewer=fipy.viewers.make(vars=(p), limits={'ymin':.2, 'ymax':1.1})
phiviewer.plot()
pviewer.plot()
raw_input("initial condition. press <return> to proceed...")
from fipy.terms.transientTerm import TransientTerm
from fipy.terms.powerLawConvectionTerm import PowerLawConvectionTerm
from fipy.terms.explicitSourceTerm import _ExplicitSourceTerm
from fipy.terms.implicitDiffusionTerm import ImplicitDiffusionTerm
eq1=ImplicitDiffusionTerm(coeff=1)==_ExplicitSourceTerm(q1s+q2s)
eq2=TransientTerm(coeff=2)==_ExplicitSourceTerm(q1s-q2s)+PowerLawConvectionTerm(coeff=2*p.getFaceGrad())-p.getFaceGrad().getDivergence()
steps=100
for i in range(steps):
eq1.solve(p, dt=timeStepDuration)
eq2.solve(phi, dt=timeStepDuration)
if __name__ =='__main__':
phiviewer.plot()
pviewer.plot()
*************************************************************************************************************************
when running this code i got the following error message
Warning (from warnings module):
File "C:/Python25/tsetdipha.py", line 43
eq1.solve(p, dt=timeStepDuration)
MaximumIterationWarning: Iterations: 1001. Relative error: 2.96727e+018
Warning (from warnings module):
File "C:/Python25/tsetdipha.py", line 43
eq1.solve(p, dt=timeStepDuration)
StagnatedSolverWarning: The solver stagnated. Iterations: 20. Relative
error: 2.23961e+016
Warning (from warnings module):
File "C:/Python25/tsetdipha.py", line 43
eq1.solve(p, dt=timeStepDuration)
StagnatedSolverWarning: The solver stagnated. Iterations: 4. Relative error:
4.16036e+016
Warning (from warnings module):
File "C:/Python25/tsetdipha.py", line 43
eq1.solve(p, dt=timeStepDuration)
StagnatedSolverWarning: The solver stagnated. Iterations: 2. Relative error:
6.11332e+016
This message seems to appear infinitly
I don't understand this error,
could any one to help me?
Regards
2008/8/20 Jonathan Guyer <[EMAIL PROTECTED]>
>
>
> On Aug 20, 2008, at 2:57 PM, franck kalala wrote:
>
> Did you not forgot a term in the second equation?
>> eqp=ImplicitDiffusionTerm(coeff=1)==_ExplicitSourceTerm(q1s+q2s)
>> eqphi=TransientTerm(coeff=2)==_ExplicitSourceTerm(q1s-q2s)
>>
>> after subtracting the two equations of the problem I sent in the attached
>> file, there a term which looks like 2\nabla(phi\nabla p), then how to
>> represent it?
>>
>
> In an equation for phi?
>
> PowerLawConvectionTerm(coeff=2 * p.getFaceGrad())
>
> You've also got a p.getFaceGrad().getDivergence() term that isn't in your
> .pdf and the sign of your ImlicitDiffusionTerm is wrong in eqp.
>
>
>
--
***********************************************
***********************************************
Franck Kalala Mutombo
[EMAIL PROTECTED]
African Institut for Mathematical Sciences, Muizenberg Cape Town, South
Africa
[EMAIL PROTECTED]
************************************************
************************************************