42 use json_module,
only : json_file
48 use,
intrinsic :: iso_c_binding, only : c_ptr
72 procedure, pass(this) :: init_from_components => &
109 type(
coef_t),
target,
intent(in) :: coef
110 type(json_file),
intent(inout) :: json
111 character(len=:),
allocatable :: field_name
113 call json_get(json,
"field_name", field_name)
114 call this%init_from_components(coef, field_name)
115 if (
allocated(field_name))
then
116 deallocate(field_name)
126 type(
coef_t),
intent(in) :: coef
127 character(len=*),
intent(in) :: field_name
129 call this%init_base(coef)
130 this%strong = .false.
132 call this%field_bc%init(this%dof, field_name)
133 call this%field_list%init(1)
134 call this%field_list%assign_to_field(1, this%field_bc)
143 call this%field_bc%free()
144 call this%field_list%free()
145 call this%flux%free()
147 if (
associated(this%update))
then
148 this%update => null()
157 if (this%msk(0) .gt. 0)
then
160 this%msk_d, this%field_bc%dof%size(), this%msk(0))
163 this%msk, this%field_bc%dof%size(), this%msk(0))
175 integer,
intent(in) :: n
176 real(kind=
rp),
intent(inout),
dimension(n) :: x
178 logical,
intent(in),
optional :: strong
179 integer :: i, m, k, facet
183 if (
present(strong))
then
189 if (.not. strong_)
then
191 if (.not. this%updated)
then
192 call this%update(this%field_list, this, time)
193 call this%gather_flux()
194 this%updated = .true.
201 facet = this%facet(i)
208 this%coef%area(idx(2), idx(3), facet, idx(4))
212 this%coef%area(idx(1), idx(3), facet, idx(4))
216 this%coef%area(idx(1), idx(2), facet, idx(4))
230 type(c_ptr),
intent(inout) :: x_d
232 logical,
intent(in),
optional :: strong
233 type(c_ptr),
intent(inout) :: strm
236 if (
present(strong))
then
242 if (.not. strong_)
then
243 if (.not. this%updated)
then
244 call this%update(this%field_list, this, time)
245 call this%gather_flux()
246 this%updated = .true.
249 if (this%msk(0) .gt. 0)
then
251 this%flux%x_d, this%coef%area_d, this%coef%Xh%lx, &
252 size(this%msk), strm)
261 integer,
intent(in) :: n
262 real(kind=
rp),
intent(inout),
dimension(n) :: x
263 real(kind=
rp),
intent(inout),
dimension(n) :: y
264 real(kind=
rp),
intent(inout),
dimension(n) :: z
266 logical,
intent(in),
optional :: strong
268 call neko_error(
"field_neumann cannot apply vector BCs.")
276 type(c_ptr),
intent(inout) :: x_d
277 type(c_ptr),
intent(inout) :: y_d
278 type(c_ptr),
intent(inout) :: z_d
280 logical,
intent(in),
optional :: strong
281 type(c_ptr),
intent(inout) :: strm
283 call neko_error(
"field_neumann cannot apply vector BCs.")
290 logical,
optional,
intent(in) :: only_facets
292 if (
present(only_facets))
then
293 if (.not. only_facets)
then
294 call neko_error(
"For field_neumann_t, only_facets has to be true.")
298 call this%finalize_base(.true.)
299 call this%flux%init(this%msk(0))
__inline__ __device__ void nonlinear_index(const int idx, const int lx, int *index)
Abstract interface defining a neumann condition on a list of fields.
Retrieves a parameter by name or throws an error.
Defines a boundary condition.
subroutine, public device_masked_gather_copy_0(a_d, b_d, mask_d, n, n_mask, strm)
Gather a masked vector .
subroutine, public device_neumann_apply_scalar(msk, facet, x, flux, area, lx, m, strm)
Defines user neumann condition for a scalar field.
subroutine field_neumann_gather_flux(this)
Gather field-defined values into compact boundary flux storage.
subroutine field_neumann_apply_vector_dev(this, x_d, y_d, z_d, time, strong, strm)
(No-op) Apply vector (device).
subroutine field_neumann_free(this)
Destructor.
subroutine field_neumann_finalize(this, only_facets)
Finalize.
subroutine field_neumann_apply_scalar_dev(this, x_d, time, strong, strm)
Apply scalar (device).
subroutine field_neumann_apply_vector(this, x, y, z, n, time, strong)
(No-op) Apply vector.
subroutine field_neumann_init(this, coef, json)
Constructor.
subroutine field_neumann_apply_scalar(this, x, n, time, strong)
Apply scalar by adding weak neumann contribution.
subroutine field_neumann_init_from_components(this, coef, field_name)
Constructor from components.
Utilities for retrieving parameters from the case files.
subroutine, public masked_gather_copy_0(a, b, mask, n, n_mask)
Gather a masked vector to reduced contigous vector .
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Module with things related to the simulation time.
Base type for a boundary condition.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
field_list_t, To be able to group fields together
User defined neumann condition, for which the user can work with an entire field. The type stores a s...
A struct that contains all info about the time, expand as needed.