76 type(system_list_t) :: list
117 class(multisystem_t),
intent(inout) :: this
118 type(mpi_grp_t),
intent(in) :: grp
120 type(system_iterator_t) :: iter
121 class(system_t),
pointer :: sys
122 type(mpi_grp_t) :: sys_grp
129 call iter%start(this%list)
130 do while (iter%has_next())
131 sys => iter%get_next()
134 call sys%init_parallelization(sys_grp)
142 class(multisystem_t),
intent(inout) :: this
143 real(real64) :: next_time_on_largest_dt
145 type(system_iterator_t) :: iter
146 class(system_t),
pointer :: system
147 type(iteration_counter_t) :: iteration
151 next_time_on_largest_dt =
m_zero
152 call iter%start(this%list)
153 do while (iter%has_next())
154 system => iter%get_next()
157 next_time_on_largest_dt = max(next_time_on_largest_dt, system%next_time_on_largest_dt())
159 iteration = system%iteration + 1
160 next_time_on_largest_dt = max(next_time_on_largest_dt, iteration%value())
179 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
185 call iter%start(this%list)
186 do while (iter%has_next())
187 system => iter%get_next()
188 call system%execute_algorithm()
199 integer,
intent(in) :: accumulated_iterations
210 call iter%start(this%list)
211 do while (iter%has_next())
212 system => iter%get_next()
213 call system%reset_iteration_counters(accumulated_iterations)
230 call iter%start(this%list)
231 do while (iter%has_next())
232 system => iter%get_next()
233 call system%init_algorithm(factory)
242 this%algo => factory%create_static(this)
243 call this%algo%rewind()
259 finished = this%algo%finished()
262 call iter%start(this%list)
263 do while (iter%has_next())
264 system => iter%get_next()
265 finished = finished .and. system%algorithm_finished()
285 call iter%start(this%list)
286 do while (iter%has_next())
287 system => iter%get_next()
288 call system%init_iteration_counters()
308 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
311 call iter%start(this%list)
312 do while (iter%has_next())
313 system => iter%get_next()
314 call system%propagation_start()
339 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
345 call iter%start(this%list)
346 do while (iter%has_next())
347 system => iter%get_next()
348 call system%propagation_finish()
367 integer,
optional,
intent(in) :: interaction_type
372 if (
present(interaction_type))
then
373 if (any(this%supported_interactions_as_partner == interaction_type))
then
380 call iter%start(this%list)
381 do while (iter%has_next())
382 system => iter%get_next()
383 call system%add_partners_to_list(list, interaction_type)
399 class(
system_t),
pointer :: subsystem
405 call iter%start(this%list)
406 do while (iter%has_next())
407 subsystem => iter%get_next()
408 call subsystem%create_interactions(interaction_factory, available_partners)
429 message(1) =
"Trying to initialize an interaction in the multi-system container class"
440 integer,
intent(in) ::
iunit
441 logical,
intent(in) :: include_ghosts
451 call sys_iter%start(this%list)
452 do while (sys_iter%has_next())
453 system => sys_iter%get_next()
456 call inter_iter%start(system%interactions)
457 do while (inter_iter%has_next())
458 interaction => inter_iter%get_next()
461 select type (interaction)
463 if (include_ghosts)
then
464 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" -> "' + trim(interaction%partner%namespace%get()) + &
465 '" [label="'+ interaction%label +
'"];'
469 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" -> "' + trim(interaction%partner%namespace%get()) + &
470 '" [label="'+ interaction%label +
'"];'
477 call system%write_interaction_graph(
iunit, include_ghosts)
493 call iter%start(this%list)
494 do while (iter%has_next())
495 system => iter%get_next()
496 call system%initial_conditions()
506 integer,
allocatable,
intent(out) :: updated_quantities(:)
519 real(real64),
intent(in) :: tol
527 call iter%start(this%list)
528 do while (iter%has_next())
529 system => iter%get_next()
530 if (.not. system%is_tolerance_reached(tol)) converged = .false.
539 integer,
intent(in) :: iq
546 message(1) =
"Trying to update a quantity in the multi-system container class"
562 message(1) =
"Trying to initialize an interaction as partner in the multi-system container class"
578 message(1) =
"Trying to copy quantities to interaction in the multi-system container class"
594 call iter%start(this%list)
595 do while (iter%has_next())
596 system => iter%get_next()
597 if (system%process_is_slave()) is_slave = .
true.
616 this%kinetic_energy =
m_zero
626 class(
system_t),
pointer :: system_2
635 this%internal_energy =
m_zero
637 call system_iter%start(this%list)
638 do while (system_iter%has_next())
640 system => system_iter%get_next()
643 call system%update_kinetic_energy()
644 this%internal_energy = this%internal_energy + system%kinetic_energy
647 call system%update_internal_energy()
648 this%internal_energy = this%internal_energy + system%internal_energy
651 call system_iter_2%start(this%list)
652 do while(system_iter_2%has_next())
654 system_2 => system_iter_2%get_next()
658 if(.not.
associated(system, system_2))
then
692 this%potential_energy =
m_zero
698 call this%get_flat_list(flat_list)
701 call system_iter%start(flat_list)
702 do while (system_iter%has_next())
704 system => system_iter%get_next()
707 call system%update_potential_energy()
710 call interaction_iter%start(system%interactions)
711 do while (interaction_iter%has_next())
712 interaction => interaction_iter%get_next()
713 if(.not. flat_list%contains(interaction%partner) .and. .not. interaction%intra_interaction)
then
714 call interaction%calculate_energy()
715 this%potential_energy = this%potential_energy + interaction%energy
735 class(
system_t),
pointer :: system_a
736 class(
system_t),
pointer :: system_b
744 select type(partner_a)
747 call system_iterator_a%start(partner_a%list)
748 do while( system_iterator_a%has_next() )
750 system_a => system_iterator_a%get_next()
752 select type(partner_b)
755 call system_iterator_b%start(partner_b%list)
756 do while( system_iterator_b%has_next() )
757 system_b => system_iterator_b%get_next()
770 select type(partner_b)
773 call system_iterator_b%start(partner_b%list)
774 do while( system_iterator_b%has_next() )
775 system_b => system_iterator_b%get_next()
791 real(real64) function interaction_energy(system, partner) result (energy)
792 class(
system_t),
target,
intent(in) :: system
800 call interaction_iterator%start(system%interactions)
801 do while(interaction_iterator%has_next())
802 interaction => interaction_iterator%get_next()
803 if(
associated(interaction%partner, partner))
then
804 call interaction%calculate_energy()
805 energy = energy + interaction%energy
818 type(system_list_t),
intent(out) :: flat_list
820 class(interaction_partner_t),
pointer :: partner
821 type(partner_iterator_t) :: iterator
825 call iterator%start(this%list)
826 do while (iterator%has_next())
827 partner => iterator%get_next()
829 call flat_list%add(partner)
831 select type (partner)
834 call partner%get_flat_list(flat_list)
847 type(system_iterator_t) :: iter
848 class(system_t),
pointer :: system
852 call iter%start(this%list)
853 do while (iter%has_next())
854 system => iter%get_next()
855 if (
associated(system))
then
860 call system_end(this)
868 real(real64),
intent(in) :: target_time
869 integer,
intent(in) :: barrier_index
871 type(system_iterator_t) :: iter
872 class(system_t),
pointer :: system
876 call iter%start(this%list)
877 do while (iter%has_next())
878 system => iter%get_next()
879 call system%start_barrier(target_time, barrier_index)
888 integer,
intent(in) :: barrier_index
890 type(system_iterator_t) :: iter
891 class(system_t),
pointer :: system
895 call iter%start(this%list)
896 do while (iter%has_next())
897 system => iter%get_next()
898 call system%end_barrier(barrier_index)
907 integer,
intent(in) :: barrier_index
909 type(system_iterator_t) :: iter
910 class(system_t),
pointer :: system
915 call iter%start(this%list)
916 do while (iter%has_next())
917 system => iter%get_next()
919 system%arrived_at_barrier(barrier_index)
929 type(system_iterator_t) :: iter
930 class(system_t),
pointer :: system
935 call system_restart_write(this)
938 call iter%start(this%list)
939 do while (iter%has_next())
940 system => iter%get_next()
941 call system%restart_write()
943 message(1) =
"Wrote restart data for multisystem "//trim(this%namespace%get())
944 call messages_info(1, namespace=this%namespace)
953 type(system_iterator_t) :: iter
954 class(system_t),
pointer :: system
960 call iter%start(this%list)
961 do while (iter%has_next())
962 system => iter%get_next()
965 system%restart_read()
969 message(1) =
"Successfully read restart data for multisystem "//trim(this%namespace%get())
970 call messages_info(1, namespace=this%namespace)
real(real64) function interaction_energy(system, partner)
This module defines the abstract interfact for algorithm factories.
This module implements the basic elements defining algorithms.
real(real64), parameter, public m_zero
This module defines the abstract interaction_t class, and some auxiliary classes for interactions.
This module defines classes and functions for interaction partners.
This module defines the abstract class for the interaction factory.
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine mpi_grp_duplicate(mpi_grp_out, mpi_grp_in)
This module implements the multisystem debug functionality.
type(event_handle_t) function, public multisystem_debug_write_event_in(system_namespace, event, extra, system_iteration, algo_iteration, interaction_iteration, partner_iteration, requested_iteration)
subroutine, public multisystem_debug_write_event_out(handle, extra, update, system_iteration, algo_iteration, interaction_iteration, partner_iteration, requested_iteration)
This module implements the abstract multisystem class.
recursive subroutine, public multisystem_end(this)
recursive logical function multisystem_process_is_slave(this)
recursive logical function multisystem_arrived_at_barrier(this, barrier_index)
recursive subroutine multisystem_init_algorithm(this, factory)
recursive subroutine multisystem_update_internal_energy(this)
recursive subroutine multisystem_create_interactions(this, interaction_factory, available_partners)
create the interactions of the multisystem
recursive subroutine multisystem_restart_write(this)
recursive subroutine multisystem_add_partners_to_list(this, list, interaction_type)
add interaction partners contained in the multisystem to a list
subroutine multisystem_init_interaction(this, interaction)
initialize a specific interaction
subroutine multisystem_update_quantity(this, iq)
subroutine multisystem_update_potential_energy(this)
Calculate the potential energy for a container.
recursive subroutine multisystem_reset_iteration_counters(this, accumulated_iterations)
recursive logical function multisystem_restart_read(this)
subroutine multisystem_init_interaction_as_partner(partner, interaction)
recursive subroutine multisystem_propagation_start(this)
call the propagation_start routine for all contained systems
recursive logical function multisystem_is_tolerance_reached(this, tol)
recursive real(real64) function multisystem_next_time_on_largest_dt(this)
recursive subroutine multisystem_propagation_finish(this)
call the propagation_finish routine for all contained systems
recursive subroutine multisystem_initial_conditions(this)
subroutine multisystem_copy_quantities_to_interaction(partner, interaction)
recursive real(real64) function multisystem_pair_energy(partner_A, partner_B)
This function calculates the complete interaction energy between partner_A and partner_B,...
recursive subroutine multisystem_execute_algorithm(this)
recursive subroutine multisystem_init_parallelization(this, grp)
brief initialize the parallelization of the multisystem
recursive subroutine multisystem_get_flat_list(this, flat_list)
Generate a list of all systems contained in a multisystem, including those inside child containers.
logical function multisystem_restart_read_data(this)
subroutine multisystem_restart_write_data(this)
recursive subroutine multisystem_end_barrier(this, barrier_index)
recursive subroutine multisystem_update_kinetic_energy(this)
Calculate the kinetic energy: The kinetic energy of a container (multisystem) is defined by the kinet...
recursive subroutine multisystem_init_iteration_counters(this)
initialize the iteration counters of the contained systems
recursive subroutine multisystem_start_barrier(this, target_time, barrier_index)
recursive logical function multisystem_algorithm_finished(this)
recursive subroutine multisystem_write_interaction_graph(this, iunit, include_ghosts)
write a graphical representation of the interactions
logical function multisystem_do_algorithmic_operation(this, operation, updated_quantities)
This module implements the abstract system type.
subroutine, public system_init_iteration_counters(this)
Initialize the iteration counters of the system and its interactions, algorithms and quantities.
subroutine, public system_update_potential_energy(this)
Calculate the potential energy of the system. The potential energy is defined as the sum of all energ...
subroutine, public system_init_parallelization(this, grp)
Basic functionality: copy the MPI group. This function needs to be implemented by extended types that...
recursive subroutine, public system_create_interactions(this, interaction_factory, available_partners)
create the interactions of the system
subroutine, public system_propagation_finish(this)
subroutine, public system_execute_algorithm(this)
perform one or more algorithmic operations
subroutine, public system_propagation_start(this)
subroutine, public system_reset_iteration_counters(this, accumulated_iterations)
Abstract class for the algorithm factories.
Descriptor of one algorithmic operation.
The ghost ineraction is a dummy interaction, which needs to be setup between otherwise non-interactin...
These class extend the list and list iterator to make an interaction list.
abstract interaction class
abstract class for general interaction partners
surrogate interaction class to avoid circular dependencies between modules.
abstract class for interaction factories
events marking a function call
handle to keep track of in- out- events
the abstract multisystem class
These classes extends the list and list iterator to create a system list.
Abstract class for systems.