77 type(system_list_t) :: list
118 class(multisystem_t),
intent(inout) :: this
119 type(mpi_grp_t),
intent(in) :: grp
121 type(system_iterator_t) :: iter
122 class(system_t),
pointer :: sys
123 type(mpi_grp_t) :: sys_grp
130 call iter%start(this%list)
131 do while (iter%has_next())
132 sys => iter%get_next()
135 call sys%init_parallelization(sys_grp)
143 class(multisystem_t),
intent(inout) :: this
144 real(real64) :: next_time_on_largest_dt
146 type(system_iterator_t) :: iter
147 class(system_t),
pointer :: system
148 type(iteration_counter_t) :: iteration
152 next_time_on_largest_dt =
m_zero
153 call iter%start(this%list)
154 do while (iter%has_next())
155 system => iter%get_next()
158 next_time_on_largest_dt = max(next_time_on_largest_dt, system%next_time_on_largest_dt())
160 iteration = system%iteration + 1
161 next_time_on_largest_dt = max(next_time_on_largest_dt, iteration%value())
180 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
186 call iter%start(this%list)
187 do while (iter%has_next())
188 system => iter%get_next()
189 call system%execute_algorithm()
200 integer,
intent(in) :: accumulated_iterations
211 call iter%start(this%list)
212 do while (iter%has_next())
213 system => iter%get_next()
214 call system%reset_iteration_counters(accumulated_iterations)
231 call iter%start(this%list)
232 do while (iter%has_next())
233 system => iter%get_next()
234 call system%new_algorithm(factory)
243 this%algo => factory%create_static(this)
244 call this%algo%rewind()
260 finished = this%algo%finished()
263 call iter%start(this%list)
264 do while (iter%has_next())
265 system => iter%get_next()
266 finished = finished .and. system%algorithm_finished()
286 call iter%start(this%list)
287 do while (iter%has_next())
288 system => iter%get_next()
289 call system%init_iteration_counters()
309 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
312 call iter%start(this%list)
313 do while (iter%has_next())
314 system => iter%get_next()
315 call system%algorithm_start()
340 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
346 call iter%start(this%list)
347 do while (iter%has_next())
348 system => iter%get_next()
349 call system%algorithm_finish()
368 integer,
optional,
intent(in) :: interaction_type
373 if (
present(interaction_type))
then
374 if (any(this%supported_interactions_as_partner == interaction_type))
then
381 call iter%start(this%list)
382 do while (iter%has_next())
383 system => iter%get_next()
384 call system%add_partners_to_list(list, interaction_type)
404 class(
system_t),
pointer :: subsystem
410 call iter%start(this%list)
411 do while (iter%has_next())
412 subsystem => iter%get_next()
413 call subsystem%create_interactions(interaction_factory, available_partners)
434 message(1) =
"Trying to initialize an interaction in the multi-system container class"
445 integer,
intent(in) ::
iunit
446 logical,
intent(in) :: include_ghosts
456 call sys_iter%start(this%list)
457 do while (sys_iter%has_next())
458 system => sys_iter%get_next()
461 call inter_iter%start(system%interactions)
462 do while (inter_iter%has_next())
463 interaction => inter_iter%get_next()
466 select type (interaction)
468 if (include_ghosts)
then
469 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" <- "' + trim(interaction%partner%namespace%get()) + &
470 '" [label="'+ interaction%label +
'"];'
474 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" <- "' + trim(interaction%partner%namespace%get()) + &
475 '" [label="'+ interaction%label +
'"];'
482 call system%write_interaction_graph(
iunit, include_ghosts)
498 call iter%start(this%list)
499 do while (iter%has_next())
500 system => iter%get_next()
501 call system%initialize()
511 character(len=:),
allocatable,
intent(out) :: updated_quantities(:)
524 real(real64),
intent(in) :: tol
532 call iter%start(this%list)
533 do while (iter%has_next())
534 system => iter%get_next()
535 if (.not. system%is_tolerance_reached(tol)) converged = .false.
544 character(len=*),
intent(in) :: label
551 message(1) =
"Trying to update a quantity in the multi-system container class"
567 message(1) =
"Trying to initialize an interaction as partner in the multi-system container class"
583 message(1) =
"Trying to copy quantities to interaction in the multi-system container class"
599 call iter%start(this%list)
600 do while (iter%has_next())
601 system => iter%get_next()
602 if (system%process_is_slave()) is_slave = .
true.
621 this%kinetic_energy =
m_zero
631 class(
system_t),
pointer :: system_2
640 this%internal_energy =
m_zero
642 call system_iter%start(this%list)
643 do while (system_iter%has_next())
645 system => system_iter%get_next()
648 call system%update_kinetic_energy()
649 this%internal_energy = this%internal_energy + system%kinetic_energy
652 call system%update_internal_energy()
653 this%internal_energy = this%internal_energy + system%internal_energy
656 call system_iter_2%start(this%list)
657 do while(system_iter_2%has_next())
659 system_2 => system_iter_2%get_next()
663 if(.not.
associated(system, system_2))
then
697 this%potential_energy =
m_zero
703 call this%get_flat_list(flat_list)
706 call system_iter%start(flat_list)
707 do while (system_iter%has_next())
709 system => system_iter%get_next()
712 call system%update_potential_energy()
715 call interaction_iter%start(system%interactions)
716 do while (interaction_iter%has_next())
717 interaction => interaction_iter%get_next()
718 if(.not. flat_list%contains(interaction%partner) .and. .not. interaction%intra_interaction)
then
719 call interaction%calculate_energy()
720 this%potential_energy = this%potential_energy + interaction%energy
740 class(
system_t),
pointer :: system_a
741 class(
system_t),
pointer :: system_b
749 select type(partner_a)
752 call system_iterator_a%start(partner_a%list)
753 do while( system_iterator_a%has_next() )
755 system_a => system_iterator_a%get_next()
757 select type(partner_b)
760 call system_iterator_b%start(partner_b%list)
761 do while( system_iterator_b%has_next() )
762 system_b => system_iterator_b%get_next()
775 select type(partner_b)
778 call system_iterator_b%start(partner_b%list)
779 do while( system_iterator_b%has_next() )
780 system_b => system_iterator_b%get_next()
796 real(real64) function interaction_energy(system, partner) result (energy)
797 class(
system_t),
target,
intent(in) :: system
805 call interaction_iterator%start(system%interactions)
806 do while(interaction_iterator%has_next())
807 interaction => interaction_iterator%get_next()
808 if(
associated(interaction%partner, partner))
then
809 call interaction%calculate_energy()
810 energy = energy + interaction%energy
823 type(system_list_t),
intent(out) :: flat_list
825 class(interaction_partner_t),
pointer :: partner
826 type(partner_iterator_t) :: iterator
830 call iterator%start(this%list)
831 do while (iterator%has_next())
832 partner => iterator%get_next()
834 call flat_list%add(partner)
836 select type (partner)
839 call partner%get_flat_list(flat_list)
852 type(system_iterator_t) :: iter
853 class(system_t),
pointer :: system
857 call iter%start(this%list)
858 do while (iter%has_next())
859 system => iter%get_next()
860 if (
associated(system))
then
865 call system_end(this)
873 real(real64),
intent(in) :: target_time
874 integer,
intent(in) :: barrier_index
876 type(system_iterator_t) :: iter
877 class(system_t),
pointer :: system
881 call iter%start(this%list)
882 do while (iter%has_next())
883 system => iter%get_next()
884 call system%start_barrier(target_time, barrier_index)
893 integer,
intent(in) :: barrier_index
895 type(system_iterator_t) :: iter
896 class(system_t),
pointer :: system
900 call iter%start(this%list)
901 do while (iter%has_next())
902 system => iter%get_next()
903 call system%end_barrier(barrier_index)
912 integer,
intent(in) :: barrier_index
914 type(system_iterator_t) :: iter
915 class(system_t),
pointer :: system
920 call iter%start(this%list)
921 do while (iter%has_next())
922 system => iter%get_next()
924 system%arrived_at_barrier(barrier_index)
934 type(system_iterator_t) :: iter
935 class(system_t),
pointer :: system
940 call system_restart_write(this)
943 call iter%start(this%list)
944 do while (iter%has_next())
945 system => iter%get_next()
946 call system%restart_write()
948 message(1) =
"Wrote restart data for multisystem "//trim(this%namespace%get())
949 call messages_info(1, namespace=this%namespace)
958 type(system_iterator_t) :: iter
959 class(system_t),
pointer :: system
965 call iter%start(this%list)
966 do while (iter%has_next())
967 system => iter%get_next()
970 system%restart_read()
974 message(1) =
"Successfully read restart data for multisystem "//trim(this%namespace%get())
975 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 multisystem_new_algorithm(this, factory)
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_update_internal_energy(this)
recursive subroutine multisystem_algorithm_start(this)
call the algorithm_start routine for all contained systems
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_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)
recursive subroutine multisystem_initialize(this)
subroutine multisystem_init_interaction_as_partner(partner, interaction)
recursive logical function multisystem_is_tolerance_reached(this, tol)
recursive real(real64) function multisystem_next_time_on_largest_dt(this)
recursive subroutine multisystem_algorithm_finish(this)
call the algorithm_finish routine for all contained systems
subroutine multisystem_update_quantity(this, label)
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 defines the quantity_t class and the IDs for quantities, which can be exposed by a system...
This module implements the abstract system type.
subroutine, public system_algorithm_start(this)
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...
subroutine, public system_algorithm_finish(this)
recursive subroutine, public system_create_interactions(this, interaction_factory, available_partners)
create the interactions of the system
subroutine, public system_execute_algorithm(this)
perform one or more algorithmic operations
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.