58 character(len=32) ::
type =
'cheap_dist'
60 character(len=32) :: decay_profile =
'gaussian'
64 real(kind=
rp) :: center(3)
66 real(kind=
rp) :: dims(3) = 1.0_rp
68 real(kind=
rp) :: rot_angle_deg_cw = 0.0_rp
70 real(kind=
rp) :: radius
72 real(kind=
rp) :: stiff_dist
75 real(kind=
rp) :: cutoff_coef
81 character(len=32) :: name =
'body'
84 real(kind=
rp) :: osc_amp(3) = 0.0_rp
85 real(kind=
rp) :: osc_freq(3) = 0.0_rp
87 character(len=32) :: rotation_center_type =
'relative'
88 character(len=32) :: rotation_type
89 real(kind=
rp) :: rot_amp_degree(3) = 0.0_rp
90 real(kind=
rp) :: rot_freq(3) = 0.0_rp
91 real(kind=
rp) :: rot_center(3) = 0.0_rp
95 real(kind=
rp) :: step_control_times(4) = 0.0_rp
96 real(kind=
rp) :: target_rot_angle_deg = 0.0_rp
97 integer :: rotation_axis = 3
99 real(kind=
rp) :: ramp_omega0(3) = 0.0_rp
100 real(kind=
rp) :: ramp_t0(3) = 1.0_rp
102 integer,
allocatable :: zone_indices(:)
109 character(len=32) :: stiffness_type =
'built-in'
110 logical :: if_output_phi = .true.
111 logical :: if_output_stiffness = .false.
114 integer :: nbodies = 0
119 real(kind=
rp) :: vel_trans(3) = 0.0_rp
120 real(kind=
rp) :: vel_ang(3) = 0.0_rp
121 real(kind=
rp) :: center(3) = 0.0_rp
126 real(kind=
rp) :: pos(3) = 0.0_rp
127 real(kind=
rp) :: vel_lag(3, 3) = 0.0_rp
128 real(kind=
rp) :: vel(3) = 0.0_rp
134 real(kind=
rp) :: pos(3) = 0.0_rp
135 real(kind=
rp) :: vel_lag(3, 3) = 0.0_rp
136 integer :: body_id = 0
145 pivot%pos = body_conf%rot_center
146 pivot%vel_lag = 0.0_rp
153 real(kind=
rp),
intent(inout) :: pos(3)
154 real(kind=
rp),
intent(inout) :: vel_lag(3, 3)
155 real(kind=
rp),
intent(in) :: current_vel(3)
157 integer,
intent(in) :: nadv
160 real(kind=
rp) :: ab_coeffs(4), dt_history(10)
163 call rzero(ab_coeffs, 4)
164 dt_history(1) = time%dt
165 dt_history(2) = time%dtlag(1)
166 dt_history(3) = time%dtlag(2)
167 call ab_scheme_obj%compute_coeffs(ab_coeffs, dt_history, nadv)
169 pos(1) = pos(1) + time%dt * ab_coeffs(1) * current_vel(1)
170 pos(2) = pos(2) + time%dt * ab_coeffs(1) * current_vel(2)
171 pos(3) = pos(3) + time%dt * ab_coeffs(1) * current_vel(3)
174 pos(1) = pos(1) + time%dt * ab_coeffs(j) * vel_lag(1, j - 1)
175 pos(2) = pos(2) + time%dt * ab_coeffs(j) * vel_lag(2, j - 1)
176 pos(3) = pos(3) + time%dt * ab_coeffs(j) * vel_lag(3, j - 1)
181 vel_lag(1, j) = vel_lag(1, j - 1)
182 vel_lag(2, j) = vel_lag(2, j - 1)
183 vel_lag(3, j) = vel_lag(3, j - 1)
187 vel_lag(1, 1) = current_vel(1)
188 vel_lag(2, 1) = current_vel(2)
189 vel_lag(3, 1) = current_vel(3)
197 real(kind=
rp),
intent(in) :: current_vel(3)
199 integer,
intent(in) :: nadv
202 current_vel, time, nadv)
213 real(kind=
rp) :: w_scalar, amp_scalar, ex_term
214 real(kind=
rp) :: t_curr, t0, t1, t2, t3, target_rad, tau, current_omega
218 kinematics%vel_trans = 0.0_rp
220 if (abs(body_conf%osc_amp(i)) > 0.0_rp)
then
221 w_scalar = body_conf%osc_freq(i) * 2.0_rp *
pi
222 kinematics%vel_trans(i) = body_conf%osc_amp(i) * w_scalar * &
223 cos(w_scalar * time%t)
228 kinematics%vel_ang = 0.0_rp
229 select case (trim(body_conf%rotation_type))
231 if (abs(body_conf%target_rot_angle_deg) > 0.0_rp)
then
233 t0 = body_conf%step_control_times(1)
234 t1 = body_conf%step_control_times(2)
235 t2 = body_conf%step_control_times(3)
236 t3 = body_conf%step_control_times(4)
237 target_rad = body_conf%target_rot_angle_deg * (
pi / 180.0_rp)
238 current_omega = 0.0_rp
240 if (t_curr < t0)
then
241 current_omega = 0.0_rp
242 elseif (t_curr < t1)
then
244 tau = (t_curr - t0) / (t1 - t0)
248 elseif (t_curr < t2)
then
249 current_omega = 0.0_rp
250 elseif (t_curr < t3)
then
252 tau = (t_curr - t2) / (t3 - t2)
253 current_omega = -1.0_rp * target_rad *
math_dstepf(tau) * &
257 kinematics%vel_ang(body_conf%rotation_axis) = current_omega
269 if (body_conf%ramp_t0(i) > 0.0_rp .and. &
270 abs(body_conf%ramp_omega0(i)) > 0.0_rp)
then
271 ex_term = exp(-4.6_rp * time%t / body_conf%ramp_t0(i))
272 kinematics%vel_ang(i) = body_conf%ramp_omega0(i) * &
279 if (abs(body_conf%rot_amp_degree(i)) > 0.0_rp)
then
280 amp_scalar = body_conf%rot_amp_degree(i) * (
pi / 180.0_rp)
281 w_scalar = body_conf%rot_freq(i) * 2.0_rp *
pi
282 kinematics%vel_ang(i) = w_scalar * amp_scalar * &
283 cos(w_scalar * time%t)
294 real(kind=
rp),
intent(out) :: pivot_loc(3)
295 real(kind=
rp),
intent(in) :: pivot_vel(3)
297 integer,
intent(in) :: nadv
299 real(kind=
rp) :: omega_osc(3), trans_disp(3)
301 select case (trim(body_conf%rotation_center_type))
306 if (time%tstep > 0)
then
308 pivot_vel, time, nadv)
310 pivot_loc = pivot%pos
314 case (
'relative_sin')
315 omega_osc = body_conf%osc_freq * 2.0_rp *
pi
316 trans_disp(1) = body_conf%osc_amp(1) * sin(omega_osc(1) * time%t)
317 trans_disp(2) = body_conf%osc_amp(2) * sin(omega_osc(2) * time%t)
318 trans_disp(3) = body_conf%osc_amp(3) * sin(omega_osc(3) * time%t)
319 pivot_loc = body_conf%rot_center + trans_disp
320 pivot%pos = pivot_loc
Adam-Bashforth scheme for time integration.
Defines data structures and algorithms for configuring, calculating, and time-integrating the rigid-b...
subroutine, public compute_body_kinematics_built_in(kinematics, body_conf, time)
Compute built-in kinematics for a body. Uses inputs from JSON. CPU-only.
subroutine, public ab_integrate_point_pos(pos, vel_lag, current_vel, time, nadv)
Advance a single point position (x,y,z) from the point's velocity using AB time-integration.
subroutine, public advance_point_tracker(tracker, current_vel, time, nadv)
Updates the point tracker's position and velocity history using AB time integration based on the curr...
subroutine, public init_pivot_state(pivot, body_conf)
Initialize pivot state.
subroutine, public update_pivot_location(pivot, pivot_loc, pivot_vel, time, nadv, body_conf)
Updates pivot location.
type(log_t), public neko_log
Global log stream.
real(kind=rp), parameter, public pi
real(kind=rp) function, public math_dstepf(x)
Derivative of math_stepf with respect to x: d(stepf)/dx.
subroutine, public rzero(a, n)
Zero a real vector.
integer, parameter, public rp
Global precision used in computations.
Module with things related to the simulation time.
Explicit Adam-Bashforth scheme for time integration.
Configuration for a single moving body.
Global ALE Configuration.
Calculated Kinematics for a body at current time.
State history for time-integration of pivots.
Type for a tracked point linked to a body.
A struct that contains all info about the time, expand as needed.