42 use,
intrinsic :: iso_c_binding
77 real(kind=
rp) :: advection_coeffs(4) = 0
79 real(kind=
rp) :: diffusion_coeffs(4) = 0
87 integer :: advection_time_order = 3
89 integer :: diffusion_time_order
91 type(c_ptr) :: advection_coeffs_d = c_null_ptr
93 type(c_ptr) :: diffusion_coeffs_d = c_null_ptr
101 procedure, pass(this) :: set_coeffs => &
115 this%diffusion_time_order = torder
118 if (torder .eq. 1)
then
119 this%advection_time_order = 1
123 call device_map(this%advection_coeffs, this%advection_coeffs_d, 4)
124 call device_map(this%diffusion_coeffs, this%diffusion_coeffs_d, 4)
133 if (c_associated(this%advection_coeffs_d))
then
136 if (c_associated(this%diffusion_coeffs_d))
then
147 real(kind=
rp),
intent(inout),
dimension(10) :: dt
148 real(kind=
rp),
dimension(4) :: adv_coeffs_old
149 real(kind=
rp),
dimension(4) :: diff_coeffs_old
153 ndiff => this%ndiff, &
154 adv_coeffs => this%advection_coeffs, &
155 adv_coeffs_d => this%advection_coeffs_d, &
156 diff_coeffs => this%diffusion_coeffs, &
157 diff_coeffs_d => this%diffusion_coeffs_d)
159 adv_coeffs_old = adv_coeffs
160 diff_coeffs_old = diff_coeffs
164 ndiff = min(ndiff, this%diffusion_time_order)
166 nadv = min(nadv, this%advection_time_order)
168 call this%bdf%compute_coeffs(diff_coeffs, dt, ndiff)
170 if (nadv .eq. 1)
then
172 call this%ext%compute_coeffs(adv_coeffs, dt, nadv)
173 else if (nadv .eq. 2)
then
174 if (ndiff .eq. 1)
then
176 call this%ab%compute_coeffs(adv_coeffs, dt, nadv)
179 call this%ext%compute_coeffs(adv_coeffs, dt, nadv)
181 else if (nadv .eq. 3)
then
182 if (ndiff .eq. 1)
then
184 call this%ab%compute_coeffs(adv_coeffs, dt, nadv)
185 else if (ndiff .eq. 2)
then
187 call this%ext%compute_modified_coeffs(adv_coeffs, dt)
190 call this%ext%compute_coeffs(adv_coeffs, dt, nadv)
195 if (c_associated(adv_coeffs_d))
then
196 if (maxval(abs(adv_coeffs - adv_coeffs_old)) .gt. 1e-10_rp)
then
202 if (c_associated(diff_coeffs_d))
then
203 if (maxval(abs(diff_coeffs - diff_coeffs_old)) .gt. 1e-10_rp)
then
Map a Fortran array to a device (allocate and associate)
Copy data between host and device (or device and device)
Adam-Bashforth scheme for time integration.
Backward-differencing scheme for time integration.
Device abstraction, common interface for various accelerators.
integer, parameter, public host_to_device
subroutine, public device_free(x_d)
Deallocate memory on the device.
Explicit extrapolation scheme for time integration.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Compound scheme for the advection and diffusion operators in a transport equation.
subroutine time_scheme_controller_free(this)
Destructor.
subroutine time_scheme_controller_init(this, torder)
Contructor.
subroutine time_scheme_controller_set_coeffs(this, dt)
Set the time coefficients.
Explicit Adam-Bashforth scheme for time integration.
Implicit backward-differencing scheme for time integration.
Explicit extrapolation scheme for time integration.
Implements the logic to compute the time coefficients for the advection and diffusion operators in a ...