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

Add isotropic thermal conduction and RKL2 supertimestepping #1

Merged
merged 50 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b5baf67
Add simple anisotropic step function test
pgrete Oct 3, 2021
e9ac8f6
Separate FillDerived and EstimateTimestep in driver in prep for STS list
pgrete Oct 3, 2021
2b30fca
Add diffflux parameter
pgrete Oct 3, 2021
db63255
Add RKL2 STS task list
pgrete Oct 3, 2021
a968fd8
Add calc of RKL2 stages
pgrete Oct 3, 2021
0e0986b
Remove unncessary register for rkl2
pgrete Oct 4, 2021
6da6766
Adopt STS RKL2 variable naming
pgrete Oct 4, 2021
d25abb3
Move calc of dt_diff into PreStep
pgrete Oct 4, 2021
b4dfdd9
Make tlim an argument for diff step test
pgrete Oct 6, 2021
5f20625
Adjust RKL2 conv test to gaussian profile
pgrete Oct 6, 2021
b75b496
Add conv panel to conv plot
pgrete Oct 6, 2021
3473da8
auto-format
pgrete Oct 6, 2021
3d26c40
rename diffusion integrator parameter
pgrete Oct 6, 2021
61a9c93
Add isotropic thermal conduction
pgrete Oct 6, 2021
647490d
Add isotropic cond to conv test
pgrete Oct 6, 2021
4e03d38
Add RKL2 conv test
pgrete Oct 6, 2021
a235952
Add new dt max ratio for rkl2 param
pgrete Oct 11, 2021
991d353
Add prolongation and fluxcorrect to RKL2 task list
pgrete Oct 11, 2021
7fd557d
Use base container as active STS container (workaround some AMR bug f…
pgrete Oct 12, 2021
755e06b
Merge branch 'pgrete/dt-fixes' into pgrete/sts
pgrete Oct 23, 2021
c2acc9e
Merge branch 'main' into pgrete/sts
pgrete Dec 8, 2021
1f9cf68
Add isotropic Spitzer thermal conduction timestep
pgrete Dec 8, 2021
1b9a797
Calc isotropic, non-const thermal diff
pgrete Dec 8, 2021
16ad2ca
Merge branch 'pgrete/cooling-hotfix' into pgrete/sts
pgrete Apr 12, 2022
c9f1dfb
Fix calc of saturated heat flux
pgrete Apr 12, 2022
8599682
Add LimO3 limiter
pgrete May 13, 2022
4ebb5d6
Add limo3 convergence
pgrete May 13, 2022
8800b51
Fix LimO3 recon
pgrete May 14, 2022
b416ce0
Merge branch 'pgrete/limo3' into pgrete/sts
pgrete May 16, 2022
3986cee
Merge branch 'main' into pgrete/sts
pgrete Jun 7, 2022
3f071d4
Fix saturated conduction prefactor
pgrete Jun 7, 2022
9582764
Remove calc of saturated conduction from cond coeff
pgrete Jun 7, 2022
115285d
Add upwinded saturated conduction in x-dir
pgrete Jun 7, 2022
51dca4f
Add saturated conduction prefactor
pgrete Jun 8, 2022
8194e97
Add x2 and x3 sat cond fluxes
pgrete Jun 8, 2022
ca3c397
Increase default rkl2 ratio to 400 and allow flux correction for all …
pgrete Jun 8, 2022
6494ab2
Remove parabolic timestep constraint for saturated conduction limit r…
pgrete Aug 9, 2022
6df018f
Add perturb to cloud pgen
pgrete Aug 10, 2022
1d0cb19
Add perturb to B (knowing this is not great...)
pgrete Aug 12, 2022
300c6a0
Revert "Add perturb to B (knowing this is not great...)"
pgrete Sep 24, 2022
9205e56
Revert "Add perturb to cloud pgen"
pgrete Sep 24, 2022
1749bb8
Limit cooling to upper bound of TFloor and cooling table cutoff
pgrete Sep 24, 2022
2bc56f8
Add oblique B field
pgrete Sep 24, 2022
3b6ac2e
Merge branch 'main' into pgrete/sts
pgrete Sep 25, 2023
b0bd7ca
Update coords and driver
pgrete Sep 25, 2023
4ab8834
Fix test cases and add success check
pgrete Sep 25, 2023
3199c6a
Merge branch 'main' into pgrete/sts
pgrete Sep 28, 2023
f6d36d2
Merge branch 'main' into pgrete/sts
pgrete Aug 21, 2024
e43c647
Add changelog
pgrete Aug 21, 2024
e1ea14a
Address comments
pgrete Aug 21, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ 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/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
8 changes: 6 additions & 2 deletions inputs/diffusion.in
Original file line number Diff line number Diff line change
Expand Up @@ -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,11 @@ reconstruction = dc
gamma = 2.0

<diffusion>
conduction = thermal_diff
integrator = unsplit
conduction = anisotropic
conduction_coeff = fixed
thermal_diff_coeff_code = 0.01
rkl2_max_dt_ratio = 400.0

<parthenon/output0>
file_type = hdf5
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ add_executable(
eos/adiabatic_glmmhd.cpp
units.hpp
eos/adiabatic_hydro.cpp
hydro/diffusion/diffusion.cpp
hydro/diffusion/diffusion.hpp
hydro/diffusion/conduction.cpp
hydro/hydro_driver.cpp
Expand Down
Loading