61 real(kind=
rp),
intent(inout),
target :: d(:)
62 type(
coef_t),
intent(in) :: coef
63 type(
mesh_t),
intent(in) :: msh
65 integer,
intent(in) :: zone_indices(:)
66 real(kind=
rp),
pointer :: d4(:, :, :, :)
67 integer :: i, j, k, e, n
68 integer :: ipass, nchange, max_pass
69 integer :: ii, jj, kk, i0, i1, j0, j1, k0, k1
70 integer :: lx, ly, lz, nel, z_idx
72 real(kind=
rp) :: dtmp, x1, y1, z1, x2, y2, z2
73 integer :: change_vec(1)
81 d4(1:lx, 1:ly, 1:lz, 1:nel) => d
85 call cfill(d, huge(0.0_rp), n)
87 if (
size(zone_indices) .gt. 0)
then
88 call bc_wall%init_from_components(coef)
89 do k = 1,
size(zone_indices)
90 z_idx = zone_indices(k)
91 call bc_wall%mark_zone(msh%labeled_zones(z_idx))
93 call bc_wall%finalize()
104 do while ((ipass .le. max_pass) .and. .not. done)
110 x1 = coef%dof%x(i, j, k, e)
111 y1 = coef%dof%y(i, j, k, e)
112 z1 = coef%dof%z(i, j, k, e)
122 if ((ii .eq. i) .and. (jj .eq. j) .and. &
124 x2 = coef%dof%x(ii, jj, kk, e)
125 y2 = coef%dof%y(ii, jj, kk, e)
126 z2 = coef%dof%z(ii, jj, kk, e)
127 dtmp = d4(ii, jj, kk, e) + &
128 sqrt((x1 - x2)**2 + &
129 (y1 - y2)**2 + (z1 - z2)**2)
130 if (dtmp .lt. d4(i, j, k, e))
then
131 d4(i, j, k, e) = dtmp
132 nchange = nchange + 1
141 call coef%gs_h%gs_op_vector(d, n, gs_op_min)
142 change_vec(1) = nchange
143 if (
glimax(change_vec, 1) .eq. 0) done = .true.
152 type(
field_t),
intent(inout) :: dist_field
153 type(
coef_t),
intent(in) :: coef
154 type(
mesh_t),
intent(in) :: msh
155 integer,
intent(in) :: zone_indices(:)
157 integer :: i, j, k, e, n
158 integer :: ipass, nchange, max_pass
159 integer :: ii, jj, kk, i0, i1, j0, j1, k0, k1
160 integer :: lx, ly, lz, nel, z_idx
161 integer :: m, idx, iter, local_iters
162 real(kind=
rp) :: dtmp, x1, y1, z1, x2, y2, z2
163 integer :: change_vec(1)
164 logical :: done, changed_local, element_changed_ever
165 character(len=LOG_SIZE) :: log_buf
176 local_iters = lx + ly + lz
178 call cfill(dist_field%x, huge(0.0_rp), n)
180 if (
size(zone_indices) .gt. 0)
then
181 call bc_wall%init_from_components(coef)
182 do k = 1,
size(zone_indices)
183 z_idx = zone_indices(k)
184 call bc_wall%mark_zone(msh%labeled_zones(z_idx))
186 call bc_wall%finalize()
190 dist_field%x(idx, 1, 1, 1) = 0.0_rp
197 do while ((ipass .le. max_pass) .and. .not. done)
202 element_changed_ever = .false.
203 changed_local = .true.
204 do while (changed_local .and. (iter .le. local_iters))
206 changed_local = .false.
210 x1 = coef%dof%x(i, j, k, e)
211 y1 = coef%dof%y(i, j, k, e)
212 z1 = coef%dof%z(i, j, k, e)
222 if ((ii .eq. i) .and. (jj .eq. j) .and. &
225 x2 = coef%dof%x(ii, jj, kk, e)
226 y2 = coef%dof%y(ii, jj, kk, e)
227 z2 = coef%dof%z(ii, jj, kk, e)
229 dtmp = dist_field%x(ii, jj, kk, e) + &
230 sqrt((x1 - x2)**2 + &
231 (y1 - y2)**2 + (z1 - z2)**2)
233 if (dtmp .lt. dist_field%x(i, j, k, e))
then
234 dist_field%x(i, j, k, e) = dtmp
235 changed_local = .true.
244 if (changed_local) element_changed_ever = .true.
248 if (element_changed_ever) nchange = nchange + 1
251 call coef%gs_h%gs_op_vector(dist_field%x, n, gs_op_min)
252 change_vec(1) = nchange
254 if (
glimax(change_vec, 1) .eq. 0) done = .true.
259 write(log_buf,
'(A, I0, A)')
" converged in: ", ipass,
" passes"
262 write(log_buf,
'(A, I0, A)')
" reached max passes: ", ipass, &
263 " without convergence"
270 x_ref, y_ref, z_ref, phi, coef, kinematics, rot_mat, inital_pivot_loc)
271 type(
field_t),
intent(inout) :: wx, wy, wz
272 type(
field_t),
intent(in) :: x_ref, y_ref, z_ref
273 type(
field_t),
intent(in) :: phi
274 type(
coef_t),
intent(in) :: coef
276 real(kind=
rp),
intent(in) :: inital_pivot_loc(3)
277 real(kind=
rp),
intent(in) :: rot_mat(3,3)
279 real(kind=
rp) :: rx, ry, rz
280 real(kind=
rp) :: v_tan_x, v_tan_y, v_tan_z
281 real(kind=
rp) :: dx_ref, dy_ref, dz_ref
282 real(kind=
rp) :: rx_target, ry_target, rz_target
283 real(kind=
rp) :: p_val
285 associate(x => coef%dof%x, y => coef%dof%y, z => coef%dof%z)
286 do concurrent(i = 1:n)
290 if ( abs(phi%x(i, 1, 1, 1) - 1.0_rp) .lt. 1e-6_rp )
then
292 rx = x(i, 1, 1, 1) - kinematics%center(1)
293 ry = y(i, 1, 1, 1) - kinematics%center(2)
294 rz = z(i, 1, 1, 1) - kinematics%center(3)
295 v_tan_x = kinematics%vel_ang(2) * rz - kinematics%vel_ang(3) * ry
296 v_tan_y = kinematics%vel_ang(3) * rx - kinematics%vel_ang(1) * rz
297 v_tan_z = kinematics%vel_ang(1) * ry - kinematics%vel_ang(2) * rx
298 wx%x(i, 1, 1, 1) = wx%x(i, 1, 1, 1) + &
299 (kinematics%vel_trans(1) + v_tan_x) * phi%x(i, 1, 1, 1)
300 wy%x(i, 1, 1, 1) = wy%x(i, 1, 1, 1) + &
301 (kinematics%vel_trans(2) + v_tan_y) * phi%x(i, 1, 1, 1)
302 wz%x(i, 1, 1, 1) = wz%x(i, 1, 1, 1) + &
303 (kinematics%vel_trans(3) + v_tan_z) * phi%x(i, 1, 1, 1)
308 dx_ref = x_ref%x(i, 1, 1, 1) - inital_pivot_loc(1)
309 dy_ref = y_ref%x(i, 1, 1, 1) - inital_pivot_loc(2)
310 dz_ref = z_ref%x(i, 1, 1, 1) - inital_pivot_loc(3)
314 rx_target = rot_mat(1,1)*dx_ref + rot_mat(1,2)*dy_ref + &
316 ry_target = rot_mat(2,1)*dx_ref + rot_mat(2,2)*dy_ref + &
318 rz_target = rot_mat(3,1)*dx_ref + rot_mat(3,2)*dy_ref + &
323 v_tan_x = kinematics%vel_ang(2) * rz_target - &
324 kinematics%vel_ang(3) * ry_target
325 v_tan_y = kinematics%vel_ang(3) * rx_target - &
326 kinematics%vel_ang(1) * rz_target
327 v_tan_z = kinematics%vel_ang(1) * ry_target - &
328 kinematics%vel_ang(2) * rx_target
330 p_val = phi%x(i, 1, 1, 1)
333 wx%x(i, 1, 1, 1) = wx%x(i, 1, 1, 1) + &
334 (kinematics%vel_trans(1) + v_tan_x) * p_val
335 wy%x(i, 1, 1, 1) = wy%x(i, 1, 1, 1) + &
336 (kinematics%vel_trans(2) + v_tan_y) * p_val
337 wz%x(i, 1, 1, 1) = wz%x(i, 1, 1, 1) + &
338 (kinematics%vel_trans(3) + v_tan_z) * p_val
347 wm_z_lag, time, nadv, scheme_type)
348 type(coef_t),
intent(inout) :: c_xh
349 type(field_t),
intent(in) :: wm_x, wm_y, wm_z
350 type(field_series_t),
intent(in) :: wm_x_lag, wm_y_lag, wm_z_lag
351 type(time_state_t),
intent(in) :: time
352 type(ab_time_scheme_t) :: ab_scheme_obj
353 integer,
intent(in) :: nadv
355 character(len=*),
intent(in) :: scheme_type
356 real(kind=rp) :: ab_coeffs(4), dt_history(10)
358 call rzero(ab_coeffs, 4)
359 if (trim(scheme_type) .eq.
'ab')
then
360 dt_history(1) = time%dt
361 dt_history(2) = time%dtlag(1)
362 dt_history(3) = time%dtlag(2)
363 call ab_scheme_obj%compute_coeffs(ab_coeffs, dt_history, nadv)
365 call neko_error(
"ALE: Unknown mesh time-integration scheme")
370 do concurrent(i = 1:n)
371 c_xh%dof%x(i, 1, 1, 1) = c_xh%dof%x(i, 1, 1, 1) + &
372 time%dt * ab_coeffs(1) * wm_x%x(i, 1, 1, 1)
373 c_xh%dof%y(i, 1, 1, 1) = c_xh%dof%y(i, 1, 1, 1) + &
374 time%dt * ab_coeffs(1) * wm_y%x(i, 1, 1, 1)
375 c_xh%dof%z(i, 1, 1, 1) = c_xh%dof%z(i, 1, 1, 1) + &
376 time%dt * ab_coeffs(1) * wm_z%x(i, 1, 1, 1)
379 c_xh%dof%x(i, 1, 1, 1) = c_xh%dof%x(i, 1, 1, 1) + &
380 time%dt * ab_coeffs(j) * wm_x_lag%lf(j - 1)%x(i, 1, 1, 1)
381 c_xh%dof%y(i, 1, 1, 1) = c_xh%dof%y(i, 1, 1, 1) + &
382 time%dt * ab_coeffs(j) * wm_y_lag%lf(j - 1)%x(i, 1, 1, 1)
383 c_xh%dof%z(i, 1, 1, 1) = c_xh%dof%z(i, 1, 1, 1) + &
384 time%dt * ab_coeffs(j) * wm_z_lag%lf(j - 1)%x(i, 1, 1, 1)