Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
wall_sampler_fctry.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 copyright
12! notice, this list of conditions and the following disclaimer in
13! the documentation and/or other materials provided with the
14! 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 json_module, only : json_file
36 use json_utils, only : json_get
40 use utils, only : neko_error
41 implicit none
42 private
44
45contains
46
52 subroutine wall_sampler_factory(object, json)
53 class(wall_sampler_t), allocatable, intent(inout) :: object
54 type(json_file), intent(inout) :: json
55 type(json_file) :: sampling
56 character(len=:), allocatable :: type_name
57 integer :: h_index
58
59 if (allocated(object)) then
60 call object%free()
61 deallocate(object)
62 end if
63
64 if (.not. json%valid_path('sampling')) then
65 call json_get(json, 'h_index', h_index)
66 call wall_sampler_allocator(object, 'gll')
67 select type (object)
68 type is (wall_gll_sampler_t)
69 call object%init_from_indices([h_index], .true.)
70 end select
71 return
72 end if
73
74 call json_get(json, 'sampling', sampling)
75 call json_get(sampling, 'type', type_name)
76 call wall_sampler_allocator(object, type_name)
77 call object%init(sampling)
78 end subroutine wall_sampler_factory
79
83 subroutine wall_sampler_allocator(object, type_name)
84 class(wall_sampler_t), allocatable, intent(inout) :: object
85 character(len=*), intent(in) :: type_name
86
87 if (allocated(object)) then
88 call object%free()
89 deallocate(object)
90 end if
91
92 select case (trim(type_name))
93 case ('gll')
94 allocate(wall_gll_sampler_t :: object)
95 case ('distance')
96 allocate(wall_distance_sampler_t :: object)
97 case default
98 call neko_error('Unknown wall sampler type: ' // trim(type_name))
99 end select
100 end subroutine wall_sampler_allocator
101
102end module wall_sampler_fctry
Retrieves a parameter by name or throws an error.
Utilities for retrieving parameters from the case files.
Utilities.
Definition utils.f90:35
Implements wall_distance_sampler_t.
Implements sampling from GLL nodes at prescribed off-wall indices.
Factory for wall-model samplers.
subroutine, public wall_sampler_allocator(object, type_name)
Allocate a concrete wall sampler implementation by type name.
subroutine, public wall_sampler_factory(object, json)
Wall sampler factory.
Defines the abstract interface for wall-model field samplers.
Implements wall-normal sampling at prescribed physical distances.
Wall sampler implementation for GLL nodes at prescribed off-wall indices.
Base type for sampling solution fields at points associated with wall nodes. Samples belonging to one...