Skip to content

Commit 929a2fc

Browse files
committed
add core changes to probe gen
1 parent 37560f1 commit 929a2fc

File tree

5 files changed

+63
-18
lines changed

5 files changed

+63
-18
lines changed

src/post_process/m_data_output.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ contains
725725
726726
if (p > 0) then
727727
err = DBMKOPTLIST(2, optlist)
728-
err = DBADDIOPT(optlist, DBOPT_LO_OFFSET, lo_offset)
729-
err = DBADDIOPT(optlist, DBOPT_HI_OFFSET, hi_offset)
728+
err = DBADDIAOPT(optlist, DBOPT_LO_OFFSET, 3, lo_offset)
729+
err = DBADDIAOPT(optlist, DBOPT_HI_OFFSET, 3, hi_offset)
730730
if (grid_geometry == 3) then
731731
err = DBPUTQM(dbfile, 'rectilinear_grid', 16, &
732732
'x', 1, 'y', 1, 'z', 1, &
@@ -743,8 +743,8 @@ contains
743743
err = DBFREEOPTLIST(optlist)
744744
elseif (n > 0) then
745745
err = DBMKOPTLIST(2, optlist)
746-
err = DBADDIOPT(optlist, DBOPT_LO_OFFSET, lo_offset)
747-
err = DBADDIOPT(optlist, DBOPT_HI_OFFSET, hi_offset)
746+
err = DBADDIAOPT(optlist, DBOPT_LO_OFFSET, 2, lo_offset)
747+
err = DBADDIAOPT(optlist, DBOPT_HI_OFFSET, 2, hi_offset)
748748
err = DBPUTQM(dbfile, 'rectilinear_grid', 16, &
749749
'x', 1, 'y', 1, 'z', 1, &
750750
x_cb, y_cb, DB_F77NULL, dims, 2, &

src/simulation/m_data_output.fpp

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ contains
363363
write (3, *) ! new line
364364

365365
if (.not. f_approx_equal(icfl_max_glb, icfl_max_glb)) then
366+
print *, 'icfl', icfl_max_glb
366367
call s_mpi_abort('ICFL is NaN. Exiting.')
367368
elseif (icfl_max_glb > 1._wp) then
368369
print *, 'icfl', icfl_max_glb
@@ -1129,6 +1130,8 @@ contains
11291130
real(wp) :: G_local
11301131
real(wp) :: dyn_p, T
11311132
real(wp) :: damage_state
1133+
character(LEN=15) :: FMT_glb
1134+
character(len=30) :: FMT
11321135

11331136
integer :: i, j, k, l, s, d !< Generic loop iterator
11341137

@@ -1145,6 +1148,13 @@ contains
11451148

11461149
T = dflt_T_guess
11471150

1151+
! Set format string based on precision
1152+
if (precision == 1) then
1153+
FMT_glb = 'F28.7'
1154+
else
1155+
FMT_glb = 'F28.16'
1156+
end if
1157+
11481158
! Non-dimensional time calculation
11491159
if (time_stepper == 23) then
11501160
nondim_time = mytime
@@ -1578,28 +1588,35 @@ contains
15781588
R(1), &
15791589
Rdot(1)
15801590
else if (elasticity) then
1581-
write (i + 30, '(6X,F12.6,F24.8,F24.8,F24.8,F24.8,'// &
1582-
'F24.8,F24.8,F24.8)') &
1591+
FMT = '(6X,F12.6,8'//FMT_glb//')'
1592+
write (i + 30, FMT) &
15831593
nondim_time, &
15841594
rho, &
15851595
vel(1), &
15861596
vel(2), &
1597+
vel(3), &
15871598
pres, &
15881599
tau_e(1), &
15891600
tau_e(2), &
15901601
tau_e(3)
15911602
else
1592-
write (i + 30, '(6X,F12.6,F24.8,F24.8,F24.8)') &
1603+
FMT = '(6X,F12.6,11'//FMT_glb//')'
1604+
write (i + 30, FMT) &
15931605
nondim_time, &
15941606
rho, &
15951607
vel(1), &
1596-
pres
1597-
print *, 'time =', nondim_time, 'rho =', rho, 'pres =', pres
1608+
vel(2), &
1609+
vel(3), &
1610+
pres, & ! Out of tolerance
1611+
gamma, &
1612+
pi_inf, &
1613+
qv, &
1614+
c, &
1615+
accel
15981616
end if
15991617
else
1600-
write (i + 30, '(6X,F12.6,F24.8,F24.8,F24.8,F24.8,'// &
1601-
'F24.8,F24.8,F24.8,F24.8,F24.8,'// &
1602-
'F24.8)') &
1618+
FMT = '(6X,F12.6,11'//FMT_glb//')'
1619+
write (i + 30, FMT) &
16031620
nondim_time, &
16041621
rho, &
16051622
vel(1), &
@@ -1608,9 +1625,7 @@ contains
16081625
pres, &
16091626
gamma, &
16101627
pi_inf, &
1611-
qv, &
1612-
c, &
1613-
accel
1628+
qv
16141629
end if
16151630
end if
16161631
end do

src/simulation/m_derived_variables.fpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ contains
168168
$:GPU_UPDATE(host='[accel_mag]')
169169

170170
call s_derive_center_of_mass(q_prim_ts2(2)%vf, c_mass)
171-
172171
call s_write_probe_files(t_step, q_cons_ts(1)%vf, accel_mag)
173-
174172
call s_write_com_files(t_step, c_mass)
175173
end if
176174

toolchain/mfc/packer/pack.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ def _extract_doubles(s: str) -> list:
136136
lines = content.splitlines()
137137
content = "\n".join(lines[1:]) # Skip the first line
138138
doubles = _extract_doubles(content)
139+
elif 'probe' in short_filepath:
140+
# Probes are constructed as <time> <value1> <value2> ...
141+
# Just discard the first column
142+
doubles = [float(e) for line in content.strip().splitlines() if line.strip() for e in _extract_doubles(line)[1:]]
139143
else:
140144
# Every line is <x> <y> <z> <value> (<y> and <z> are optional). So the
141145
# number of dimensions is the number of doubles in the first line minus 1.

toolchain/mfc/test/case.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,36 @@ def create_directory(self):
230230
mods['omega_wrt(2)'] = 'T'
231231
mods['omega_wrt(3)'] = 'T'
232232
else:
233-
mods['parallel_io'] = 'F'
233+
mods['parallel_io'] = 'F'
234234
mods['prim_vars_wrt'] = 'F'
235+
if ('fd_order' not in case) and ('fd_order' not in mods):
236+
mods['fd_order'] = 1
237+
if ('probe_wrt' not in case):
238+
mods['probe_wrt'] = 'T'
239+
if case['n'] == 0:
240+
mods['num_probes'] = 2
241+
dx = (case['x_domain%end'] - case['x_domain%beg']) / 3
242+
for i in range(2):
243+
mods[f'probe({{i+1}})%x'] = case['x_domain%beg'] + (i+1) * dx
244+
elif case['p'] == 0:
245+
mods['num_probes'] = 4
246+
dx = (case['x_domain%end'] - case['x_domain%beg']) / 3
247+
dy = (case['y_domain%end'] - case['y_domain%beg']) / 3
248+
for i in range(2):
249+
for j in range(2):
250+
mods[f'probe({{i*2+j+1}})%x'] = case['x_domain%beg'] + (i+1) * dx
251+
mods[f'probe({{i*2+j+1}})%y'] = case['y_domain%beg'] + (j+1) * dy
252+
else:
253+
mods['num_probes'] = 8
254+
dx = (case['x_domain%end'] - case['x_domain%beg']) / 3
255+
dy = (case['y_domain%end'] - case['y_domain%beg']) / 3
256+
dz = (case['z_domain%end'] - case['z_domain%beg']) / 3
257+
for i in range(2):
258+
for j in range(2):
259+
for k in range(2):
260+
mods[f'probe({{i*4+j*2+k+1}})%x'] = case['x_domain%beg'] + (i+1) * dx
261+
mods[f'probe({{i*4+j*2+k+1}})%y'] = case['y_domain%beg'] + (j+1) * dy
262+
mods[f'probe({{i*4+j*2+k+1}})%z'] = case['z_domain%beg'] + (k+1) * dz
235263
236264
print(json.dumps({{**case, **mods}}))
237265
""")

0 commit comments

Comments
 (0)