46 use,
intrinsic :: iso_c_binding, only : c_ptr, c_sizeof, c_null_ptr
47 use json_module,
only : json_file
61 real(kind=
rp) :: delta
63 type(c_ptr) :: normal_x_d = c_null_ptr
64 type(c_ptr) :: normal_y_d = c_null_ptr
65 type(c_ptr) :: normal_z_d = c_null_ptr
85 type(
coef_t),
intent(in) :: coef
86 type(json_file),
intent(inout) :: json
88 call this%init_base(coef)
101 integer,
intent(in) :: n
102 real(kind=
rp),
intent(inout),
dimension(n) :: x
103 real(kind=
rp),
intent(in),
optional :: t
104 integer,
intent(in),
optional :: tstep
105 logical,
intent(in),
optional :: strong
106 integer :: i, m, k, facet, idx(4)
107 real(kind=
rp) :: vn, s0, ux, uy, uz, normal_xyz(3)
108 logical :: strong_ = .true.
110 if (
present(strong)) strong_ = strong
116 facet = this%facet(i)
117 ux = this%u%x(k,1,1,1)
118 uy = this%v%x(k,1,1,1)
119 uz = this%w%x(k,1,1,1)
121 normal_xyz = this%coef%get_normal(idx(1), idx(2), idx(3), idx(4), &
123 vn = ux*normal_xyz(1) + uy*normal_xyz(2) + uz*normal_xyz(3)
124 s0 = 0.5_rp*(1.0_rp - tanh(vn / (this%uinf * this%delta)))
126 x(k) = -0.5*(ux*ux+uy*uy+uz*uz)*s0
135 integer,
intent(in) :: n
136 real(kind=
rp),
intent(inout),
dimension(n) :: x
137 real(kind=
rp),
intent(inout),
dimension(n) :: y
138 real(kind=
rp),
intent(inout),
dimension(n) :: z
139 real(kind=
rp),
intent(in),
optional :: t
140 integer,
intent(in),
optional :: tstep
141 logical,
intent(in),
optional :: strong
150 real(kind=
rp),
intent(in),
optional :: t
151 integer,
intent(in),
optional :: tstep
152 logical,
intent(in),
optional :: strong
153 logical :: strong_ = .true.
155 if (
present(strong)) strong_ = strong
157 if (strong_ .and. this%msk(0) .gt. 0)
then
159 this%normal_x_d, this%normal_y_d, this%normal_z_d, &
160 this%u%x_d, this%v%x_d, this%w%x_d, &
161 this%uinf, this%delta, &
175 real(kind=
rp),
intent(in),
optional :: t
176 integer,
intent(in),
optional :: tstep
177 logical,
intent(in),
optional :: strong
195 real(kind=
rp),
allocatable :: temp_x(:)
196 real(kind=
rp),
allocatable :: temp_y(:)
197 real(kind=
rp),
allocatable :: temp_z(:)
199 integer :: i, m, k, facet, idx(4)
200 real(kind=
rp) :: normal_xyz(3)
203 call this%finalize_base(.true.)
208 call device_alloc(this%normal_x_d, c_sizeof(dummy)*this%msk(0))
209 call device_alloc(this%normal_y_d, c_sizeof(dummy)*this%msk(0))
210 call device_alloc(this%normal_z_d, c_sizeof(dummy)*this%msk(0))
217 facet = this%facet(i)
220 this%coef%get_normal(idx(1), idx(2), idx(3), idx(4), facet)
221 temp_x(i) = normal_xyz(1)
222 temp_y(i) = normal_xyz(2)
223 temp_z(i) = normal_xyz(3)
231 deallocate( temp_x, temp_y, temp_z)
__device__ void nonlinear_index(const int idx, const int lx, int *index)
Copy data between host and device (or device and device)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
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_dev(this, x_d, y_d, z_d, t, tstep, strong)
Boundary condition apply for a generic Dirichlet condition to vectors x, y and z (device version)
subroutine dong_outflow_finalize(this)
Finalize.
subroutine dong_outflow_apply_scalar_dev(this, x_d, t, tstep, strong)
Boundary condition apply for a generic Dirichlet condition to a vector x (device version)
subroutine dong_outflow_apply_vector(this, x, y, z, n, t, tstep, strong)
Boundary condition apply for a generic Dirichlet condition to vectors x, y and z.
subroutine dong_outflow_apply_scalar(this, x, n, t, tstep, strong)
Boundary condition apply for a generic Dirichlet condition to a vector x.
subroutine dong_outflow_free(this)
Destructor.
subroutine dong_outflow_init(this, coef, json)
Constructor.
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
Utilities for retrieving parameters from the case files.
integer, parameter neko_bcknd_device
integer, parameter, public c_rp
integer, parameter, public rp
Global precision used in computations.
Base type for a boundary condition.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Generic Dirichlet boundary condition on .
Dong outflow condition Follows "A Convective-like Energy-Stable Open Boundary Condition for Simulati...