Setting all components of velocity in a boundary condition in a simulation with spherical coordinates

19 views
Skip to first unread message

Patrick Farrell

unread,
Aug 7, 2025, 8:28:51 AMAug 7
to Dedalus Users
Dear all,

I'm trying to set up my first Dedalus simulation. I'd like to impose full Dirichlet conditions on the velocity in an incompressible Navier-Stokes simulation in a ball.

I'm writing

```
problem.add_equation("radial(u(r=1)) = 0")
problem.add_equation("angular(u(r=1)) = 0")
problem.add_equation("azimuthal(u(r=1))= u_bc")
```

I couldn't find any demos that impose conditions on the azimuthal component. Here I'm making an educated guess about angular and azimuthal components, by looking at the public interface listed in dedalus/core/operators.py. However, my educated guess is wrong, because it doesn't work:

```
Traceback (most recent call last):
  File "/home/randriatstioaina/tidal-core/ivp_tidal_core_a/tidal_core_a.py", line 94, in <module>
    problem.add_equation("azimuthal(u(r=1))= u_bc")
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/randriatstioaina/miniforge3/envs/dedalus3/lib/python3.13/site-packages/dedalus/core/problems.py", line 75, in add_equation
    LHS = eval(LHS_str, namespace)
  File "<string>", line 1, in <module>
  File "/home/randriatstioaina/miniforge3/envs/dedalus3/lib/python3.13/site-packages/dedalus/tools/dispatch.py", line 35, in __call__
    raise NotImplementedError("No subclasses of {} found for the supplied arguments: {}, {}".format(cls, args, kw))
NotImplementedError: No subclasses of <class 'dedalus.core.operators.AzimuthalComponent'> found for the supplied arguments: [interp(<Field 123144821382784>, r=1)], {'index': 0, 'out': None}
```

What's the right way to impose Dirichlet boundary conditions on all components?

Thanks!

Patrick

Daniel Lecoanet

unread,
Aug 7, 2025, 8:40:05 AMAug 7
to dedalu...@googlegroups.com
Hi Patrick,

Define u_bc to be a VectorField on the surface of the ball which only has a non-zero azimuthal component, e.g.

u_bc = dist.VectorField(coords, bases=ball.surface)
u_bc[‘g’][0] = np.sin(theta)

Then you can add the boundary condition

problem.add_equation(“u = u_bc”)

Hope that helps,
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/dcb4907c-c636-4199-bc99-4ebe8f3d7ce3n%40googlegroups.com.

Keaton Burns

unread,
Aug 7, 2025, 8:44:37 AMAug 7
to dedalu...@googlegroups.com
Sounds like this was already fixed offline while the post waited in moderation, but just to summarize:

  1. The easiest way to apply Dirichlet BCs is probably to do all vector components at once by defining a surface vector field and setting its individual components in grid space.
  2. For 3-component vectors on the sphere (S2), the “radial" operator returns the scalar-valued radial component of the vector field, while the “angular” operator returns tangential / non-radial part of the vector field with 2 components in phi and theta.
  3. At first glance, it would seem convenient to have operators to individually get/set the phi and theta components of the velocity field, but these are not smooth scalar fields on S2 so we don’t allow that and prefer interacting with the tangential vector field all together.

Best,
-Keaton


Reply all
Reply to author
Forward
0 new messages