42 use json_module,
only : json_file
48 use,
intrinsic :: iso_c_binding, only : c_ptr
108 type(
coef_t),
target,
intent(in) :: coef
109 type(json_file),
intent(inout) :: json
110 character(len=:),
allocatable :: field_name
112 call json_get(json,
"field_name", field_name)
113 call this%init_from_components(coef, field_name)
114 if (
allocated(field_name))
then
115 deallocate(field_name)
125 type(
coef_t),
intent(in) :: coef
126 character(len=*),
intent(in) :: field_name
128 call this%init_base(coef)
129 this%strong = .false.
131 call this%field_bc%init(this%dof, field_name)
132 call this%field_list%init(1)
133 call this%field_list%assign_to_field(1, this%field_bc)
142 call this%field_bc%free()
143 call this%field_list%free()
144 call this%flux%free()
146 if (
associated(this%update))
then
147 this%update => null()
156 if (this%msk(0) .gt. 0)
then
159 this%msk_d, this%field_bc%dof%size(), this%msk(0))
162 this%msk, this%field_bc%dof%size(), this%msk(0))
174 integer,
intent(in) :: n
175 real(kind=
rp),
intent(inout),
dimension(n) :: x
177 logical,
intent(in),
optional :: strong
178 integer :: i, m, k, facet
182 if (
present(strong))
then
188 if (.not. strong_)
then
190 if (.not. this%updated)
then
191 call this%update(this%field_list, this, time)
192 call this%gather_flux()
193 this%updated = .true.
200 facet = this%facet(i)
207 this%coef%area(idx(2), idx(3), facet, idx(4))
211 this%coef%area(idx(1), idx(3), facet, idx(4))
215 this%coef%area(idx(1), idx(2), facet, idx(4))
229 type(c_ptr),
intent(inout) :: x_d
231 logical,
intent(in),
optional :: strong
232 type(c_ptr),
intent(inout) :: strm
235 if (
present(strong))
then
241 if (.not. strong_)
then
242 if (.not. this%updated)
then
243 call this%update(this%field_list, this, time)
244 call this%gather_flux()
245 this%updated = .true.
248 if (this%msk(0) .gt. 0)
then
250 this%flux%x_d, this%coef%area_d, this%coef%Xh%lx, &
251 size(this%msk), strm)
260 integer,
intent(in) :: n
261 real(kind=
rp),
intent(inout),
dimension(n) :: x
262 real(kind=
rp),
intent(inout),
dimension(n) :: y
263 real(kind=
rp),
intent(inout),
dimension(n) :: z
265 logical,
intent(in),
optional :: strong
267 call neko_error(
"field_neumann cannot apply vector BCs.")
275 type(c_ptr),
intent(inout) :: x_d
276 type(c_ptr),
intent(inout) :: y_d
277 type(c_ptr),
intent(inout) :: z_d
279 logical,
intent(in),
optional :: strong
280 type(c_ptr),
intent(inout) :: strm
282 call neko_error(
"field_neumann cannot apply vector BCs.")
289 logical,
optional,
intent(in) :: only_facets
291 if (
present(only_facets))
then
292 if (.not. only_facets)
then
293 call neko_error(
"For field_neumann_t, only_facets has to be true.")
297 call this%finalize_base(.true.)
298 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.