Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magnetic flutter terms #275

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/sphinx/components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,11 @@ electromagnetic
(``electromagnetic:magnetic_flutter=true``). They use an
``Apar_flutter`` field, not the ``Apar`` field that is calculated
from the induction terms.
5. If using ``vorticity:phi_boundary_relax`` to evolve the radial
boundary of the electrostatic potential, the timescale
``phi_boundary_timescale`` should be set much longer than the
Alfven wave period or unphysical instabilities may grow from the
boundaries.

This component modifies the definition of momentum of all species, to
include the contribution from the electromagnetic potential
Expand Down Expand Up @@ -2289,5 +2294,12 @@ parallel derivative terms in the ``evolve_density``, ``evolve_pressure``, ``evol
``evolve_momentum`` components. Parallel flow terms are modified, and parallel heat
conduction.

.. math::

\begin{aligned}\mathbf{b}\cdot\nabla f =& \mathbf{b}_0\cdot\nabla f + \delta\mathbf{b}\cdot\nabla f \\
=& \mathbf{b}_0\cdot\nabla f + \frac{1}{B}\nabla\times\left(\mathbf{b}A_{||}\right)\cdot\nabla f \\
\simeq& \mathbf{b}_0\cdot\nabla f + \frac{1}{B_0}\left[A_{||}\nabla\times\mathbf{b} + \left(\nabla A_{||}\right)\times\mathbf{b}_0\right]\cdot\nabla f \\
\simeq& \mathbf{b}_0\cdot\nabla f + \frac{1}{B_0}\mathbf{b}_0\times \nabla A_{||} \cdot \nabla f\end{aligned}

.. doxygenstruct:: Electromagnetic
:members:
8 changes: 8 additions & 0 deletions src/evolve_momentum.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ void EvolveMomentum::finally(const Options &state) {
}
ddt(NV) += Z * Apar * dndt;
}
if (state["fields"].isSet("Apar_flutter")) {
// Magnetic flutter term
const Field3D Apar_flutter = get<Field3D>(state["fields"]["Apar_flutter"]);

// Using the approximation for small delta-B/B
// b dot Grad(phi) = Grad_par(phi) + [phi, Apar]
ddt(NV) -= Z * N * bracket(phi, Apar_flutter, BRACKET_ARAKAWA);
}
} else {
ddt(NV) = 0.0;
}
Expand Down
2 changes: 2 additions & 0 deletions src/evolve_pressure.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ void EvolvePressure::finally(const Options& state) {
Field3D db_dot_T = bracket(T, Apar_flutter, BRACKET_ARAKAWA);
Field3D b0_dot_T = Grad_par(T);
mesh->communicate(db_dot_T, b0_dot_T);
db_dot_T.applyBoundary("neumann");
b0_dot_T.applyBoundary("neumann");
ddt(P) += (2. / 3) * (Div_par(kappa_par * db_dot_T) -
Div_n_g_bxGrad_f_B_XZ(kappa_par, db_dot_T + b0_dot_T, Apar_flutter));
}
Expand Down
16 changes: 14 additions & 2 deletions src/vorticity.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ void Vorticity::transform(Options& state) {

void Vorticity::finally(const Options& state) {
AUTO_TRACE();
auto coord = mesh->getCoordinates();

phi = get<Field3D>(state["fields"]["phi"]);

Expand Down Expand Up @@ -670,7 +671,7 @@ void Vorticity::finally(const Options& state) {
}
}

if (state.isSection("fields") and state["fields"].isSet("DivJextra")) {
if (state["fields"].isSet("DivJextra")) {
auto DivJextra = get<Field3D>(state["fields"]["DivJextra"]);

// Parallel current is handled here, to allow different 2D or 3D closures
Expand All @@ -695,7 +696,18 @@ void Vorticity::finally(const Options& state) {
const BoutReal A = get<BoutReal>(species["AA"]);

// Note: Using NV rather than N*V so that the cell boundary flux is correct
ddt(Vort) += Div_par((Z / A) * NV);
const Field3D jpar = (Z / A) * NV;
ddt(Vort) += Div_par(jpar);

if (state["fields"].isSet("Apar_flutter")) {
// Magnetic flutter term
const Field3D Apar_flutter = get<Field3D>(state["fields"]["Apar_flutter"]);

// Div_par(jpar) = B * Grad_par(jpar / B)
// Using the approximation for small delta-B/B
// b dot Grad(jpar) = Grad_par(jpar) + [jpar, Apar]
ddt(Vort) += coord->Bxy * bracket(jpar / coord->Bxy, Apar_flutter, BRACKET_ARAKAWA);
}
}

// Viscosity
Expand Down
Loading