40 use json_module,
only : json_file
69 procedure, pass(this) :: preprocess => &
99 type(json_file),
intent(inout) :: json
100 class(
case_t),
intent(inout),
target :: case
118 module subroutine simulation_component_factory(object, json,
case)
119 class(simulation_component_t),
allocatable,
intent(inout) :: object
120 type(json_file),
intent(inout) :: json
121 class(
case_t),
intent(inout),
target :: case
122 end subroutine simulation_component_factory
125 public :: simulation_component_factory
129 subroutine simulation_component_init_base(this, json, case)
130 class(simulation_component_t),
intent(inout) :: this
131 type(json_file),
intent(inout) :: json
132 class(
case_t),
intent(inout),
target :: case
133 character(len=:),
allocatable :: preprocess_control, compute_control, output_control
134 real(kind=
rp) :: preprocess_value, compute_value, output_value
156 if (output_control ==
"global")
then
157 call json_get(this%case%params,
'case.fluid.output_control', &
159 call json_get(this%case%params,
'case.fluid.output_value', &
166 call this%preprocess_controller%init(
case%end_time, preprocess_control, &
168 call this%compute_controller%init(
case%end_time, compute_control, &
170 call this%output_controller%init(
case%end_time, output_control, &
173 end subroutine simulation_component_init_base
176 subroutine simulation_component_free_base(this)
177 class(simulation_component_t),
intent(inout) :: this
180 end subroutine simulation_component_free_base
186 subroutine simulation_component_preprocess_wrapper(this, t, tstep)
187 class(simulation_component_t),
intent(inout) :: this
188 real(kind=
rp),
intent(in) :: t
189 integer,
intent(in) :: tstep
191 if (this%preprocess_controller%check(t, tstep))
then
192 call this%preprocess_(t, tstep)
193 call this%preprocess_controller%register_execution()
195 end subroutine simulation_component_preprocess_wrapper
201 subroutine simulation_component_compute_wrapper(this, t, tstep)
202 class(simulation_component_t),
intent(inout) :: this
203 real(kind=
rp),
intent(in) :: t
204 integer,
intent(in) :: tstep
206 if (this%compute_controller%check(t, tstep))
then
207 call this%compute_(t, tstep)
208 call this%compute_controller%register_execution()
210 end subroutine simulation_component_compute_wrapper
215 subroutine simulation_component_restart_wrapper(this, t)
216 class(simulation_component_t),
intent(inout) :: this
217 real(kind=
rp),
intent(in) :: t
219 call this%compute_controller%set_counter(t)
220 call this%output_controller%set_counter(t)
221 call this%restart_(t)
223 end subroutine simulation_component_restart_wrapper
227 subroutine restart_(this, t)
228 class(simulation_component_t),
intent(inout) :: this
229 real(kind=
rp),
intent(in) :: t
232 end subroutine restart_
237 subroutine preprocess_(this, t, tstep)
238 class(simulation_component_t),
intent(inout) :: this
239 real(kind=
rp),
intent(in) :: t
240 integer,
intent(in) :: tstep
243 end subroutine preprocess_
248 subroutine compute_(this, t, tstep)
249 class(simulation_component_t),
intent(inout) :: this
250 real(kind=
rp),
intent(in) :: t
251 integer,
intent(in) :: tstep
254 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.
Simulation components are objects that encapsulate functionality that can be fit to a particular comp...
subroutine preprocess_(this, t, tstep)
Dummy preprocessing function.
subroutine simulation_component_free_base(this)
Destructor for the simulation_component_t (base) class.
subroutine simulation_component_restart_wrapper(this, t)
Wrapper for calling set_counter_ based for the controllers. Serves as the public interface.
subroutine simulation_component_preprocess_wrapper(this, t, tstep)
Wrapper for calling preprocess_ based on the preprocess_controller. Serves as the public interface.
subroutine compute_(this, t, tstep)
Dummy compute function.
subroutine simulation_component_init_base(this, json, case)
Simulation component factory. Both constructs and initializes the object.
subroutine restart_(this, t)
Dummy restart function.
subroutine simulation_component_compute_wrapper(this, t, tstep)
Wrapper for calling compute_ based on the compute_controller. Serves as the public interface.
Contains the time_based_controller_t type.
Base abstract class for simulation components.
A helper type that is needed to have an array of polymorphic objects.
A utility type for determening whether an action should be executed based on the current time value....