65 real(kind=
rp),
pointer :: tlag(:) => null()
66 real(kind=
rp),
pointer :: dtlag(:) => null()
87 real(kind=
dp) :: t = 0d0
99 real(kind=
rp),
pointer :: msh_x(:,:,:,:) => null()
100 real(kind=
rp),
pointer :: msh_y(:,:,:,:) => null()
101 real(kind=
rp),
pointer :: msh_z(:,:,:,:) => null()
102 real(kind=
rp),
pointer :: pivot_pos(:) => null()
103 real(kind=
rp),
pointer :: pivot_vel_lag(:,:) => null()
104 real(kind=
rp),
pointer :: blag(:,:,:,:) => null()
105 real(kind=
rp),
pointer :: blaglag(:,:,:,:) => null()
106 real(kind=
rp),
pointer :: basis_pos(:) => null()
107 real(kind=
rp),
pointer :: basis_vel_lag(:,:) => null()
125 class(
chkp_t),
intent(inout) :: this
134 class(
chkp_t),
intent(inout) :: this
138 if (
associated(this%u))
nullify(this%u)
139 if (
associated(this%v))
nullify(this%v)
140 if (
associated(this%w))
nullify(this%w)
141 if (
associated(this%p))
nullify(this%p)
143 if (
associated(this%ulag))
nullify(this%ulag)
144 if (
associated(this%vlag))
nullify(this%vlag)
145 if (
associated(this%wlag))
nullify(this%wlag)
147 if (
associated(this%tlag))
nullify(this%tlag)
148 if (
associated(this%dtlag))
nullify(this%dtlag)
151 if (
associated(this%wm_x))
nullify(this%wm_x)
152 if (
associated(this%wm_y))
nullify(this%wm_y)
153 if (
associated(this%wm_z))
nullify(this%wm_z)
154 if (
associated(this%wm_x_lag))
nullify(this%wm_x_lag)
155 if (
associated(this%wm_y_lag))
nullify(this%wm_y_lag)
156 if (
associated(this%wm_z_lag))
nullify(this%wm_z_lag)
157 if (
associated(this%basis_vel_lag))
nullify(this%basis_vel_lag)
158 if (
associated(this%msh_x))
nullify(this%msh_x)
159 if (
associated(this%msh_y))
nullify(this%msh_y)
160 if (
associated(this%msh_z))
nullify(this%msh_z)
161 if (
associated(this%pivot_pos))
nullify(this%pivot_pos)
162 if (
associated(this%pivot_vel_lag))
nullify(this%pivot_vel_lag)
163 if (
associated(this%Blag))
nullify(this%Blag)
164 if (
associated(this%Blaglag))
nullify(this%Blaglag)
165 if (
associated(this%basis_pos))
nullify(this%basis_pos)
167 if (
associated(this%abx1))
nullify(this%abx1)
168 if (
associated(this%abx2))
nullify(this%abx2)
169 if (
associated(this%aby1))
nullify(this%aby1)
170 if (
associated(this%aby2))
nullify(this%aby2)
171 if (
associated(this%abz1))
nullify(this%abz1)
172 if (
associated(this%abz2))
nullify(this%abz2)
174 if (
associated(this%s))
nullify(this%s)
175 if (
associated(this%slag))
nullify(this%slag)
176 if (
associated(this%abs1))
nullify(this%abs1)
177 if (
associated(this%abs2))
nullify(this%abs2)
179 call this%scalar_lags%free()
181 if (
allocated(this%scalar_abx1))
then
182 deallocate(this%scalar_abx1)
185 if (
allocated(this%scalar_abx2))
then
186 deallocate(this%scalar_abx2)
189 call this%previous_mesh%free()
190 call this%previous_Xh%free()
196 class(
chkp_t),
intent(inout) :: this
200 associate(u => this%u, v => this%v, w => this%w, &
201 ulag => this%ulag, vlag => this%vlag, wlag => this%wlag, &
204 if (
associated(this%u) .and.
associated(this%v) .and. &
205 associated(this%w) .and.
associated(this%p))
then
212 if (
associated(this%ulag) .and.
associated(this%vlag) .and. &
213 associated(this%wlag))
then
230 if (
associated(this%s))
then
239 if (
associated(this%wm_x) .and.
associated(this%wm_y) .and. &
240 associated(this%wm_z))
then
245 if (
associated(this%wm_x_lag) .and.
associated(this%wm_y_lag) &
246 .and.
associated(this%wm_z_lag))
then
266 do i = 1, this%scalar_lags%size()
270 slag => this%scalar_lags%get(i)
271 slag_size = slag%size()
279 if (
allocated(this%scalar_abx1) .and.
allocated(this%scalar_abx2))
then
280 do i = 1,
size(this%scalar_abx1)
288 call device_sync(glb_cmd_queue)
295 class(
chkp_t),
intent(inout) :: this
298 if (neko_bcknd_device .eq. 1)
then
299 associate(u => this%u, v => this%v, w => this%w, &
300 ulag => this%ulag, vlag => this%vlag, wlag => this%wlag, &
303 if (
associated(this%u) .and.
associated(this%v) .and. &
304 associated(this%w))
then
305 call u%copy_from(host_to_device, sync = .false.)
306 call v%copy_from(host_to_device, sync = .false.)
307 call w%copy_from(host_to_device, sync = .false.)
308 call p%copy_from(host_to_device, sync = .false.)
311 if (
associated(this%ulag) .and.
associated(this%vlag) .and. &
312 associated(this%wlag))
then
313 call ulag%lf(1)%copy_from(host_to_device, sync = .false.)
314 call ulag%lf(2)%copy_from(host_to_device, sync = .false.)
316 call vlag%lf(1)%copy_from(host_to_device, sync = .false.)
317 call vlag%lf(2)%copy_from(host_to_device, sync = .false.)
319 call wlag%lf(1)%copy_from(host_to_device, sync = .false.)
320 call wlag%lf(2)%copy_from(host_to_device, sync = .false.)
323 if (
associated(this%s))
then
324 call this%s%copy_from(host_to_device, sync = .false.)
326 call this%slag%lf(1)%copy_from(host_to_device, sync = .false.)
327 call this%slag%lf(2)%copy_from(host_to_device, sync = .false.)
328 call this%abs1%copy_from(host_to_device, sync = .false.)
329 call this%abs2%copy_from(host_to_device, sync = .false.)
333 if (
associated(this%wm_x) .and.
associated(this%wm_y) .and. &
334 associated(this%wm_z))
then
335 call this%wm_x%copy_from(host_to_device, sync = .false.)
336 call this%wm_y%copy_from(host_to_device, sync = .false.)
337 call this%wm_z%copy_from(host_to_device, sync = .false.)
338 if (
associated(this%wm_x_lag) .and.
associated(this%wm_y_lag) .and. &
339 associated(this%wm_z_lag))
then
340 call this%wm_x_lag%lf(1)%copy_from(host_to_device, &
342 call this%wm_x_lag%lf(2)%copy_from(host_to_device, &
345 call this%wm_y_lag%lf(1)%copy_from(host_to_device, &
347 call this%wm_y_lag%lf(2)%copy_from(host_to_device, &
350 call this%wm_z_lag%lf(1)%copy_from(host_to_device, &
352 call this%wm_z_lag%lf(2)%copy_from(host_to_device, &
358 if (
allocated(this%scalar_lags%items) .and. &
359 this%scalar_lags%size() > 0)
then
360 do i = 1, this%scalar_lags%size()
362 type(field_series_t),
pointer :: slag
363 integer :: slag_size, dof_size
364 slag => this%scalar_lags%get(i)
365 slag_size = slag%size()
366 dof_size = slag%f%dof%size()
368 call slag%lf(j)%copy_from(host_to_device, sync = .false.)
375 if (
allocated(this%scalar_abx1) .and.
allocated(this%scalar_abx2))
then
376 do i = 1,
size(this%scalar_abx1)
377 call this%scalar_abx1(i)%ptr%copy_from(host_to_device, &
379 call this%scalar_abx2(i)%ptr%copy_from(host_to_device, &
390 class(
chkp_t),
intent(inout) :: this
391 type(field_t),
target :: u
392 type(field_t),
target :: v
393 type(field_t),
target :: w
394 type(field_t),
target :: p
398 if ( u%Xh .ne. v%Xh .or. &
399 u%Xh .ne. w%Xh )
then
400 call neko_error(
'Different function spaces for each velocity component')
404 if ( u%msh%nelv .ne. p%msh%nelv )
then
405 call neko_error(
'Velocity and pressure defined on different meshes')
417 class(
chkp_t),
intent(inout) :: this
418 type(field_series_t),
target :: ulag
419 type(field_series_t),
target :: vlag
420 type(field_series_t),
target :: wlag
432 class(
chkp_t),
intent(inout) :: this
433 type(field_t),
target,
intent(in) :: s
434 type(field_series_t),
target,
intent(in) :: slag
435 type(field_t),
target,
intent(in),
optional :: abs1, abs2
440 if (
present(abs1)) this%abs1 => abs1
441 if (
present(abs2)) this%abs2 => abs2
446 subroutine chkp_add_ale(this, x, y, z, Blag, Blaglag, wm_x, wm_y, wm_z, &
447 wm_x_lag, wm_y_lag, wm_z_lag, pivot_pos, pivot_vel_lag, basis_pos, &
449 class(
chkp_t),
intent(inout) :: this
450 type(field_t),
target,
intent(in) :: wm_x, wm_y, wm_z
451 real(kind=rp),
intent(in),
pointer :: pivot_pos(:), pivot_vel_lag(:,:)
452 type(field_series_t),
target,
intent(in) :: wm_x_lag, wm_y_lag, wm_z_lag
453 real(kind=rp),
intent(in),
pointer :: x(:,:,:,:), y(:,:,:,:), z(:,:,:,:)
454 real(kind=rp),
pointer,
intent(in) :: blag(:,:,:,:), blaglag(:,:,:,:)
455 real(kind=rp),
intent(in),
pointer :: basis_pos(:)
456 real(kind=rp),
intent(in),
pointer :: basis_vel_lag(:,:)
464 this%wm_x_lag => wm_x_lag
465 this%wm_y_lag => wm_y_lag
466 this%wm_z_lag => wm_z_lag
468 this%Blaglag => blaglag
469 this%pivot_pos => pivot_pos
470 this%pivot_vel_lag => pivot_vel_lag
471 this%basis_pos => basis_pos
472 this%basis_vel_lag => basis_vel_lag
477 class(
chkp_t),
intent(in) :: this
478 real(kind=dp) :: rtime
485 class(
chkp_t),
intent(in) :: this
486 type(time_state_t),
intent(inout) :: time_state
Copy data between host and device (or device and device)
Synchronize a device or stream.
subroutine chkp_sync_host(this)
Synchronize checkpoint with device.
subroutine chkp_set_time_state(this, time_state)
Set time state.
subroutine chkp_sync_device(this)
Synchronize device with checkpoint.
subroutine chkp_add_ale(this, x, y, z, blag, blaglag, wm_x, wm_y, wm_z, wm_x_lag, wm_y_lag, wm_z_lag, pivot_pos, pivot_vel_lag, basis_pos, basis_vel_lag)
Add mesh velocity and other required variables to checkpointing for ALE.
pure real(kind=dp) function chkp_restart_time(this)
Return restart time from a loaded checkpoint.
subroutine chkp_free(this)
Reset checkpoint.
subroutine chkp_add_lag(this, ulag, vlag, wlag)
Add lagged velocity terms.
subroutine chkp_add_fluid(this, u, v, w, p)
Add a fluid to the checkpoint.
subroutine chkp_init(this)
Initialize checkpoint structure with mandatory data.
subroutine chkp_add_scalar(this, s, slag, abs1, abs2)
Add a scalar to checkpointing.
Device abstraction, common interface for various accelerators.
integer, parameter, public host_to_device
integer, parameter, public device_to_host
type(c_ptr), bind(C), public glb_cmd_queue
Global command queue.
Contains the field_series_list_t type for managing multiple field series.
Contains the field_serties_t type.
Implements global_interpolation given a dofmap.
real(kind=dp), parameter, public glob_interp_tol
real(kind=rp), parameter, public neko_eps
Machine epsilon .
integer, parameter neko_bcknd_device
integer, parameter, public dp
integer, parameter, public rp
Global precision used in computations.
Defines a function space.
Module with things related to the simulation time.
field_ptr_t, To easily obtain a pointer to a field
Stores a series (sequence) of fields, logically connected to a base field, and arranged according to ...
A list of field series pointers, used for managing multiple scalar lag fields.
The function space for the SEM solution fields.
A struct that contains all info about the time, expand as needed.