mod_global_variables Module

All global variables are defined in this module, and can be accessed throughout the entire code. Most variables are first initialised to a default value, and are properly set either in the parfile or in an equilibrium submodule.



Contents


Variables

TypeVisibilityAttributesNameInitial
integer, public, parameter:: sp =real32

single-precision value

integer, public, parameter:: dp =real64

double-precision value

integer, public, parameter:: qp =real128

quadruple-precision value

integer, public, parameter:: str_len =125

default length for strings

integer, public, parameter:: str_len_arr =16

default length for strings in arrays

real(kind=dp), public, parameter:: dp_LIMIT =5.0d-15

values smaller than this are forced to zero, bit higher than machine precision

real(kind=dp), protected :: NaN

NaN value (ieee_quiet_nan)

complex(kind=dp), public, parameter:: ic =(0.0d0, 1.0d0)

complex number i

complex(kind=dp), public, parameter:: ir =(1.0d0, 0.0d0)

complex real

logical, public, save:: cgs_units

boolean for cgs units, defaults to True

real(kind=dp), protected :: gamma

ratio of specific heats gamma, defaults to 5/3

real(kind=dp), protected :: gamma_1

variable for (gamma - 1)

logical, public, save:: incompressible

boolean for incompressible approximation, defaults to False

logical, public, save:: flow

boolean for flow, defaults to False

logical, public, save:: radiative_cooling

boolean for radiative cooling, defaults to False

integer, public :: ncool

number of points to interpolate the radiative cooling curve, defaults to 4000

character(len=str_len), public :: cooling_curve

name of the cooling curve to use, defaults to \p jc_corona

logical, public, save:: external_gravity

boolean for external gravity, defaults to False

logical, public, save:: thermal_conduction

boolean for thermal conduction, defaults to False

logical, public, save:: use_fixed_tc_para

boolean to set a fixed value for parallel conduction, defaults to False

real(kind=dp), public :: fixed_tc_para_value

defines the fixed value for parallel conduction, defaults to 0

logical, public, save:: use_fixed_tc_perp

boolean to set a fixed value for perpendicular conduction, defaults to False

real(kind=dp), public :: fixed_tc_perp_value

defines the fixed value for perpendicular conduction, defaults to 0

logical, public, save:: resistivity

boolean for resistivity, defaults to False

logical, public, save:: use_fixed_resistivity

boolean to set a fixed value for the resistivity, defaults to False

real(kind=dp), public :: fixed_eta_value

defines the fixed value for the resistivity, defaults to 0

logical, public, save:: use_eta_dropoff

boolean for a resistivity profile that goes to zero on edges, defaults to False

real(kind=dp), public :: dropoff_edge_dist

distance between the grid edge and start of dropoff, defaults to 0.05

real(kind=dp), public :: dropoff_width

width of the dropoff region, defaults to 0.1

logical, public, save:: viscosity

boolean for viscosity, defaults to False

logical, public, save:: viscous_heating

boolean to include viscous heating, defaults to False

real(kind=dp), public :: viscosity_value

defines the fixed value for the dynamic viscosity, defaults to 0

logical, public, save:: hall_mhd

boolean to use Hall MHD, defaults to False

logical, public, save:: hall_substitution

boolean to use substitution for Hall elements (as presented in the paper), defaults to True

logical, public, save:: hall_dropoff

boolean to use dropoff profile for Hall parameter, defaults to False

logical, public, save:: elec_inertia

boolean to use electron inertia in Ohm's law, defaults to False

logical, public, save:: inertia_dropoff

boolean to use dropoff profile for inertia parameter, defaults to False

real(kind=dp), public :: electron_fraction

fraction of number of electrons to number of all particles (between 0 and 1), defaults to 0.5

character(len=str_len), public :: geometry

defines the geometry of the problem, defaults depend on chosen equilibrium

logical, public, save:: coaxial

defines the presence of a coaxial inner boundary for a cylindrical geometry, defaults to False

real(kind=dp), public :: x_start

start value of the base grid, defaults depend on chosen equilibrium

real(kind=dp), public :: x_end

end value of the base grid, defaults depend on chosen equilibrium

integer, protected :: gridpts

number of gridpoints in the base grid, defaults to 31

logical, public, save:: force_r0

boolean to force r=0 in cylindrical geometry, defaults to False

integer, protected :: gauss_gridpts

number of gridpoints in the gaussian grid, automatically set by \p gridpts

integer, protected :: ef_gridpts

size of a single eigenfunction array, automatically set by \p gridpts

character(len=str_len_arr), protected, allocatable:: state_vector(:)

array containing the current state vector

integer, public, parameter:: n_gauss =4

number of Gaussian nodes

real(kind=dp), public, dimension(n_gauss):: gaussian_nodes =(/-0.861136311594053, -0.339981043584856, 0.339981043584856, 0.861136311594053/)

values for the Gaussian nodes in [-1, 1]

real(kind=dp), public, dimension(n_gauss):: gaussian_weights =(/0.347854845137454, 0.652145154862546, 0.652145154862546, 0.347854845137454/)

weights for the Gaussian nodes in [-1, 1]

character(len=str_len), public :: equilibrium_type

name of the equilibrium to set up, determines the submodule, defaults to \p "adiabatic_homo"

character(len=str_len), public :: boundary_type

type of boundary conditions, defaults to \p "wall"

logical, public, save:: use_defaults

use default values for parameters in the chosen submodule, defaults to True

logical, public, save:: remove_spurious_eigenvalues

boolean for spurious eigenvalue removal, defaults to False

integer, public :: nb_spurious_eigenvalues

amount of eigenvalues to remove on each side of the imaginary axis, defaults to 1

integer, protected :: nb_eqs

total number of equations

integer, protected :: dim_integralblock

dimension of one finite element integral block, e.g. A(1, 2)

integer, protected :: dim_subblock

dimension of one subblock, 4 of these define a quadblock

integer, protected :: dim_quadblock

dimension of one quadblock, this is the block shifted along the main diagonal

integer, protected :: dim_matrix

size of the A and B matrices

logical, public, save:: write_matrices

boolean to write both matrices to the datfile, defaults to False

logical, public, save:: write_eigenvectors

boolean to write the eigenvectors to the datfile, defaults to False

logical, public, save:: write_residuals

boolean to write the residuals to the datfile, defaults to True

logical, public, save:: write_eigenfunctions

boolean to write the eigenfunctions to the datfile, defaults to True

logical, public, save:: write_derived_eigenfunctions

boolean to write postprocessed quantities to the datfile, defaults to True

logical, public, save:: write_eigenfunction_subset

boolean to select subset of the eigenfunctions to save, defaults to False

complex(kind=dp), public :: eigenfunction_subset_center

point used as the center for the eigenfunction subset

real(kind=dp), public :: eigenfunction_subset_radius

radius used to determine eigenfunction subset

logical, public, save:: show_results

boolean to call the Python wrapper and plot the results, defaults to True

character(len=str_len), public :: basename_datfile

base name for the datfile, defaults to \p "datfile"

character(len=str_len), public :: basename_logfile

base name for the logfile, defaults to ""

character(len=3), public :: output_folder

path to the output folder, defaults to "."

integer, public :: logging_level

sets the logging level, defaults to 2 (errors, warnings and info)

logical, public, save:: dry_run

boolean for doing a dry run, defaults to False

character(len=str_len), public :: solver

method to solve the eigenvalue problem, defaults to "QR-invert"

character(len=str_len), public :: arpack_mode

selected mode for ARPACK, defaults to "standard"

integer, public :: number_of_eigenvalues

number of eigenvalues to calculate with ARPACK, defaults to 100

character(len=2), public :: which_eigenvalues

which eigenvalues to calculate, defaults to "LM" (largest magnitude)

integer, public :: maxiter

maximum number iterations of Arnoldi or inverse iteration

complex(kind=dp), public :: sigma

sigma value, used in Arnoldi shift-invert mode and inverse iteration

integer, public :: ncv

value for ncv, only used for Arnoldi

real(kind=dp), public :: tolerance

the tolerance used by inverse-iteration, defaults to dp_LIMIT


Functions

public function should_compute_eigenvectors()

See if any output options require us to compute the eigenvectors

Arguments

None

Return Value logical

the result


Subroutines

public subroutine initialise_globals()

Initialises the global variables in this module. All variables in this module are first set to their default values. These are either regular values or NaN, the latter in case variables must be explicitly set in the parfile or equilibrium submodule.

Read more…

Arguments

None

public subroutine set_gamma(gamma_in)

Sets the ratio of specific heats gamma and its corresponding value gamma - 1.

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(in) :: gamma_in

the value for gamma

public subroutine set_gridpts(points)

Sets all gridpoint-related variables: sets the base number of gridpoints, the gridpoints of the Gaussian grid, matrix sizes and size of the eigenfunction arrays.

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: points

amount of gridpoints for the base grid

public subroutine set_matrix_properties(points)

Sets dimensions for matrix A and B, subblock sizes and state vector

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: points

gridpoints for the base grid