The FARGO_THORIN code developer's guide
|
Subroutines related to the heating/cooling source terms, numerical solver for the energy equation and radiative diffusion. More...
#include "fargo.h"
Go to the source code of this file.
Macros | |
#define | SORMAXITERS 1000 |
#define | SOREPS 1.0e-8 |
Functions | |
void | InitRadiatDiffusionFields () |
Initialises the polar arrays associated with the heating/cooling processes. More... | |
void | CalculateQminus (PolarGrid *Rho) |
Estimate of the heat loss due to radiation escape in the vertical direction with respect to the midplane. More... | |
void | CalculateQirr (PolarGrid *Rho) |
Calculates the stellar irradiation source term. More... | |
void | CalculateFlaring () |
Calculates the sine of the grazing angle by reconstructing the surface from the pressure scale height. More... | |
void | ImplicitRadiativeDiffusion (PolarGrid *Rho, PolarGrid *EnergyInt, PolarGrid *EnergyNew, real dt) |
The main numerical solver of the energy equation. More... | |
void | IterateRelaxationParameter () |
When solving the energy equation for the first time, the function spans through various values of the SOR parameter in order to find its best value to start with. More... | |
int | SuccessiveOverrelaxation (real omega, boolean errcheck) |
The SOR method algorithm inspired by the one from Numerical Recipes. More... | |
void | ChessBoardIndexing () |
Function ensures the odd-even ordering of the SOR method when the grid is split on multiple CPUs. More... | |
void | DiffusionCoefs () |
Calculation of the diffusion coefficients. More... | |
void | TemperatureGradient () |
Finds the temperature gradients and their magnitude over the mesh. More... | |
void | MidplaneVolumeDensity (PolarGrid *Rho) |
Translates the surface density into the midplane volume density using the local pressure scale height. More... | |
void | OpacityProfile () |
Fills the opacity polar grid, either with a fixed parametric value or using the Bell & Lin (1994) opacity table. More... | |
real | FluxLimiterValue (real s) |
Calculates the flux limiter according to Kley (1989) More... | |
real | EffectiveOpticalDepth (real tau) |
Calculates the effective optical depth in a simple gray model of the disk's vertical structure; see Hubeny (1990). More... | |
void | SynchronizeOverlapFields (real *field, int nr, int nsync) |
For a MPI-split grid, synchronizes the values in a requested number 'nsync' of the overlapping radial rings. More... | |
void | CreateTorqueMapInfile (int istep, PolarGrid *Surfdens) |
Writes an input file for the 'torquemap' code written by Bertram Bitsch. More... | |
Variables | |
static real | kappa0 [7] = {2.0e-4, 2.0e16, 0.1, 2.0e81, 1.0e-8, 1.0e-36, 1.5e20} |
static real | a [7] = {0.0, 0.0, 0.0, 1.0, 2.0/3.0, 1.0/3.0, 1.0} |
static real | b [7] = {2.0, -7.0, 0.5, -24.0, 3.0, 10.0, -5.0/2.0} |
static PolarGrid * | GradTemperRad |
static PolarGrid * | GradTemperTheta |
static PolarGrid * | GradTemperMagnitude |
static PolarGrid * | DiffCoefCentered |
static PolarGrid * | DiffCoefIfaceRad |
static PolarGrid * | DiffCoefIfaceTheta |
static PolarGrid * | Opacity |
static PolarGrid * | VolumeDensity |
static PolarGrid * | Flaring |
static PolarGrid * | Qirradiation |
static PolarGrid * | DiscretizationCoefA |
static PolarGrid * | DiscretizationCoefB |
static PolarGrid * | MatrixNexttoTemperl |
static PolarGrid * | MatrixNexttoTemperlip |
static PolarGrid * | MatrixNexttoTemperlim |
static PolarGrid * | MatrixNexttoTemperljp |
static PolarGrid * | MatrixNexttoTemperljm |
static PolarGrid * | RightHandSide |
static real | CV |
static real | omegabest |
static real | domega |
static int | Niterbest |
static int | jchess1st |
static int | jchess2nd |
Subroutines related to the heating/cooling source terms, numerical solver for the energy equation and radiative diffusion.
Calculates the individual energy source terms according to Chrenko et al. (2017). Then solves the energy equation in a linearised implicit form using the successive over-relaxation (SOR) method (see Appendix A in Chrenko et al. 2017).
Copyright (c) 2017 Ondřej Chrenko. See the LICENSE file of the distribution.
Definition in file EnergySources.c.
#define SOREPS 1.0e-8 |
Definition at line 23 of file EnergySources.c.
Referenced by SuccessiveOverrelaxation().
#define SORMAXITERS 1000 |
Definition at line 22 of file EnergySources.c.
Referenced by IterateRelaxationParameter(), and SuccessiveOverrelaxation().
void CalculateFlaring | ( | ) |
Calculates the sine of the grazing angle by reconstructing the surface from the pressure scale height.
See Eq. (15) in Chrenko et al. (2017).
Definition at line 147 of file EnergySources.c.
References AU_SI, polargrid::Field, InvDiffRsup, InvRmed, polargrid::Nrad, polargrid::Nsec, OmegaInv, Rinf, Rmed, Rsup, SoundSpeed, SQRT_ADIABIND_INV, and STELLARRADIUS.
Referenced by ImplicitRadiativeDiffusion().
void CalculateQirr | ( | PolarGrid * | Rho | ) |
Calculates the stellar irradiation source term.
See Eq. (13) in Chrenko et al. (2017).
Definition at line 104 of file EnergySources.c.
References AU_SI, DISCALBEDO, EffectiveOpticalDepth(), EFFECTIVETEMPERATURE, polargrid::Field, OPACITYDROP, Rmed2, STEFANBOLTZMANN, STELLARRADIUS, and T2SI.
Referenced by ImplicitRadiativeDiffusion().
void CalculateQminus | ( | PolarGrid * | Rho | ) |
Estimate of the heat loss due to radiation escape in the vertical direction with respect to the midplane.
See Eq. (9) in Chrenko et al. (2017).
Definition at line 76 of file EnergySources.c.
References EffectiveOpticalDepth(), polargrid::Field, polargrid::Nrad, OPACITYDROP, Qminus, STEFANBOLTZMANN, and Temperature.
Referenced by ImplicitRadiativeDiffusion().
void ChessBoardIndexing | ( | ) |
Function ensures the odd-even ordering of the SOR method when the grid is split on multiple CPUs.
Definition at line 486 of file EnergySources.c.
References CPU_Master, CPU_Number, CPU_Rank, CPUOVERLAP, fargostat, jchess1st, jchess2nd, MPI_COMM_WORLD, MPI_INT, MPI_Recv(), MPI_Send(), and NRAD.
Referenced by SuccessiveOverrelaxation().
void CreateTorqueMapInfile | ( | int | istep, |
PolarGrid * | Surfdens | ||
) |
Writes an input file for the 'torquemap' code written by Bertram Bitsch.
Definition at line 816 of file EnergySources.c.
References a, ADIABIND, ALPHAVISCOSITY, b, CPU_Master, polargrid::Field, fopenp(), GLOBALNRAD, GlobalRmed, kappa0, masterprint(), MAX1D, mpi_make1Dprofile(), Opacity, OUTPUTDIR, PARAMETRICOPACITY, PI, PRESS2CGS, Pressure, RHO2CGS, Sigma(), SIGMA2CGS, SoundSpeed, T2SI, Temperature, VISCOSITY, and ViscosityAlpha.
Referenced by main().
void DiffusionCoefs | ( | ) |
Calculation of the diffusion coefficients.
Definition at line 527 of file EnergySources.c.
References polargrid::Field, FluxLimiterValue(), polargrid::Nrad, polargrid::Nsec, STEFANBOLTZMANN, Temperature, and TemperatureGradient().
Referenced by ImplicitRadiativeDiffusion().
Calculates the effective optical depth in a simple gray model of the disk's vertical structure; see Hubeny (1990).
Definition at line 736 of file EnergySources.c.
References StellarIrradiation.
Referenced by CalculateQirr(), and CalculateQminus().
Calculates the flux limiter according to Kley (1989)
Definition at line 719 of file EnergySources.c.
Referenced by DiffusionCoefs().
void ImplicitRadiativeDiffusion | ( | PolarGrid * | Rho, |
PolarGrid * | EnergyInt, | ||
PolarGrid * | EnergyNew, | ||
real | dt | ||
) |
The main numerical solver of the energy equation.
Definition at line 202 of file EnergySources.c.
References AccretHeating, ADIABIND, CalculateFlaring(), CalculateQirr(), CalculateQminus(), ComputeSoundSpeed(), ComputeTemperatureField(), CPU_Number, CPU_Rank, CPUOVERLAP, CV, DiffusionCoefs(), DivergenceVelocity, domega, polargrid::Field, heatsrc, heatsrc_index, heatsrc_max, InvDiffRmed, InvDiffRsup, IterateRelaxationParameter(), MaxMO_or_active, MidplaneVolumeDensity(), Niterbest, NO, omegabest, OmegaInv, One_or_active, OpacityProfile(), PI, Qminus, Qplus, Rinf, Rmed, SoundSpeed, SQRT_ADIABIND_INV, StellarIrradiation, SuccessiveOverrelaxation(), SynchronizeOverlapFields(), Temperature, and YES.
Referenced by SubStep3().
void InitRadiatDiffusionFields | ( | ) |
Initialises the polar arrays associated with the heating/cooling processes.
Definition at line 46 of file EnergySources.c.
References ADIABIND, CreatePolarGrid(), CV, GASCONST, MOLWEIGHT, NRAD, NSEC, Qbalance, Qminus, and Write_Qbalance.
Referenced by InitEuler().
void IterateRelaxationParameter | ( | ) |
When solving the energy equation for the first time, the function spans through various values of the SOR parameter in order to find its best value to start with.
Definition at line 338 of file EnergySources.c.
References domega, polargrid::Field, masterprint(), Niterbest, NO, polargrid::Nrad, polargrid::Nsec, omegabest, prs_exit(), SORMAXITERS, SuccessiveOverrelaxation(), Temperature, and YES.
Referenced by ImplicitRadiativeDiffusion().
void MidplaneVolumeDensity | ( | PolarGrid * | Rho | ) |
Translates the surface density into the midplane volume density using the local pressure scale height.
Definition at line 629 of file EnergySources.c.
References polargrid::Field, polargrid::Nrad, OmegaInv, SoundSpeed, SQRT2PI_INV, and SQRT_ADIABIND_INV.
Referenced by ImplicitRadiativeDiffusion().
void OpacityProfile | ( | ) |
Fills the opacity polar grid, either with a fixed parametric value or using the Bell & Lin (1994) opacity table.
Definition at line 656 of file EnergySources.c.
References a, b, polargrid::Field, kappa0, NO, polargrid::Nrad, polargrid::Nsec, OPA2CU, PARAMETRICOPACITY, RHO2CGS, T2SI, Temperature, and YES.
Referenced by ImplicitRadiativeDiffusion().
The SOR method algorithm inspired by the one from Numerical Recipes.
Definition at line 396 of file EnergySources.c.
References ChessBoardIndexing(), CPU_Number, polargrid::Field, jchess1st, jchess2nd, masterprint(), MaxMO_or_active, MPI_Allreduce(), MPI_COMM_WORLD, MPI_DOUBLE, MPI_SUM, NO, polargrid::Nrad, polargrid::Nsec, One_or_active, prs_exit(), SOREPS, SORMAXITERS, SynchronizeOverlapFields(), Temperature, and YES.
Referenced by ImplicitRadiativeDiffusion(), and IterateRelaxationParameter().
void SynchronizeOverlapFields | ( | real * | field, |
int | nr, | ||
int | nsync | ||
) |
For a MPI-split grid, synchronizes the values in a requested number 'nsync' of the overlapping radial rings.
Definition at line 751 of file EnergySources.c.
References CPU_Number, CPU_Rank, CPUOVERLAP, fargostat, MPI_COMM_WORLD, MPI_DOUBLE, MPI_Irecv(), MPI_Isend(), MPI_Wait(), NO, NSEC, prs_exit(), and YES.
Referenced by ImplicitRadiativeDiffusion(), SuccessiveOverrelaxation(), and SynchronizePebbleDisc().
void TemperatureGradient | ( | ) |
Finds the temperature gradients and their magnitude over the mesh.
Definition at line 580 of file EnergySources.c.
References polargrid::Field, InvDiffRmed, polargrid::Nrad, polargrid::Nsec, PI, Rmed, and Temperature.
Referenced by DiffusionCoefs().
|
static |
Definition at line 27 of file EnergySources.c.
Referenced by CreateTorqueMapInfile(), FindOrbitalElements(), max2(), min2(), OpacityProfile(), SetupReboundSimulation(), and Trapzd().
|
static |
Definition at line 28 of file EnergySources.c.
Referenced by CreateTorqueMapInfile(), max2(), min2(), and OpacityProfile().
|
static |
Definition at line 39 of file EnergySources.c.
Referenced by ImplicitRadiativeDiffusion(), and InitRadiatDiffusionFields().
|
static |
Definition at line 31 of file EnergySources.c.
|
static |
Definition at line 31 of file EnergySources.c.
|
static |
Definition at line 31 of file EnergySources.c.
|
static |
Definition at line 35 of file EnergySources.c.
|
static |
Definition at line 35 of file EnergySources.c.
|
static |
Definition at line 40 of file EnergySources.c.
Referenced by AlgoGas(), ImplicitRadiativeDiffusion(), and IterateRelaxationParameter().
|
static |
Definition at line 33 of file EnergySources.c.
|
static |
Definition at line 30 of file EnergySources.c.
|
static |
Definition at line 30 of file EnergySources.c.
|
static |
Definition at line 30 of file EnergySources.c.
|
static |
Definition at line 42 of file EnergySources.c.
Referenced by ChessBoardIndexing(), and SuccessiveOverrelaxation().
|
static |
Definition at line 42 of file EnergySources.c.
Referenced by ChessBoardIndexing(), and SuccessiveOverrelaxation().
|
static |
Definition at line 26 of file EnergySources.c.
Referenced by CreateTorqueMapInfile(), and OpacityProfile().
|
static |
Definition at line 36 of file EnergySources.c.
|
static |
Definition at line 36 of file EnergySources.c.
|
static |
Definition at line 36 of file EnergySources.c.
|
static |
Definition at line 37 of file EnergySources.c.
|
static |
Definition at line 37 of file EnergySources.c.
|
static |
Definition at line 41 of file EnergySources.c.
Referenced by ImplicitRadiativeDiffusion(), and IterateRelaxationParameter().
|
static |
Definition at line 40 of file EnergySources.c.
Referenced by ImplicitRadiativeDiffusion(), and IterateRelaxationParameter().
|
static |
Definition at line 32 of file EnergySources.c.
Referenced by CreateTorqueMapInfile().
|
static |
Definition at line 33 of file EnergySources.c.
|
static |
Definition at line 37 of file EnergySources.c.
|
static |
Definition at line 32 of file EnergySources.c.