@@ -1356,12 +1356,7 @@ contains
13561356 integer, dimension(num_procs) :: meshtypes
13571357 integer :: i, ios, file_unit
13581358 integer :: ierr, nBodies
1359- real(wp), dimension(:), allocatable :: px, py, pz
1360- real(wp), dimension(:), allocatable :: force_x, force_y, force_z
1361- real(wp), dimension(:), allocatable :: torque_x, torque_y, torque_z
1362- real(wp), dimension(:), allocatable :: vel_x, vel_y, vel_z
1363- real(wp), dimension(:), allocatable :: omega_x, omega_y, omega_z
1364- real(wp), dimension(:), allocatable :: angle_x, angle_y, angle_z
1359+ type(ib_dynamics_t) :: pos, force, torque, vel, omega, angle
13651360 real(wp), dimension(:), allocatable :: ib_diameter
13661361
13671362 ! Build path to per-timestep IB state file
@@ -1377,12 +1372,12 @@ contains
13771372
13781373 if (nBodies > 0) then
13791374 allocate (ib_data(nBodies, NFIELDS_PER_IB))
1380- allocate (px (nBodies), py (nBodies), pz (nBodies))
1381- allocate (force_x (nBodies), force_y (nBodies), force_z (nBodies))
1382- allocate (torque_x (nBodies), torque_y (nBodies), torque_z (nBodies))
1383- allocate (vel_x (nBodies), vel_y (nBodies), vel_z (nBodies))
1384- allocate (omega_x (nBodies), omega_y (nBodies), omega_z (nBodies))
1385- allocate (angle_x (nBodies), angle_y (nBodies), angle_z (nBodies))
1375+ allocate (pos%x (nBodies), pos%y (nBodies), pos%z (nBodies))
1376+ allocate (force%x (nBodies), force%y (nBodies), force%z (nBodies))
1377+ allocate (torque%x (nBodies), torque%y (nBodies), torque%z (nBodies))
1378+ allocate (vel%x (nBodies), vel%y (nBodies), vel%z (nBodies))
1379+ allocate (omega%x (nBodies), omega%y (nBodies), omega%z (nBodies))
1380+ allocate (angle%x (nBodies), angle%y (nBodies), angle%z (nBodies))
13861381 allocate (ib_diameter(nBodies))
13871382
13881383 if (proc_rank == 0) then
@@ -1401,12 +1396,12 @@ contains
14011396 call MPI_BCAST(ib_data, nBodies*NFIELDS_PER_IB, mpi_p, 0, MPI_COMM_WORLD, ierr)
14021397
14031398 do i = 1, nBodies
1404- force_x (i) = ib_data(i, 2); force_y (i) = ib_data(i, 3); force_z (i) = ib_data(i, 4)
1405- torque_x (i) = ib_data(i, 5); torque_y (i) = ib_data(i, 6); torque_z (i) = ib_data(i, 7)
1406- vel_x (i) = ib_data(i, 8); vel_y (i) = ib_data(i, 9); vel_z (i) = ib_data(i, 10)
1407- omega_x (i) = ib_data(i, 11); omega_y (i) = ib_data(i, 12); omega_z (i) = ib_data(i, 13)
1408- angle_x (i) = ib_data(i, 14); angle_y (i) = ib_data(i, 15); angle_z (i) = ib_data(i, 16)
1409- px (i) = ib_data(i, 17); py (i) = ib_data(i, 18); pz (i) = ib_data(i, 19)
1399+ force%x (i) = ib_data(i, 2); force%y (i) = ib_data(i, 3); force%z (i) = ib_data(i, 4)
1400+ torque%x (i) = ib_data(i, 5); torque%y (i) = ib_data(i, 6); torque%z (i) = ib_data(i, 7)
1401+ vel%x (i) = ib_data(i, 8); vel%y (i) = ib_data(i, 9); vel%z (i) = ib_data(i, 10)
1402+ omega%x (i) = ib_data(i, 11); omega%y (i) = ib_data(i, 12); omega%z (i) = ib_data(i, 13)
1403+ angle%x (i) = ib_data(i, 14); angle%y (i) = ib_data(i, 15); angle%z (i) = ib_data(i, 16)
1404+ pos%x (i) = ib_data(i, 17); pos%y (i) = ib_data(i, 18); pos%z (i) = ib_data(i, 19)
14101405 ib_diameter(i) = ib_data(i, 20)*2.0_wp
14111406 end do
14121407
@@ -1419,28 +1414,28 @@ contains
14191414 err = DBPUTMMESH(dbroot, ' ib_bodies' , 16, num_procs, meshnames, len_trim(meshnames), meshtypes, DB_F77NULL, ierr)
14201415 end if
14211416
1422- err = DBPUTPM(dbfile, ' ib_bodies' , 9, 3, px, py, pz , nBodies, DB_DOUBLE, DB_F77NULL, ierr)
1423-
1424- call s_write_ib_variable(' ib_force_x' , t_step, force_x , nBodies)
1425- call s_write_ib_variable(' ib_force_y' , t_step, force_y , nBodies)
1426- call s_write_ib_variable(' ib_force_z' , t_step, force_z , nBodies)
1427- call s_write_ib_variable(' ib_torque_x' , t_step, torque_x , nBodies)
1428- call s_write_ib_variable(' ib_torque_y' , t_step, torque_y , nBodies)
1429- call s_write_ib_variable(' ib_torque_z' , t_step, torque_z , nBodies)
1430- call s_write_ib_variable(' ib_vel_x' , t_step, vel_x , nBodies)
1431- call s_write_ib_variable(' ib_vel_y' , t_step, vel_y , nBodies)
1432- call s_write_ib_variable(' ib_vel_z' , t_step, vel_z , nBodies)
1433- call s_write_ib_variable(' ib_omega_x' , t_step, omega_x , nBodies)
1434- call s_write_ib_variable(' ib_omega_y' , t_step, omega_y , nBodies)
1435- call s_write_ib_variable(' ib_omega_z' , t_step, omega_z , nBodies)
1436- call s_write_ib_variable(' ib_angle_x' , t_step, angle_x , nBodies)
1437- call s_write_ib_variable(' ib_angle_y' , t_step, angle_y , nBodies)
1438- call s_write_ib_variable(' ib_angle_z' , t_step, angle_z , nBodies)
1417+ err = DBPUTPM(dbfile, ' ib_bodies' , 9, 3, pos%x, pos%y, pos%z , nBodies, DB_DOUBLE, DB_F77NULL, ierr)
1418+
1419+ call s_write_ib_variable(' ib_force_x' , t_step, force%x , nBodies)
1420+ call s_write_ib_variable(' ib_force_y' , t_step, force%y , nBodies)
1421+ call s_write_ib_variable(' ib_force_z' , t_step, force%z , nBodies)
1422+ call s_write_ib_variable(' ib_torque_x' , t_step, torque%x , nBodies)
1423+ call s_write_ib_variable(' ib_torque_y' , t_step, torque%y , nBodies)
1424+ call s_write_ib_variable(' ib_torque_z' , t_step, torque%z , nBodies)
1425+ call s_write_ib_variable(' ib_vel_x' , t_step, vel%x , nBodies)
1426+ call s_write_ib_variable(' ib_vel_y' , t_step, vel%y , nBodies)
1427+ call s_write_ib_variable(' ib_vel_z' , t_step, vel%z , nBodies)
1428+ call s_write_ib_variable(' ib_omega_x' , t_step, omega%x , nBodies)
1429+ call s_write_ib_variable(' ib_omega_y' , t_step, omega%y , nBodies)
1430+ call s_write_ib_variable(' ib_omega_z' , t_step, omega%z , nBodies)
1431+ call s_write_ib_variable(' ib_angle_x' , t_step, angle%x , nBodies)
1432+ call s_write_ib_variable(' ib_angle_y' , t_step, angle%y , nBodies)
1433+ call s_write_ib_variable(' ib_angle_z' , t_step, angle%z , nBodies)
14391434 call s_write_ib_variable(' ib_diameter' , t_step, ib_diameter, nBodies)
14401435
1441- deallocate (ib_data, px, py, pz, force_x, force_y, force_z )
1442- deallocate (torque_x, torque_y, torque_z, vel_x, vel_y, vel_z )
1443- deallocate (omega_x, omega_y, omega_z, angle_x, angle_y, angle_z )
1436+ deallocate (ib_data, pos%x, pos%y, pos%z, force%x, force%y, force%z )
1437+ deallocate (torque%x, torque%y, torque%z, vel%x, vel%y, vel%z )
1438+ deallocate (omega%x, omega%y, omega%z, angle%x, angle%y, angle%z )
14441439 deallocate (ib_diameter)
14451440 end if
14461441#endif
0 commit comments