Fluid models#

Pure fluid models where all plasma species are considered in local thermal equilibirum.

class struphy.models.fluid.LinearMHD[source]#

Bases: StruphyModel

Linear ideal MHD with zero-flow equilibrium (\(\mathbf U_0 = 0\)).

Normalization:

\[\hat U = \hat v_\textnormal{A} \,.\]

Equations:

\[\begin{split}&\frac{\partial \tilde \rho}{\partial t}+\nabla\cdot(\rho_0 \tilde{\mathbf{U}})=0\,, \\[2mm] \rho_0&\frac{\partial \tilde{\mathbf{U}}}{\partial t} + \nabla \tilde p = (\nabla \times \tilde{\mathbf{B}})\times \mathbf{B}_0 + (\nabla\times\mathbf{B}_0)\times \tilde{\mathbf{B}} \,, \\[2mm] &\frac{\partial \tilde p}{\partial t} + \nabla\cdot(p_0 \tilde{\mathbf{U}}) + \frac{2}{3}\,p_0\nabla\cdot \tilde{\mathbf{U}}=0\,, \\[2mm] &\frac{\partial \tilde{\mathbf{B}}}{\partial t} - \nabla\times(\tilde{\mathbf{U}} \times \mathbf{B}_0) = 0\,.\end{split}\]

Propagators (called in sequence):

  1. ShearAlfven

  2. Magnetosonic

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Propagators[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.LinearExtendedMHDuniform[source]#

Bases: StruphyModel

Linear extended MHD with zero-flow equilibrium (\(\mathbf U_0 = 0\)). For uniform background conditions only.

Normalization:

\[\hat U = \hat v_\textnormal{A} \,.\]

Equations:

\[\begin{split}&\frac{\partial \tilde \rho}{\partial t}+\nabla\cdot(\rho_0 \tilde{\mathbf{U}})=0\,, \\[2mm] \rho_0&\frac{\partial \tilde{\mathbf{U}}}{\partial t} + \nabla \tilde p =(\nabla\times \tilde{\mathbf{B}})\times\mathbf{B}_0 \,, \\[2mm] &\frac{\partial \tilde p}{\partial t} + \frac{5}{3}\,p_{0}\nabla\cdot \tilde{\mathbf{U}}=0\,, \\[2mm] &\frac{\partial \tilde{\mathbf{B}}}{\partial t} - \nabla\times \left( \tilde{\mathbf{U}} \times \mathbf{B}_0 - \frac{1}{\varepsilon} \frac{\nabla\times \tilde{\mathbf{B}}}{\rho_0}\times \mathbf{B}_0 \right) = 0\,.\end{split}\]

where

\[\varepsilon = \frac{1}{\hat \Omega_{\textnormal{c}} \hat t}\,,\qquad \textnormal{with} \qquad\hat \Omega_{\textnormal{c}} = \frac{Ze \hat B}{A m_\textnormal{H}}\,.\]

Propagators (called in sequence):

  1. ShearAlfvenB1

  2. Hall

  3. MagnetosonicUniform

Model info:

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Propagators[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.ColdPlasma[source]#

Bases: StruphyModel

Cold plasma model.

Normalization:

\[\hat v = c\,,\qquad \hat E = c \hat B \,.\]

Equations:

\[\begin{split}\frac{1}{n_0} &\frac{\partial \mathbf j}{\partial t} = \frac{1}{\varepsilon} \mathbf E + \frac{1}{\varepsilon n_0} \mathbf j \times \mathbf B_0\,, \\[2mm] &\frac{\partial \mathbf B}{\partial t} + \nabla\times\mathbf E = 0\,, \\[2mm] -&\frac{\partial \mathbf E}{\partial t} + \nabla\times\mathbf B = \frac{\alpha^2}{\varepsilon} \mathbf j \,,\end{split}\]

where \((n_0,\mathbf B_0)\) denotes a (inhomogeneous) background and

\[\alpha = \frac{\hat \Omega_\textnormal{p}}{\hat \Omega_\textnormal{c}}\,, \qquad \varepsilon = \frac{1}{\hat \Omega_\textnormal{c} \hat t}\,.\]

Propagators (called in sequence):

  1. Maxwell

  2. OhmCold

  3. JxBCold

Model info:

class EMFields[source]#

Bases: FieldSpecies

class Electrons[source]#

Bases: FluidSpecies

class Propagators[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

class struphy.models.fluid.ViscoResistiveMHD(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: StruphyModel

Full (non-linear) visco-resistive MHD equations discretized with a variational method.

Normalization:

\[\hat u = \hat v_\textnormal{A}\,, \qquad \hat{\mathcal U} = \frac{\hat{\mathbf B}^2}{\hat \rho \mu_0 (\gamma-1)} \,,\qquad \hat s = \hat \rho\ \textrm{ln}\left(\frac{\hat{\mathbf B}^2}{\mu_0 (\gamma -1) \hat{\rho}}\right) \,.\]

Equations:

\[\begin{split}&\partial_t \rho + \nabla \cdot ( \rho \mathbf u ) = 0 \,, \\[4mm] &\partial_t (\rho \mathbf u) + \nabla \cdot (\rho \mathbf u \otimes \mathbf u) + \rho \nabla \frac{(\rho \mathcal U (\rho, s))}{\partial \rho} + s \nabla \frac{(\rho \mathcal U (\rho, s))}{\partial s} + \mathbf B \times \nabla \times \mathbf B - \nabla \cdot \left((\mu+\mu_a(\mathbf x)) \nabla \mathbf u \right) = 0 \,, \\[4mm] &\partial_t s + \nabla \cdot ( s \mathbf u ) = \frac{1}{T}\left((\mu+\mu_a(\mathbf x)) |\nabla \mathbf u|^2 + (\eta + \eta_a(\mathbf x)) |\nabla \times \mathbf B|^2\right) \,, \\[4mm] &\partial_t \mathbf B + \nabla \times ( \mathbf B \times \mathbf u ) + \nabla \times (\eta + \eta_a(\mathbf x)) \nabla \times \mathbf B = 0 \,,\end{split}\]

where the internal energy per unit mass is \(\mathcal U(\rho) = \rho^{\gamma-1} \exp(s / \rho)\), and \(\mu_a(\mathbf x)\) and \(\eta_a(\mathbf x)\) are artificial viscosity and resistivity coefficients.

Propagators (called in sequence):

  1. VariationalDensityEvolve

  2. VariationalMomentumAdvection

  3. VariationalEntropyEvolve

  4. VariationalMagFieldEvolve

  5. VariationalViscosity

  6. VariationalResistivity

Model info:

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Propagators(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.ViscousFluid(with_viscosity: bool = True)[source]#

Bases: StruphyModel

Full (non-linear) viscous Navier-Stokes equations discretized with a variational method.

Normalization:

\[\hat u = \hat v_\textnormal{A}\,, \qquad \hat{\mathcal U} = \frac{\hat{\mathbf B}^2}{\hat \rho \mu_0 (\gamma-1)} \,,\qquad \hat s = \hat \rho\ \textrm{ln}\left(\frac{\hat{\mathbf B}^2}{\mu_0 (\gamma -1) \hat{\rho}}\right) \,.\]

Equations:

\[\begin{split}&\partial_t \rho + \nabla \cdot ( \rho \mathbf u ) = 0 \,, \\[4mm] &\partial_t (\rho \mathbf u) + \nabla \cdot (\rho \mathbf u \otimes \mathbf u) + \rho \nabla \frac{(\rho \mathcal U (\rho, s))}{\partial \rho} + s \nabla \frac{(\rho \mathcal U (\rho, s))}{\partial s} - \nabla \cdot \left((\mu +\mu_a(\mathbf x)) \nabla \mathbf u\right) = 0 \,, \\[4mm] &\partial_t s + \nabla \cdot ( s \mathbf u ) = \frac{1}{T}\left((\mu+\mu_a(\mathbf x)) |\nabla \mathbf u|^2 \right) \,,\end{split}\]

where the internal energy per unit mass is \(\mathcal U(\rho) = \rho^{\gamma-1} \exp(s / \rho)\). and \(\mu_a(\mathbf x)\) is an artificial viscosity coefficient.

Propagators (called in sequence):

  1. VariationalDensityEvolve

  2. VariationalMomentumAdvection

  3. VariationalEntropyEvolve

  4. VariationalViscosity

Model info:

class Fluid[source]#

Bases: FluidSpecies

class Propagators(with_viscosity: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.ViscoResistiveMHD_with_p(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: StruphyModel

Full (non-linear) visco-resistive MHD equations, with the pressure variable discretized with a variational method.

Normalization:

\[\hat u = \hat v_\textnormal{A}\,.\]

Equations:

\[\begin{split}&\partial_t \rho + \nabla \cdot ( \rho \mathbf u ) = 0 \,, \\[4mm] &\partial_t (\rho \mathbf u) + \nabla \cdot (\rho \mathbf u \otimes \mathbf u) + \frac{1}{\gamma -1} \nabla p + \mathbf B \times \nabla \times \mathbf B - \nabla \cdot \left((\mu+\mu_a(\mathbf x)) \nabla \mathbf u \right) = 0 \,, \\[4mm] &\partial_t p + u \cdot \nabla p + \gamma p \nabla \cdot u = \frac{1}{(\gamma -1)}\left((\mu+\mu_a(\mathbf x)) |\nabla \mathbf u|^2 + (\eta + \eta_a(\mathbf x)) |\nabla \times \mathbf B|^2\right) \,, \\[4mm] &\partial_t \mathbf B + \nabla \times ( \mathbf B \times \mathbf u ) + \nabla \times (\eta + \eta_a(\mathbf x)) \nabla \times \mathbf B = 0 \,,\end{split}\]

and \(\mu_a(\mathbf x)\) and \(\eta_a(\mathbf x)\) are artificial viscosity and resistivity coefficients.

Propagators (called in sequence):

  1. VariationalDensityEvolve

  2. VariationalMomentumAdvection

  3. VariationalPBEvolve

  4. VariationalViscosity

  5. VariationalResistivity

Model info:

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Diagnostics[source]#

Bases: DiagnosticSpecies

class Propagators(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.ViscoResistiveLinearMHD(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: StruphyModel

Linear visco-resistive MHD equations discretized with a variational method.

Normalization:

\[\hat u = \hat v_\textnormal{A}\,.\]

Equations:

\[\begin{split}&\partial_t \tilde{\rho} + \nabla \cdot ( \rho_0 \tilde{\mathbf u} ) = 0 \,, \\[4mm] &\partial_t (\rho_0 \tilde{\mathbf u}) + \frac{1}{\gamma -1} \nabla \tilde{p} + \mathbf B_0 \times \nabla \times \tilde{\mathbf B} + \tilde{\mathbf B} \times \nabla \times \mathbf B_0 - \nabla \cdot \left((\mu+\mu_a(\mathbf x)) \nabla \tilde{\mathbf u} \right) = 0 \,, \\[4mm] &\partial_t \tilde{p} + \tilde{\mathbf u} \cdot \nabla p_0 + \gamma p_0 \nabla \cdot \tilde{\mathbf u} = \frac{1}{(\gamma -1)}\left((\mu+\mu_a(\mathbf x)) |\nabla \tilde{\mathbf u}|^2 + (\eta + \eta_a(\mathbf x)) |\nabla \times \tilde{\mathbf B}|^2\right) \,, \\[4mm] &\partial_t \tilde{\mathbf B} + \nabla \times ( \mathbf B_0 \times \tilde{\mathbf u} ) + \nabla \times (\eta + \eta_a(\mathbf x)) \nabla \times \tilde{\mathbf B} = 0 \,,\end{split}\]

and \(\mu_a(\mathbf x)\) and \(\eta_a(\mathbf x)\) are artificial viscosity and resistivity coefficients.

Propagators (called in sequence):

  1. VariationalDensityEvolve

  2. VariationalPBEvolve

  3. VariationalViscosity

  4. VariationalResistivity

Model info:

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Diagnostics[source]#

Bases: DiagnosticSpecies

class Propagators(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.ViscoResistiveDeltafMHD(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: StruphyModel

\(\delta f\) visco-resistive MHD equations discretized with a variational method.

Normalization:

\[\hat u = \hat v_\textnormal{A}\,.\]

Equations:

\[\begin{split}&\partial_t \tilde{\rho} + \nabla \cdot ( (\tilde{\rho}+\rho_0) \tilde{\mathbf u} ) = 0 \,, \\[4mm] &\partial_t ((\tilde{\rho}+\rho_0) \tilde{\mathbf u}) + \nabla \cdot ((\tilde{\rho}+\rho_0) \tilde{\mathbf u} \otimes \tilde{\mathbf u}) + \frac{1}{\gamma -1} \nabla \tilde{p} + \mathbf B_0 \times \nabla \times \tilde{\mathbf B} + \tilde{\mathbf B} \times \nabla \times \mathbf B_0 + \tilde{\mathbf B} \times \nabla \times \tilde{\mathbf B} - \nabla \cdot \left((\mu+\mu_a(\mathbf x)) \nabla \tilde{\mathbf u} \right) = 0 \,, \\[4mm] &\partial_t \tilde{p} + \tilde{\mathbf u} \cdot \nabla (\tilde{p} + p_0) + \gamma (\tilde{p} + p_0) \nabla \cdot \tilde{\mathbf u} = \frac{1}{(\gamma -1)}\left((\mu+\mu_a(\mathbf x)) |\nabla \tilde{\mathbf u}|^2 + (\eta + \eta_a(\mathbf x)) |\nabla \times \tilde{\mathbf B}|^2\right) \,, \\[4mm] &\partial_t \tilde{\mathbf B} + \nabla \times ( (\tilde{\mathbf B} + \mathbf B_0) \times \tilde{\mathbf u} ) + \nabla \times (\eta + \eta_a(\mathbf x)) \nabla \times \tilde{\mathbf B} = 0 \,,\end{split}\]

and \(\mu_a(\mathbf x)\) and \(\eta_a(\mathbf x)\) are artificial viscosity and resistivity coefficients.

Propagators (called in sequence):

  1. VariationalDensityEvolve

  2. VariationalMomentumAdvection

  3. VariationalPBEvolve

  4. VariationalViscosity

  5. VariationalResistivity

Model info:

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Diagnostics[source]#

Bases: DiagnosticSpecies

class Propagators(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.ViscoResistiveMHD_with_q(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: StruphyModel

Full (non-linear) visco-resistive MHD equations, with the q variable (square root of the pressure) discretized with a variational method.

Normalization:

\[\hat u = \hat v_\textnormal{A}\,.\]

Equations:

\[\begin{split}&\partial_t \rho + \nabla \cdot ( \rho \mathbf u ) = 0 \,, \\[4mm] &\partial_t (\rho \mathbf u) + \nabla \cdot (\rho \mathbf u \otimes \mathbf u) + \frac{2q}{\gamma -1} \nabla q + \mathbf B \times \nabla \times \mathbf B - \nabla \cdot \left((\mu+\mu_a(\mathbf x)) \nabla \mathbf u \right) = 0 \,, \\[4mm] &\partial_t q + \cdot(\nabla q \mathbf u) + (\gamma/2 -1) q \nabla \cdot u = \frac{2 q}{(\gamma -1)}\left((\mu+\mu_a(\mathbf x)) |\nabla \mathbf u|^2 + (\eta + \eta_a(\mathbf x)) |\nabla \times \mathbf B|^2\right) \,, \\[4mm] &\partial_t \mathbf B + \nabla \times ( \mathbf B \times \mathbf u ) + \nabla \times (\eta + \eta_a(\mathbf x)) \nabla \times \mathbf B = 0 \,,\end{split}\]

and \(\mu_a(\mathbf x)\) and \(\eta_a(\mathbf x)\) are artificial viscosity and resistivity coefficients.

Propagators (called in sequence):

  1. VariationalDensityEvolve

  1. VariationalDensityEvolve

  2. VariationalMomentumAdvection

  3. VariationalQBEvolve

  4. VariationalViscosity

  5. VariationalResistivity

Model info:

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Diagnostics[source]#

Bases: DiagnosticSpecies

class Propagators(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.ViscoResistiveLinearMHD_with_q(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: StruphyModel

Linear visco-resistive MHD equations, with the q variable (square root of the pressure), discretized with a variational method.

Normalization:

\[\hat u = \hat v_\textnormal{A}\,.\]

Equations:

\[\begin{split}&\partial_t \tilde{\rho} + \nabla \cdot ( \rho_0 \tilde{\mathbf u} ) = 0 \,, \\[4mm] &\partial_t (\rho_0 \tilde{\mathbf u}) + \frac{2 q_0}{\gamma -1} \nabla \tilde{q} + \frac{2 \tilde{q}}{\gamma -1} \nabla q_0 + \mathbf B_0 \times \nabla \times \tilde{\mathbf B} + \tilde{\mathbf B} \times \nabla \times \mathbf B_0 - \nabla \cdot \left((\mu+\mu_a(\mathbf x)) \nabla \tilde{\mathbf u} \right) = 0 \,, \\[4mm] &\partial_t \tilde{q} + \cdot(\nabla q_0 \mathbf u) + (\gamma/2 -1) q_0 \nabla \cdot u = 0 \,, \\[4mm] &\partial_t \tilde{\mathbf B} + \nabla \times ( \mathbf B_0 \times \tilde{\mathbf u} ) + \nabla \times (\eta + \eta_a(\mathbf x)) \nabla \times \tilde{\mathbf B} = 0 \,,\end{split}\]

and \(\mu_a(\mathbf x)\) and \(\eta_a(\mathbf x)\) are artificial viscosity and resistivity coefficients.

Propagators (called in sequence):

  1. VariationalDensityEvolve

  2. VariationalQBEvolve

  3. VariationalViscosity

  4. VariationalResistivity

Model info:

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Diagnostics[source]#

Bases: DiagnosticSpecies

class Propagators(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.ViscoResistiveDeltafMHD_with_q(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: StruphyModel

Linear visco-resistive MHD equations discretized with a variational method.

Normalization:

\[\hat u = \hat v_\textnormal{A}\,.\]

Equations:

\[\begin{split}&\partial_t \tilde{\rho} + \nabla \cdot ( \rho_0 \tilde{\mathbf u} ) = 0 \,, \\[4mm] &\partial_t (\rho_0 \tilde{\mathbf u}) + \frac{2 q_0}{\gamma -1} \nabla \tilde{q} + \frac{2 \tilde{q}}{\gamma -1} \nabla q_0 + \frac{2 \tilde{q}}{\gamma -1} \nabla \tilde{q} + \mathbf B_0 \times \nabla \times \tilde{\mathbf B} + \tilde{\mathbf B} \times \nabla \times \mathbf B_0 - \nabla \cdot \left((\mu+\mu_a(\mathbf x)) \nabla \tilde{\mathbf u} \right) = 0 \,, \\[4mm] &\partial_t \tilde{q} + \cdot(\nabla (q_0 + \tilde{q}) \mathbf u) + (\gamma/2 -1) (q_0 + \tilde{q}) \nabla \cdot u = 0 \,, \\[4mm] &\partial_t \tilde{\mathbf B} + \nabla \times ( \mathbf (B_0 + \tilde{\mathbf B}) \times \tilde{\mathbf u} ) + \nabla \times (\eta + \eta_a(\mathbf x)) \nabla \times \tilde{\mathbf B} = 0 \,,\end{split}\]

and \(\mu_a(\mathbf x)\) and \(\eta_a(\mathbf x)\) are artificial viscosity and resistivity coefficients.

Propagators (called in sequence):

  1. VariationalDensityEvolve

  2. VariationalMomentumAdvection

  3. VariationalQBEvolve

  4. VariationalViscosity

  5. VariationalResistivity

Model info:

class EMFields[source]#

Bases: FieldSpecies

class MHD[source]#

Bases: FluidSpecies

class Diagnostics[source]#

Bases: DiagnosticSpecies

class Propagators(with_viscosity: bool = True, with_resistivity: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.EulerSPH(with_B0: bool = True)[source]#

Bases: StruphyModel

Euler equations discretized with smoothed particle hydrodynamics (SPH).

Normalization:

\[\hat u = \hat v_\textnormal{th} \,.\]

Equations:

\[\begin{split}\begin{align} \partial_t \rho + \nabla \cdot (\rho \mathbf u) &= 0\,, \\[2mm] \rho(\partial_t \mathbf u + \mathbf u \cdot \nabla \mathbf u) &= - \nabla \left(\rho^2 \frac{\partial \mathcal U(\rho, S)}{\partial \rho} \right)\,, \\[2mm] \partial_t S + \mathbf u \cdot \nabla S &= 0\,, \end{align}\end{split}\]

where \(S\) denotes the entropy per unit mass. The internal energy per unit mass can be defined in two ways:

\[ \begin{align}\begin{aligned}\mathrm{"isothermal:"}\qquad &\mathcal U(\rho, S) = \kappa(S) \log \rho\,.\\\mathrm{"polytropic:"}\qquad &\mathcal U(\rho, S) = \kappa(S) \frac{\rho^{\gamma - 1}}{\gamma - 1}\,.\end{aligned}\end{align} \]

Propagators (called in sequence):

  1. PushEta

  2. PushVxB

  3. PushVinSPHpressure

class EulerFluid[source]#

Bases: ParticleSpecies

class Propagators(with_B0: bool = True)[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str

class struphy.models.fluid.HasegawaWakatani[source]#

Bases: StruphyModel

Hasegawa-Wakatani equations in 2D.

Normalization:

\[\hat u = \hat v_\textnormal{th}\,,\qquad \hat \phi = \hat u\, \hat x \,.\]

Equations:

\[\begin{split}&\frac{\partial n}{\partial t} = C (\phi - n) - [\phi, n] - \kappa\, \partial_y \phi + \nu\, \nabla^{2N} n\,, \\[2mm] &\frac{\partial \omega}{\partial t} = C (\phi - n) - [\phi, \omega] + \nu\, \nabla^{2N} \omega \,, \\[3mm] &\Delta \phi = \omega\,,\end{split}\]

where \([\phi, n] = \partial_x \phi \partial_y n - \partial_y \phi \partial_x n\), \(C = C(x, y)\) and \(\kappa\) and \(\nu\) are constants (at the moment only \(N=1\) is available).

Propagators (called in sequence):

  1. Poisson

  2. HasegawaWakatani

Model info:

class EMFields[source]#

Bases: FieldSpecies

class Plasma[source]#

Bases: FluidSpecies

class Propagators[source]#

Bases: object

allocate_helpers()[source]#

Allocate helper arrays that are needed during simulation.

update_rho()[source]#
generate_default_parameter_file(path=None, prompt=True)[source]#

Generate a parameter file with default options for each species, and save it to the current input path.

The default name is params_<model_name>.yml.

Parameters:
  • path (str) – Alternative path to getcwd()/params_MODEL.py.

  • prompt (bool) – Whether to prompt for overwriting the specified .yml file.

Returns:

params_path – The path of the parameter file.

Return type:

str