Neko 1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
lambda2.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!
36
37module lambda2
38 use num_types, only : rp
39 use json_module, only : json_file
42 use field, only : field_t
43 use time_state, only : time_state_t
44 use operators, only : lambda2op
45 use case, only : case_t
48 use device
49 implicit none
50 private
51
52 type, public, extends(simulation_component_t) :: lambda2_t
54 type(field_t), pointer :: u
56 type(field_t), pointer :: v
58 type(field_t), pointer :: w
59
61 type(field_t), pointer :: lambda2
62
64 type(field_t) :: temp1
65 type(field_t) :: temp2
66
68 type(field_writer_t) :: writer
69
70 contains
72 procedure, pass(this) :: init => lambda2_init_from_json
74 generic :: init_from_components => &
75 init_from_controllers, init_from_controllers_properties
77 procedure, pass(this) :: init_from_controllers => &
81 procedure, pass(this) :: init_from_controllers_properties => &
84 procedure, private, pass(this) :: init_common => lambda2_init_common
86 procedure, pass(this) :: free => lambda2_free
88 procedure, pass(this) :: compute_ => lambda2_compute
89 end type lambda2_t
90
91contains
92
94 subroutine lambda2_init_from_json(this, json, case)
95 class(lambda2_t), intent(inout), target :: this
96 type(json_file), intent(inout) :: json
97 class(case_t), intent(inout), target ::case
98 character(len=20) :: fields(1)
99 type(field_t), pointer :: u, v, w, lambda2
100
101 ! Add fields keyword to the json so that the field_writer picks it up.
102 ! Will also add fields to the registry.
103 fields(1) = "lambda2"
104 call json%add("fields", fields)
105
106 call this%init_base(json, case)
107 call this%writer%init(json, case)
108
109 call this%init_common()
110 end subroutine lambda2_init_from_json
111
113 subroutine lambda2_init_common(this)
114 class(lambda2_t), intent(inout) :: this
115
116 this%u => neko_field_registry%get_field("u")
117 this%v => neko_field_registry%get_field("v")
118 this%w => neko_field_registry%get_field("w")
119 this%lambda2 => neko_field_registry%get_field("lambda2")
120
121 end subroutine lambda2_init_common
122
132 subroutine lambda2_init_from_controllers(this, case, order, &
133 preprocess_controller, compute_controller, output_controller, &
134 filename, precision)
135 class(lambda2_t), intent(inout) :: this
136 class(case_t), intent(inout), target :: case
137 integer :: order
138 type(time_based_controller_t), intent(in) :: preprocess_controller
139 type(time_based_controller_t), intent(in) :: compute_controller
140 type(time_based_controller_t), intent(in) :: output_controller
141 character(len=*), intent(in), optional :: filename
142 integer, intent(in), optional :: precision
143
144 character(len=20) :: fields(1)
145 fields(1) = "lambda2"
146
147 call this%init_base_from_components(case, order, preprocess_controller, &
148 compute_controller, output_controller)
149 call this%writer%init_from_components(case, order, preprocess_controller, &
150 compute_controller, output_controller, fields, filename, precision)
151 call this%init_common()
152
153 end subroutine lambda2_init_from_controllers
154
170 case, order, preprocess_control, preprocess_value, compute_control, &
171 compute_value, output_control, output_value, filename, precision)
172 class(lambda2_t), intent(inout) :: this
173 class(case_t), intent(inout), target :: case
174 integer :: order
175 character(len=*), intent(in) :: preprocess_control
176 real(kind=rp), intent(in) :: preprocess_value
177 character(len=*), intent(in) :: compute_control
178 real(kind=rp), intent(in) :: compute_value
179 character(len=*), intent(in) :: output_control
180 real(kind=rp), intent(in) :: output_value
181 character(len=*), intent(in), optional :: filename
182 integer, intent(in), optional :: precision
183
184 character(len=20) :: fields(1)
185 fields(1) = "lambda2"
186
187 call this%init_base_from_components(case, order, preprocess_control, &
188 preprocess_value, compute_control, compute_value, output_control, &
189 output_value)
190 call this%writer%init_from_components(case, order, preprocess_control, &
191 preprocess_value, compute_control, compute_value, output_control, &
192 output_value, fields, filename, precision)
193 call this%init_common()
194
196
198 subroutine lambda2_free(this)
199 class(lambda2_t), intent(inout) :: this
200 call this%free_base()
201 end subroutine lambda2_free
202
205 subroutine lambda2_compute(this, time)
206 class(lambda2_t), intent(inout) :: this
207 type(time_state_t), intent(in) :: time
208
209 call lambda2op(this%lambda2, this%u, this%v, this%w, this%case%fluid%c_Xh)
210
211 end subroutine lambda2_compute
212
213end module lambda2
Defines a simulation case.
Definition case.f90:34
Device abstraction, common interface for various accelerators.
Definition device.F90:34
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
Implements the field_writer_t type.
Defines a field.
Definition field.f90:34
A simulation component that computes lambda2 The values are stored in the field registry under the na...
Definition lambda2.f90:37
subroutine lambda2_init_from_controllers_properties(this, case, order, preprocess_control, preprocess_value, compute_control, compute_value, output_control, output_value, filename, precision)
Constructor from components, passing properties to the time_based_controller` components in the base ...
Definition lambda2.f90:172
subroutine lambda2_init_from_json(this, json, case)
Constructor from json.
Definition lambda2.f90:95
subroutine lambda2_init_from_controllers(this, case, order, preprocess_controller, compute_controller, output_controller, filename, precision)
Constructor from components, passing controllers.
Definition lambda2.f90:135
subroutine lambda2_init_common(this)
Common part of constructors.
Definition lambda2.f90:114
subroutine lambda2_compute(this, time)
Compute the lambda2 field.
Definition lambda2.f90:206
subroutine lambda2_free(this)
Destructor.
Definition lambda2.f90:199
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Operators.
Definition operators.f90:34
subroutine, public lambda2op(lambda2, u, v, w, coef)
Compute the Lambda2 field for a given velocity field.
Implements output_controller_t
Simulation components are objects that encapsulate functionality that can be fit to a particular comp...
subroutine compute_(this, time)
Dummy compute function.
Contains the time_based_controller_t type.
Module with things related to the simulation time.
A simulation component that writes a 3d field to a file.
Base abstract class for simulation components.
A utility type for determining whether an action should be executed based on the current time value....
A struct that contains all info about the time, expand as needed.