48 type(c_ptr),
private :: usr_x_d = c_null_ptr
78 ix, iy, iz, ie, t, tstep)
80 real(kind=
rp),
intent(inout) :: s
81 real(kind=
rp),
intent(in) :: x
82 real(kind=
rp),
intent(in) :: y
83 real(kind=
rp),
intent(in) :: z
84 real(kind=
rp),
intent(in) :: nx
85 real(kind=
rp),
intent(in) :: ny
86 real(kind=
rp),
intent(in) :: nz
87 integer,
intent(in) :: ix
88 integer,
intent(in) :: iy
89 integer,
intent(in) :: iz
90 integer,
intent(in) :: ie
91 real(kind=
rp),
intent(in) :: t
92 integer,
intent(in) :: tstep
104 if (c_associated(this%usr_x_d))
then
117 integer,
intent(in) :: n
118 real(kind=
rp),
intent(inout),
dimension(n) :: x
119 real(kind=
rp),
intent(in),
optional :: t
120 integer,
intent(in),
optional :: tstep
121 integer :: i, m, k, idx(4), facet, tstep_
130 if (
present(tstep))
then
136 associate(xc => this%c%dof%x, yc => this%c%dof%y, zc => this%c%dof%z, &
137 nx => this%c%nx, ny => this%c%ny, nz => this%c%nz, &
142 facet = this%facet(i)
146 call this%eval(x(k), &
147 xc(idx(1), idx(2), idx(3), idx(4)), &
148 yc(idx(1), idx(2), idx(3), idx(4)), &
149 zc(idx(1), idx(2), idx(3), idx(4)), &
150 nx(idx(2), idx(3), facet, idx(4)), &
151 ny(idx(2), idx(3), facet, idx(4)), &
152 nz(idx(2), idx(3), facet, idx(4)), &
153 idx(1), idx(2), idx(3), idx(4), &
156 call this%eval(x(k), &
157 xc(idx(1), idx(2), idx(3), idx(4)), &
158 yc(idx(1), idx(2), idx(3), idx(4)), &
159 zc(idx(1), idx(2), idx(3), idx(4)), &
160 nx(idx(1), idx(3), facet, idx(4)), &
161 ny(idx(1), idx(3), facet, idx(4)), &
162 nz(idx(1), idx(3), facet, idx(4)), &
163 idx(1), idx(2), idx(3), idx(4), &
166 call this%eval(x(k), &
167 xc(idx(1), idx(2), idx(3), idx(4)), &
168 yc(idx(1), idx(2), idx(3), idx(4)), &
169 zc(idx(1), idx(2), idx(3), idx(4)), &
170 nx(idx(1), idx(2), facet, idx(4)), &
171 ny(idx(1), idx(2), facet, idx(4)), &
172 nz(idx(1), idx(2), facet, idx(4)), &
173 idx(1), idx(2), idx(3), idx(4), &
188 real(kind=rp),
intent(in),
optional :: t
189 integer,
intent(in),
optional :: tstep
190 integer :: i, m, k, idx(4), facet, tstep_
192 integer(c_size_t) :: s
193 real(kind=rp),
allocatable :: x(:)
202 if (
present(tstep))
then
208 associate(xc => this%c%dof%x, yc => this%c%dof%y, zc => this%c%dof%z, &
209 nx => this%c%nx, ny => this%c%ny, nz => this%c%nz, &
210 lx => this%c%Xh%lx, usr_x_d => this%usr_x_d)
214 if (.not. c_associated(usr_x_d))
then
218 call device_alloc(this%usr_x_d, s)
222 facet = this%facet(i)
226 call this%eval(x(i), &
227 xc(idx(1), idx(2), idx(3), idx(4)), &
228 yc(idx(1), idx(2), idx(3), idx(4)), &
229 zc(idx(1), idx(2), idx(3), idx(4)), &
230 nx(idx(2), idx(3), facet, idx(4)), &
231 ny(idx(2), idx(3), facet, idx(4)), &
232 nz(idx(2), idx(3), facet, idx(4)), &
233 idx(1), idx(2), idx(3), idx(4), &
236 call this%eval(x(i), &
237 xc(idx(1), idx(2), idx(3), idx(4)), &
238 yc(idx(1), idx(2), idx(3), idx(4)), &
239 zc(idx(1), idx(2), idx(3), idx(4)), &
240 nx(idx(1), idx(3), facet, idx(4)), &
241 ny(idx(1), idx(3), facet, idx(4)), &
242 nz(idx(1), idx(3), facet, idx(4)), &
243 idx(1), idx(2), idx(3), idx(4), &
246 call this%eval(x(i), &
247 xc(idx(1), idx(2), idx(3), idx(4)), &
248 yc(idx(1), idx(2), idx(3), idx(4)), &
249 zc(idx(1), idx(2), idx(3), idx(4)), &
250 nx(idx(1), idx(2), facet, idx(4)), &
251 ny(idx(1), idx(2), facet, idx(4)), &
252 nz(idx(1), idx(2), facet, idx(4)), &
253 idx(1), idx(2), idx(3), idx(4), &
258 call device_memcpy(x, this%usr_x_d, m, host_to_device, sync=.true.)
263 call device_inhom_dirichlet_apply_scalar(this%msk_d, x_d, &
273 integer,
intent(in) :: n
274 real(kind=rp),
intent(inout),
dimension(n) :: x
275 real(kind=rp),
intent(inout),
dimension(n) :: y
276 real(kind=rp),
intent(inout),
dimension(n) :: z
277 real(kind=rp),
intent(in),
optional :: t
278 integer,
intent(in),
optional :: tstep
279 integer :: i, m, k, idx(4), facet
288 real(kind=rp),
intent(in),
optional :: t
289 integer,
intent(in),
optional :: tstep
290 integer :: i, m, k, idx(4), facet
291 integer(c_size_t) :: s
292 real(kind=rp),
allocatable :: x(:)
293 real(kind=rp),
allocatable :: y(:)
294 real(kind=rp),
allocatable :: z(:)
300 type(coef_t),
target,
intent(inout) :: c
309 this%eval => user_scalar_bc
318 if (.not.
associated(this%c))
then
319 call neko_warning(
'Missing coefficients')
323 if (.not.
associated(this%eval))
then
324 call neko_warning(
'Missing eval function')
328 if (.not. valid)
then
329 call neko_error(
'Invalid user defined scalar condition')
__device__ void nonlinear_index(const int idx, const int lx, int *index)
Abstract interface defining a user defined scalar boundary condition (pointwise) Just imitating inflo...
Device abstraction, common interface for various accelerators.
subroutine, public device_free(x_d)
Deallocate memory on the device.
Defines a dirichlet boundary condition.
integer, parameter, public rp
Global precision used in computations.
Defines dirichlet conditions for scalars.
subroutine usr_scalar_apply_scalar_dev(this, x_d, t, tstep)
Scalar apply (device version) Just imitating inflow for now, but we should look this over Applies bou...
subroutine usr_scalar_apply_vector_dev(this, x_d, y_d, z_d, t, tstep)
No-op vector apply (device version)
subroutine usr_scalar_apply_vector(this, x, y, z, n, t, tstep)
No-op vector apply.
subroutine usr_scalar_set_eval(this, user_scalar_bc)
Assign user provided eval function.
subroutine usr_scalar_apply_scalar(this, x, n, t, tstep)
Scalar apply Just imitating inflow for now, but we should look this over Applies boundary conditions ...
subroutine usr_scalar_set_coef(this, c)
Assign coefficients (facet normals etc)
subroutine usr_inflow_free(this)
subroutine usr_scalar_validate(this)
Validate user scalar condition.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Generic Dirichlet boundary condition on .
User defined dirichlet condition for scalars.