79 type(system_list_t) :: list
121 class(multisystem_t),
intent(inout) :: this
122 type(namespace_t),
intent(in) :: namespace
123 class(system_factory_abst_t),
intent(in) :: factory
125 integer :: isys, system_type, ic
126 character(len=128) :: system_name
131 this%namespace = namespace
133 if (
parse_block(this%namespace, factory%block_name(), blk) == 0)
then
138 if (len_trim(system_name) == 0)
then
153 message(1) =
"Input error while reading block "//trim(this%namespace%get())//
"."//trim(factory%block_name())
165 character(len=128),
intent(in) :: system_name
166 integer,
intent(in) :: system_type
167 integer,
intent(in) :: isys
177 call io_mkdir(system_name, namespace=this%namespace)
180 sys => factory%create(this%namespace, system_name, system_type)
181 if (.not.
associated(sys))
then
186 call iter%start(this%list)
187 do while (iter%has_next())
188 other => iter%get_next()
189 if (sys%namespace == other%namespace)
then
191 row=isys-1, column=0)
196 call this%list%add(sys)
217 call iter%start(this%list)
218 do while (iter%has_next())
219 sys => iter%get_next()
222 call sys%init_parallelization(sys_grp)
231 float :: next_time_on_largest_dt
239 next_time_on_largest_dt =
m_zero
240 call iter%start(this%list)
241 do while (iter%has_next())
242 system => iter%get_next()
245 next_time_on_largest_dt = max(next_time_on_largest_dt, system%next_time_on_largest_dt())
247 iteration = system%iteration + 1
248 next_time_on_largest_dt = max(next_time_on_largest_dt, iteration%value())
267 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
273 call iter%start(this%list)
274 do while (iter%has_next())
275 system => iter%get_next()
276 call system%execute_algorithm()
287 integer,
intent(in) :: accumulated_iterations
298 call iter%start(this%list)
299 do while (iter%has_next())
300 system => iter%get_next()
301 call system%reset_iteration_counters(accumulated_iterations)
318 call iter%start(this%list)
319 do while (iter%has_next())
320 system => iter%get_next()
321 call system%init_algorithm(factory)
330 this%algo => factory%create_static(this)
331 call this%algo%rewind()
347 finished = this%algo%finished()
350 call iter%start(this%list)
351 do while (iter%has_next())
352 system => iter%get_next()
353 finished = finished .and. system%algorithm_finished()
373 call iter%start(this%list)
374 do while (iter%has_next())
375 system => iter%get_next()
376 call system%init_iteration_counters()
396 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
402 call iter%start(this%list)
403 do while (iter%has_next())
404 system => iter%get_next()
405 call system%propagation_start()
427 system_iteration = this%iteration, algo_iteration = this%algo%iteration)
433 call iter%start(this%list)
434 do while (iter%has_next())
435 system => iter%get_next()
436 call system%propagation_finish()
462 call iter_i%start(this%interactions)
463 do while (iter_i%has_next())
464 interaction => iter_i%get_next()
465 select type (interaction)
469 call this%init_interaction(interaction)
470 call interaction%partner%init_interaction_as_partner(interaction)
476 call iter_s%start(this%list)
477 do while (iter_s%has_next())
478 system => iter_s%get_next()
479 call system%init_all_interactions()
501 message(1) =
"Trying to initialize an interaction in the multi-system container class"
512 integer,
intent(in) ::
iunit
513 logical,
intent(in) :: include_ghosts
523 call sys_iter%start(this%list)
524 do while (sys_iter%has_next())
525 system => sys_iter%get_next()
528 call inter_iter%start(system%interactions)
529 do while (inter_iter%has_next())
530 interaction => inter_iter%get_next()
533 select type (interaction)
535 if (include_ghosts)
then
536 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" -> "' + trim(interaction%partner%namespace%get()) + &
537 '" [label="'+ interaction%label +
'"];'
541 write(
iunit,
'(2x,a)')
'"' + trim(system%namespace%get()) +
'" -> "' + trim(interaction%partner%namespace%get()) + &
542 '" [label="'+ interaction%label +
'"];'
549 call system%write_interaction_graph(
iunit, include_ghosts)
565 call iter%start(this%list)
566 do while (iter%has_next())
567 system => iter%get_next()
568 call system%initial_conditions()
578 integer,
allocatable,
intent(out) :: updated_quantities(:)
591 float,
intent(in) :: tol
599 call iter%start(this%list)
600 do while (iter%has_next())
601 system => iter%get_next()
602 if (.not. system%is_tolerance_reached(tol)) converged = .false.
611 integer,
intent(in) :: iq
618 message(1) =
"Trying to update a quantity in the multi-system container class"
634 message(1) =
"Trying to initialize an interaction as partner in the multi-system container class"
650 message(1) =
"Trying to copy quantities to interaction in the multi-system container class"
666 call iter%start(this%list)
667 do while (iter%has_next())
668 system => iter%get_next()
669 if (system%process_is_slave()) is_slave = .
true.
688 this%kinetic_energy =
m_zero
698 class(
system_t),
pointer :: system_2
707 this%internal_energy =
m_zero
709 call system_iter%start(this%list)
710 do while (system_iter%has_next())
712 system => system_iter%get_next()
715 call system%update_kinetic_energy()
716 this%internal_energy = this%internal_energy + system%kinetic_energy
719 call system%update_internal_energy()
720 this%internal_energy = this%internal_energy + system%internal_energy
723 call system_iter_2%start(this%list)
724 do while(system_iter_2%has_next())
726 system_2 => system_iter_2%get_next()
730 if(.not.
associated(system, system_2))
then
764 this%potential_energy =
m_zero
770 call this%get_flat_list(flat_list)
773 call system_iter%start(flat_list)
774 do while (system_iter%has_next())
776 system => system_iter%get_next()
779 call system%update_potential_energy()
782 call interaction_iter%start(system%interactions)
783 do while (interaction_iter%has_next())
784 interaction => interaction_iter%get_next()
785 if(.not. flat_list%contains(interaction%partner) .and. .not. interaction%intra_interaction)
then
786 call interaction%calculate_energy()
787 this%potential_energy = this%potential_energy + interaction%energy
807 class(
system_t),
pointer :: system_a
808 class(
system_t),
pointer :: system_b
816 select type(partner_a)
819 call system_iterator_a%start(partner_a%list)
820 do while( system_iterator_a%has_next() )
822 system_a => system_iterator_a%get_next()
824 select type(partner_b)
827 call system_iterator_b%start(partner_b%list)
828 do while( system_iterator_b%has_next() )
829 system_b => system_iterator_b%get_next()
842 select type(partner_b)
845 call system_iterator_b%start(partner_b%list)
846 do while( system_iterator_b%has_next() )
847 system_b => system_iterator_b%get_next()
864 class(
system_t),
target,
intent(in) :: system
872 call interaction_iterator%start(system%interactions)
873 do while(interaction_iterator%has_next())
874 interaction => interaction_iterator%get_next()
875 if(
associated(interaction%partner, partner))
then
876 call interaction%calculate_energy()
877 energy = energy + interaction%energy
897 call iterator%start(this%list)
898 do while (iterator%has_next())
899 partner => iterator%get_next()
901 call flat_list%add(partner)
903 select type (partner)
906 call partner%get_flat_list(flat_list)
924 call iter%start(this%list)
925 do while (iter%has_next())
926 system => iter%get_next()
927 if (
associated(system))
then
940 float,
intent(in) :: target_time
941 integer,
intent(in) :: barrier_index
948 call iter%start(this%list)
949 do while (iter%has_next())
950 system => iter%get_next()
951 call system%start_barrier(target_time, barrier_index)
960 integer,
intent(in) :: barrier_index
967 call iter%start(this%list)
968 do while (iter%has_next())
969 system => iter%get_next()
970 call system%end_barrier(barrier_index)
979 integer,
intent(in) :: barrier_index
987 call iter%start(this%list)
988 do while (iter%has_next())
989 system => iter%get_next()
991 system%arrived_at_barrier(barrier_index)
1010 call iter%start(this%list)
1011 do while (iter%has_next())
1012 system => iter%get_next()
1013 call system%restart_write()
1015 message(1) =
"Wrote restart data for multisystem "//trim(this%namespace%get())
1032 call iter%start(this%list)
1033 do while (iter%has_next())
1034 system => iter%get_next()
1037 system%restart_read()
1041 message(1) =
"Successfully read restart data for multisystem "//trim(this%namespace%get())
real(8) function interaction_energy(system, partner)
This module defines the abstract interfact for algorithm factories.
This module implements the basic elements defining algorithms.
real(8), parameter, public m_zero
This module defines the abstract interaction_t class, and some auxiliary classes for interactions.
integer, parameter, public timing_exact
This module defines classes and functions for interaction partners.
subroutine, public io_mkdir(fname, namespace, parents)
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
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, public messages_input_error(namespace, var, details, row, column)
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 subroutine multisystem_init_all_interactions(this)
initialize all interactions of the multisystem
recursive logical function multisystem_process_is_slave(this)
recursive subroutine, public multisystem_init(this, namespace, factory)
initialize the multisystem class
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_restart_write(this)
recursive real(8) function multisystem_pair_energy(partner_A, partner_B)
This function calculates the complete interaction energy between partner_A and partner_B,...
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_create_system(this, system_name, system_type, isys, factory)
create a system in the 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 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(8) function multisystem_next_time_on_largest_dt(this)
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)
character(len=27), parameter, public parser_varname_excluded_characters
integer function, public parse_block(namespace, name, blk, check_varinfo_)
This module defines the abstract class for the system factory.
This module implements the abstract system type.
subroutine, public system_init_iteration_counters(this)
subroutine, public system_restart_write(this)
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_propagation_finish(this)
subroutine, public system_end(this)
subroutine, public system_execute_algorithm(this)
perform one or more algorithmic operations
logical function, public system_restart_read(this)
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
iterator for the list of partners
surrogate interaction class to avoid circular dependencies between modules.
This class implements the iteration counter used by the multisystem algorithms. As any iteration coun...
This is defined even when running serial.
events marking a function call
handle to keep track of in- out- events
the abstract multisystem class
abstract class of the system factory
These classes extends the list and list iterator to create a system list.
Abstract class for systems.