Hi Ryan,

Good to see that you are finding FiPy useful. To quantify the pore
surface area I think you have a number of choices. Firstly, things are
much easier if the cut surface is a plane, aligned along one of the
axes and the mesh is a uniform Grid3D, which it appears to be. Let's
assume this for now. The following should work for you

     from fipy import *

     nx = 50
     ny = 50
     nz = 50
     dx = 1.0
     dy = 1.0
     dz = 1.0
     planeZ = 0.78 * nz * dz

     mesh = Grid3D(dx=dx,dy=dy,dz=dz,nx=nx,ny=ny,nz=nz)
     x, y, z = mesh.getCellCenters()
     var = CellVariable(mesh=mesh, value= (x * y * z) / (nx * ny * nz
* dx * dy * dz))

     planeMesh = Grid2D(dx=mesh.dx, dy=mesh.dy, nx=mesh.nx, ny=mesh.ny)
     planeX, planeY = planeMesh.getCellCenters()
     planeZ = planeZ * numerix.ones(planeMesh.getNumberOfCells())
     planeVar = CellVariable(mesh=planeMesh, value=var((planeX,
planeY, planeZ)))
     print planeVar.getCellVolumeAverage()

The crucial code is "var((planeX, planeY, planeZ))". This allows an
extraction of
the values in var at the points defined by (planeX, planeY, planeZ)). By default
this a first order interpolation.

Hope this helps.

On Tue, Jan 4, 2011 at 8:01 PM, Ryan Paul <ryanmp...@gmail.com> wrote:
>
> Dear FiPy developers and users:
>
> I am using FiPy to simulate diffusion and reaction in a porous
> material.  The reaction causes a growth in porosity, and I would like
> to quantify the pore surface area during the simulation.  I am able to
> get the total volume fraction of porosity using
> "getCellVolumeAverage()", but is there a piece of code to output the
> pore surface area in FiPy?.  I have included a bit of code to show how
> I am generating the pores (phase =1) versus the solid (phase = 0).
>
> Truth be told, my real interest is to somehow differentiate between
> open and closed pores (surface area and volume fraction) in FiPy.
>
> I appreciate any help, if possible.  I am very grateful for the FiPy
> software. Without it, I would have a difficult time performing
> simulations.
>
> -Ryan
>
>
> In the code below, I am first randomly placing pores, then randomly
> placing "particles" over top.  The resulting porous structure is the
> input for the simulation (the pore and particle sizes and numbers are
> varied).  For brevity, I  have not included the simulation equations.
> --------------------------------------------------------------------------------------------------
> from fipy import *
> nx = 50
> ny = 50
> nz = 50
> dx = 1.0
> dy = 1.0
> dz = 1.0
> mesh = Grid3D(dx=dx,dy=dy,dz=dz,nx=nx,ny=ny,nz=nz)
> phase = CellVariable(name="Phase", mesh=mesh,hasOld=1)
> pores = 20
> particles = 20
> x,y,z = mesh.getCellCenters()
> for i in range(pores):
>    cx = random.random()*nx*dx
>    cy = random.random()*ny*dy
>    cz = random.random()*nz*dz
>    r = 10
>    phase[((x - cx)**2 + (y - cy)**2 + (z - cz)**2) < r**2]= 1
> for i in range(particles):
>    cx = random.random()*nx*dx
>    cy = random.random()*nx*dx
>    cz = random.random()*nx*dx
>    r = 10
>    phase[((x - cx)**2 + (y - cy)**2 + (z - cz)**2) < r**2]= 0
> print "pore volume fraction=",phase.getCellVolumeAverage()
> -----------------------------------------------------------------------------------------------------
>
>



-- 
Daniel Wheeler


Reply via email to