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)
403 class(
system_t),
pointer :: subsystem
409 call iter%start(this%list)
410 do while (iter%has_next())
411 subsystem => iter%get_next()
412 call subsystem%create_interactions(interaction_factory, available_partners)
433 message(1) =
"Trying to initialize an interaction in the multi-system container class"
444 integer,
intent(in) ::
iunit
445 logical,
intent(in) :: include_ghosts
455 call sys_iter%start(this%list)
456 do while (sys_iter%has_next())
457 system => sys_iter%get_next()
460 call inter_iter%start(system%interactions)
461 do while (inter_iter%has_next())
462 interaction => inter_iter%get_next()
465 select type (interaction)
467 if (include_ghosts)
then
468 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" <- "' + trim(interaction%partner%namespace%get()) + &
469 '" [label="'+ interaction%label +
'"];'
473 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" <- "' + trim(interaction%partner%namespace%get()) + &
474 '" [label="'+ interaction%label +
'"];'
481 call system%write_interaction_graph(
iunit, include_ghosts)
497 call iter%start(this%list)
498 do while (iter%has_next())
499 system => iter%get_next()
500 call system%initial_conditions()
510 integer,
allocatable,
intent(out) :: updated_quantities(:)
523 real(real64),
intent(in) :: tol
531 call iter%start(this%list)
532 do while (iter%has_next())
533 system => iter%get_next()
534 if (.not. system%is_tolerance_reached(tol)) converged = .false.
543 integer,
intent(in) :: iq
550 message(1) =
"Trying to update a quantity in the multi-system container class"
566 message(1) =
"Trying to initialize an interaction as partner in the multi-system container class"
582 message(1) =
"Trying to copy quantities to interaction in the multi-system container class"
598 call iter%start(this%list)
599 do while (iter%has_next())
600 system => iter%get_next()
601 if (system%process_is_slave()) is_slave = .
true.
620 this%kinetic_energy =
m_zero
630 class(
system_t),
pointer :: system_2
639 this%internal_energy =
m_zero
641 call system_iter%start(this%list)
642 do while (system_iter%has_next())
644 system => system_iter%get_next()
647 call system%update_kinetic_energy()
648 this%internal_energy = this%internal_energy + system%kinetic_energy
651 call system%update_internal_energy()
652 this%internal_energy = this%internal_energy + system%internal_energy
655 call system_iter_2%start(this%list)
656 do while(system_iter_2%has_next())
658 system_2 => system_iter_2%get_next()
662 if(.not.
associated(system, system_2))
then
696 this%potential_energy =
m_zero
702 call this%get_flat_list(flat_list)
705 call system_iter%start(flat_list)
706 do while (system_iter%has_next())
708 system => system_iter%get_next()
711 call system%update_potential_energy()
714 call interaction_iter%start(system%interactions)
715 do while (interaction_iter%has_next())
716 interaction => interaction_iter%get_next()
717 if(.not. flat_list%contains(interaction%partner) .and. .not. interaction%intra_interaction)
then
718 call interaction%calculate_energy()
719 this%potential_energy = this%potential_energy + interaction%energy
739 class(
system_t),
pointer :: system_a
740 class(
system_t),
pointer :: system_b
748 select type(partner_a)
751 call system_iterator_a%start(partner_a%list)
752 do while( system_iterator_a%has_next() )
754 system_a => system_iterator_a%get_next()
756 select type(partner_b)
759 call system_iterator_b%start(partner_b%list)
760 do while( system_iterator_b%has_next() )
761 system_b => system_iterator_b%get_next()
774 select type(partner_b)
777 call system_iterator_b%start(partner_b%list)
778 do while( system_iterator_b%has_next() )
779 system_b => system_iterator_b%get_next()
795 real(real64) function interaction_energy(system, partner) result (energy)
796 class(
system_t),
target,
intent(in) :: system
804 call interaction_iterator%start(system%interactions)
805 do while(interaction_iterator%has_next())
806 interaction => interaction_iterator%get_next()
807 if(
associated(interaction%partner, partner))
then
808 call interaction%calculate_energy()
809 energy = energy + interaction%energy
822 type(system_list_t),
intent(out) :: flat_list
824 class(interaction_partner_t),
pointer :: partner
825 type(partner_iterator_t) :: iterator
829 call iterator%start(this%list)
830 do while (iterator%has_next())
831 partner => iterator%get_next()
833 call flat_list%add(partner)
835 select type (partner)
838 call partner%get_flat_list(flat_list)
851 type(system_iterator_t) :: iter
852 class(system_t),
pointer :: system
856 call iter%start(this%list)
857 do while (iter%has_next())
858 system => iter%get_next()
859 if (
associated(system))
then
864 call system_end(this)
872 real(real64),
intent(in) :: target_time
873 integer,
intent(in) :: barrier_index
875 type(system_iterator_t) :: iter
876 class(system_t),
pointer :: system
880 call iter%start(this%list)
881 do while (iter%has_next())
882 system => iter%get_next()
883 call system%start_barrier(target_time, barrier_index)
892 integer,
intent(in) :: barrier_index
894 type(system_iterator_t) :: iter
895 class(system_t),
pointer :: system
899 call iter%start(this%list)
900 do while (iter%has_next())
901 system => iter%get_next()
902 call system%end_barrier(barrier_index)
911 integer,
intent(in) :: barrier_index
913 type(system_iterator_t) :: iter
914 class(system_t),
pointer :: system
919 call iter%start(this%list)
920 do while (iter%has_next())
921 system => iter%get_next()
923 system%arrived_at_barrier(barrier_index)
933 type(system_iterator_t) :: iter
934 class(system_t),
pointer :: system
939 call system_restart_write(this)
942 call iter%start(this%list)
943 do while (iter%has_next())
944 system => iter%get_next()
945 call system%restart_write()
947 message(1) =
"Wrote restart data for multisystem "//trim(this%namespace%get())
948 call messages_info(1, namespace=this%namespace)
957 type(system_iterator_t) :: iter
958 class(system_t),
pointer :: system
964 call iter%start(this%list)
965 do while (iter%has_next())
966 system => iter%get_next()
969 system%restart_read()
973 message(1) =
"Successfully read restart data for multisystem "//trim(this%namespace%get())
974 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.