Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
fluid_pnpn_bc_template.f90
Go to the documentation of this file.
1! Copyright (c) 2026, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
38 use bc, only : bc_t
39 use coefs, only : coef_t
40 use, intrinsic :: iso_c_binding, only : c_ptr
41 use json_module, only : json_file
42 use num_types, only : rp
44 register_fluid_pnpn_velocity_bc
45 use time_state, only : time_state_t
46 use utils, only : neko_error
47 implicit none
48 private
49
52 contains
54 procedure :: apply_scalar => fluid_pnpn_bc_template_apply_scalar
56 procedure :: apply_vector => fluid_pnpn_bc_template_apply_vector
58 procedure :: apply_scalar_dev => &
61 procedure :: apply_vector_dev => &
64 procedure :: init => fluid_pnpn_bc_template_init
66 procedure :: free => fluid_pnpn_bc_template_free
68 procedure :: finalize => fluid_pnpn_bc_template_finalize
70
72
73contains
74
78 subroutine fluid_pnpn_bc_template_init(this, coef, json)
79 class(fluid_pnpn_bc_template_t), target, intent(inout) :: this
80 type(coef_t), target, intent(in) :: coef
81 type(json_file), intent(inout) :: json
82
83 call this%free()
84 call this%init_base(coef)
85 this%bc_type = -1
86
87 ! TODO: Read parameters from json and set this%bc_type to the appropriate
88 ! BC_* classification from the bc module. The fluid scheme uses
89 ! bc_type to decide how the condition enters the residual
90 ! projectors: BC_DIRICHLET conditions are treated as strong
91 ! constraints on all components. Mixed conditions must extend
92 ! mixed_bc_t and require the full stress formulation.
93 end subroutine fluid_pnpn_bc_template_init
94
100 subroutine fluid_pnpn_bc_template_apply_scalar(this, x, n, time, strong)
101 class(fluid_pnpn_bc_template_t), intent(inout) :: this
102 integer, intent(in) :: n
103 real(kind=rp), intent(inout) :: x(n)
104 type(time_state_t), intent(in), optional :: time
105 logical, intent(in), optional :: strong
106
107 ! Required by bc_t, but not used for velocity conditions.
108 call neko_error("fluid_pnpn_bc_template: apply_scalar is not implemented")
110
118 subroutine fluid_pnpn_bc_template_apply_vector(this, x, y, z, n, time, &
119 strong)
120 class(fluid_pnpn_bc_template_t), intent(inout) :: this
121 integer, intent(in) :: n
122 real(kind=rp), intent(inout) :: x(n), y(n), z(n)
123 type(time_state_t), intent(in), optional :: time
124 logical, intent(in), optional :: strong
125
126 ! TODO: Apply the condition to the velocity components in this%msk.
127 call neko_error("fluid_pnpn_bc_template: apply_vector is not implemented")
129
135 subroutine fluid_pnpn_bc_template_apply_scalar_dev(this, x_d, time, &
136 strong, strm)
137 class(fluid_pnpn_bc_template_t), target, intent(inout) :: this
138 type(c_ptr), intent(inout) :: x_d
139 type(time_state_t), intent(in), optional :: time
140 logical, intent(in), optional :: strong
141 type(c_ptr), intent(inout) :: strm
142
143 ! Required by bc_t, but not used for velocity conditions.
144 call neko_error( &
145 "fluid_pnpn_bc_template: apply_scalar_dev is not implemented")
147
155 subroutine fluid_pnpn_bc_template_apply_vector_dev(this, x_d, y_d, z_d, &
156 time, strong, strm)
157 class(fluid_pnpn_bc_template_t), target, intent(inout) :: this
158 type(c_ptr), intent(inout) :: x_d, y_d, z_d
159 type(time_state_t), intent(in), optional :: time
160 logical, intent(in), optional :: strong
161 type(c_ptr), intent(inout) :: strm
162
163 ! TODO: Launch the device implementation of the velocity condition.
164 call neko_error( &
165 "fluid_pnpn_bc_template: apply_vector_dev is not implemented")
167
170 class(fluid_pnpn_bc_template_t), target, intent(inout) :: this
171
172 call this%free_base()
173 end subroutine fluid_pnpn_bc_template_free
174
177 class(fluid_pnpn_bc_template_t), target, intent(inout) :: this
178
179 call this%finalize_base()
181
184 procedure(fluid_pnpn_bc_allocate), pointer :: allocator
185
187 call register_fluid_pnpn_velocity_bc("fluid_pnpn_bc_template", allocator)
189
193 class(bc_t), pointer, intent(inout) :: obj
194
195 allocate(fluid_pnpn_bc_template_t::obj)
197end module fluid_pnpn_bc_template
Split a boundary condition entry of the case file into a velocity part and a pressure part.
Defines a boundary condition.
Definition bc.f90:34
Coefficients.
Definition coef.f90:34
Template for a user-defined fluid Pn/Pn velocity boundary condition. A pressure condition is register...
subroutine fluid_pnpn_bc_template_apply_scalar_dev(this, x_d, time, strong, strm)
Apply the boundary condition to a scalar field on the device.
subroutine fluid_pnpn_bc_template_apply_vector_dev(this, x_d, y_d, z_d, time, strong, strm)
Apply the boundary condition to a vector field on the device.
subroutine fluid_pnpn_bc_template_finalize(this)
Finalize the boundary condition.
subroutine fluid_pnpn_bc_template_apply_vector(this, x, y, z, n, time, strong)
Apply the boundary condition to a vector field on the CPU.
subroutine fluid_pnpn_bc_template_allocate(obj)
Allocate the custom boundary condition.
subroutine fluid_pnpn_bc_template_apply_scalar(this, x, n, time, strong)
Apply the boundary condition to a scalar field on the CPU.
subroutine fluid_pnpn_bc_template_free(this)
Destructor.
subroutine fluid_pnpn_bc_template_init(this, coef, json)
Constructor from JSON.
subroutine, public fluid_pnpn_bc_template_register_types()
Register the custom velocity boundary condition type with fluid Pn/Pn.
Modular version of the Classic Nek5000 Pn/Pn formulation for fluids.
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Module with things related to the simulation time.
Utilities.
Definition utils.f90:35
Base type for a boundary condition.
Definition bc.f90:73
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:136
A user-defined fluid Pn/Pn velocity boundary condition.
A struct that contains all info about the time, expand as needed.