params_template_m.f90 Source File


Contents

Source Code


Source Code

module params_template_m
    !! Contains all parameters related with template model
    use precision_grillix_m, only : GP, GP_LARGE, GP_NAN
    use technical_constants_m, only : PATHLEN_MAX
    implicit none

    character(len=*), parameter :: default_nml_file = 'template.nml'

    character(len=PATHLEN_MAX), protected :: paths_filename = default_nml_file
    ! Default file to read all path parameters from

    ! Parameters related with filepaths for I/O of template model
    character(len=PATHLEN_MAX), protected :: path_features = default_nml_file
    !! Path where to read the features of the template model from
    character(len=PATHLEN_MAX), protected :: path_tstep = default_nml_file
    !! Path where to read the tstep params of the template model from
    character(len=PATHLEN_MAX), protected :: path_params = default_nml_file
    !! Path where to read the model params of the template model from
    character(len=PATHLEN_MAX), protected :: path_parbnd = default_nml_file
    !! Path where to read the model params of the template model from
    character(len=PATHLEN_MAX), protected :: path_mms = default_nml_file
    !! Path where to read the MMS params of the template model from
    character(len=PATHLEN_MAX), protected :: path_init_select = default_nml_file
    !! Path where to read the initial state selection parameters from
    character(len=PATHLEN_MAX), protected :: path_snapsdir = 'snapsdir_template'
    !! Directory for I/O of snapshot files
    character(len=PATHLEN_MAX), protected :: path_mmsjobout = 'mms_template_job.out'
    !! File for output of MMS diagnostics
    character(len=PATHLEN_MAX), protected :: diagfile_path = 'diagnostics_template.txt'
    !! Output file for diagnostics
    interface
        module subroutine read_params_template_paths(optional_filepath)
            !! Reads parameters related with file paths
            character(len=*), intent(in), optional :: optional_filepath
            !! Filename, where to read path parameters from
        end subroutine

        module subroutine display_params_template_paths()
            !! Prints parameters related with file paths
        end subroutine
    end interface

    ! Parameters related with selection of features for template model
    logical, protected :: mms_on = .false.
    !! If true, code runs with MMS sources and performs MMS diagnostics
    !! MMS = method of manufactured solutions
    logical, protected :: perptransp_on = .true.
    !! If true runs with perpendicular (diffusive) transport model enabled
    logical, protected :: partransp_on = .true.
    !! If true runs with parallel transport model enabled
    logical, protected :: pardiff_on = .true.
    !! If true runs with parallel diffusion terms
    interface
        module subroutine read_params_template_features(optional_filepath)
            !! Reads parameters related with feature selection
            character(len=*), intent(in), optional :: optional_filepath
            !! Filename, where to read feature selection parameters from
        end subroutine

        module subroutine display_params_template_features()
            !! Prints parameters related with feature selection to stdout
        end subroutine
    end interface

    ! Time-stepping related parameters
    real(GP), protected :: dtau = 1.0E-6_GP
    !! Size of timestep
    real(GP), protected :: tau_fin = 1.0E-1_GP
    !! End time of simulation
    real(GP), protected :: tau_snaps = 1.0E-2_GP
    !! Interval for writing snapshots
    real(GP), protected :: tau_diag = GP_LARGE
    !! Interval for performing diagnostics
    real(GP), protected :: tau_perf = 1.0E-2_GP
    !! Interval for writing performance statistics
    character(len=32), protected :: tstep_method = 'Karniadakis'
    !! Timestep method
    integer, protected :: tstep_order = 2
    !! Order of timestep method
    interface
        module subroutine read_params_template_tstep(optional_filepath)
            !! Reads parameters related with timestepping
            character(len=*), intent(in), optional :: optional_filepath
            !! Filename, where to read timestep parameters from
        end subroutine

        module subroutine display_params_template_tstep()
            !! Prints parameters related with timestepping to stdout
        end subroutine
    end interface

    ! Model related parameters
    real(GP), protected :: dperp_coeff_dens = GP_NAN
    !! Perpendicular diffusion coefficent for density
    real(GP), protected :: dperp_coeff_parmom = GP_NAN
    !! Perpendicular diffusion coefficent for parallel momentum
    real(GP), protected :: dperp_coeff_pion = GP_NAN
    !! Perpendicular diffusion coefficent for ion pressure
    real(GP), protected :: dpar_coeff_dens = GP_NAN
    !! Parallel diffusion coefficent for density
    real(GP), protected :: dpar_coeff_parmom = GP_NAN
    !! Parallel diffusion coefficent for parallel momentum
    real(GP), protected :: dpar_coeff_pion = GP_NAN
    !! Parallel diffusion coefficent for ion pressure
    real(GP), protected :: ion_heat_cond_coeff = GP_NAN
    !! Ion heat conduction coefficient

    interface
        module subroutine read_params_template_model(optional_filepath)
            !! Reads parameters related with timestepping
            character(len=*), intent(in), optional :: optional_filepath
            !! Filename, where to read model parameters from
        end subroutine

        module subroutine display_params_template_model()
            !! Prints parameters related with timestepping to stdout
        end subroutine
    end interface

    ! Paramters related with parallel (Sheath) boundaries
    character(len=32), protected :: parbnd_method = 'Taylor'
    !! Method for treatment of parallel boundaries
    !! - 'None': No boundary condition is applied at all (not meant for production runs)
    !! - 'Immersed': Boundaries are applied via immersion technique
    !! - 'Taylor': Boundaries are applied via Taylor expansion method
    character(len=32), protected :: parbnd_type_dens = 'Extrapolate'
    !! Type of boundary condition applied to density
    character(len=32), protected :: parbnd_type_parmom = 'Sonic'
    !! Type of boundary condition applied to parallel momentum
    real(GP), protected :: parbnd_immersed_epsinv = 0.0_GP
    !! Inverse epsilon, controling strength off immersion source
    integer, protected :: parbnd_taylor_order = 2
    !! Order in Taylor expansion method

    interface
        module subroutine read_params_template_parbnd(optional_filepath)
            !! Reads parameters related with parallel boundary conditions
            character(len=*), intent(in), optional :: optional_filepath
            !! Filename, where to read parameters from
        end subroutine

        module subroutine display_params_template_parbnd()
            !! Prints parameters related with parallel boundary conditions
        end subroutine
    end interface

contains

    subroutine read_all_params_template()
        !! Initializes all parameters of template model (except for paths)
        call read_params_template_features(path_features)
        call read_params_template_tstep(path_tstep)
        call read_params_template_model(path_params)
        call read_params_template_parbnd(path_parbnd)
        
        call display_params_template_features()
        call display_params_template_tstep()
        call display_params_template_model()
        call display_params_template_parbnd()

    end subroutine

end module