Hi Dan,


Thanks for your reply, and for the tip to use Grid1D with variable dx. I was 
able to deploy  it right away.



There  is a new complexity in this connection.



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.



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.



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





Krishna





-----Original Message-----
From: fipy-boun...@nist.gov [mailto:fipy-boun...@nist.gov] On Behalf Of Daniel 
Wheeler
Sent: 17 June 2016 14:50
To: Multiple recipients of list <fipy@nist.gov>
Subject: Re: casting implicit Boundary Conditions in FiPy



On Thu, Jun 16, 2016 at 12:35 PM, Gopalakrishnan, Krishnakumar 
<k.gopalakrishna...@imperial.ac.uk<mailto:k.gopalakrishna...@imperial.ac.uk>> 
wrote:

> Thanks.

>

> Yes, this Is indeed only first order accurate.  I verified this by 
> successively cutting my dx by half, running your code, and comparing against 
> the Mathematica generated result. Each time dx is cut by half, the error is 
> also proportionately halved.

>

> This code requires me to take unreasonably small dx values.  Since, neither 
> the solution, nor the gradients are available at each implicit time-steps, I 
> think that higher order schemes are probably ruled out.



I think you're right. It's not easy.



> I am thinking of using a variable mesh-sizing, let's say a log-spacing in 1D, 
> keeping a very fine spacing (ultra-small dx) for the last cell near the 
> boundary, and gradually taking bigger steps.  This is also physically 
> consistent with my problem, wherein all the action takes place close to the 
> boundary, and nothing much is happening at the middle or left edges.



Maybe it's possible to make the edge cell almost infinitely small and have the 
rest of the cells evenly spaced.



> This brings me to another issue.  I don't see a way to import a 1D .msh file 
> generated by gmsh into FiPy.



I'm not sure if Gmsh does 1D meshes, you can always use a 2D mesh as a 1D mesh 
of course.



> Secondly,  I notice that there is an optimistic sounding  grid1DBuilder 
> method.   I couldn't find any help on how to use this method. Is this method 
> capable of creating the log-spaced mesh that I am considering ?



Note that Grid1D takes an array for dx. So you can do



    >>> mesh = fp.Grid1D(dx=[0.5, 1.0, 2.0])

    >>> print(mesh.cellCenters)

    [[ 0.25  1.   2.5 ]]



As long as you can calculate the grid spacing then you don't need Gmsh.



--

Daniel Wheeler



_______________________________________________

fipy mailing list

fipy@nist.gov<mailto:fipy@nist.gov>

http://www.ctcms.nist.gov/fipy

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

Reply via email to