Neko 1.99.1
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, 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
41 implicit none
42
43 ! List of all possible types created by the boundary condition factories
44 character(len=25) :: SCALAR_PNPN_KNOWN_BCS(3) = [character(len=25) :: &
45 "dirichlet", &
46 "user", &
47 "neumann"]
48
49contains
50
58 module subroutine bc_factory(object, scheme, json, coef, user)
59 class(bc_t), pointer, intent(inout) :: object
60 type(scalar_pnpn_t), intent(in) :: scheme
61 type(json_file), intent(inout) :: json
62 type(coef_t), intent(in) :: coef
63 type(user_t), intent(in) :: user
64 character(len=:), allocatable :: type
65 integer :: i
66 integer, allocatable :: zone_indices(:)
67
68 call json_get(json, "type", type)
69
70 select case (trim(type))
71 case ("user")
72 allocate(field_dirichlet_t::object)
73 select type (obj => object)
74 type is (field_dirichlet_t)
75 obj%update => user%dirichlet_conditions
76 ! Add the name of the dummy field in the bc, matching the scalar
77 ! solved for.
78 call json%add("field_name", scheme%s%name)
79 end select
80 case ("dirichlet")
81 allocate(dirichlet_t::object)
82 case ("neumann")
83 allocate(neumann_t::object)
84 case default
85 call neko_type_error("scalar_pnpn boundary conditions", type, &
86 SCALAR_PNPN_KNOWN_BCS)
87 end select
88
89 call json_get(json, "zone_indices", zone_indices)
90 call object%init(coef, json)
91 do i = 1, size(zone_indices)
92 call object%mark_zone(coef%msh%labeled_zones(zone_indices(i)))
93 end do
94 call object%finalize()
95
96 end subroutine bc_factory
97
98
99end submodule scalar_pnpn_bc_fctry
Defines a dirichlet boundary condition.
Definition dirichlet.f90:34
Defines user dirichlet condition for a scalar field.
Defines a Neumann boundary condition.
Definition neumann.f90:34
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:251
Generic Dirichlet boundary condition on .
Definition dirichlet.f90:48
User defined dirichlet condition, for which the user can work with an entire field....
A Neumann boundary condition for scalar fields. Sets the flux of the field to the chosen value.
Definition neumann.f90:56
A type collecting all the overridable user routines and flag to suppress type injection from custom m...