This is great to know!! I will play around and see if it would work. I hope it 
is not much slower.

Regards,
Leyton

-----Ursprüngliche Nachricht-----
Von: fipy-boun...@nist.gov [mailto:fipy-boun...@nist.gov] Im Auftrag von Daniel 
Wheeler
Gesendet: Montag, 8. Jänner 2018 19:58
An: Multiple recipients of list <fipy@nist.gov>
Betreff: Re: Gradient in cylindrical coordinates

Also, note that the "leastSquaresGrad" doesn't have this issue:

https://gist.github.com/wd15/fc34ccb2e57602fc6f9bea96d8160f4a#file-untitled-ipynb

See,

https://www.ctcms.nist.gov/fipy/fipy/generated/fipy.variables.html#fipy.variables.cellVariable.CellVariable.leastSquaresGrad


On Mon, Jan 8, 2018 at 1:39 PM, Daniel Wheeler <daniel.wheel...@gmail.com> 
wrote:
> Hi Leyton,
>
> I think there is an error in FiPy when calculating gradients with
> cylindrical grids. FiPy assumes that the cylindrical faces don't count
> towards the face contributions, but they do. It needs to be fixed. It
> results in a systematic error of "phi / r". I'll try and fix this in
> the near future. Sorry about that.
>
> For further details see,
>
> https://gist.github.com/wd15/fc34ccb2e57602fc6f9bea96d8160f4a#file-unt
> itled-ipynb
>
> I've very roughly outlined the problem at the bottom of the notebook
> and a better discretization. A quick fix right now would be to use a
> 3D slice rather than the cylindrical grid. I'm not sure how much this
> impacts other calculations with cylindrical grids in FiPy.
>
> I also put this in an issue. Please do add comments if you have ideas.
>
> https://github.com/usnistgov/fipy/issues/547
>
> Thanks for reporting this.
>
> Cheers,
>
> Daniel
>
>
> On Fri, Jan 5, 2018 at 7:23 PM, Munoz Leyton
> <leyton.mu...@hirtenberger.com> wrote:
>> Dear Fipy Team,
>>
>>
>>
>> First of all I would like to thank you for your amazing work! I love
>> working with fipy.
>>
>>
>>
>> I have a problem when I calculate the gradient of my variable in
>> cylindrical coordinates. You can see the code I used below this line.
>>
>>
>>
>> from fipy import *
>>
>> from fipy import CellVariable, FaceVariable, Grid2D, TransientTerm, \
>>
>>     UpwindConvectionTerm, DiffusionTerm, ImplicitSourceTerm,
>> CylindricalGrid2D
>>
>>
>>
>> L = 89e-3  # m
>>
>> diameterChamber = 13.75e-3
>>
>> radius = diameterChamber/2
>>
>> dz = 1e-3
>>
>> dr = 0.75e-3
>>
>> nz = round(L/dz)
>>
>> nr = round(radius/dr)
>>
>> #mesh = Grid2D(dx=dx, nx=nx, dy=dy, ny=ny)
>>
>> mesh = CylindricalGrid2D(dz=dz, nz=nz, dr=dr, nr=nr)
>>
>>
>>
>> pressure_0 = CellVariable(mesh=mesh, name='Pressure Gas', hasOld=1)
>>
>> pressure_0.setValue(1e5)
>>
>> pressure_0.grad.value
>>
>>
>>
>> The pressure is constant all over the domain so I would expect the
>> gradient to be zero. just as it is in Cartesian coordinates. But I get this:
>>
>>
>>
>> array([[ 2666.66666667,   888.88888889,   533.33333333, ...,
>>
>>           205.12820513,   177.77777778,   156.8627451 ],
>>
>>        [    0.        ,     0.        ,     0.        , ...,
>>
>>             0.        ,     0.        ,     0.        ]])
>>
>>
>>
>> Could you please help me? Am I doing something wrong? is it a bug?
>>
>>
>>
>> I would like also to contribute to the community with an example of
>> compressible flow with euler equations in 2D Cartesian coordinates. I
>> validated the results with SOD shock tube and I was quite happy with it.
>> With whom should I talk to review it and possibly upload it?
>>
>>
>>
>> Kind regards,
>>
>> Leyton
>>
>> ________________________________
>>
>> ACHTUNG neue e-Mail Adresse: vorname.nachn...@hirtenberger.com
>> Nachrichten an die alte E-Mail Adresse werden vorübergehend auf die
>> neue Adresse umgeleitet.
>>
>> ATTENTION new e-mail address: vorname.nachn...@hirtenberger.com
>> Messages to the old address are temporarily redirected to the new address.
>>
>> ________________________________
>>
>> P  Bitte prüfen Sie der Umwelt zuliebe, ob der Ausdruck dieser Mail
>> erforderlich ist. / Please consider your environmental responsibility
>> before printing this email.
>>
>>
>>
>> Diese Nachricht und allfaellige angehaengte Dokumente sind
>> vertraulich und nur für den/die Adressaten bestimmt. Sollten Sie
>> nicht der beabsichtigte Adressat sein, ist jede Offenlegung,
>> Weiterleitung oder sonstige Verwendung dieser Information nicht
>> gestattet. In diesem Fall bitten wir, den Absender zu verstaendigen
>> und die Information zu vernichten. Für Uebermittlungsfehler oder sonstige 
>> Irrtuemer bei der Uebermittlung besteht keine Haftung.
>>
>> This message and any attached files are confidential and intended
>> solely for the addressee(s). Any publication, transmission or other
>> use of the information by a person or entity other than the intended
>> addressee is prohibited. If you receive this in error please contact
>> the sender and delete the material. The sender does not accept
>> liability for any errors or missions as a result of the transmission.
>> Please destroy this message and notify the sender.
>>
>>
>> _______________________________________________
>> fipy mailing list
>> fipy@nist.gov
>> http://www.ctcms.nist.gov/fipy
>>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy
>> ]
>>
>
>
>
> --
> Daniel Wheeler



--
Daniel Wheeler

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

ACHTUNG neue e-Mail Adresse: 
vorname.nachn...@hirtenberger.com<mailto:vorname.nachn...@hirtenberger.com> 
Nachrichten an die alte E-Mail Adresse werden vorübergehend auf die neue 
Adresse umgeleitet.

ATTENTION new e-mail address: 
vorname.nachn...@hirtenberger.com<mailto:vorname.nachn...@hirtenberger.com> 
Messages to the old address are temporarily redirected to the new address.

________________________________
P  Bitte prüfen Sie der Umwelt zuliebe, ob der Ausdruck dieser Mail 
erforderlich ist. / Please consider your environmental responsibility before 
printing this email.

Diese Nachricht und allfaellige angehaengte Dokumente sind vertraulich und nur 
für den/die Adressaten bestimmt. Sollten Sie nicht der beabsichtigte Adressat 
sein, ist jede Offenlegung, Weiterleitung oder sonstige Verwendung dieser 
Information nicht gestattet. In diesem Fall bitten wir, den Absender zu 
verstaendigen und die Information zu vernichten. Für Uebermittlungsfehler oder 
sonstige Irrtuemer bei der Uebermittlung besteht keine Haftung.

This message and any attached files are confidential and intended solely for 
the addressee(s). Any publication, transmission or other use of the information 
by a person or entity other than the intended addressee is prohibited. If you 
receive this in error please contact the sender and delete the material. The 
sender does not accept liability for any errors or missions as a result of the 
transmission. Please destroy this message and notify the sender.

_______________________________________________
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