Preserving Stokes theorem, or equivalently, "scaled-consistent-line"

Hi everyone,

I am a new preCICE user, and I recently obtained funding to explore coupling two large 3D MHD codes that we use to simulate solar and stellar atmospheres. I would appreciate some advice on how to set up the coupling in a mathematically and physically consistent way.

The setup is the following: I have two 3D domains sharing a common horizontal interface. One code evolves the lower domain, the other the upper domain, and preCICE is used for two-way coupling across the interface. Simple Cartesian coordinates, and grids are block-structured, with uniform \Delta x, \Delta y, and \Delta z for each block.

One of the evolved quantities is the magnetic field \mathbf{B}, which must satisfy \nabla \cdot \mathbf{B} = 0.

To preserve this condition, both codes use a constrained-transport type scheme: the electric field \mathbf{E} is defined on cell edges, while the magnetic field components are defined on cell faces. The magnetic field is updated through Faraday’s law,

\frac{\partial \mathbf{B}}{\partial t} = - \nabla \times \mathbf{E},

which guarantees \nabla \cdot \mathbf{B} = 0 by construction.

For example, for a face of size \Delta x \times \Delta y, with B_z located at the face centre, the update reads schematically

B_z^{n+1}=B_z^n-\Delta t\left[ \left(E_{x,\mathrm{top}} - E_{x,\mathrm{bottom}}\right)/\Delta y+ \left(E_{y,\mathrm{right}} - E_{y,\mathrm{left}}\right)/\Delta x\right].

At the interface, exchanging the normal magnetic field component B_z with the “scaled-consistent-surface” mapping works well, since it conserves the vertical magnetic flux across the interface.

However, to maintain compatibility with the constrained-transport update, I would also need a mapping for the electric field that preserves its circulation along edges. In other words, I would need something conceptually similar to a “scaled-consistent-line” mapping for the electric field, where the integrated quantity along an edge is conserved.

More generally, I am looking for a mapping operator that is compatible with Stokes’ theorem, i.e. something satisfying a relation of the form

\mathrm{mapping}\left[\oint\nabla\times \mathbf{F}d\mathrm{A}\right]=\int(\mathrm{mapping}[\mathbf{F}]) \cdot d\mathbf{l}

Does preCICE currently support something along these lines? Or has anyone encountered a similar problem?

Any suggestions or ideas would be extremely valuable.

Best regards,
Fabio

Hi all again,

as a possible workaround, I was thinking the following. Since I want to interpolate in a conservative way E_x\dot\Delta x and E_y\dot\Delta y, I could interpolate E_x/\Delta y and E_y/\Delta x using the “scaled-consistent-surface” mapping. Could it work?

Cheers,

Fabio