40  use json_module, 
only : json_file
 
   64     generic :: init_base_from_components => &
 
   65          init_base_from_controllers_properties, &
 
   66          init_base_from_controllers
 
   70     procedure, pass(this) :: init_base_from_controllers => &
 
   75     procedure, pass(this) :: init_base_from_controllers_properties => &
 
   84     procedure, pass(this) :: preprocess => &
 
 
  116       type(json_file), 
intent(inout) :: json
 
  117       class(
case_t), 
intent(inout), 
target :: case
 
 
  135     module subroutine simulation_component_factory(object, json, 
case)
 
  136       class(simulation_component_t), 
allocatable, 
intent(inout) :: object
 
  137       type(json_file), 
intent(inout) :: json
 
  138       class(
case_t), 
intent(inout), 
target :: case
 
  139     end subroutine simulation_component_factory
 
  146     module subroutine simulation_component_allocator(object, type_name)
 
  147       class(simulation_component_t), 
allocatable, 
intent(inout) :: object
 
  148       character(len=*), 
intent(in):: type_name
 
  149     end subroutine simulation_component_allocator
 
  160     subroutine simulation_component_allocate(obj)
 
  161       import simulation_component_t
 
  162       class(simulation_component_t), 
allocatable, 
intent(inout) :: obj
 
 
  163     end subroutine simulation_component_allocate
 
  168     module subroutine register_simulation_component(type_name, allocator)
 
  169       character(len=*), 
intent(in) :: type_name
 
  170       procedure(simulation_component_allocate), 
pointer, 
intent(in) :: &
 
  172     end subroutine register_simulation_component
 
  178     character(len=20) :: type_name
 
  179     procedure(simulation_component_allocate), 
pointer, 
nopass :: allocator
 
  180  end type allocator_entry
 
 
  183  type(allocator_entry), 
allocatable :: simcomp_registry(:)
 
  186  integer :: simcomp_registry_size = 0
 
  188  public :: simulation_component_factory, simulation_component_allocator, &
 
  189       register_simulation_component, simulation_component_allocate
 
  194  subroutine simulation_component_init_base(this, json, case)
 
  195    class(simulation_component_t), 
intent(inout) :: this
 
  196    type(json_file), 
intent(inout) :: json
 
  197    class(
case_t), 
intent(inout), 
target :: case
 
  198    character(len=:), 
allocatable :: preprocess_control, compute_control, &
 
  200    real(kind=
rp) :: preprocess_value, compute_value, output_value
 
  203    call this%parse_json(json, 
case%params, preprocess_control, &
 
  204         preprocess_value, compute_control, compute_value, output_control, &
 
  209    call this%init_base_from_components(
case, order, &
 
  210         preprocess_control, preprocess_value, compute_control, compute_value, &
 
  211         output_control, output_value)
 
 
  213  end subroutine simulation_component_init_base
 
  225  subroutine simulation_component_init_base_from_controllers_properties(this, &
 
  226       case, order, preprocess_control, preprocess_value, compute_control, &
 
  227       compute_value, output_control, output_value)
 
  228    class(simulation_component_t), 
intent(inout) :: this
 
  229    class(
case_t), 
intent(inout), 
target :: case
 
  231    character(len=*), 
intent(in) :: preprocess_control
 
  232    real(kind=
rp), 
intent(in) :: preprocess_value
 
  233    character(len=*), 
intent(in) :: compute_control
 
  234    real(kind=
rp), 
intent(in) :: compute_value
 
  235    character(len=*), 
intent(in) :: output_control
 
  236    real(kind=
rp), 
intent(in) :: output_value
 
  241    call this%preprocess_controller%init(
case%time%start_time, &
 
  242         case%time%end_time, preprocess_control, preprocess_value)
 
  243    call this%compute_controller%init(
case%time%start_time, 
case%time%end_time,&
 
  244         compute_control, compute_value)
 
  245    call this%output_controller%init(
case%time%start_time, 
case%time%end_time, &
 
  246         output_control, output_value)
 
 
  248  end subroutine simulation_component_init_base_from_controllers_properties
 
  256  subroutine simulation_component_init_base_from_controllers(this, case, order,&
 
  257       preprocess_controller, compute_controller, output_controller)
 
  258    class(simulation_component_t), 
intent(inout) :: this
 
  259    class(
case_t), 
intent(inout), 
target :: case
 
  267    this%preprocess_controller = preprocess_controller
 
  268    this%compute_controller = compute_controller
 
 
  270  end subroutine simulation_component_init_base_from_controllers
 
  281  subroutine simulation_component_parse_json(this, json, case_params, &
 
  282       preprocess_control, preprocess_value, compute_control, compute_value, &
 
  283       output_control, output_value)
 
  284    class(simulation_component_t), 
intent(inout) :: this
 
  285    type(json_file), 
intent(inout) :: json
 
  286    type(json_file), 
intent(inout) :: case_params
 
  287    character(len=:), 
allocatable, 
intent(inout) :: preprocess_control
 
  288    real(kind=
rp), 
intent(out) :: preprocess_value
 
  289    character(len=:), 
allocatable, 
intent(inout) :: compute_control
 
  290    real(kind=
rp), 
intent(out) :: compute_value
 
  291    character(len=:), 
allocatable, 
intent(inout) :: output_control
 
  292    real(kind=
rp), 
intent(out) :: output_value
 
  304    if (compute_control .eq. 
"fluid_output") 
then 
  305       call json_get(case_params, 
'case.fluid.output_control', &
 
  307       call json_get(case_params, 
'case.fluid.output_value', &
 
  317    if (output_control == 
"global") 
then 
  318       call json_get(case_params, 
'case.fluid.output_control', &
 
  320       call json_get(case_params, 
'case.fluid.output_value', &
 
 
  323  end subroutine simulation_component_parse_json
 
  326  subroutine simulation_component_free_base(this)
 
  327    class(simulation_component_t), 
intent(inout) :: this
 
 
  330  end subroutine simulation_component_free_base
 
  335  subroutine simulation_component_preprocess_wrapper(this, time)
 
  336    class(simulation_component_t), 
intent(inout) :: this
 
  339    if (this%preprocess_controller%check(time)) 
then 
  340       call this%preprocess_(time)
 
  341       call this%preprocess_controller%register_execution()
 
 
  343  end subroutine simulation_component_preprocess_wrapper
 
  348  subroutine simulation_component_compute_wrapper(this, time)
 
  349    class(simulation_component_t), 
intent(inout) :: this
 
  352    if (this%compute_controller%check(time)) 
then 
  353       call this%compute_(time)
 
  354       call this%compute_controller%register_execution()
 
 
  356  end subroutine simulation_component_compute_wrapper
 
  360  subroutine simulation_component_restart_wrapper(this, time)
 
  361    class(simulation_component_t), 
intent(inout) :: this
 
  364    call this%compute_controller%set_counter(time)
 
  365    call this%output_controller%set_counter(time)
 
  366    call this%restart_(time)
 
 
  368  end subroutine simulation_component_restart_wrapper
 
  372  subroutine restart_(this, time)
 
  373    class(simulation_component_t), 
intent(inout) :: this
 
 
  377  end subroutine restart_
 
  381  subroutine preprocess_(this, time)
 
  382    class(simulation_component_t), 
intent(inout) :: this
 
 
  386  end subroutine preprocess_
 
  390  subroutine compute_(this, time)
 
  391    class(simulation_component_t), 
intent(inout) :: this
 
 
  395  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 simulation_component_init_base_from_controllers(this, case, order, preprocess_controller, compute_controller, output_controller)
Constructor for the simulation_component_t (base) class from components.
 
subroutine preprocess_(this, time)
Dummy preprocessing function.
 
subroutine simulation_component_init_base_from_controllers_properties(this, case, order, preprocess_control, preprocess_value, compute_control, compute_value, output_control, output_value)
Constructor for the simulation_component_t (base) class via the properties of the time_based_controll...
 
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_parse_json(this, json, case_params, preprocess_control, preprocess_value, compute_control, compute_value, output_control, output_value)
Parse JSON to determine the properties of the time_based_controllers.
 
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.