-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathparams.f90
106 lines (79 loc) · 3.24 KB
/
params.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
!=============================================================================
! params module
!
! The params module is responsible for reading in runtime parameters
! and providing them to any routines that need them.
!=============================================================================
module params_module
use datatypes_module
implicit none
!---------------------------------------------------------------------------
! declare runtime parameters with SAVE attribute and default values
!---------------------------------------------------------------------------
! grid parameters
integer, save :: nx = 16
real (kind=dp_t), save :: xmin = 0.0_dp_t
real (kind=dp_t), save :: xmax = 1.0_dp_t
! geometry
logical, save :: is_spherical = .false.
character (len=32), save :: xlboundary = "outflow"
character (len=32), save :: xrboundary = "outflow"
character (len=32), save :: hse_bc_const = "temperature"
character (len=32), save :: hse_vel_type = "reflect"
! timestep parameters
real (kind=dp_t), save :: init_shrink = 1.0_dp_t
real (kind=dp_t), save :: dt_change = 1.2_dp_t
real (kind=dp_t), save :: tmax = 1.0_dp_t
real (kind=dp_t), save :: cfl = 0.8_dp_t
real (kind=dp_t), save :: fixed_dt = -1.0_dp_t
! eos parameters
real (kind=dp_t), save :: gamma = 1.4_dp_t
! hydro parameters
integer, save :: godunov_type = 2
logical, save :: ppm_temp = .false.
real (kind=dp_t), save :: cvisc = 0.0_dp_t
logical, save :: do_flattening = .true.
! gravity
logical, save :: do_gravity = .false.
integer, save :: gravity_monopole = 0
real (kind=dp_t), save :: grav = 0.0_dp_t
! problem-specific parameters
character (len=32), save :: problem_name = "sod"
! output parameters
logical, save :: write_ghost = .false.
real (kind=dp_t), save :: plot_dt = -1.0_dp_t
! namelist
namelist /params/ nx, xmin, xmax, is_spherical, &
xlboundary, xrboundary, &
hse_bc_const, hse_vel_type, &
init_shrink, dt_change, fixed_dt, tmax, &
cfl, cvisc, do_flattening, &
gamma, &
godunov_type, &
ppm_temp, &
do_gravity, grav, gravity_monopole, &
problem_name, &
write_ghost, &
plot_dt
character (len=32), save :: infile = ""
contains
!===========================================================================
! init_params
!===========================================================================
subroutine init_params()
integer :: lun
! read in the inputs file, if any -- we assume that the only command
! line argument is the inputs file name
if (command_argument_count() == 0) then
print *, 'no inputs file specified -- using parameter defaults'
else if (command_argument_count() > 1) then
print *, 'ERROR: only one command line argument allowed'
else
call get_command_argument(1, infile)
print *, 'reading parameters from ', trim(infile)
open(newunit=lun, file=trim(infile), status="old", action="read")
read(unit=lun, nml=params)
close(unit=lun)
endif
end subroutine init_params
end module params_module