Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
scalar_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!
35 use bc, only : bc_t
36 use coefs, only : coef_t
37 use, intrinsic :: iso_c_binding, only : c_ptr
38 use json_module, only : json_file
39 use num_types, only : rp
41 register_scalar_pnpn_bc
42 use time_state, only : time_state_t
43 use utils, only : neko_error
44 implicit none
45 private
46
49 contains
51 procedure :: apply_scalar => scalar_pnpn_bc_template_apply_scalar
53 procedure :: apply_vector => scalar_pnpn_bc_template_apply_vector
55 procedure :: apply_scalar_dev => &
58 procedure :: apply_vector_dev => &
61 procedure :: init => scalar_pnpn_bc_template_init
63 procedure :: free => scalar_pnpn_bc_template_free
65 procedure :: finalize => scalar_pnpn_bc_template_finalize
67
69
70contains
71
75 subroutine scalar_pnpn_bc_template_init(this, coef, json)
76 class(scalar_pnpn_bc_template_t), target, intent(inout) :: this
77 type(coef_t), target, intent(in) :: coef
78 type(json_file), intent(inout) :: json
79
80 call this%free()
81 call this%init_base(coef)
82 this%bc_type = -1
83
84 ! TODO: Read parameters from json and set this%bc_type to the appropriate
85 ! BC_* classification from the bc module.
86 end subroutine scalar_pnpn_bc_template_init
87
93 subroutine scalar_pnpn_bc_template_apply_scalar(this, x, n, time, strong)
94 class(scalar_pnpn_bc_template_t), intent(inout) :: this
95 integer, intent(in) :: n
96 real(kind=rp), intent(inout) :: x(n)
97 type(time_state_t), intent(in), optional :: time
98 logical, intent(in), optional :: strong
99
100 ! TODO: Apply the condition to the entries in this%msk.
101 call neko_error("scalar_pnpn_bc_template: apply_scalar is not implemented")
103
111 subroutine scalar_pnpn_bc_template_apply_vector(this, x, y, z, n, time, &
112 strong)
113 class(scalar_pnpn_bc_template_t), intent(inout) :: this
114 integer, intent(in) :: n
115 real(kind=rp), intent(inout) :: x(n), y(n), z(n)
116 type(time_state_t), intent(in), optional :: time
117 logical, intent(in), optional :: strong
118
119 ! Required by bc_t, but not used by the scalar scheme.
120 call neko_error("scalar_pnpn_bc_template: apply_vector is not implemented")
122
128 subroutine scalar_pnpn_bc_template_apply_scalar_dev(this, x_d, time, &
129 strong, strm)
130 class(scalar_pnpn_bc_template_t), target, intent(inout) :: this
131 type(c_ptr), intent(inout) :: x_d
132 type(time_state_t), intent(in), optional :: time
133 logical, intent(in), optional :: strong
134 type(c_ptr), intent(inout) :: strm
135
136 ! TODO: Launch the device implementation of the scalar condition.
137 call neko_error( &
138 "scalar_pnpn_bc_template: apply_scalar_dev is not implemented")
140
148 subroutine scalar_pnpn_bc_template_apply_vector_dev(this, x_d, y_d, z_d, &
149 time, strong, strm)
150 class(scalar_pnpn_bc_template_t), target, intent(inout) :: this
151 type(c_ptr), intent(inout) :: x_d, y_d, z_d
152 type(time_state_t), intent(in), optional :: time
153 logical, intent(in), optional :: strong
154 type(c_ptr), intent(inout) :: strm
155
156 ! Required by bc_t, but not used by the scalar scheme.
157 call neko_error( &
158 "scalar_pnpn_bc_template: apply_vector_dev is not implemented")
160
163 class(scalar_pnpn_bc_template_t), target, intent(inout) :: this
164
165 call this%free_base()
166 end subroutine scalar_pnpn_bc_template_free
167
170 class(scalar_pnpn_bc_template_t), target, intent(inout) :: this
171
172 call this%finalize_base()
174
177 procedure(scalar_pnpn_bc_allocate), pointer :: allocator
178
180 call register_scalar_pnpn_bc("scalar_pnpn_bc_template", allocator)
182
186 class(bc_t), pointer, intent(inout) :: obj
187
188 allocate(scalar_pnpn_bc_template_t::obj)
Boundary condition factory. Both constructs and initializes the object.
Defines a boundary condition.
Definition bc.f90:34
Coefficients.
Definition coef.f90:34
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Template for a user-defined scalar Pn/Pn boundary condition.
subroutine scalar_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 scalar_pnpn_bc_template_free(this)
Destructor.
subroutine scalar_pnpn_bc_template_init(this, coef, json)
Constructor from JSON.
subroutine, public scalar_pnpn_bc_template_register_types()
Register the custom boundary condition type with scalar Pn/Pn.
subroutine scalar_pnpn_bc_template_apply_vector(this, x, y, z, n, time, strong)
Apply the boundary condition to a vector field on the CPU.
subroutine scalar_pnpn_bc_template_allocate(obj)
Allocate the custom boundary condition.
subroutine scalar_pnpn_bc_template_apply_scalar_dev(this, x_d, time, strong, strm)
Apply the boundary condition to a scalar field on the device.
subroutine scalar_pnpn_bc_template_finalize(this)
Finalize the boundary condition.
subroutine scalar_pnpn_bc_template_apply_scalar(this, x, n, time, strong)
Apply the boundary condition to a scalar field on the CPU.
Contains the scalar_pnpn_t type.
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:135
A user-defined scalar Pn/Pn boundary condition.
A struct that contains all info about the time, expand as needed.