Curl of a vector field in the zhat direction

91 views
Skip to first unread message

amélie ch

unread,
Nov 17, 2025, 11:11:00 AM11/17/25
to Dedalus Users
Hi all, 

I'm working on a 2D shallow water mhd simulation and I was wondering if there was any way in Dedalus that I could define the substitution (or something of the form):
B = 1/h * curl(A zhat) where B=B(x,y,t) is a vector field, h=h(x,y,t) is a field, A=A(x,y,t) is a field and zhat is the z unit vector.  This is how I want to implement it into my equations (see attachment below).

Thanks, 

Amélie


swmhd_code.png

Daniel Lecoanet

unread,
Nov 17, 2025, 12:29:24 PM11/17/25
to Dedalus Users
Hi Amelie,

I believe you want to use -d3.skew(d3.grad(A)). But you should check the sign.

Daniel

--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dedalus-users/f9e5ed12-5bb9-4d36-98e4-5ac0b666c751n%40googlegroups.com.
<swmhd_code.png>

amélie ch

unread,
Feb 6, 2026, 6:45:30 PMFeb 6
to Dedalus Users
Hi!

Thanks for the response. I am now working in spherical coordinates so my unit vector is now rhat. So I want to preform the operation  B = 1/h * curl(A rhat). Would I still use as you said 
-d3.skew(d3.grad(A))?

Thanks,

Amélie

amélie ch

unread,
Feb 9, 2026, 12:42:09 AMFeb 9
to Dedalus Users
** note that I'm using S2Coordinates so I can't really radial unit vectors (as I understand it)

Daniel Lecoanet

unread,
Feb 9, 2026, 1:38:23 PMFeb 9
to dedalu...@googlegroups.com
Yes I believe that is right, but be sure to check the sign!

Daniel

On Feb 8, 2026, at 23:42, amélie ch <ameliec...@gmail.com> wrote:

** note that I'm using S2Coordinates so I can't really radial unit vectors (as I understand it)
Reply all
Reply to author
Forward
0 new messages