46 use,
intrinsic :: iso_c_binding, only : c_ptr, c_sizeof
59 real(kind=
rp) :: delta
61 type(c_ptr) :: normal_x_d
62 type(c_ptr) :: normal_y_d
63 type(c_ptr) :: normal_z_d
75 real(kind=
rp),
intent(in) :: uinf
76 real(kind=
rp),
optional,
intent(in) :: delta
77 real(kind=
rp),
allocatable :: temp_x(:)
78 real(kind=
rp),
allocatable :: temp_y(:)
79 real(kind=
rp),
allocatable :: temp_z(:)
81 integer :: i, m, k, facet, idx(4)
82 real(kind=
rp) :: normal_xyz(3)
85 if (
present(delta))
then
95 call device_alloc(this%normal_x_d,c_sizeof(dummy)*this%msk(0))
96 call device_alloc(this%normal_y_d,c_sizeof(dummy)*this%msk(0))
97 call device_alloc(this%normal_z_d,c_sizeof(dummy)*this%msk(0))
104 facet = this%facet(i)
107 this%coef%get_normal(idx(1), idx(2), idx(3), idx(4),facet)
108 temp_x(i) = normal_xyz(1)
109 temp_y(i) = normal_xyz(2)
110 temp_z(i) = normal_xyz(3)
118 deallocate( temp_x, temp_y, temp_z)
126 integer,
intent(in) :: n
127 real(kind=
rp),
intent(inout),
dimension(n) :: x
128 real(kind=
rp),
intent(in),
optional :: t
129 integer,
intent(in),
optional :: tstep
130 integer :: i, m, k, facet, idx(4)
131 real(kind=
rp) :: vn, s0, ux, uy, uz, normal_xyz(3)
136 facet = this%facet(i)
137 ux = this%u%x(k,1,1,1)
138 uy = this%v%x(k,1,1,1)
139 uz = this%w%x(k,1,1,1)
141 normal_xyz = this%coef%get_normal(idx(1), idx(2), idx(3), idx(4),facet)
142 vn = ux*normal_xyz(1) + uy*normal_xyz(2) + uz*normal_xyz(3)
143 s0 = 0.5_rp*(1.0_rp - tanh(vn / (this%uinf * this%delta)))
145 x(k)=-0.5*(ux*ux+uy*uy+uz*uz)*s0
153 integer,
intent(in) :: n
154 real(kind=
rp),
intent(inout),
dimension(n) :: x
155 real(kind=
rp),
intent(inout),
dimension(n) :: y
156 real(kind=
rp),
intent(inout),
dimension(n) :: z
157 real(kind=
rp),
intent(in),
optional :: t
158 integer,
intent(in),
optional :: tstep
167 real(kind=
rp),
intent(in),
optional :: t
168 integer,
intent(in),
optional :: tstep
171 this%normal_y_d, this%normal_z_d,&
172 this%u%x_d, this%v%x_d, this%w%x_d,&
173 this%uinf, this%delta,&
185 real(kind=
rp),
intent(in),
optional :: t
186 integer,
intent(in),
optional :: tstep
__device__ void nonlinear_index(const int idx, const int lx, int *index)
Copy data between host and device (or device and device)
Defines a boundary condition.
subroutine, public device_dong_outflow_apply_scalar(msk, x, normal_x, normal_y, normal_z, u, v, w, uinf, delta, m)
Device abstraction, common interface for various accelerators.
integer, parameter, public host_to_device
subroutine, public device_alloc(x_d, s)
Allocate memory on the device.
Defines a dirichlet boundary condition.
Defines a mapping of the degrees of freedom.
Defines a dong outflow condition.
subroutine dong_outflow_apply_vector(this, x, y, z, n, t, tstep)
Boundary condition apply for a generic Dirichlet condition to vectors x, y and z.
subroutine dong_outflow_apply_scalar(this, x, n, t, tstep)
Boundary condition apply for a generic Dirichlet condition to a vector x.
subroutine dong_outflow_apply_vector_dev(this, x_d, y_d, z_d, t, tstep)
Boundary condition apply for a generic Dirichlet condition to vectors x, y and z (device version)
subroutine dong_outflow_apply_scalar_dev(this, x_d, t, tstep)
Boundary condition apply for a generic Dirichlet condition to a vector x (device version)
subroutine dong_outflow_set_vars(this, uinf, delta)
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Generic Dirichlet boundary condition on .
Dong outflow condition Follows "A Convective-like Energy-Stable Open Boundary Condition for Simulati...