-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathgemini_init.f90
More file actions
168 lines (130 loc) · 4.77 KB
/
Copy pathgemini_init.f90
File metadata and controls
168 lines (130 loc) · 4.77 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
module gemini_init
use gemini3d_config, only : gemini_cfg
use mpimod, only : mpi_cfg
use filesystem, only : assert_is_file, assert_is_dir
implicit none (type, external)
private
public :: find_config, check_input_files
contains
subroutine find_config(cfg)
type(gemini_cfg), intent(inout) :: cfg
logical :: exists
integer :: i
character(*), parameter :: locs(2) = [character(18) :: "/inputs/config.nml", "/config.nml"]
character(:), allocatable :: loc
do i = 1, size(locs)
loc = trim(cfg%outdir // locs(i))
inquire(file=loc, exist=exists)
if (exists) then
cfg%infile = loc
return
endif
end do
error stop 'GEMINI3D: could not find configuration file (config.nml) in ' // cfg%outdir
end subroutine find_config
subroutine check_input_files(cfg)
type(gemini_cfg), intent(in) :: cfg
!> PRINT SOME DIAGNOSIC INFO FROM ROOT
if (mpi_cfg%myid==0) then
call assert_is_file(cfg%indatsize)
call assert_is_file(cfg%indatgrid)
call assert_is_file(cfg%indatfile)
print *, '******************** input config ****************'
print '(A)', 'simulation directory: ' // cfg%outdir
print '(A51,I6,A1,I0.2,A1,I0.2)', ' start year-month-day: ', cfg%ymd0(1), '-', cfg%ymd0(2),'-', cfg%ymd0(3)
print '(A51,F10.3)', 'start time: ',cfg%UTsec0
print '(A51,F10.3)', 'duration: ',cfg%tdur
print '(A51,F10.3)', 'output every: ',cfg%dtout
print '(A,/,A,/,A,/,A)', 'gemini.f90: using input data files:', cfg%indatsize, cfg%indatgrid, cfg%indatfile
if(cfg%flagdneu==1) then
if (.not. (cfg%interptype==5 .or. cfg%interptype==6)) call assert_is_dir(cfg%sourcedir)
print *, 'Neutral disturbance mlat,mlon: ',cfg%sourcemlat,cfg%sourcemlon
print *, 'Neutral disturbance cadence (s): ',cfg%dtneu
print *, 'Neutral grid resolution (m): ',cfg%drhon,cfg%dzn
print *, 'Neutral disturbance data files located in directory: ',cfg%sourcedir
else
print *, "no neutral disturbance specified."
end if
if (cfg%flagprecfile==1) then
call assert_is_dir(cfg%precdir)
print '(A,F10.3)', 'Precipitation file input cadence (s): ',cfg%dtprec
print *, 'Precipitation file input source directory: ' // cfg%precdir
else
print *, "no precipitation specified"
end if
if(cfg%flagE0file==1) then
call assert_is_dir(cfg%E0dir)
print *, 'Electric field file input cadence (s): ',cfg%dtE0
print *, 'Electric field file input source directory: ' // cfg%E0dir
else
print *, "no Efield specified"
end if
if(cfg%flagsolfluxfile==1) then
call assert_is_dir(cfg%solfluxdir)
print *, 'Solar flux file input cadence (s): ',cfg%dtsolflux
print *, 'Solar flux file input source directory: ' // cfg%solfluxdir
else
print *, "no solar flux specified"
end if
if (cfg%flagglow==1) then
print *, 'GLOW enabled for auroral emission calculations.'
print *, 'GLOW electron transport calculation cadence (s): ', cfg%dtglow
print *, 'GLOW auroral emission output cadence (s): ', cfg%dtglowout
else
print *, "GLOW disabled"
end if
if (cfg%msis_version > 0) then
print '(A,f3.1,A)', 'MSIS ', real(cfg%msis_version)/10, ' enabled for neutral atmosphere calculations.'
else
print '(A)', "MSISE00 enabled for neutral atmosphere calculations."
end if
if (cfg%flagneuBG) then
print*, 'Neutral background updated at: ',cfg%dtneuBG
end if
if (cfg%flagEIA) then
print*, 'EIA enables with peok equatorial drift: ',cfg%v0equator
else
print*, 'EIA disabled'
end if
if (cfg%flagneuBG) then
print*, 'Variable background neutral atmosphere enabled at cadence: ',cfg%dtneuBG
else
print*, 'Variable background neutral atmosphere disabled.'
end if
print*, 'Background precipitation has total energy flux and energy: ',cfg%PhiWBG,cfg%W0BG
if (cfg%flagJpar) then
print*, 'Parallel current calculation enabled.'
else
print*, 'Parallel current calculation disabled.'
end if
print*, 'Inertial capacitance calculation type: ',cfg%flagcap
print*, 'Diffusion solve type: ',cfg%diffsolvetype
if (cfg%mcadence > 0) then
print*, 'Milestone output selected; cadence (every nth output) of: ',cfg%mcadence
else
print*, 'Milestone output disabled.'
end if
if (cfg%flaggravdrift) then
print*, 'Gravitational drift terms enabled.'
else
print*, 'Gravitaional drift terms disabled.'
end if
if (cfg%flagtwoway) then
print*, 'Two-way coupling enabled.'
else
print*, 'Two-way coupling disabled.'
end if
if (cfg%flaglagrangian) then
print*, 'Lagrangian grid enabled.'
else
print*, 'Lagrangian grid disabled'
end if
if (cfg%flagmagpole) then
print*, 'Using year-based magnetic pole.'
else
print*, 'Using default magnetic pole.'
end if
print *, '**************** end input config ***************'
end if
end subroutine check_input_files
end module gemini_init