Skip to content

Commit 6ae701b

Browse files
committed
adds output of IB state (posittion, velocities, angles)
1 parent f1552c1 commit 6ae701b

11 files changed

Lines changed: 54 additions & 37 deletions

File tree

docs/documentation/case.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ To restart the simulation from $k$-th time step, see @ref running "Restarting Ca
615615
| `alpha_wrt(i)` | Logical | Add the volume fraction of fluid $i$ to the database |
616616
| `gamma_wrt` | Logical | Add the specific heat ratio function to the database |
617617
| `heat_ratio_wrt` | Logical | Add the specific heat ratio to the database |
618-
| `ib_force_wrt` | Logical | Write IB force & torque datafile at each time step |
618+
| `ib_state_wrt` | Logical | Write IB state and loads to a datafile at each time step |
619619
| `pi_inf_wrt` | Logical | Add the liquid stiffness function to the database |
620620
| `pres_inf_wrt` | Logical | Add the liquid stiffness to the formatted database |
621621
| `c_wrt` | Logical | Add the sound speed to the database |
@@ -676,7 +676,7 @@ If `file_per_process` is true, then pre_process, simulation, and post_process mu
676676

677677
- `probe_wrt` activates the output of state variables at coordinates specified by `probe(i)%[x;y,z]`.
678678

679-
- `ib_force_wrt` activates the output of data specified by patch_ib(i)%force(:) and patch_ib(i)%torque(:) into a single binary datafile for all IBs at all timesteps. During post_processing, this file is converted into separate force/torque time histories for each IB.
679+
- `ib_state_wrt` activates the output of data specified by patch_ib(i)%force(:) (and torque, vel, angular_vel, angles, [x,y,z]_centroid) into a single binary datafile for all IBs at all timesteps. During post_processing, this file is converted into separate time histories for each IB.
680680

681681
- `output_partial_domain` activates the output of part of the domain specified by `[x,y,z]_output%%beg` and `[x,y,z]_output%%end`.
682682
This is useful for large domains where only a portion of the domain is of interest.

src/post_process/m_data_output.fpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module m_data_output
3030
s_write_variable_to_formatted_database_file, &
3131
s_write_lag_bubbles_results_to_text, &
3232
s_write_lag_bubbles_to_formatted_database_file, &
33-
s_write_ib_force_files, &
33+
s_write_ib_state_files, &
3434
s_write_intf_data_file, &
3535
s_write_energy_data_file, &
3636
s_close_formatted_database_file, &
@@ -1500,17 +1500,19 @@ contains
15001500
15011501
end subroutine s_write_lag_variable_to_formatted_database_file
15021502
1503-
impure subroutine s_write_ib_force_files()
1503+
impure subroutine s_write_ib_state_files()
15041504
15051505
character(len=len_trim(case_dir) + 4*name_len) :: in_file, out_file, file_loc
1506-
integer :: iu_in, ios, i, rec_step, rec_id
1506+
integer :: iu_in, ios, i, rec_id
15071507
integer, allocatable, dimension(:) :: iu_out
15081508
real(wp) :: rec_time
15091509
real(wp), dimension(3) :: rec_force, rec_torque
1510+
real(wp), dimension(3) :: rec_vel, rec_angular_vel
1511+
real(wp), dimension(3) :: rec_angles, rec_centroid
15101512
15111513
file_loc = trim(case_dir)//'/D'
15121514
1513-
in_file = trim(file_loc)//'/ib_force.dat'
1515+
in_file = trim(file_loc)//'/ib_state.dat'
15141516
open (newunit=iu_in, file=trim(in_file), form='unformatted', access='stream', &
15151517
status='old', action='read', iostat=ios)
15161518
if (ios /= 0) then
@@ -1531,16 +1533,24 @@ contains
15311533
deallocate (iu_out)
15321534
return
15331535
end if
1534-
write (iu_out(i), '(A)') 'mytime fx fy fz Tau_x Tau_y Tau_z'
1536+
write (iu_out(i), '(A)') &
1537+
'mytime fx fy fz Tau_x Tau_y Tau_z vx vy vz omega_x omega_y omega_z angle_x angle_y angle_z x_c y_c z_c'
15351538
end do
15361539
15371540
do
1538-
read (iu_in, iostat=ios) rec_step, rec_time, rec_id, rec_force, rec_torque
1539-
if (ios /= 0) exit ! EOF (<0) or read error (>0)
1541+
read (iu_in, iostat=ios) rec_time, rec_id, &
1542+
rec_force, rec_torque, rec_vel, rec_angular_vel, rec_angles, &
1543+
rec_centroid(1), rec_centroid(2), rec_centroid(3)
1544+
if (ios /= 0) exit
1545+
15401546
if (rec_id >= 1 .and. rec_id <= num_ibs) then
1541-
write (iu_out(rec_id), '(7(ES24.16E3,1X))') rec_time, &
1547+
write (iu_out(rec_id), '(19(ES24.16E3,1X))') rec_time, &
15421548
rec_force(1), rec_force(2), rec_force(3), &
1543-
rec_torque(1), rec_torque(2), rec_torque(3)
1549+
rec_torque(1), rec_torque(2), rec_torque(3), &
1550+
rec_vel(1), rec_vel(2), rec_vel(3), &
1551+
rec_angular_vel(1), rec_angular_vel(2), rec_angular_vel(3), &
1552+
rec_angles(1), rec_angles(2), rec_angles(3), &
1553+
rec_centroid(1), rec_centroid(2), rec_centroid(3)
15441554
end if
15451555
end do
15461556
@@ -1550,7 +1560,7 @@ contains
15501560
end do
15511561
deallocate (iu_out)
15521562
1553-
end subroutine s_write_ib_force_files
1563+
end subroutine s_write_ib_state_files
15541564
15551565
!> @brief Extract the volume-fraction interface contour from primitive fields and write the coordinates to the interface data file.
15561566
impure subroutine s_write_intf_data_file(q_prim_vf)

src/post_process/m_global_parameters.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ module m_global_parameters
261261
logical :: schlieren_wrt
262262
logical :: cf_wrt
263263
logical :: ib
264-
logical :: ib_force_wrt
264+
logical :: ib_state_wrt
265265
logical :: chem_wrt_Y(1:num_species)
266266
logical :: chem_wrt_T
267267
logical :: lag_header
@@ -495,7 +495,7 @@ contains
495495
sim_data = .false.
496496
cf_wrt = .false.
497497
ib = .false.
498-
ib_force_wrt = .false.
498+
ib_state_wrt = .false.
499499
lag_txt_wrt = .false.
500500
lag_header = .true.
501501
lag_db_wrt = .false.

src/post_process/m_mpi_proxy.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ contains
101101
& 'adv_n', 'ib', 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', &
102102
& 'surface_tension', 'hyperelasticity', 'bubbles_lagrange', &
103103
& 'output_partial_domain', 'relativity', 'cont_damage', 'bc_io', &
104-
& 'down_sample','fft_wrt', 'hyper_cleaning', 'ib_force_wrt']
104+
& 'down_sample','fft_wrt', 'hyper_cleaning', 'ib_state_wrt']
105105
call MPI_BCAST(${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
106106
#:endfor
107107

src/post_process/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ contains
116116
lag_rad_wrt, lag_rvel_wrt, lag_r0_wrt, lag_rmax_wrt, &
117117
lag_rmin_wrt, lag_dphidt_wrt, lag_pres_wrt, lag_mv_wrt, &
118118
lag_mg_wrt, lag_betaT_wrt, lag_betaC_wrt, &
119-
alpha_rho_e_wrt, ib_force_wrt
119+
alpha_rho_e_wrt, ib_state_wrt
120120

121121
! Inquiring the status of the post_process.inp file
122122
file_loc = 'post_process.inp'

src/post_process/p_main.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ program p_main
9393
end do
9494
! END: Time-Marching Loop
9595

96-
if (proc_rank == 0 .and. ib_force_wrt) then
97-
call s_write_ib_force_files()
96+
if (proc_rank == 0 .and. ib_state_wrt) then
97+
call s_write_ib_state_files()
9898
end if
9999

100100
close (11)

src/simulation/m_data_output.fpp

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ module m_data_output
3737
s_open_run_time_information_file, &
3838
s_open_com_files, &
3939
s_open_probe_files, &
40-
s_open_ib_force_file, &
40+
s_open_ib_state_file, &
4141
s_write_run_time_information, &
4242
s_write_data_files, &
4343
s_write_serial_data_files, &
4444
s_write_parallel_data_files, &
4545
s_write_ib_data_file, &
4646
s_write_com_files, &
4747
s_write_probe_files, &
48-
s_write_ib_force_file, &
48+
s_write_ib_state_file, &
4949
s_close_run_time_information_file, &
5050
s_close_com_files, &
5151
s_close_probe_files, &
52-
s_close_ib_force_file, &
52+
s_close_ib_state_file, &
5353
s_finalize_data_output_module
5454

5555
real(wp), allocatable, dimension(:, :, :) :: icfl_sf !< ICFL stability criterion
@@ -257,17 +257,17 @@ contains
257257

258258
end subroutine s_open_probe_files
259259

260-
impure subroutine s_open_ib_force_file
260+
impure subroutine s_open_ib_state_file
261261
character(LEN=path_len + 2*name_len) :: file_loc
262262

263-
write (file_loc, '(A)') 'ib_force.dat'
263+
write (file_loc, '(A)') 'ib_state.dat'
264264
file_loc = trim(case_dir)//'/D/'//trim(file_loc)
265265
open (92, FILE=trim(file_loc), &
266266
FORM='unformatted', &
267267
ACCESS='stream', &
268268
STATUS='replace', &
269269
POSITION='append')
270-
end subroutine s_open_ib_force_file
270+
end subroutine s_open_ib_state_file
271271

272272
!> The goal of the procedure is to output to the run-time
273273
!! information file the stability criteria extrema in the
@@ -1153,20 +1153,27 @@ contains
11531153

11541154
end subroutine s_write_ib_data_file
11551155

1156-
!> @brief Writes IB force/torque records to D/ib_force.dat on rank 0.
1157-
impure subroutine s_write_ib_force_file(time_step)
1156+
!> @brief Writes IB state records to D/ib_state.dat on rank 0.
1157+
impure subroutine s_write_ib_state_file()
11581158

1159-
integer, intent(in) :: time_step
11601159
if (proc_rank == 0) then
11611160
block
11621161
integer :: i
11631162
do i = 1, num_ibs
1164-
write (92) time_step, mytime, i, patch_ib(i)%force, patch_ib(i)%torque
1163+
write (92) mytime, i, &
1164+
patch_ib(i)%force, &
1165+
patch_ib(i)%torque, &
1166+
patch_ib(i)%vel, &
1167+
patch_ib(i)%angular_vel, &
1168+
patch_ib(i)%angles, &
1169+
patch_ib(i)%x_centroid, &
1170+
patch_ib(i)%y_centroid, &
1171+
patch_ib(i)%z_centroid
11651172
end do
11661173
end block
11671174
end if
11681175

1169-
end subroutine s_write_ib_force_file
1176+
end subroutine s_write_ib_state_file
11701177

11711178
!> This writes a formatted data file where the root processor
11721179
!! can write out the CoM information
@@ -1937,11 +1944,11 @@ contains
19371944

19381945
end subroutine s_close_probe_files
19391946

1940-
impure subroutine s_close_ib_force_file
1947+
impure subroutine s_close_ib_state_file
19411948

19421949
close (92)
19431950

1944-
end subroutine s_close_ib_force_file
1951+
end subroutine s_close_ib_state_file
19451952

19461953
!> The computation of parameters, the allocation of memory,
19471954
!! the association of pointers and/or the execution of any

src/simulation/m_global_parameters.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ module m_global_parameters
396396
!> @{
397397
logical :: ib
398398
integer :: num_ibs
399-
logical :: ib_force_wrt
399+
logical :: ib_state_wrt
400400

401401
type(ib_patch_parameters), dimension(num_patches_max) :: patch_ib
402402
type(vec3_dt), allocatable, dimension(:) :: airfoil_grid_u, airfoil_grid_l
@@ -716,7 +716,7 @@ contains
716716
! Immersed Boundaries
717717
ib = .false.
718718
num_ibs = dflt_int
719-
ib_force_wrt = .false.
719+
ib_state_wrt = .false.
720720
721721
! Bubble modeling
722722
bubbles_euler = .false.

src/simulation/m_mpi_proxy.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ contains
114114
& 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', 'surface_tension', &
115115
& 'shear_stress', 'bulk_stress', 'bubbles_lagrange', &
116116
& 'hyperelasticity', 'down_sample', 'int_comp','fft_wrt', &
117-
& 'hyper_cleaning', 'ib_force_wrt']
117+
& 'hyper_cleaning', 'ib_state_wrt']
118118
call MPI_BCAST(${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
119119
#:endfor
120120

src/simulation/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ contains
144144
x_domain, y_domain, z_domain, &
145145
hypoelasticity, &
146146
ib, num_ibs, patch_ib, &
147-
ib_force_wrt, &
147+
ib_state_wrt, &
148148
fluid_pp, bub_pp, probe_wrt, prim_vars_wrt, &
149149
fd_order, probe, num_probes, t_step_old, &
150150
alt_soundspeed, mixture_err, weno_Re_flux, &

0 commit comments

Comments
 (0)