Neko 1.99.7
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
scalar_pnpn_bc_fctry.f90
Go to the documentation of this file.
1! Copyright (c) 2024-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!
33!
35submodule(scalar_pnpn) scalar_pnpn_bc_fctry
36 use dirichlet, only : dirichlet_t
37 use neumann, only : neumann_t
38 use user_intf, only : user_t
39 use utils, only : neko_type_error
44 implicit none
45
46 ! List of all possible types created by the boundary condition factories
47 character(len=25) :: SCALAR_PNPN_KNOWN_BCS(6) = [character(len=25) :: &
48 "dirichlet", &
49 "expression_dirichlet", &
50 "user_dirichlet", &
51 "user_neumann", &
52 "neumann", &
53 "overset_interface"]
54
55contains
56
64 module subroutine bc_factory(object, scheme, json, coef, user)
65 class(bc_t), pointer, intent(inout) :: object
66 type(scalar_pnpn_t), intent(in) :: scheme
67 type(json_file), intent(inout) :: json
68 type(coef_t), target, intent(in) :: coef
69 type(user_t), intent(in) :: user
70 character(len=:), allocatable :: type
71 integer :: i
72 integer, allocatable :: zone_indices(:)
73 character(len=:), allocatable :: default_name
74 character(len=64) :: buf
75
76 if (associated(object)) then
77 call object%free()
78 nullify(object)
79 end if
80
81 call json_get(json, "type", type)
82
83 select case (trim(type))
84 case ("user_dirichlet")
85 allocate(field_dirichlet_t::object)
86 select type (obj => object)
87 type is (field_dirichlet_t)
88 obj%update => user%dirichlet_conditions
89 ! Add the name of the dummy field in the bc, matching the scalar
90 ! solved for.
91 call json%add("field_name", scheme%s%name)
92 end select
93 case ("dirichlet")
94 allocate(dirichlet_t::object)
95 case ("expression_dirichlet")
96 allocate(expression_dirichlet_t::object)
97 case ("user_neumann")
98 allocate(field_neumann_t::object)
99 select type (obj => object)
100 type is (field_neumann_t)
101 obj%update => user%neumann_conditions
102 ! Add the name of the dummy field in the bc, matching the scalar
103 ! solved for.
104 call json%add("field_name", scheme%s%name)
105 end select
106 case ("neumann")
107 allocate(neumann_t::object)
108 case ("overset_interface")
109 allocate(overset_interface_t::object)
110 select type (obj => object)
111 type is (overset_interface_t)
112 call json%add("field_name", scheme%s%name)
113 end select
114 case default
115 call neko_type_error("scalar_pnpn boundary conditions", type, &
116 SCALAR_PNPN_KNOWN_BCS)
117 end select
118
119 call json_get(json, "zone_indices", zone_indices)
120 call object%init(coef, json)
121 do i = 1, size(zone_indices)
122 call object%mark_zone(coef%msh%labeled_zones(zone_indices(i)))
123 end do
124
125 write(buf,'("scalar_bc_",I0)') zone_indices(1)
126 default_name = trim(buf)
127 call json_get_or_default(json, "name", object%name, default_name)
128 object%zone_indices = zone_indices
129 call object%finalize()
130
131 end subroutine bc_factory
132
133
134end submodule scalar_pnpn_bc_fctry
Defines a dirichlet boundary condition.
Definition dirichlet.f90:34
Defines a Dirichlet condition prescribed by a mathematical expression.
Defines user dirichlet condition for a scalar field.
Defines user neumann condition for a scalar field.
Defines a Neumann boundary condition.
Definition neumann.f90:34
Defines overset interface scalar boundary conditions.
Contains the scalar_pnpn_t type.
Interfaces for user interaction with NEKO.
Definition user_intf.f90:34
Utilities.
Definition utils.f90:35
subroutine, public neko_type_error(base_type, wrong_type, known_types)
Reports an error allocating a type for a particular base pointer class.
Definition utils.f90:365
Generic Dirichlet boundary condition on .
Definition dirichlet.f90:49
Dirichlet condition on , where is a mathematical expression given in the case file.
User defined dirichlet condition, for which the user can work with an entire field....
User defined neumann condition, for which the user can work with an entire field. The type stores a s...
A Neumann boundary condition. Sets the flux of the field to the chosen values.
Definition neumann.f90:60
Overset interface BC for a scalar field.
A type collecting all the overridable user routines and flag to suppress type injection from custom m...