40 use json_module,
only : json_file
70 procedure, pass(this) :: preprocess => &
100 type(json_file),
intent(inout) :: json
101 class(
case_t),
intent(inout),
target :: case
119 module subroutine simulation_component_factory(object, json,
case)
120 class(simulation_component_t),
allocatable,
intent(inout) :: object
121 type(json_file),
intent(inout) :: json
122 class(
case_t),
intent(inout),
target :: case
123 end subroutine simulation_component_factory
130 module subroutine simulation_component_allocator(object, type_name)
131 class(simulation_component_t),
allocatable,
intent(inout) :: object
132 character(len=*),
intent(in):: type_name
133 end subroutine simulation_component_allocator
144 subroutine simulation_component_allocate(obj)
145 import simulation_component_t
146 class(simulation_component_t),
allocatable,
intent(inout) :: obj
144 subroutine simulation_component_allocate(obj)
…
147 end subroutine simulation_component_allocate
152 module subroutine register_simulation_component(type_name, allocator)
153 character(len=*),
intent(in) :: type_name
154 procedure(simulation_component_allocate),
pointer,
intent(in) :: &
156 end subroutine register_simulation_component
162 character(len=20) :: type_name
163 procedure(simulation_component_allocate),
pointer,
nopass :: allocator
164 end type allocator_entry
161 type allocator_entry
…
167 type(allocator_entry),
allocatable :: simcomp_registry(:)
170 integer :: simcomp_registry_size = 0
172 public :: simulation_component_factory, simulation_component_allocator, &
173 register_simulation_component, simulation_component_allocate
178 subroutine simulation_component_init_base(this, json, case)
179 class(simulation_component_t),
intent(inout) :: this
180 type(json_file),
intent(inout) :: json
181 class(
case_t),
intent(inout),
target :: case
182 character(len=:),
allocatable :: preprocess_control, compute_control, &
184 real(kind=
rp) :: preprocess_value, compute_value, output_value
199 if (compute_control .eq.
"fluid_output")
then
200 call json_get(this%case%params,
'case.fluid.output_control', &
202 call json_get(this%case%params,
'case.fluid.output_value', &
212 if (output_control ==
"global")
then
213 call json_get(this%case%params,
'case.fluid.output_control', &
215 call json_get(this%case%params,
'case.fluid.output_value', &
222 call this%preprocess_controller%init(
case%time%end_time, &
223 preprocess_control, preprocess_value)
224 call this%compute_controller%init(
case%time%end_time, compute_control, &
226 call this%output_controller%init(
case%time%end_time, output_control, &
178 subroutine simulation_component_init_base(this, json, case)
…
229 end subroutine simulation_component_init_base
232 subroutine simulation_component_free_base(this)
233 class(simulation_component_t),
intent(inout) :: this
232 subroutine simulation_component_free_base(this)
…
236 end subroutine simulation_component_free_base
241 subroutine simulation_component_preprocess_wrapper(this, time)
242 class(simulation_component_t),
intent(inout) :: this
245 if (this%preprocess_controller%check(time))
then
246 call this%preprocess_(time)
247 call this%preprocess_controller%register_execution()
241 subroutine simulation_component_preprocess_wrapper(this, time)
…
249 end subroutine simulation_component_preprocess_wrapper
254 subroutine simulation_component_compute_wrapper(this, time)
255 class(simulation_component_t),
intent(inout) :: this
258 if (this%compute_controller%check(time))
then
259 call this%compute_(time)
260 call this%compute_controller%register_execution()
254 subroutine simulation_component_compute_wrapper(this, time)
…
262 end subroutine simulation_component_compute_wrapper
266 subroutine simulation_component_restart_wrapper(this, time)
267 class(simulation_component_t),
intent(inout) :: this
270 call this%compute_controller%set_counter(time)
271 call this%output_controller%set_counter(time)
272 call this%restart_(time)
266 subroutine simulation_component_restart_wrapper(this, time)
…
274 end subroutine simulation_component_restart_wrapper
278 subroutine restart_(this, time)
279 class(simulation_component_t),
intent(inout) :: this
278 subroutine restart_(this, time)
…
283 end subroutine restart_
287 subroutine preprocess_(this, time)
288 class(simulation_component_t),
intent(inout) :: this
287 subroutine preprocess_(this, time)
…
292 end subroutine preprocess_
296 subroutine compute_(this, time)
297 class(simulation_component_t),
intent(inout) :: this
296 subroutine compute_(this, time)
…
301 end subroutine compute_
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.
The common constructor using a JSON dictionary.
Defines a simulation case.
Utilities for retrieving parameters from the case files.
integer, parameter, public rp
Global precision used in computations.
Implements output_controller_t
Simulation components are objects that encapsulate functionality that can be fit to a particular comp...
subroutine simulation_component_free_base(this)
Destructor for the simulation_component_t (base) class.
subroutine restart_(this, time)
Dummy restart function.
subroutine simulation_component_restart_wrapper(this, time)
Wrapper for calling set_counter_ based for the controllers.
subroutine preprocess_(this, time)
Dummy preprocessing function.
subroutine simulation_component_init_base(this, json, case)
Constructor for the simulation_component_t (base) class.
subroutine compute_(this, time)
Dummy compute function.
subroutine simulation_component_preprocess_wrapper(this, time)
Wrapper for calling preprocess_ based on the preprocess_controller. Serves as the public interface.
subroutine simulation_component_compute_wrapper(this, time)
Wrapper for calling compute_ based on the compute_controller. Serves as the public interface.
Contains the time_based_controller_t type.
Module with things related to the simulation time.
Base abstract class for simulation components.
A helper type that is needed to have an array of polymorphic objects.
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.