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()
123 k = this%resolved_msk%get(i)
124 normal = this%n%x(:,i)
125 u_n = x(k) * normal(1) + y(k) * normal(2) + z(k) * normal(3)
127 x(k) = x(k) - u_n * normal(1)
128 y(k) = y(k) - u_n * normal(2)
129 z(k) = z(k) - u_n * normal(3)
133 call this%neumann_x%apply_scalar(x, n, strong = .false.)
134 call this%neumann_y%apply_scalar(y, n, strong = .false.)
135 call this%neumann_z%apply_scalar(z, n, strong = .false.)
144 type(c_ptr),
intent(inout) :: x_d
146 logical,
intent(in),
optional :: strong
147 type(c_ptr),
intent(inout) :: strm
149 call neko_error(
"The shear stress bc is not applicable to scalar fields.")
158 type(c_ptr),
intent(inout) :: x_d
159 type(c_ptr),
intent(inout) :: y_d
160 type(c_ptr),
intent(inout) :: z_d
162 logical,
intent(in),
optional :: strong
163 type(c_ptr),
intent(inout) :: strm
167 if (
present(strong))
then
174 m = this%resolved_msk%size()
177 x_d, y_d, z_d, 1, 0, 0, this%n%x_d, this%t1%x_d, &
178 this%t2%x_d, m, strm)
181 call this%neumann_x%apply_scalar_dev(x_d, strong = .false., strm = strm)
182 call this%neumann_y%apply_scalar_dev(y_d, strong = .false., strm = strm)
183 call this%neumann_z%apply_scalar_dev(z_d, strong = .false., strm = strm)
193 type(
coef_t),
target,
intent(in) :: coef
194 type(json_file),
intent(inout) ::json
195 real(kind=
rp),
allocatable :: value(:)
199 if (
size(
value) .ne. 3)
then
200 call neko_error (
"The shear stress vector provided for the shear stress &
201 & boundary condition should have 3 components.")
204 call this%init_from_components(coef,
value)
212 type(
coef_t),
intent(in) :: coef
213 real(kind=
rp),
intent(in) :: value(3)
215 call this%init_base(coef)
218 call this%neumann_x%free()
219 call this%neumann_y%free()
220 call this%neumann_z%free()
222 call this%neumann_x%init_from_components(this%coef, value(1))
223 call this%neumann_y%init_from_components(this%coef, value(2))
224 call this%neumann_z%init_from_components(this%coef, value(3))
230 call this%finalize_base()
232 call this%neumann_x%mark_facets(this%marked_facet)
233 call this%neumann_y%mark_facets(this%marked_facet)
234 call this%neumann_z%mark_facets(this%marked_facet)
236 call this%neumann_x%finalize()
237 call this%neumann_y%finalize()
238 call this%neumann_z%finalize()
245 real(kind=
rp),
intent(in) :: tau_x
246 real(kind=
rp),
intent(in) :: tau_y
247 real(kind=
rp),
intent(in) :: tau_z
250 call this%neumann_x%set_flux(tau_x, 1)
251 call this%neumann_y%set_flux(tau_y, 1)
252 call this%neumann_z%set_flux(tau_z, 1)
265 call this%neumann_x%set_flux(tau_x, 1)
266 call this%neumann_y%set_flux(tau_y, 1)
267 call this%neumann_z%set_flux(tau_z, 1)
274 call this%free_mixed()
276 call this%neumann_x%free
277 call this%neumann_y%free
278 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.