Initialization

Constructing the systems

In the multisystem framework, it is important to detail how the various components are initialized. The top level system is created in main/run.F90 by calling the multisystem_basic_t constructor

Definition of multisystem_basic_constructor()

which itself calls multisystem_basic_init() and multisystem_init().

Definition of multisystem_basic_init()

Finally, multisystem_create_system() loops over the subsystems and calls the system factory to create each of them.

Definition of multisystem_create_system()

Initializing the propagators

The propagators for the system(s) are initialized in time_dependent_run_multisystem() by a call to systems%init_propagators(). As time_dependent_run_multisystem() is called with systems being of type multisystem_basic_t, this translates to a call to multisystem_init_propagator().

Definition of multisystem_init_propagator()

This routine parses the input for the propagator type, and then creates a propagator of the given type using the respective constructor.

Then, multisystem_init_propagator() loops over the subsystems, and calls system%propagator_init() for each.

In general (i.e. if the function is not overloaded by a derived class), systems use the function system_propagator_init():

Definition of system_init_propagator()

system_propagator_init() parses the input file, looking for the variable TDSystemPropagator. Here it is important to remember the order in which the parser treats namespaces.

If the system is specified in the input file as:

%Systems
"System_A" | <type_A>
"System_B" | <type B>
%

the top-level multisystem will internally be called . and we have in total three namespaces:

.
./System_A
./System_B

The system%propagator_init() routines for System_A and System_B will first look whether TDSystemPropagator is defined in their respective namespace. If this is not the case, they will look for the variable in the parent namespace, which here is the global namespace ..

The code does allow to specify different propagators for the multisystem, and the subsystems. While this might work if the subsystems do not interact, it will most likely fail for interacting systems. Therefore, it is highly recommended not to specify the propagators for the subsystems separately, unless one knows exactly what one is doing.