Hi,
I'm having problems when saving results of a calculation on a Gmsh
grid when running in parallel. I've attached an example of the problem,
based on the diffusion/circle.py example. The code
"test_circle_parallel.py" runs the diffusion equation on a circle and
then saves the result to a file, the code "circle_view.py" opens the
file and displays the results in a viewer. If the first code is run in
serial everything works as it should, but if I run the first code in
parallel, the second script consumes all the free memory in the system
and crashes.
I've tried a similar version of this, but using a square grid (like
the mesh20x20.py example) and in this case it works both in serial and
in parallel, so it seems that the problem is when saving a Gmsh grid.
Adrian.
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 28 10:50 2013
@author: ajacobo
"""
import fipy as fp
viewer = None
u= fp.dump.read('u_circle.dat')
#v= fp.dump.read('v_circle.dat')
viewer_u = fp.MatplotlibViewer(vars=u, datamin=-2., datamax=2.)
viewer_u.plot()
#viewer_v.plot()
raw_input("Done. Press <return> to proceed...")
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 28 10:50 2013
@author: ajacobo
"""
import fipy as fp
import pylab as pl
#-----Mesh Variables and definition-----#
cellSize = 0.01
radius = 1.
mesh = fp.Gmsh2D('''
cellSize = %(cellSize)g;
radius = %(radius)g;
Point(1) = {0, 0, 0, cellSize};
Point(2) = {-radius, 0, 0, cellSize};
Point(3) = {0, radius, 0, cellSize};
Point(4) = {radius, 0, 0, cellSize};
Point(5) = {0, -radius, 0, cellSize};
Circle(6) = {2, 1, 3};
Circle(7) = {3, 1, 4};
Circle(8) = {4, 1, 5};
Circle(9) = {5, 1, 2};
Line Loop(10) = {6, 7, 8, 9};
Plane Surface(11) = {10};
''' % locals())
#-----Equation parammeters, variables and definition-----#
noise = fp.GaussianNoiseVariable(mesh=mesh,
mean=0.5,
variance=1.).value
u = fp.CellVariable(name = "U",
mesh = mesh,
value = 1.)
xc=0.
yc=0.9
mask = ((mesh.x>=xc) & (mesh.x <=xc+cellSize) &
(mesh.y>=yc) & (mesh.y<=yc+cellSize))
largeValue = 1e+10
value = 1.
#-----Define Boundary Conditions-----#
X, Y = mesh.faceCenters
u.faceGrad.constrain(0.,mesh.exteriorFaces)
#----------Define equations---------#
d=1.
eq1 = fp.TransientTerm(var=u) == fp.DiffusionTerm(var=u,coeff=d)
eq=eq1
timeStepDuration = 10 * 0.9 * cellSize**2 / (2 * d)
steps = 10
plotsteps=100
print timeStepDuration*steps,10 * 0.9 * cellSize**2 / (2 * d)
for step in range(steps):
eq.solve(dt=timeStepDuration)
#if (step % plotsteps ==0):
# viewer.plot()
fp.dump.write(u,filename='u_circle.dat')
viewer_u = fp.MatplotlibViewer(vars=u, datamin=-2., datamax=2.)
viewer_u.plot()
raw_input("Done. Press <return> to proceed...")
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]