Re: casting implicit Boundary Conditions in FiPy

2016-06-23 Thread Guyer, Jonathan E. Dr. (Fed)

> On Jun 23, 2016, at 10:23 AM, Daniel Wheeler  
> wrote:
> 
> I'm not sure what the thinking is of your colleagues, but the size of
> the elements has little or no impact on conservation. In finite
> volume, the equations are conservative to at least the precision of
> the linear solver (if not more) independently from the accuracy of the
> solution. Of course there could be an issue with source terms that I'm
> not seeing, but the diffusion and convection terms should be entirely
> conservative.

I think the bigger issue is that a Grid1D will not properly represent a 
spherical divergence, regardless of the volumes of the cells. I thought we had 
a set of SphericalGrid1D classes, but apparently not. It would be the same 
basic idea as CylindricalNonUniformGrid1D, but I think the cell volumes and 
face areas would need to be changed, I believe like this:

def _calcFaceAreas(self):
r = self._calcFaceCenters()[0]
return r**2

def _calcCellVolumes(self):
return super(CylindricalNonUniformGrid1D, self)._calcCellVolumes() / 3.



___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Re: casting implicit Boundary Conditions in FiPy

2016-06-23 Thread Daniel Wheeler
On Fri, Jun 17, 2016 at 5:36 PM, Gopalakrishnan, Krishnakumar
 wrote:
>
> My problem models the  solid diffusion in a spherical particle.  Matter
> diffuses  from the centre of the particle  and reacts at the surface.   This
> is captured in a normalised 1-D domain  with suitable equations and
> co-ordinate scaling.  Particle-centre is represented at x = 0 boundary, and
> surface of the sphere represented by x=1 boundary.
>
>
>
> Now, my meshing algorithm is a special one. My inter-nodal distance (the
> thickness of each sub-shell of the sphere) is such that, all of the internal
> shells have equal volume.  This is done so that mass is conserved within the
> domain. This practise is stemming from my finite difference/finite element
> colleagues who advocate this.

Hi Krishna,

I'm not sure what the thinking is of your colleagues, but the size of
the elements has little or no impact on conservation. In finite
volume, the equations are conservative to at least the precision of
the linear solver (if not more) independently from the accuracy of the
solution. Of course there could be an issue with source terms that I'm
not seeing, but the diffusion and convection terms should be entirely
conservative.

> The problem is that, it is impossible to EXACTLY divide the shell into
> integer number of iso-volume subshells. Thus, the scheme is chosen such
> that, we get iso-volume shells for all inner sub-shells upto the last shell.
> The last shell's thickness (dx) is obviously and purposefully made
> ultra-small   following the discussions and Dan's solution proposed in this
> thread. Clearly, this last shell's volume differs from the rest of the inner
> subshells.
>
>
>
> Am I violating any conservation laws here by doing it ? I know that finite
> volume is a conservative method.  But this question nevertheless nags me.

I don't think so, what do the solutions show. Are the solutions conservative?

> Is there any advantage to doing iso-volume subshells ( for the inner shells)
> only to break  this concept for the last shell ?

I don't think so as long as the jump in the size of the cell volume is
well within the precision of the solver. Three or four orders of
magnitude should be okay.

>  Given that all the
> solution dynamics happen at the surface (right boundary) , does a simple
> geometric progression suffice with a very small dx at the right boundary
> suffice ?  Or is there any other optimal (structured) mesh generation
> algorithm for choosing mesh sizes depending on problem-type, that I need to
> refer to ?

Don't know this one. Have you tried both methods and compared the solution?

-- 
Daniel Wheeler
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]