slightly complicated initial condition #2695
-
I started with the Burgers equation demo but need an initial condition that is complex enough that I would much prefer not stuffing it into a string. https://www.firedrakeproject.org/interpolation.html#python-expression-classes looks fine to me but it has been removed. What is the best way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Well we also don't support string expressions, so that's a happy coincidence ;). If you've got an analytic expression for an initial condition then the preferred way to set the initial condition is to express that analytic experession in UFL and interpolate that. The key tools you need beyond the usual arithmetic and trig operations are |
Beta Was this translation helpful? Give feedback.
-
UFL interpolation/projection — the things commented as “UFL equivalent” works. It supports conditionals and basic transcendental functions as well.On Dec 19, 2022, at 6:25 AM, markadams ***@***.***> wrote:
I started with the Burgers equation demo but need an initial condition that is complex enough that I would much prefer not stuffing it into a string. https://www.firedrakeproject.org/interpolation.html#python-expression-classes looks fine to me but it has been removed. What is the best way to do this?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
`atan_2`, `bessel_I`, `bessel_K`, `bessel_J`, and `bessel_Y` all enter the
namespace after `from firedrake import *`
Hopefully these will DTRT for you
…On Mon, Dec 19, 2022 at 8:40 AM markadams ***@***.***> wrote:
Thanks, I now need Atan2 (or some way to get a theta, and will need Bessel
functions next. I see
https://fenics.readthedocs.io/projects/ufl/en/latest/api-doc/ufl.html#ufl.classes.Atan2
but I get theta = Atan2(x[0],x[1]) NameError: name 'Atan2' is not defined
—
Reply to this email directly, view it on GitHub
<#2695 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4XUL454WCNNSEW5VJWRPLWOBXUNANCNFSM6AAAAAATDJS5ZQ>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
Well we also don't support string expressions, so that's a happy coincidence ;).
If you've got an analytic expression for an initial condition then the preferred way to set the initial condition is to express that analytic experession in UFL and interpolate that. The key tools you need beyond the usual arithmetic and trig operations are
SpatialCoordinate(mymesh)
which will return a symbolic vector which you use as the coordinates in your expresion, andufl.Conditional
which you can use for any branches you need.