Neko 1.99.3
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
wall_model_fctry.f90
Go to the documentation of this file.
1! Copyright (c) 2021-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
34submodule(wall_model) wall_model_fctry
35 use spalding, only : spalding_t
38 use most, only : most_t
39 use richardson, only : richardson_t
40 use utils, only : neko_type_error
42 implicit none
43
44 ! List of all possible types created by the factory routine
45 character(len=20) :: WALLM_KNOWN_TYPES(5) = [character(len=20) :: &
46 "spalding", &
47 "cai_sagaut_model_ii", &
48 "rough_log_law", &
49 "most", &
50 "richardson"]
51
52contains
53
62 module subroutine wall_model_factory(object, scheme_name, coef, msk, facet, &
63 json)
64 class(wall_model_t), allocatable, intent(inout) :: object
65 character(len=*), intent(in) :: scheme_name
66 type(coef_t), intent(in) :: coef
67 integer, intent(in) :: msk(:)
68 integer, intent(in) :: facet(:)
69 type(json_file), intent(inout) :: json
70 character(len=:), allocatable :: type_name
71 character(len=:), allocatable :: type_string
72 integer :: h_index
73
74 call json_get(json, "model", type_name)
75 call json_get(json, "h_index", h_index)
76
77 call wall_model_allocator(object, type_name)
78
79 ! Initialize
80 call object%init(scheme_name, coef, msk, facet, h_index, json)
81
82 end subroutine wall_model_factory
83
87 module subroutine wall_model_allocator(object, type_name)
88 class(wall_model_t), allocatable, intent(inout) :: object
89 character(len=:), allocatable, intent(in) :: type_name
90 integer :: i
91
92 if (allocated(object)) then
93 call object%free()
94 deallocate(object)
95 end if
96
97 select case (trim(type_name) )
98 case ("spalding")
99 allocate(spalding_t::object)
100 case ("cai_sagaut_model_ii")
101 allocate(cai_sagaut_model_ii_t::object)
102 case ("rough_log_law")
103 allocate(rough_log_law_t::object)
104 case ("most")
105 allocate(most_t::object)
106 case ("richardson")
107 allocate(richardson_t::object)
108 case default
109 do i = 1, wall_model_registry_size
110 if (trim(type_name) .eq. trim(wall_model_registry(i)%type_name)) then
111 call wall_model_registry(i)%allocator(object)
112 return
113 end if
114 end do
115 call neko_type_error("wall model", trim(type_name), wallm_known_types)
116 end select
117 end subroutine wall_model_allocator
118
124 module subroutine register_wall_model(type_name, allocator)
125 character(len=*), intent(in) :: type_name
126 procedure(wall_model_allocate), pointer, intent(in) :: allocator
127 type(allocator_entry), allocatable :: temp(:)
128 integer :: i
129
130 do i = 1, size(wallm_known_types)
131 if (trim(type_name) .eq. trim(wallm_known_types(i))) then
132 call neko_type_registration_error("wall model", type_name, .true.)
133 end if
134 end do
135
136 do i = 1, wall_model_registry_size
137 if (trim(type_name) .eq. trim(wall_model_registry(i)%type_name)) then
138 call neko_type_registration_error("wall model", type_name, .false.)
139 end if
140 end do
141
142 ! Expand registry
143 if (wall_model_registry_size .eq. 0) then
144 allocate(wall_model_registry(1))
145 else
146 allocate(temp(wall_model_registry_size + 1))
147 temp(1:wall_model_registry_size) = wall_model_registry
148 call move_alloc(temp, wall_model_registry)
149 end if
150
151 wall_model_registry_size = wall_model_registry_size + 1
152 wall_model_registry(wall_model_registry_size)%type_name = type_name
153 wall_model_registry(wall_model_registry_size)%allocator => allocator
154 end subroutine register_wall_model
155
156end submodule wall_model_fctry
Implements cai_sagaut_model_ii_t.
Implements most_t.
Definition most.f90:35
Implements richardson_t.
Implements rough_log_law_t.
Implements spalding_t.
Definition spalding.f90:35
Utilities.
Definition utils.f90:35
subroutine, public neko_type_registration_error(base_type, wrong_type, known)
Definition utils.f90:374
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:359
Implements wall_model_t.
Explicit wall model based on Model-II from Cai and Sagaut (2021).
Wall model based on the Monin-Obukhov Similarity Theory for atmospheric boundary layer flows....
Definition most.f90:63
Wall model similar to the Monin-Obukhov Similarity Theory for atmospheric boundary layer flows,...
Wall model based on the log-law for a rough wall. The formula defining the law is ....
Wall model based on Spalding's law of the wall. Reference: http://dx.doi.org/10.1115/1....
Definition spalding.f90:58