Reads in the dist_fn_species_knobs namelist and populates the member variables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dist_fn_species_config_type), | intent(inout) | :: | self |
subroutine read_dist_fn_species_config(self)
use file_utils, only: input_unit_exist, get_indexed_namelist_unit
use mp, only: proc0
implicit none
class(dist_fn_species_config_type), intent(in out) :: self
logical :: exist
integer :: in_file
! Note: When this routine is in the module where these variables live
! we shadow the module level variables here. This is intentional to provide
! isolation and ensure we can move this routine to another module easily.
real :: bakdif, fexpi, fexpr
namelist /dist_fn_species_knobs/ bakdif, fexpi, fexpr
! Only proc0 reads from file
if (.not. proc0) return
! First set local variables from current values
bakdif = self%bakdif
fexpi = self%fexpi
fexpr = self%fexpr
! Now read in the main namelist
call get_indexed_namelist_unit(in_file, trim(self%get_name()), self%index, exist)
if (exist) read(in_file, nml = dist_fn_species_knobs)
close(unit = in_file)
! Now copy from local variables into type members
self%bakdif = bakdif
self%fexpi = fexpi
self%fexpr = fexpr
self%exist = exist
end subroutine read_dist_fn_species_config