Skip to content

Commit ace7b94

Browse files
committed
Merge branch 'master' of ssh://github.com/magic-sph/magic
2 parents fb909b6 + e6c97d3 commit ace7b94

20 files changed

Lines changed: 390 additions & 161 deletions

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* **MagIC** uses either Chebyshev polynomials or finite differences in the radial direction and spherical harmonic decomposition in the azimuthal and latitudinal directions. MagIC supports several Implicit-Explicit time schemes where the nonlinear terms and the Coriolis force are treated explicitly, while the remaining linear terms are treated implicitly.
1414

1515

16-
* **MagIC** is written in Fortran and designed to be used on supercomputing clusters. It thus relies on a hybrid parallelisation scheme using both [OpenMP](https://openmp.org/wp/) and [MPI](https://www.open-mpi.org/). Postprocessing functions written in python (requiring [matplotlib](https://matplotlib.org/) and [scipy](https://www.scipy.org/) are also provided to allow a useful data analysis.
16+
* **MagIC** is written in Fortran and designed to be used on supercomputing clusters. It thus relies on a hybrid parallelisation scheme using both [OpenMP](https://openmp.org/wp/) and [MPI](https://www.open-mpi.org/). Postprocessing functions written in python (requiring [matplotlib](https://matplotlib.org/), [meson](https://mesonbuild.com/meson-python/) and [scipy](https://www.scipy.org/) are also provided to allow a useful data analysis.
1717

1818
* **MagIC** is a free software. It can be used, modified and redistributed under the terms of the [GNU GPL v3 licence](https://www.gnu.org/licenses/gpl-3.0.en.html).
1919

@@ -78,7 +78,7 @@ $ ./configure --enable-openmp --prefix=$HOME/local
7878
if FFTW is used or
7979

8080
```sh
81-
$ ./configure --enable-openmp --enable-ishioka --enable-magic-layout --prefix=$HOME/local --enable-mkl
81+
$ ./configure --enable-openmp --prefix=$HOME/local --enable-mkl
8282
```
8383

8484
if the MKL is used. Possible additional options may be required depending on the machine (check the website). Then compile and install the library
@@ -162,7 +162,7 @@ $ mpiexec -n 4 ./magic.exe input.nml
162162

163163
### 7) Data visualisation and postprocessing
164164

165-
a) Set-up your PYTHON environment ([ipython](https://ipython.org/), [scipy](https://www.scipy.org/) and [matplotlib](https://matplotlib.org/) are needed)
165+
a) Set-up your PYTHON environment ([ipython](https://ipython.org/), [scipy](https://www.scipy.org/), [meson](https://mesonbuild.com/meson-python/) and [matplotlib](https://matplotlib.org/) are needed)
166166

167167
b) Modify `magic.cfg` according to your machine in case the auto-configuration didn't work
168168

bin/install-shtns.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if test ! -d $HOME/local; then
66
mkdir $HOME/local
77
fi
88

9-
wget https://bitbucket.org/nschaeff/shtns/downloads/shtns-$ver.tar.gz
9+
#wget https://bitbucket.org/nschaeff/shtns/downloads/shtns-$ver.tar.gz
1010
wget https://gricad-gitlab.univ-grenoble-alpes.fr/schaeffn/shtns/-/archive/v$ver/shtns-v$ver.tar.gz
1111
tar -xvf shtns-v$ver.tar.gz
1212
rm shtns-v$ver.tar.gz
@@ -44,7 +44,7 @@ else
4444
fi
4545
fi
4646

47-
opts="--enable-magic-layout --prefix=$HOME/local"
47+
opts="--prefix=$HOME/local"
4848
if [[ -n $MKLROOT ]]
4949
then
5050
echo "MKL found, installing with MKL"

doc/magic_manual.pdf

23.1 KB
Binary file not shown.

doc/sphinx/equations.rst

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ the commonly used form
9191

9292
.. math::
9393
\dfrac{\partial \vec{B}}{\partial t} = \vec{\nabla} \times \left( \vec{u}\times\vec{B} \right)
94-
+ \lambda\,\vec{\Delta}\vec{B}.
94+
+ \lambda\,\vec{\nabla}^2\vec{B}.
9595
:label: eqInduction2
9696
9797
The physical properties determining above equations are rotation rate
@@ -225,7 +225,7 @@ The first order Navier-Stokes equation (after to zero order hydrostatic referenc
225225
+ \alpha \tilde{g}_o T' \dfrac{\vec{r}}{r_o}
226226
+ \delta \tilde{g}_o \xi' \dfrac{\vec{r}}{r_o}
227227
+ \dfrac{1}{\mu_0}(\vec{\nabla}\times\vec{B})\times\vec{B}
228-
+ \tilde{\rho} \nu \Delta \vec{u}.
228+
+ \tilde{\rho} \nu \vec{nabla}^2 \vec{u}.
229229
:label: eqNSB
230230
231231
Here :math:`u` and :math:`B` are understood as first order disturbances and
@@ -246,7 +246,7 @@ The first order energy equation becomes
246246

247247
.. math::
248248
\tilde{\rho}\left(\dfrac{\partial T'}{\partial t}+\vec{u}\cdot \vec{\nabla} T' \right) =
249-
\kappa \Delta T' + \epsilon,
249+
\kappa \nabla^2 T' + \epsilon,
250250
:label: eqEntropyB
251251
252252
where we have assumed a homogeneous :math:`k` and neglected viscous and Ohmic
@@ -266,7 +266,7 @@ for chemical composition becomes
266266

267267
.. math::
268268
\tilde{\rho}\left(\dfrac{\partial \xi'}{\partial t}+\vec{u}\cdot \vec{\nabla} \xi' \right) =
269-
\kappa_\xi \Delta \xi' + \epsilon_\xi,
269+
\kappa_\xi \nabla^2 \xi' + \epsilon_\xi,
270270
:label: eqCompB
271271
272272
where we have assumed a homogeneous :math:`k_\xi` and adjusted the definition of :math:`\epsilon_\xi`.
@@ -296,7 +296,7 @@ form:
296296
+ \dfrac{Ra}{Pr} T' \dfrac{\vec{r}}{r_o}
297297
+ \dfrac{Ra_\xi}{Sc} \xi' \dfrac{\vec{r}}{r_o}
298298
+ \dfrac{1}{E Pm}(\vec{\nabla}\times\vec{B})\times\vec{B}
299-
+ \Delta \vec{u},
299+
+ \vec{\nabla}^2 \vec{u},
300300
:label: eqNSBoussinesq
301301
302302
where :math:`\vec{e}_z` is the unit vector in the direction of the rotation
@@ -471,6 +471,61 @@ Lorentz force in the Navier-Stokes equation. For small :math:`Di` both heating
471471
terms can be neglected compared to entropy changes due to advection, an limit
472472
that is used in the Boussinesq approximation.
473473

474+
Equation for phase field model
475+
==============================
476+
477+
To explore the uneven generation of topography associated with the
478+
freezing and melting which occurs at the fluid-solid interface, MagIC can consider
479+
the evolution of motionless solid phase. To model the phase changes, MagIC relies
480+
on the phase field
481+
formulation by `Beckermann et al. (1999) <https://doi.org/10.1006/jcph.1999.6323>`_
482+
combined with a volume penalization technique
483+
(`Hester et al. 2021 <https://doi.org/10.1016/j.jcp.2020.110043>`_).
484+
Practically, this method involves the
485+
time integration of a continuous scalar quantity :math:`\phi` which
486+
continuously varies from 0 in the liquid phase to 1 in the solid
487+
phase. A small dimensionless parameter :math:`\epsilon`, usually
488+
termed the Cahn number, then defines the ratio between
489+
the microscopic thickness of the transition between the two
490+
phases and the macroscopic domain size which is here
491+
the shell gap. Phase field methods represent a smoothed
492+
formulation of phase changes which are easier to implement
493+
numerically, especially when using pseudo-spectral methods,
494+
and converge to the exact moving boundary formulation
495+
in the limit of vanishing :math:`\epsilon`. The governing equation
496+
for the phase field reads
497+
498+
.. math::
499+
\frac{5}{6} St Pr \frac{\partial \phi}{\partial t} = a\nabla^2 \phi
500+
-\frac{1}{\epsilon^2}\phi(1-\phi)[a(1-2\phi)+T-T_M],
501+
:label: eqPhaseField
502+
503+
In the above equation, :math:`T_M` denotes the melting temperature, while :math:`a`
504+
is an order one parameter of the phase field model which expresses the curvature
505+
dependence of the melting temperature `Beckermann et al. (1999) <https://doi.org/10.1006/jcph.1999.6323>`_.
506+
507+
To account for the latent heat release during melting/freezing, an additional term
508+
needs to be added in the temperature equation. In the Boussinesq limit, this would
509+
yield (in absence of volumetric source terms)
510+
511+
.. math::
512+
\frac{\partial T}{\partial t}+\vec{u}\cdot\vec{\nabla} T = \frac{1}{Pr}\nabla^2 T
513+
+ St \dfrac{\partial \phi}{\partial t}.
514+
515+
A penalty term of the form :math:`-\phi\vec{u}/(\epsilon^2\tau_p)` is also
516+
added to the r.h.s. of the Navier-Stokes equations :eq:`eqNSNd` to ensure that
517+
no flow is creeping into the solid. Practically, this term attenuates the
518+
velocity inside the solid phase, effectively treating it as a porous medium
519+
using a Darcy-Brinkman model.
520+
521+
Although an optimal value for the parameter :math:`\tau_p` can be derived
522+
in simple configurations
523+
(`Hester et al. 2021 <https://doi.org/10.1016/j.jcp.2020.110043>`_),
524+
the value of :math:`\tau_p` needs to be
525+
adjusted for each simulation to ensure that the kinetic energy
526+
density of the solid phase remains smaller than that of the
527+
fluid phase.
528+
474529

475530
Dimensionless control parameters
476531
================================
@@ -513,7 +568,15 @@ and the magnetic Prandtl number
513568
Pm = \frac{\nu_o}{\lambda_i}.
514569
:label: eqmaPrandtl
515570
516-
In addition to these four numbers, the reference state is controlled by the geometry of
571+
In case, the phase field model is used, the Stefan number becomes also a control parameter defined by
572+
573+
.. math::
574+
St = \frac{{\cal L}}{c_p \Delta T},
575+
576+
where :math:`{\cal L}` is the latent heat per unit mass associated with the solid-liquid
577+
transition.
578+
579+
In addition to these numbers, the reference state is controlled by the geometry of
517580
the spherical shell given by its radius ratio
518581

519582
.. math::

doc/sphinx/foreword.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ several Implicit-Explicit time schemes where the nonlinear terms and the Corioli
1717
**MagIC** is written in Fortran and designed to be used on supercomputing
1818
clusters. It thus relies on a hybrid parallelisation scheme using both `OpenMP
1919
<https://openmp.org/wp/>`_ and `MPI <https://www.open-mpi.org/>`_. Postprocessing
20-
functions written in python (requiring `matplotlib <https://matplotlib.org/>`_
21-
and `scipy <https://www.scipy.org/>`_) are also provided to allow a useful data
20+
functions written in python (requiring `matplotlib <https://matplotlib.org/>`_,
21+
`meson <https://mesonbuild.com/meson-python/>`_ and
22+
`scipy <https://www.scipy.org/>`_) are also provided to allow a useful data
2223
analysis.
2324

2425
.. figure:: figs/magic_occigen.png

doc/sphinx/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ Welcome
4444

4545
**MagIC** is written in Fortran and designed to be used on supercomputing
4646
clusters. It thus relies on a hybrid parallelisation scheme using both `OpenMP
47-
<http://openmp.org/wp/>`_ and `MPI <http://www.open-mpi.org/>`_. Postprocessing
48-
functions written in python (requiring `matplotlib <http://matplotlib.org/>`_
49-
and `scipy <http://www.scipy.org/>`_) are also provided to allow a useful data
47+
<http://openmp.org/wp/>`_ and `MPI <https://www.open-mpi.org/>`_. Postprocessing
48+
functions written in python (requiring `matplotlib <https://matplotlib.org/>`_,
49+
`meson <https://mesonbuild.com/meson-python/>`_,
50+
and `scipy <https://www.scipy.org/>`_) are also provided to allow a useful data
5051
analysis.
5152

5253
.. figure:: figs/magic_occigen.png

doc/sphinx/inputNamelists/controlNamelist.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ where :math:`u_h=(u_\theta^2+u_\phi^2)^{1/2}`, :math:`\delta h = \dfrac{r}{\sqrt
107107
108108
where :math:`u_{F,r}` is the radial component of the fluid velocity and :math:`u_{A,r}=Br/\sqrt{E\,Pm}` is the radial Alven velocity. The denominator of the rightmost term accounts for the damping of the Alven waves.
109109

110+
In case the phase field model is employed, the explicit treatment of the additional volume
111+
penalization term entering the Navier-Stokes equations yields an extra constraint
112+
on the time step size :math:`\delta t` compared to classical convection problems, such that
113+
114+
.. math::
115+
\delta t < C \tau_p \epsilon^2,
116+
117+
where :math:`\epsilon` is the Cahn number.
118+
110119
* **dtMax** (default :f:var:`dtMax=1e-4 <dtmax>`) is a real. This is the maximum allowed time step :math:`\delta t`. If :math:`\delta t > \hbox{dtmax}`, the time step is decreased to at least dtMax (See routine `dt_courant`). Run is stopped if :math:`\delta t < \hbox{dtmin}` and :math:`\hbox{dtmin}=10^{-6}\,\hbox{dtmax}`.
111120

112121
* **courfac** (default :f:var:`courfac=2.5 <courfac>`) is a real used to scale velocity in Courant criteria. This parameter corresponds to :math:`c_F` in the above equation.

doc/sphinx/inputNamelists/physNamelist.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ Phase field
176176
.. math::
177177
St = \frac{\mathcal{L}}{c_p\Delta T}
178178
179-
* **tmelt** (default :f:var:`tmelt=0.0 <tmelt>`) is a real. This is the dimensionless melting temperature.
179+
* **tmelt** (default :f:var:`tmelt=0.0 <tmelt>`) is a real. This is the dimensionless melting temperature :math:`T_M` which enters :eq:`eqPhaseField`.
180180

181-
* **epsPhase** (default :f:var:`epsPhase=0.01 <epsphase>`) is a real. This is the dimensionless interface thickness between the solid and the liquid phase (sometimes known as the Cahn number).
181+
* **epsPhase** (default :f:var:`epsPhase=0.01 <epsphase>`) is a real. This is the dimensionless interface thickness between the solid and the liquid phase (sometimes known as the Cahn number). This corresponds to :math:`\epsilon` in :eq:`eqPhaseField`.
182182

183-
* **phaseDiffFac** (default :f:var:`phaseDiffFac=1.0 <phasedifffac>`) is a real. This is a coefficient that goes in front of the diffusion term in the phase field equation.
183+
* **phaseDiffFac** (default :f:var:`phaseDiffFac=1.0 <phasedifffac>`) is a real. This is a coefficient that goes in front of the diffusion term in the phase field equation. This corresponds to :math:`a` in :eq:`eqPhaseField`.
184184

185-
* **penaltyFac** (default :f:var:`penaltyFac=1.0 <penaltyfac>`) is a real. This is coefficient used for the penalisation of the velocity field in the solid phase. The smaller the coefficient, the stronger the penalisation. Since this is a nonlinear term, it is handled explicitly and the time step size should be decreased with the square of :f:var:`penaltyfac`.
185+
* **penaltyFac** (default :f:var:`penaltyFac=1.0 <penaltyfac>`) is a real. This is coefficient :math:`\tau_p` used for the penalisation of the velocity field in the solid phase. The smaller the coefficient, the stronger the penalisation. Since this is a nonlinear term, it is handled explicitly and the time step size should be decreased with the square of :f:var:`penaltyfac`.
186186

187187

188188
Transport properties
@@ -259,6 +259,12 @@ Thermal diffusivity
259259
+----------------+----------------------------------------------------------------------------+
260260
| ``nVarDiff=4`` | polynomial-fit to an interior model of the Earth liquid core |
261261
+----------------+----------------------------------------------------------------------------+
262+
| ``nVarDiff=5`` | ... |
263+
+----------------+----------------------------------------------------------------------------+
264+
| ``nVarDiff=6`` | tanh-like jump increase of thermal diffusivity in a stably-stratified-layer|
265+
+----------------+----------------------------------------------------------------------------+
266+
| ``nVarDiff=7`` | tanh-like jump increase of thermal diffusivity in a bottom stable layer |
267+
+----------------+----------------------------------------------------------------------------+
262268

263269
.. _varnVarVisc:
264270

@@ -277,6 +283,10 @@ Viscosity
277283
| | .. math:: \nu=\left(\frac{\tilde{\rho}(r)} |
278284
| | {\tilde{\rho}_i}\right)^{\alpha} |
279285
+----------------+-------------------------------------------------------------------------+
286+
| ``nVarVisc=3`` | tanh-like increase of kinematic viscosity in a stably-stratified layer |
287+
+----------------+-------------------------------------------------------------------------+
288+
| ``nVarVisc=4`` | tanh-like increase of kinematic viscosity in a bottom stable layer |
289+
+----------------+-------------------------------------------------------------------------+
280290

281291
where :math:`\alpha` is an exponent set by the namelist input variable ``difExp``.
282292

@@ -291,8 +301,6 @@ Anelastic liquid equations
291301

292302
.. math:: \epsilon \simeq \frac{\Delta T}{T} \simeq \frac{\Delta s}{c_p}
293303

294-
* **cmbHflux** (default :f:var:`cmbHflux=0.0 <cmbhflux>`) is a real. This is the CMB heat flux that enters the calculation of the reference state of the liquid core of the Earth, when the anelastic liquid approximation is employed.
295-
296304
* **slopeStrat** (default :f:var:`slopeStrat=20.0 <slopestrat>`) is a real. This parameter controls the transition between the convective layer and the stably-stratified layer below the CMB.
297305

298306

@@ -379,7 +387,7 @@ Boundary conditions for chemical composition
379387

380388
4. Imaginary amplitude (:math:`\sin` contribution)
381389

382-
For example, if the boundary condition should be a combination of an :math:`(\ell=1,m=0)` sherical harmonic with the amplitude 1 and an :math:`(\ell=2,m=1)` spherical harmonic with the amplitude (0.5,0.5) the respective namelist entry could read:
390+
For example, if the boundary condition should be a combination of an :math:`(\ell=1,m=0)` spherical harmonic with the amplitude 1 and an :math:`(\ell=2,m=1)` spherical harmonic with the amplitude (0.5,0.5) the respective namelist entry could read:
383391

384392

385393
.. code-block:: fortran

doc/sphinx/install.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ or install it manually after downloading and extracting the latest version `here
8585

8686
.. code-block:: bash
8787
88-
./configure --enable-openmp --enable-ishioka --enable-magic-layout --prefix=$HOME/local
88+
./configure --enable-openmp --prefix=$HOME/local
8989
9090
if FFTW is used or
9191

9292
.. code-block:: bash
9393
94-
./configure --enable-openmp --enable-ishioka --enable-magic-layout --prefix=$HOME/local --enable-mkl
94+
./configure --enable-openmp --prefix=$HOME/local --enable-mkl
9595
9696
if the MKL is used. Possible additional options may be required depending on the machine (check the website). Then compile and install the library
9797

0 commit comments

Comments
 (0)