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
149 if (compute_control .eq.
"fluid_output")
then
150 call json_get(this%case%params,
'case.fluid.output_control', &
152 call json_get(this%case%params,
'case.fluid.output_value', &
162 if (output_control ==
"global")
then
163 call json_get(this%case%params,
'case.fluid.output_control', &
165 call json_get(this%case%params,
'case.fluid.output_value', &
172 call this%preprocess_controller%init(
case%end_time, preprocess_control, &
174 call this%compute_controller%init(
case%end_time, compute_control, &
176 call this%output_controller%init(
case%end_time, output_control, &
179 end subroutine simulation_component_init_base
182 subroutine simulation_component_free_base(this)
183 class(simulation_component_t),
intent(inout) :: this
186 end subroutine simulation_component_free_base
192 subroutine simulation_component_preprocess_wrapper(this, t, tstep)
193 class(simulation_component_t),
intent(inout) :: this
194 real(kind=
rp),
intent(in) :: t
195 integer,
intent(in) :: tstep
197 if (this%preprocess_controller%check(t, tstep))
then
198 call this%preprocess_(t, tstep)
199 call this%preprocess_controller%register_execution()
201 end subroutine simulation_component_preprocess_wrapper
207 subroutine simulation_component_compute_wrapper(this, t, tstep)
208 class(simulation_component_t),
intent(inout) :: this
209 real(kind=
rp),
intent(in) :: t
210 integer,
intent(in) :: tstep
212 if (this%compute_controller%check(t, tstep))
then
213 call this%compute_(t, tstep)
214 call this%compute_controller%register_execution()
216 end subroutine simulation_component_compute_wrapper
221 subroutine simulation_component_restart_wrapper(this, t)
222 class(simulation_component_t),
intent(inout) :: this
223 real(kind=
rp),
intent(in) :: t
225 call this%compute_controller%set_counter(t)
226 call this%output_controller%set_counter(t)
227 call this%restart_(t)
229 end subroutine simulation_component_restart_wrapper
233 subroutine restart_(this, t)
234 class(simulation_component_t),
intent(inout) :: this
235 real(kind=
rp),
intent(in) :: t
238 end subroutine restart_
243 subroutine preprocess_(this, t, tstep)
244 class(simulation_component_t),
intent(inout) :: this
245 real(kind=
rp),
intent(in) :: t
246 integer,
intent(in) :: tstep
249 end subroutine preprocess_
254 subroutine compute_(this, t, tstep)
255 class(simulation_component_t),
intent(inout) :: this
256 real(kind=
rp),
intent(in) :: t
257 integer,
intent(in) :: tstep
260 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 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....