77 type(system_list_t) :: list
115 class(multisystem_t),
intent(inout) :: this
116 real(real64) :: next_time_on_largest_dt
118 type(system_iterator_t) :: iter
119 class(system_t),
pointer :: system
120 type(iteration_counter_t) :: iteration
124 next_time_on_largest_dt =
m_zero
125 call iter%start(this%list)
126 do while (iter%has_next())
127 system => iter%get_next()
130 next_time_on_largest_dt = max(next_time_on_largest_dt, system%next_time_on_largest_dt())
132 iteration = system%iteration + 1
133 next_time_on_largest_dt = max(next_time_on_largest_dt, iteration%value())
142 class(multisystem_t),
intent(inout) :: this
144 type(system_iterator_t) :: iter
145 class(system_t),
pointer :: system
147 type(event_handle_t) :: debug_handle
152 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
158 call iter%start(this%list)
159 do while (iter%has_next())
160 system => iter%get_next()
161 call system%execute_algorithm()
171 class(multisystem_t),
intent(inout) :: this
172 integer,
intent(in) :: accumulated_iterations
183 call iter%start(this%list)
184 do while (iter%has_next())
185 system => iter%get_next()
186 call system%reset_iteration_counters(accumulated_iterations)
203 call iter%start(this%list)
204 do while (iter%has_next())
205 system => iter%get_next()
206 call system%new_algorithm(factory)
215 this%algo => factory%create_static(this)
216 call this%algo%rewind()
232 finished = this%algo%finished()
235 call iter%start(this%list)
236 do while (iter%has_next())
237 system => iter%get_next()
238 finished = finished .and. system%algorithm_finished()
258 call iter%start(this%list)
259 do while (iter%has_next())
260 system => iter%get_next()
261 call system%init_iteration_counters()
281 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
284 call iter%start(this%list)
285 do while (iter%has_next())
286 system => iter%get_next()
287 call system%algorithm_start()
312 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
318 call iter%start(this%list)
319 do while (iter%has_next())
320 system => iter%get_next()
321 call system%algorithm_finish()
340 integer,
optional,
intent(in) :: interaction_type
345 if (
present(interaction_type))
then
346 if (any(this%supported_interactions_as_partner == interaction_type))
then
353 call iter%start(this%list)
354 do while (iter%has_next())
355 system => iter%get_next()
356 call system%add_partners_to_list(list, interaction_type)
376 class(
system_t),
pointer :: subsystem
382 call iter%start(this%list)
383 do while (iter%has_next())
384 subsystem => iter%get_next()
385 call subsystem%create_interactions(interaction_factory, available_partners)
406 message(1) =
"Trying to initialize an interaction in the multi-system container class"
417 integer,
intent(in) ::
iunit
418 logical,
intent(in) :: include_ghosts
428 call sys_iter%start(this%list)
429 do while (sys_iter%has_next())
430 system => sys_iter%get_next()
433 call inter_iter%start(system%interactions)
434 do while (inter_iter%has_next())
435 interaction => inter_iter%get_next()
438 select type (interaction)
440 if (include_ghosts)
then
441 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" <- "' + trim(interaction%partner%namespace%get()) + &
442 '" [label="'+ interaction%label +
'"];'
446 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" <- "' + trim(interaction%partner%namespace%get()) + &
447 '" [label="'+ interaction%label +
'"];'
454 call system%write_interaction_graph(
iunit, include_ghosts)
470 call iter%start(this%list)
471 do while (iter%has_next())
472 system => iter%get_next()
473 call system%initialize()
483 character(len=:),
allocatable,
intent(out) :: updated_quantities(:)
496 real(real64),
intent(in) :: tol
504 call iter%start(this%list)
505 do while (iter%has_next())
506 system => iter%get_next()
507 if (.not. system%is_tolerance_reached(tol)) converged = .false.
516 character(len=*),
intent(in) :: label
523 message(1) =
"Trying to update a quantity in the multi-system container class"
539 message(1) =
"Trying to initialize an interaction as partner in the multi-system container class"
555 message(1) =
"Trying to copy quantities to interaction in the multi-system container class"
571 call iter%start(this%list)
572 do while (iter%has_next())
573 system => iter%get_next()
574 if (system%process_is_slave()) is_slave = .
true.
593 this%kinetic_energy =
m_zero
603 class(
system_t),
pointer :: system_2
612 this%internal_energy =
m_zero
614 call system_iter%start(this%list)
615 do while (system_iter%has_next())
617 system => system_iter%get_next()
620 call system%update_kinetic_energy()
621 this%internal_energy = this%internal_energy + system%kinetic_energy
624 call system%update_internal_energy()
625 this%internal_energy = this%internal_energy + system%internal_energy
628 call system_iter_2%start(this%list)
629 do while(system_iter_2%has_next())
631 system_2 => system_iter_2%get_next()
635 if(.not.
associated(system, system_2))
then
669 this%potential_energy =
m_zero
675 call this%get_flat_list(flat_list)
678 call system_iter%start(flat_list)
679 do while (system_iter%has_next())
681 system => system_iter%get_next()
684 call system%update_potential_energy()
687 call interaction_iter%start(system%interactions)
688 do while (interaction_iter%has_next())
689 interaction => interaction_iter%get_next()
690 if(.not. flat_list%contains(interaction%partner) .and. .not. interaction%intra_interaction)
then
691 call interaction%calculate_energy()
692 this%potential_energy = this%potential_energy + interaction%energy
712 class(
system_t),
pointer :: system_a
713 class(
system_t),
pointer :: system_b
721 select type(partner_a)
724 call system_iterator_a%start(partner_a%list)
725 do while( system_iterator_a%has_next() )
727 system_a => system_iterator_a%get_next()
729 select type(partner_b)
732 call system_iterator_b%start(partner_b%list)
733 do while( system_iterator_b%has_next() )
734 system_b => system_iterator_b%get_next()
747 select type(partner_b)
750 call system_iterator_b%start(partner_b%list)
751 do while( system_iterator_b%has_next() )
752 system_b => system_iterator_b%get_next()
768 real(real64) function interaction_energy(system, partner) result (energy)
769 class(
system_t),
target,
intent(in) :: system
777 call interaction_iterator%start(system%interactions)
778 do while(interaction_iterator%has_next())
779 interaction => interaction_iterator%get_next()
780 if(
associated(interaction%partner, partner))
then
781 call interaction%calculate_energy()
782 energy = energy + interaction%energy
795 type(system_list_t),
intent(out) :: flat_list
797 class(interaction_partner_t),
pointer :: partner
798 type(partner_iterator_t) :: iterator
802 call iterator%start(this%list)
803 do while (iterator%has_next())
804 partner => iterator%get_next()
806 call flat_list%add(partner)
808 select type (partner)
811 call partner%get_flat_list(flat_list)
824 type(system_iterator_t) :: iter
825 class(system_t),
pointer :: system
829 call iter%start(this%list)
830 do while (iter%has_next())
831 system => iter%get_next()
832 if (
associated(system))
then
837 call system_end(this)
845 real(real64),
intent(in) :: target_time
846 integer,
intent(in) :: barrier_index
848 type(system_iterator_t) :: iter
849 class(system_t),
pointer :: system
853 call iter%start(this%list)
854 do while (iter%has_next())
855 system => iter%get_next()
856 call system%start_barrier(target_time, barrier_index)
865 integer,
intent(in) :: barrier_index
867 type(system_iterator_t) :: iter
868 class(system_t),
pointer :: system
872 call iter%start(this%list)
873 do while (iter%has_next())
874 system => iter%get_next()
875 call system%end_barrier(barrier_index)
884 integer,
intent(in) :: barrier_index
886 type(system_iterator_t) :: iter
887 class(system_t),
pointer :: system
892 call iter%start(this%list)
893 do while (iter%has_next())
894 system => iter%get_next()
896 system%arrived_at_barrier(barrier_index)
906 type(system_iterator_t) :: iter
907 class(system_t),
pointer :: system
912 call system_restart_write(this)
915 call iter%start(this%list)
916 do while (iter%has_next())
917 system => iter%get_next()
918 call system%restart_write()
920 message(1) =
"Wrote restart data for multisystem "//trim(this%namespace%get())
921 call messages_info(1, namespace=this%namespace)
930 type(system_iterator_t) :: iter
931 class(system_t),
pointer :: system
937 call iter%start(this%list)
938 do while (iter%has_next())
939 system => iter%get_next()
942 system%restart_read()
946 message(1) =
"Successfully read restart data for multisystem "//trim(this%namespace%get())
947 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.
System information (time, memory, sysname)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
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_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_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.