39 use json_module,
only : json_file, json_core, json_value
56 integer,
allocatable :: order(:)
77 type(
case_t),
target,
intent(inout) :: case
78 integer :: n_simcomps, i
79 type(json_core) :: core
80 type(json_value),
pointer :: simcomp_object
81 type(json_file) :: comp_subdict
84 logical,
allocatable :: mask(:)
86 integer,
allocatable :: read_order(:)
92 if (
case%params%valid_path(
'case.simulation_components'))
then
94 call case%params%info(
'case.simulation_components', n_children=n_simcomps)
95 allocate(this%simcomps(n_simcomps))
96 allocate(this%order(n_simcomps))
97 allocate(read_order(n_simcomps))
98 allocate(mask(n_simcomps))
101 call case%params%get_core(core)
102 call case%params%get(
'case.simulation_components', simcomp_object, found)
116 loc = minloc(read_order, mask=mask)
117 this%order(i) = loc(1)
126 if (.not. comp_subdict%valid_path(
"order"))
then
127 call comp_subdict%add(
"order", this%order(i))
140 if (
allocated(this%order))
deallocate(this%order)
142 if (
allocated(this%simcomps))
then
143 do i=1,
size(this%simcomps)
144 call this%simcomps(i)%simcomp%free
146 deallocate(this%simcomps)
155 real(kind=
rp),
intent(in) :: t
156 integer,
intent(in) :: tstep
159 if (
allocated(this%simcomps))
then
160 do i=1,
size(this%simcomps)
161 call this%simcomps(this%order(i))%simcomp%compute(t, tstep)
171 real(kind=
rp),
intent(in) :: t
174 if (
allocated(this%simcomps))
then
175 do i=1,
size(this%simcomps)
176 call this%simcomps(this%order(i))%simcomp%restart(t)
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.
Utilities for retrieving parameters from the case files.
subroutine, public json_extract_item(core, array, i, item)
Extract ith item from a JSON array as a separate JSON object.
integer, parameter, public rp
Global precision used in computations.
Contains the simcomp_executor_t type.
type(simcomp_executor_t), public neko_simcomps
Global variable for the simulation component driver.
subroutine simcomp_executor_restart(this, t)
Execute restart for all simcomps.
subroutine simcomp_executor_compute(this, t, tstep)
Execute compute_ for all simcomps.
subroutine simcomp_executor_free(this)
Destructor.
subroutine simcomp_executor_init(this, case)
Constructor.
Defines a factory subroutine for simulation components.
subroutine, public simulation_component_factory(simcomp, json, case)
Simulation component factory. Both constructs and initializes the object.
Simulation components are objects that encapsulate functionality that can be fit to a particular comp...
Singleton type that serves as a driver for the simulation components. Stores all the components in th...
A helper type that is needed to have an array of polymorphic objects.