Loading [MathJax]/extensions/tex2jax.js
Neko 0.9.99
A portable framework for high-order spectral element flow simulations
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Pages
les_simcomp.f90
Go to the documentation of this file.
1! Copyright (c) 2023, 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!
35
37 use num_types, only : rp
38 use json_module, only : json_file
40 use case, only : case_t
41 use time_state, only : time_state_t
42 use les_model, only : les_model_t, les_model_factory
45 use utils, only : neko_error
46 implicit none
47 private
48
51 type, public, extends(simulation_component_t) :: les_simcomp_t
53 class(les_model_t), allocatable :: les_model
55 type(field_writer_t) :: writer
56 contains
58 procedure, pass(this) :: init => les_simcomp_init_from_json
60 procedure, pass(this) :: free => les_simcomp_free
62 procedure, pass(this) :: preprocess_ => les_simcomp_compute
64 procedure, pass(this) :: restart_ => les_simcomp_restart
65 end type les_simcomp_t
66
67contains
68
70 subroutine les_simcomp_init_from_json(this, json, case)
71 class(les_simcomp_t), intent(inout) :: this
72 type(json_file), intent(inout) :: json
73 class(case_t), intent(inout), target :: case
74 character(len=:), allocatable :: name
75 character(len=:), allocatable :: nut_field
76 character(len=20) :: fields(2)
77
78 call this%free()
79
80 ! Check for whether eddy viscosity is enabled in fluid_scheme_incompressible
81 if (case%fluid%variable_material_properties .eqv. .false.) then
82 call neko_error("Eddy viscosity is not acting &
83 &on the equations. &
84 &Please set up a nut_field option &
85 &in the fluid solver")
86 end if
87
88 ! Add fields keyword to the json so that the field_writer picks it up.
89 ! Will also add fields to the registry if missing.
90 call json_get_or_default(json, "nut_field", nut_field, "nut")
91 fields(1) = "les_delta"
92 fields(2) = nut_field
93
94 call json%add("fields", fields)
95
96 call this%init_base(json, case)
97 call this%writer%init(json, case)
98
99 call json_get(json, "model", name)
100
101 call les_model_factory(this%les_model, name, case%fluid, json)
102 end subroutine les_simcomp_init_from_json
103
105 subroutine les_simcomp_free(this)
106 class(les_simcomp_t), intent(inout) :: this
107 call this%free_base()
108 call this%writer%free()
109
110 if (allocated(this%les_model)) then
111 call this%les_model%free()
112 deallocate(this%les_model)
113 end if
114 end subroutine les_simcomp_free
115
118 subroutine les_simcomp_compute(this, time)
119 class(les_simcomp_t), intent(inout) :: this
120 type(time_state_t), intent(in) :: time
121
122 call this%les_model%compute(time%t, time%tstep)
123 end subroutine les_simcomp_compute
124
127 subroutine les_simcomp_restart(this, time)
128 class(les_simcomp_t), intent(inout) :: this
129 type(time_state_t), intent(in) :: time
130
131 call this%les_model%compute(time%t, 0)
132 end subroutine les_simcomp_restart
133
134end module les_simcomp
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Defines a simulation case.
Definition case.f90:34
Implements the field_writer_t type.
Utilities for retrieving parameters from the case files.
Implements les_model_t.
Definition les_model.f90:35
Implements the les_simcomp_t type.
subroutine les_simcomp_restart(this, time)
Compute the les_simcomp field when restart.
subroutine les_simcomp_init_from_json(this, json, case)
Constructor from json.
subroutine les_simcomp_compute(this, time)
Compute the les_simcomp field.
subroutine les_simcomp_free(this)
Destructor.
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Simulation components are objects that encapsulate functionality that can be fit to a particular comp...
subroutine restart_(this, time)
Dummy restart function.
subroutine preprocess_(this, time)
Dummy preprocessing function.
Module with things related to the simulation time.
Utilities.
Definition utils.f90:35
A simulation component that writes a 3d field to a file.
Base abstract type for LES models based on the Boussinesq approximation.
Definition les_model.f90:64
A simulation component that drives the computation of the SGS viscosity.
Base abstract class for simulation components.
A struct that contains all info about the time, expand as needed.