Jonathan Guyer | 10 Jul 19:16

Re: Error in code


On Jul 10, 2008, at 9:58 AM, Rashmi Ranjan Mohanty wrote:

> I am running a Fipy code with a system size of 400x400 mesh points  
> on a Mac Pro 3GHz Dual-Intel Xeon processor with 2GB memory. After  
> running few steps it stops with the following error message:
>
> python(1013) malloc: *** vm_allocate(size=7921664) failed (error  
> code=3)
> python(1013) malloc: *** error: can't allocate region
> python(1013) malloc: *** set a breakpoint in szone_error to debug
> malloc fails for local dworkptr[].Traceback (most recent call last):
>  File "isothermal-new2D.py", line 355, in <module>
>    compRes = compEq.sweep(var = comp, boundaryConditions = BCsC,  
> dt=time, solver=solver)
>  File "/sw/lib/python2.5/site-packages/fipy/terms/term.py", line  
> 153, in sweep
>    self._solveLinearSystem(var, solver, matrix, RHSvector)
>  File "/sw/lib/python2.5/site-packages/fipy/terms/term.py", line  
> 102, in _solveLinearSystem
>    solver._solve(matrix, array, RHSvector)
>  File "/sw/lib/python2.5/site-packages/fipy/solvers/ 
> linearLUSolver.py", line 92, in _solve
>    LU = superlu.factorize(L._getMatrix().to_csr())
> MemoryError
>
> I guess it has something to do with memory, but could not figure out  
> a solution.
> I would appreciate your help.

(Continue reading)

Re: Error in code


Thank you Dr. Guyer.

I tried with other solvers and the LinearGMRESSolver seems to work  
better. I am not sure if I could use that, though I have a non- 
symmetric matrix (I have a convection term in my formulation). With  
this solver the memory error seems to be gone, but "invalid value  
encountered in log" error comes up and the program stops running.

I am still struggling to find where the bug is. Just for  
confirmation : Is this correct to combine a phase transformation term  
and a counter diffusion term to make one convection coefficient ?
I have got the following terms:

counterDiffusion = -2[(La - Lb)*p(phi) + Lb] * c.getFaceGrad()

phaseTransformation = [G + (1 - 2c)*(La - Lb)] * p(phi).getFaceGrad()  
+ (Wb - Wa) * g(phi).getFaceGrad()

convectionCoefficient = counterDiffusion + phaseTransformation

convectionCoefficient *= D*(1-c).getHarmonicFaceValue()/R*T

where, phi = phase field variable, c = composition
p(phi) and g(phi) are the interpolation function and double well  
function respectively.

D is the diffusivity. D = MRT/c(1-c) (as described in fipy examples)

G, La, Lb, Wa and Wb are all constants for the time being.
(Continue reading)

Jonathan Guyer | 11 Jul 22:33

Re: Error in code


On Jul 11, 2008, at 2:56 PM, Rashmi Ranjan Mohanty wrote:

> I tried with other solvers and the LinearGMRESSolver seems to work  
> better. I am not sure if I could use that, though I have a non- 
> symmetric matrix (I have a convection term in my formulation).

GMRES handles asymmetric matrices, as far as I know.

> With this solver the memory error seems to be gone, but "invalid  
> value encountered in log" error comes up and the program stops  
> running.

Where is the error occurring?

"invalid value encountered in log" is likely happening because you are  
getting negative concentrations, although I don't know why log() would  
be getting evaluated on your fields. That's not something we do in the  
examples.
>

> I am still struggling to find where the bug is. Just for  
> confirmation : Is this correct to combine a phase transformation  
> term and a counter diffusion term to make one convection coefficient ?

Anything that can be expressed as \nabla\cdot{c \vec{v}} can be  
combined as a single convection term. As we show in the manual, you  
can lump all sorts of things into \vec{v}.

> I have got the following terms:
(Continue reading)


Gmane