Explicit Diffusion ================== Introduction ------------ Alongside the ideal (non-dissipative) solvers, AthenaK can add **explicit diffusion** terms to the fluid and induction equations: - **Viscosity** — diffusion of momentum (shear and, optionally, anisotropic viscosity). - **Thermal conduction** — diffusion of heat (isotropic, anisotropic, or Spitzer). - **Resistivity** — diffusion of the magnetic field (Ohmic and ambipolar). Each process is implemented as an additional flux that is added to the face-centered fluxes of the conserved variables every stage of the Runge–Kutta integrator. Because the terms are treated **explicitly**, they impose a diffusive stability limit on the time step, .. math:: \Delta t \lesssim \frac{(\Delta x)^2}{D}, where :math:`D` is the relevant diffusivity. For strongly diffusive problems this can dominate the cost, and the ideal (advective) CFL condition no longer sets the step. Viscosity and thermal conduction can be added to either the ```` or the ```` block; resistivity is only meaningful for MHD and lives in the ```` block. Inputs ------ **Viscosity** (in ```` or ````): - ``nu_iso`` (default ``0``): coefficient of isotropic (kinematic) shear viscosity :math:`\nu`. - ``nu_aniso`` (default ``0``): coefficient of anisotropic (Braginskii) viscosity. The isotropic viscous stress diffuses momentum, with a heating term added to the energy equation so that total energy is conserved. **Thermal conduction** (in ```` or ````): - ``alpha_iso`` (default ``0``): coefficient of isotropic thermal **diffusivity** :math:`\alpha`. - ``alpha_aniso`` (default ``0``): coefficient of anisotropic (field-aligned) thermal diffusivity. - ``alpha_spitzer`` (default ``false``): use a temperature-dependent Spitzer conductivity rather than a constant coefficient. - ``q_limit``: cap on the heat flux magnitude (saturated conduction); unlimited by default. .. note:: The conduction coefficients ``alpha_*`` are **diffusivities**, not conductivities. The conductivity is :math:`\kappa = \rho\,\alpha` and the heat flux is :math:`\boldsymbol{Q} = -\kappa\,\nabla T = -\rho\,\alpha\,\nabla T`. AthenaK uses a dimensionless temperature :math:`T = P/\rho` (the factor :math:`\bar{m}/k_{\rm B}` is not included), so ``alpha_iso`` must be given in the corresponding dimensionless units (see :doc:`units`). **Resistivity** (in ````): - ``eta_ohm`` (default ``0``): Ohmic resistivity :math:`\eta_{\rm O}`. - ``eta_ad`` (default ``0``): ambipolar diffusivity :math:`\eta_{\rm A}` (the effective diffusivity :math:`\eta_{\rm O} + \eta_{\rm A} B^2` then varies in space). A process is active whenever its coefficient is non-zero; for example, adding .. code-block:: text nu_iso = 1.0e-3 # shear viscosity alpha_iso = 1.0e-3 # thermal diffusivity eta_ohm = 1.0e-2 # Ohmic resistivity enables viscosity, conduction, and Ohmic resistivity together in an MHD run. Governing equations ------------------- The dissipative fluxes added to the conserved-variable equations are .. math:: \Pi_{ij} = \rho\,\nu\left(\partial_i v_j + \partial_j v_i - \tfrac{2}{3}\,\delta_{ij}\nabla\!\cdot\!\boldsymbol{v}\right), \qquad \boldsymbol{Q} = -\rho\,\alpha\,\nabla T, \qquad \boldsymbol{\mathcal{E}}_{\rm O} = \eta_{\rm O}\,\nabla\times\boldsymbol{B}, for the viscous stress, heat flux, and Ohmic electric field respectively. Each reduces, for a small perturbation on a uniform background, to a simple diffusion equation :math:`\partial_t q = D\,\nabla^2 q` for the diffusing quantity :math:`q` (a velocity component, the temperature, or a magnetic-field component), with diffusivity :math:`D` equal to :math:`\nu`, :math:`(\gamma-1)\,\alpha`, and :math:`\eta_{\rm O}` respectively. Outputs ------- Diffusion does not introduce new output variables; it modifies the evolution of the standard :doc:`hydro ` and :doc:`mhd` fields. Visualize the affected quantity as usual — e.g. ``eint`` (temperature) for conduction, ``vely``/``velz`` for viscosity, or ``bcc*`` for resistivity. Verification: Gaussian-pulse diffusion -------------------------------------- The cleanest test of each module is to diffuse a Gaussian pulse and compare with the exact solution. AthenaK ships a built-in ``diffusion`` problem generator (input files ``tst/inputs/diffusion.athinput`` for hydro and ``tst/inputs/diffusion_mhd.athinput`` for MHD) that initializes an isotropic :math:`n`-dimensional Gaussian and evolves it under **pure diffusion**. The pulse can spread along one, two, or three axes (``spread_x1/x2/x3``), and the diffusing quantity is a temperature pulse (``conduction_test``), a single velocity component (``viscosity_test``), or a single magnetic-field component (``resistivity_test``, selected with ``vel_comp`` = 1/2/3 → Bx/By/Bz). The exact solution is .. math:: q(\boldsymbol{r}, t) = \frac{A}{(1 + 4Dt)^{n/2}}\, \exp\!\left(-\frac{r^2}{1 + 4Dt}\right), where :math:`A` is the amplitude, :math:`n` the number of spread axes, and :math:`D` the diffusivity of the active process. .. important:: The ``diffusion`` generator must be run in **kinematic** mode (``