An older version of fipy (tr...@3480, for example) gives, In [1]: from fipy import * m = CylindricalGrid1D(dx=(1.,2.)) /users/wd15/Documents/python/fipy/tr...@3480/fipy/viewers/gnuplotViewer/gnuplot1DViewer.py:76: Warning: 'with' will become a reserved keyword in Python 2.6 In [2]: m = CylindricalGrid1D(dx=(1.,2.)) In [3]: In [4]: In [5]: m.getCellVolumes() Out[5]: array([ 0.5, 16. ])
The latest version of trunk gives, In [1]: from fipy import * In [2]: m = CylindricalGrid1D(dx=(1.,2.)) In [3]: m.getCellVolumes() Out[3]: array([ 0.5, 4. ]) What do you get? On Sun, May 16, 2010 at 2:52 PM, Eduard Manley <celez1...@hotmail.com> wrote: > Hi, > thanks for your reply. > > I copied the files in the install dir (right subdir) and did a new install > of fipy (completely new install on other pc), it should be ok but I tried > running the code and the result is the same as before and so is wrong. > > I am doing some error? > > Thanks > >> Date: Thu, 13 May 2010 16:51:39 -0400 >> From: daniel.wheel...@gmail.com >> To: fipy@nist.gov >> Subject: Re: Problem in solving Poisson equation with 1D Cylindrical mesh >> >> >> With any luck this has now been dealt with. Latest versions of >> branches/version-2_1 and trunk/ should now have the fixes for >> <http://matforge.org/fipy/ticket/294> >> >> On Tue, May 11, 2010 at 5:44 PM, Eduard Manley <celez1...@hotmail.com> >> wrote: >> > Hi, >> > thanks for your reply. >> > >> > You can find attached a sample problem. >> > >> > The equation is a heat equation, variable is temperature,other and >> > transient >> > and diffusion term, there is a spatially varying source term (q) >> > computed >> > by analytical expression which is and hyperbola. >> > >> > We should reach about 100°C in 30-35 sec and the shape of the solution >> > should be similiar to and hyperbola. >> > >> > As it is now the file works fine (mesh declared with: mesh = >> > CylindricalGrid1D(dr=dr, nr=(len(DR))) + (r_int,) ) but if you define >> > the >> > mesh with ( mesh = CylindricalGrid1D(dx=DR) + (r_int,) ) the result you >> > obtain are wrong. >> > >> > The 2 declaration of CylindricalGrid1D should be the same, the face and >> > cell >> > centers are the same, but the result are different. >> > >> > You can observe the same problem also when solving the same equation >> > but without transient term >> > >> > Thanks >> > Eduard >> > >> > >> > >> >> Date: Tue, 11 May 2010 10:45:24 -0400 >> >> From: daniel.wheel...@gmail.com >> >> To: fipy@nist.gov >> >> Subject: Re: Problem in solving Poisson equation with 1D Cylindrical >> >> mesh >> >> >> >> >> >> Can you put together the simplest script possible that demonstrates >> >> the problem and I'll try and debug it? Thanks. >> >> >> >> On Thu, May 6, 2010 at 2:01 PM, Eduard Manley <celez1...@hotmail.com> >> >> wrote: >> >> > Thanks for your reply. >> >> > >> >> > I probably found the reason of the problem. >> >> > >> >> > As said before I'm trying to solve an eq of this type: >> >> > >> >> > A(d phi/d t) = div (D grad phi) + q >> >> > >> >> > where A and D are costant coefficient and q is a spatially varying >> >> > heat >> >> > source. >> >> > >> >> > The problem is in how I create the cylindrical 1D mesh (origin of the >> >> > mesh >> >> > is not in 0.). >> >> > >> >> > It doesn't matter if the discretization is logarithmic or uniform but >> >> > how I >> >> > declare it: >> >> > >> >> > (using a uniform spacing:) >> >> > >> >> > ** mesh = CylindricalGrid1D(dx=dr, nx=(len(DR))) + (r_int,) ** >> >> > SHOULD BE EQUAL TO: >> >> > >> >> > ** mesh = CylindricalGrid1D(dx=DR) + (r_int,) ** >> >> > >> >> > [dr = 5e-04, nr=58, r_int=0.00125, DR is a list which contains the >> >> > various >> >> > dx(58 elements of value dr for uniform grid)] >> >> > >> >> > BUT It is NOT. >> >> > >> >> > The mesh (cell centers, facecenters) is ok but the results are NOT. >> >> > The results are right only if I create the mesh using dx=dr and nx=.. >> >> > . >> >> > And this is why before I thought the problem was the logaritmic >> >> > discretization (must use DR=[...]). >> >> > >> >> > As said before with Cylindrical 2D mesh results are instead correct. >> >> > Is this a bug? >> >> > >> >> >> Date: Thu, 6 May 2010 11:11:10 -0400 >> >> >> From: daniel.wheel...@gmail.com >> >> >> To: fipy@nist.gov >> >> >> Subject: Re: Problem in solving Poisson equation with 1D Cylindrical >> >> >> mesh >> >> >> >> >> >> >> >> >> Edward, This may be to do with having a very small volume (or area >> >> >> or >> >> >> line or point) for the inner most element of the domain. It should >> >> >> be >> >> >> the same whether one is using a 1D or 2D mesh. Since you are getting >> >> >> differences in the 1D and 2D case, it should be relatively easy to >> >> >> debug and figure out what's going on It could also be that the >> >> >> boundary condition on the inner boundary as zero area and this is >> >> >> causing issues. Try shifting the grid by a small value away from the >> >> >> zero point and see if things are improved I have always had this >> >> >> issue with cylindrical grids and have never really had a >> >> >> satisfactory >> >> >> solution (other than shifting away from the zero point). If you >> >> >> discover a better way to handle this, let me know. Cheers. >> >> >> >> >> >> >> >> >> If you can't debug it, then send me the most minimalist scripts that >> >> >> show the issue and I'll give it a shot. >> >> >> >> >> >> On Wed, May 5, 2010 at 9:53 PM, Eduard Manley >> >> >> <celez1...@hotmail.com> >> >> >> wrote: >> >> >> > Problem partially solved: >> >> >> > >> >> >> > I'm using a logarithmic discretization (first dr= 5e-04 and next >> >> >> > dr increasing as 1.05)(with internal radius= 0.00125, external >> >> >> > radius=0.03) >> >> >> > and, >> >> >> > for some unknown reason this create problems and wrong result with >> >> >> > cylindrical 1D mesh. I tried using a uniform discretization >> >> >> > (dr=5e-04 >> >> >> > nx=58) >> >> >> > and now the result is correct. >> >> >> > >> >> >> > However I need to use the logarithmic discr. so after some hours >> >> >> > of >> >> >> > sleep >> >> >> > I'll think about the reason..... >> >> >> > >> >> >> > ________________________________ >> >> >> > Hotmail: Trusted email with powerful SPAM protection. Sign up now. >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> Daniel Wheeler >> >> >> >> >> >> >> >> > >> >> > ________________________________ >> >> > Your E-mail and More On-the-Go. Get Windows Live Hotmail Free Sign up >> >> > now. >> >> >> >> >> >> >> >> -- >> >> Daniel Wheeler >> >> >> >> >> > >> > ________________________________ >> > Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign >> > up >> > now. >> >> >> >> -- >> Daniel Wheeler >> >> > > > ________________________________ > Hotmail: Free, trusted and rich email service. Get it now. -- Daniel Wheeler