22 character(len=*),
intent(in) :: context_name
23 integer,
intent(in),
optional :: repetition
24 integer,
intent(in),
optional :: id
27 character(len=255) :: dump_filename
28 character(len=255) :: output_folder
29 logical :: should_write, file_exists
30 integer :: iter_value_to_use, i
33 json_pretty_print = .true.
36 iter_value_to_use = id
38 iter_value_to_use =
iter2
42 should_write = .false.
50 if (trim(context_name) .eq.
"add_fluxes")
then
52 else if (trim(context_name) .eq.
"metric")
then
54 else if (trim(context_name) .eq.
"volume")
then
56 else if (trim(context_name) .eq.
"bcontrav")
then
58 else if (trim(context_name) .eq.
"bcov")
then
60 else if (trim(context_name) .eq.
"lambda_forces")
then
62 else if (trim(context_name) .eq.
"bcov_full")
then
64 else if (trim(context_name) .eq.
"precondn")
then
66 else if (trim(context_name) .eq.
"forceNorms_tcon")
then
68 else if (trim(context_name) .eq.
"lulv_comb")
then
70 else if (trim(context_name) .eq.
"calc_fbal")
then
72 else if (trim(context_name) .eq.
"evolve")
then
74 else if (trim(context_name) .eq.
"fixaray")
then
76 else if (trim(context_name) .eq.
"spectral_constraint")
then
78 else if (trim(context_name) .eq.
"forces")
then
80 else if (trim(context_name) .eq.
"totzsp_input")
then
82 else if (trim(context_name) .eq.
"funct3d_geometry")
then
84 else if (trim(context_name) .eq.
"rbsq")
then
86 else if (trim(context_name) .eq.
"constraint_force")
then
88 else if (trim(context_name) .eq.
"guess_axis")
then
90 else if (trim(context_name) .eq.
"interp")
then
92 else if (trim(context_name) .eq.
"jacobian")
then
94 else if (trim(context_name) .eq.
"lamcal")
then
96 else if (trim(context_name) .eq.
"profil1d")
then
98 else if (trim(context_name) .eq.
"profil3d")
then
100 else if (trim(context_name) .eq.
"readin_boundary")
then
102 else if (trim(context_name) .eq.
"fsq")
then
104 else if (trim(context_name) .eq.
"scale_m1")
then
106 else if (trim(context_name) .eq.
"scalfor_out")
then
108 else if (trim(context_name) .eq.
"fsq1")
then
110 else if (trim(context_name) .eq.
"scalfor_R")
then
112 else if (trim(context_name) .eq.
"scalfor_Z")
then
114 else if (trim(context_name) .eq.
"symforce")
then
116 else if (trim(context_name) .eq.
"tomnsps")
then
118 else if (trim(context_name) .eq.
"tomnspa")
then
120 else if (trim(context_name) .eq.
"phys_gc")
then
122 else if (trim(context_name) .eq.
"multigrid_result")
then
127 should_write = .true.
129 else if (trim(context_name) .eq.
"printout")
then
133 else if (trim(context_name) .eq.
"bcovar_fileout")
then
135 else if (trim(context_name) .eq.
"bss")
then
137 else if (trim(context_name) .eq.
"jxbforce_bsub_lowpass")
then
139 else if (trim(context_name) .eq.
"jxbout")
then
141 else if (trim(context_name) .eq.
"mercier")
then
143 else if (trim(context_name) .eq.
"threed1_firstTable")
then
145 else if (trim(context_name) .eq.
"threed1_geomag")
then
147 else if (trim(context_name) .eq.
"threed1_volquant")
then
149 else if (trim(context_name) .eq.
"threed1_axis")
then
151 else if (trim(context_name) .eq.
"threed1_beta")
then
153 else if (trim(context_name) .eq.
"threed1_shafrint")
then
155 else if (trim(context_name) .eq.
"freeb_data")
then
160 else if (trim(context_name) .eq.
"vac1n_vacuum")
then
162 else if (trim(context_name) .eq.
"vac1n_precal")
then
164 else if (trim(context_name) .eq.
"vac1n_surface")
then
166 else if (trim(context_name) .eq.
"vac1n_bextern")
then
168 else if (trim(context_name) .eq.
"vac1n_analyt")
then
170 else if (trim(context_name) .eq.
"vac1n_greenf")
then
172 else if (trim(context_name) .eq.
"vac1n_fourp")
then
174 else if (trim(context_name) .eq.
"vac1n_fouri")
then
176 else if (trim(context_name) .eq.
"vac1n_solver")
then
178 else if (trim(context_name) .eq.
"vac1n_bsqvac")
then
182 else if (trim(context_name) .eq.
"vac2_vacuum")
then
184 else if (trim(context_name) .eq.
"vac2_precal")
then
186 else if (trim(context_name) .eq.
"vac2_surface")
then
188 else if (trim(context_name) .eq.
"vac2_bexmat")
then
190 else if (trim(context_name) .eq.
"vac2_matrix")
then
192 else if (trim(context_name) .eq.
"vac2_foumat_unreg")
then
194 else if (trim(context_name) .eq.
"vac2_analin")
then
196 else if (trim(context_name) .eq.
"vac2_analyt")
then
198 else if (trim(context_name) .eq.
"vac2_foumat")
then
200 else if (trim(context_name) .eq.
"vac2_linsys")
then
202 else if (trim(context_name) .eq.
"vac2_linslv")
then
204 else if (trim(context_name) .eq.
"vac2_bsqvac")
then
210 write(*,*)
"unknown debug output context: '",trim(context_name),
"'"
221 CALL system(
"mkdir -p "//trim(output_folder))
223 if (
present(id))
then
224 if (
present(repetition))
then
225 write(dump_filename, 998) trim(output_folder), &
226 trim(context_name), &
227 ns, id, repetition, &
230 write(dump_filename, 999) trim(output_folder), &
231 trim(context_name), &
235 if (
present(repetition))
then
236 write(dump_filename, 998) trim(output_folder), &
237 trim(context_name), &
241 write(dump_filename, 999) trim(output_folder), &
242 trim(context_name), &
246998
format(a,
'/',a,
'_',i5.5,
'_',i6.6,
'_',i2.2,
'.',a,
'.json')
247999
format(a,
'/',a,
'_',i5.5,
'_',i6.6,
'_01.',a,
'.json')
250 inquire(file=trim(dump_filename), exist=file_exists)
251 if (file_exists)
then
257 stop
"debug output file already exists: '"//trim(dump_filename)//
"'"
260 call open_dbg_out(dump_filename)
logical skip_dbgout_collison
logical function open_dbg_context(context_name, repetition, id)
check if any output is desired for the current iteration check if the given context should be openend...
integer ns
number of flux surfaces
integer iter2
total number of iterations