40 use,
intrinsic :: iso_c_binding, only : c_ptr
44 use json_module,
only : json_file
67 procedure, pass(this) :: init_from_components => &
69 procedure, pass(this) :: set_stress_scalar => &
71 procedure, pass(this) :: set_stress_array => &
74 generic :: set_stress => set_stress_scalar, set_stress_array
86 integer,
intent(in) :: n
87 real(kind=
rp),
intent(inout),
dimension(n) :: x
89 logical,
intent(in),
optional :: strong
90 integer :: i, m, k, facet
94 call neko_error(
"The shear stress bc is not applicable to scalar fields.")
102 integer,
intent(in) :: n
103 real(kind=
rp),
intent(inout),
dimension(n) :: x
104 real(kind=
rp),
intent(inout),
dimension(n) :: y
105 real(kind=
rp),
intent(inout),
dimension(n) :: z
107 logical,
intent(in),
optional :: strong
110 real(kind=
rp) :: normal(3), u_n
112 if (
present(strong))
then
119 m = this%resolved_msk%size()
122 k = this%resolved_msk%get(i)
123 normal = this%n%x(:,i)
124 u_n = x(k) * normal(1) + y(k) * normal(2) + z(k) * normal(3)
126 x(k) = x(k) - u_n * normal(1)
127 y(k) = y(k) - u_n * normal(2)
128 z(k) = z(k) - u_n * normal(3)
131 call this%neumann_x%apply_scalar(x, n, strong = .false.)
132 call this%neumann_y%apply_scalar(y, n, strong = .false.)
133 call this%neumann_z%apply_scalar(z, n, strong = .false.)
142 type(c_ptr),
intent(inout) :: x_d
144 logical,
intent(in),
optional :: strong
145 type(c_ptr),
intent(inout) :: strm
147 call neko_error(
"The shear stress bc is not applicable to scalar fields.")
156 type(c_ptr),
intent(inout) :: x_d
157 type(c_ptr),
intent(inout) :: y_d
158 type(c_ptr),
intent(inout) :: z_d
160 logical,
intent(in),
optional :: strong
161 type(c_ptr),
intent(inout) :: strm
165 if (
present(strong))
then
172 m = this%resolved_msk%size()
175 x_d, y_d, z_d, 1, 0, 0, this%n%x_d, this%t1%x_d, &
176 this%t2%x_d, m, strm)
179 call this%neumann_x%apply_scalar_dev(x_d, strong = .false., strm = strm)
180 call this%neumann_y%apply_scalar_dev(y_d, strong = .false., strm = strm)
181 call this%neumann_z%apply_scalar_dev(z_d, strong = .false., strm = strm)
191 type(
coef_t),
target,
intent(in) :: coef
192 type(json_file),
intent(inout) ::json
193 real(kind=
rp),
allocatable :: value(:)
197 if (
size(
value) .ne. 3)
then
198 call neko_error (
"The shear stress vector provided for the shear stress &
199 & boundary condition should have 3 components.")
202 call this%init_from_components(coef,
value)
210 type(
coef_t),
intent(in) :: coef
211 real(kind=
rp),
intent(in) :: value(3)
213 call this%init_base(coef)
216 call this%neumann_x%free()
217 call this%neumann_y%free()
218 call this%neumann_z%free()
220 call this%neumann_x%init_from_components(this%coef, value(1))
221 call this%neumann_y%init_from_components(this%coef, value(2))
222 call this%neumann_z%init_from_components(this%coef, value(3))
228 call this%finalize_base()
230 call this%neumann_x%mark_facets(this%marked_facet)
231 call this%neumann_y%mark_facets(this%marked_facet)
232 call this%neumann_z%mark_facets(this%marked_facet)
234 call this%neumann_x%finalize()
235 call this%neumann_y%finalize()
236 call this%neumann_z%finalize()
243 real(kind=
rp),
intent(in) :: tau_x
244 real(kind=
rp),
intent(in) :: tau_y
245 real(kind=
rp),
intent(in) :: tau_z
248 call this%neumann_x%set_flux(tau_x, 1)
249 call this%neumann_y%set_flux(tau_y, 1)
250 call this%neumann_z%set_flux(tau_z, 1)
263 call this%neumann_x%set_flux(tau_x, 1)
264 call this%neumann_y%set_flux(tau_y, 1)
265 call this%neumann_z%set_flux(tau_z, 1)
272 call this%free_mixed()
274 call this%neumann_x%free
275 call this%neumann_y%free
276 call this%neumann_z%free
__inline__ __device__ void nonlinear_index(const int idx, const int lx, int *index)
Defines a boundary condition.
integer, parameter, public bc_mixed_constrains_normal
Device wrappers for basis-aware mixed boundary-condition constraint kernels. These routines operate o...
subroutine, public device_constrain_mixed_bc_zero(mixed_msk, x, y, z, constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm)
Constrain mixed-boundary projections by zeroing the selected local components on the device.
Utilities for retrieving parameters from the case files.
Defines a Neumann boundary condition.
integer, parameter, public rp
Global precision used in computations.
Defines a shear stress boundary condition for a vector field. Maintainer: Timofey Mukha.
subroutine shear_stress_init_from_components(this, coef, value)
Constructor from components.
subroutine shear_stress_free(this)
Destructor.
subroutine shear_stress_finalize(this)
subroutine shear_stress_apply_scalar(this, x, n, time, strong)
Apply shear stress for a scalar field x.
subroutine shear_stress_set_stress_array(this, tau_x, tau_y, tau_z)
Set the shear stress components.
subroutine shear_stress_apply_scalar_dev(this, x_d, time, strong, strm)
Boundary condition apply for a generic shear_stress condition to a vector x (device version)
subroutine shear_stress_set_stress_scalar(this, tau_x, tau_y, tau_z)
Set the value of the shear stress vector using 3 scalars.
subroutine shear_stress_init(this, coef, json)
Constructor.
subroutine shear_stress_apply_vector_dev(this, x_d, y_d, z_d, time, strong, strm)
Boundary condition apply for a generic shear_stress condition to vectors x, y and z (device version)
subroutine shear_stress_apply_vector(this, x, y, z, n, time, strong)
Boundary condition apply for a generic shear_stress condition to vectors x, y and z.
Module with things related to the simulation time.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Base type for mixed boundary conditions that need projector-provided local-basis data on the physical...
A Neumann boundary condition. Sets the flux of the field to the chosen values.
A shear stress boundary condition.
A struct that contains all info about the time, expand as needed.