Neko  0.9.99
A portable framework for high-order spectral element flow simulations
les_model_fctry.f90
Go to the documentation of this file.
1 ! Copyright (c) 2021-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 submodule(les_model) les_model_fctry
34  use vreman, only : vreman_t
35  use smagorinsky, only : smagorinsky_t
37  use sigma, only : sigma_t
39  implicit none
40 
41  ! List of all possible types created by the factory routine
42  character(len=20) :: LES_KNOWN_TYPES(4) = [character(len=20) :: &
43  "vreman", &
44  "smagorinsky", &
45  "dymamic_smagorinsky", &
46  "sigma"]
47 
48 contains
55  module subroutine les_model_factory(object, type_name, dofmap, coef, json)
56  class(les_model_t), allocatable, intent(inout) :: object
57  character(len=*), intent(in) :: type_name
58  type(dofmap_t), intent(in) :: dofmap
59  type(coef_t), intent(in) :: coef
60  type(json_file), intent(inout) :: json
61  character(len=:), allocatable :: type_string
62 
63  if (allocated(object)) then
64  deallocate(object)
65  else if (trim(type_name) .eq. 'vreman') then
66  allocate(vreman_t::object)
67  else if (trim(type_name) .eq. 'smagorinsky') then
68  allocate(smagorinsky_t::object)
69  else if (trim(type_name) .eq. 'dynamic_smagorinsky') then
70  allocate(dynamic_smagorinsky_t::object)
71  else if (trim(type_name) .eq. 'sigma') then
72  allocate(sigma_t::object)
73  else
74  type_string = concat_string_array(les_known_types, &
75  new_line('A') // "- ", .true.)
76  call neko_error("Unknown LES model type: " &
77  // trim(type_name) // ". Known types are: " &
78  // type_string)
79  stop
80 
81  end if
82  call object%init(dofmap, coef, json)
83  end subroutine les_model_factory
84 
85 end submodule les_model_fctry
Defines a mapping of the degrees of freedom.
Definition: dofmap.f90:35
Implements dynamic_smagorinsky_t.
Implements les_model_t.
Definition: les_model.f90:35
Implements sigma_t.
Definition: sigma.f90:35
Implements smagorinsky_t.
Definition: smagorinsky.f90:35
Utilities.
Definition: utils.f90:35
character(:) function, allocatable, public concat_string_array(array, sep, prepend)
Concatenate an array of strings into one string with array items separated by spaces.
Definition: utils.f90:255
Implements vreman_t.
Definition: vreman.f90:35
Implements the dynamic Smagorinsky LES model.
Implements the Sigma LES model.
Definition: sigma.f90:52
Implements the smagorinsky LES model.
Definition: smagorinsky.f90:51
Implements the Vreman LES model.
Definition: vreman.f90:52