Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pgrete/diffusion' into pgrete/next
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrete committed Nov 21, 2023
2 parents a8a81e1 + 98f2f1f commit b90fb0d
Show file tree
Hide file tree
Showing 28 changed files with 2,408 additions and 214 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
build/tst/regression/outputs/cluster_hse/analytic_comparison.png
build/tst/regression/outputs/cluster_tabular_cooling/convergence.png
build/tst/regression/outputs/aniso_therm_cond_ring_conv/ring_convergence.png
build/tst/regression/outputs/aniso_therm_cond_gauss_conv/cond.png
build/tst/regression/outputs/diffusion/ohm.png
build/tst/regression/outputs/diffusion/visc.png
build/tst/regression/outputs/field_loop/field_loop.png
build/tst/regression/outputs/riemann_hydro/shock_tube.png
build/tst/regression/outputs/turbulence/parthenon.hst
Expand Down
50 changes: 43 additions & 7 deletions docs/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,22 @@ conserved to primitive conversion if both are defined.

#### Diffusive processes

##### Anisotropic thermal conduction (required MHD)
##### Isotropic (hydro and MHD )and anisotropic thermal conduction (only MHD)
In the presence of magnetic fields thermal conduction is becoming anisotropic with the flux along
the local magnetic field direction typically being much stronger than the flux perpendicular to the magnetic field.

From a theoretical point of view, thermal conduction is included in the system of MHD equations by an additional
term in the total energy equation:
```math
\delta_t E + \nabla \cdot (... + \mathbf{F}) \quad \mathrm{with}\\
\mathbf{F} = - \kappa \mathbf{\hat b} (\mathbf{\hat b \cdot \nabla T})
\delta_t E + \nabla \cdot (... + \mathbf{F}_\mathrm{c})
```
where the full thermal conduction flux $`\mathbf{F}_\mathrm{c}`$ contains both the classic thermal conduction
```math
\mathbf{F}_\mathrm{classic} = - \kappa \mathbf{\hat b} (\mathbf{\hat b \cdot \nabla T})
```
as well as the saturated flux (as introduced by [^CM77])
```math
\mathbf{F}_\mathrm{sat} = - 5 \phi \rho^{-1/2} p^{3/2} \mathrm{sgn}(\mathbf{\hat b \cdot \nabla T}) \mathbf{\hat b}
```

From an implementation point of view, two options implemented and can be configured within a `<diffusion>` block in the input file.
Expand All @@ -86,23 +93,52 @@ the integration step (before flux correction in case of AMR, and calculating the
Moreover, they are implemented explicitly, i.e., they add a (potentially very restrictive) constraint to the timestep due to the scaling with $`\propto \Delta_x^2`$.
Finally, we employ limiters for calculating the temperature gradients following Sharma & Hammett (2007)[^SH07].
This prevents unphysical conduction against the gradient, which may be introduced because the off-axis gradients are not centered on the interfaces.
Similarly, to account for the different nature of classic and saturated fluxes (parabolic and hyperbolic, respectively),
we follow [^M+12] and use a smooth transition
```math
\mathbf{F}_\mathrm{c} = \frac{q}{q + F_\mathrm{classic}} \mathbf{F}_\mathrm{classic} \quad \mathrm{with} \quad q = 5 \phi \rho^{-1/2} p^{3/2}
```
and upwinding of the hyperbolic, saturated fluxes.

To enable conduction, set
To enable thermal conduction, set

Parameter: `conduction` (string)
- `none` : No thermal conduction
- `isotropic` : Isotropic thermal conduction
- `anisotropic` : Anisotropic thermal conduction

In addition the coefficient (or diffusivity) needs to be set

Parameter: `conduction_coeff` (string)
- `spitzer` : Anisotropic thermal conduction with a temperature dependent classic Spitzer thermal conductivity
$`\kappa (T) = c_\kappa T^{5/2} \mathrm{erg/s/K/cm}`$ and
$`c_\kappa`$ being constant prefactor (set via `diffusion/spitzer_cond_in_erg_by_s_K_cm` with a default value of $`4.6\times10^{-7}`$). Note, as indicated by the units in the input parameter name, this kind of thermal conductivity requires a full set of units
$`c_\kappa`$ being constant prefactor (set via the additional `diffusion/spitzer_cond_in_erg_by_s_K_cm` parameter with a default value of $`4.6\times10^{-7}`$). Note, as indicated by the units in the input parameter name, this kind of thermal conductivity requires a full set of units
to be defined for the simulation.
- `thermal_diff` : Contrary to a temperature dependent conductivity, a simple thermal diffusivity can be used instead for which
- `fixed` : Contrary to a temperature dependent conductivity, a simple thermal diffusivity can be used instead for which
the conduction flux is $`\mathbf{F} = - \chi \rho \mathbf{\hat b} (\mathbf{\hat b \cdot \nabla \frac{p_\mathrm{th}}{\rho}})`$
Here, the strength, $`\chi`$, is controlled via the `thermal_diff_coeff_code` parameter in code units.
Here, the strength, $`\chi`$, is controlled via the additional `thermal_diff_coeff_code` parameter in code units.
Given the dimensions of $`L^2/T`$ it is referred to a thermal diffusivity rather than thermal conductivity.

Parameter: `conduction_sat_phi` (float)
- Default value 0.3\
Factor to account for the uncertainty in the estimated of saturated fluxes, see [^CM77].
Default value corresponds to the typical value used in literature and goes back to [^MMM80] and [^BM82].


[^SH07]:
P. Sharma and G. W. Hammett, "Preserving monotonicity in anisotropic diffusion," Journal of Computational Physics, vol. 227, no. 1, Art. no. 1, 2007, doi: https://doi.org/10.1016/j.jcp.2007.07.026.

[^M+12]:
A. Mignone, C. Zanni, P. Tzeferacos, B. van Straalen, P. Colella, and G. Bodo, “THE PLUTO CODE FOR ADAPTIVE MESH COMPUTATIONS IN ASTROPHYSICAL FLUID DYNAMICS,” The Astrophysical Journal Supplement Series, vol. 198, Art. no. 1, Dec. 2011, doi: https://doi.org/10.1088/0067-0049/198/1/7

[^CM77]:
L. Cowie and C. F. McKee, “The evaporation of spherical clouds in a hot gas. I. Classical and saturated mass loss rates.,” , vol. 211, pp. 135–146, Jan. 1977, doi: https://doi.org/10.1086/154911

[^MMM80]:
C. E. Max, C. F. McKee, and W. C. Mead, “A model for laser driven ablative implosions,” The Physics of Fluids, vol. 23, Art. no. 8, 1980, doi: https://doi.org/10.1063/1.863183

[^BM82]:
S. A. Balbus and C. F. McKee, “The evaporation of spherical clouds in a hot gas. III - Suprathermal evaporation,” , vol. 252, pp. 529–552, Jan. 1982, doi: https://doi.org/10.1086/159581

### Additional MHD options in `<hydro>` block

Expand Down
18 changes: 14 additions & 4 deletions inputs/diffusion.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# AthenaPK - a performance portable block structured AMR MHD code
# Copyright (c) 2021, Athena Parthenon Collaboration. All rights reserved.
# Copyright (c) 2021-2023, Athena Parthenon Collaboration. All rights reserved.
# Licensed under the BSD 3-Clause License (the "LICENSE");

<comment>
problem = Thermal diffusion setup
problem = Diffusion setup (for thermal, momentum and Ohmic diffusion tests)

<job>
problem_id = diffusion
Expand All @@ -14,7 +14,8 @@ Bx = 1.0 # Bx for x1 step function (permutated for iprobs in other direction
By = 0.0 # By for x1 step function (permutated for iprobs in other directions)

#iprob = 10 # Diffusion of Gaussian profile in x1 direction
sigma = 0.1 # standard deviation of Gaussian for iprob=10
t0 = 0.5 # Temporal offset for initial Gaussian profile
amp = 1e-6 # Amplitude of Gaussian profile

iprob = 20 # ring diffusion in x1-x2 plane; 21 for x2-x3 plane; 22 for x3-x1 plane

Expand Down Expand Up @@ -59,8 +60,17 @@ reconstruction = dc
gamma = 2.0

<diffusion>
conduction = thermal_diff
integrator = rkl2
conduction = anisotropic
conduction_coeff = fixed
thermal_diff_coeff_code = 0.01
viscosity = none # none (disabled), isotropic, or anisotropic
viscosity_coeff = fixed
mom_diff_coeff_code = 0.25
resistivity = none # none (disabled) or isotropic
resistivity_coeff = fixed
ohm_diff_coeff_code = 0.25
rkl2_max_dt_ratio = 100.0

<parthenon/output0>
file_type = hdf5
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ add_executable(
eos/adiabatic_glmmhd.cpp
units.hpp
eos/adiabatic_hydro.cpp
hydro/diffusion/diffusion.hpp
hydro/diffusion/conduction.cpp
hydro/diffusion/diffusion.cpp
hydro/diffusion/diffusion.hpp
hydro/diffusion/resistivity.cpp
hydro/diffusion/viscosity.cpp
hydro/hydro_driver.cpp
hydro/hydro.cpp
hydro/glmmhd/dedner_source.cpp
Expand Down
Loading

0 comments on commit b90fb0d

Please sign in to comment.