• R/O
  • SSH

treelm: Commit

Repository of the treelm library. Now found at https://github.com/apes-suite/treelm


Commit MetaInfo

Revision6209c188ba7c4e51f6377d2fe65af1db56f0e697 (tree)
Zeit2021-02-19 19:22:50
AutorHarald Klimach <harald.klimach@uni-...>
CommiterHarald Klimach

Log Message

Added a solverAborts type to hold solver specific configurations for
aborts of the simulation to be loaded in the abort_criteria table.

Ändern Zusammenfassung

Diff

diff -r 638a7c50b638 -r 6209c188ba7c source/control/tem_abortCriteria_module.f90
--- a/source/control/tem_abortCriteria_module.f90 Mon Feb 15 08:52:12 2021 +0100
+++ b/source/control/tem_abortCriteria_module.f90 Fri Feb 19 11:22:50 2021 +0100
@@ -1,4 +1,4 @@
1-! Copyright (c) 2013-2014, 2019-2020 Harald Klimach <harald.klimach@uni-siegen.de>
1+! Copyright (c) 2013-2014, 2019-2021 Harald Klimach <harald.klimach@uni-siegen.de>
22 ! Copyright (c) 2014 Peter Vitt <peter.vitt2@uni-siegen.de>
33 ! Copyright (c) 2014 Simon Zimny <s.zimny@grs-sim.de>
44 ! Copyright (c) 2014 Jiaxing Qi <jiaxing.qi@uni-siegen.de>
@@ -28,6 +28,8 @@
2828 ! **************************************************************************** !
2929 !> This module provides the definition of various abort criteria upon which
3030 !! a simulation should be stopped.
31+!! Note that solvers may extend this table and have their own set of
32+!! addititonal abort parameters to be set in this table.
3133 !!
3234 !! There are two primary options that may be set:
3335 !!
@@ -111,10 +113,41 @@
111113 public :: tem_abortCriteria_dump
112114 public :: tem_stop_file_exists
113115
116+ !> Abstract type to describe solver specific abort criteria.
117+ !!
118+ !! Solvers may extend this type and pass it to load additional,
119+ !! solver specific criteria.
120+ type, abstract, public :: tem_solverAborts_type
121+ contains
122+ procedure(load_aborts), deferred :: load
123+ end type tem_solverAborts_type
124+
125+ abstract interface
126+
127+ !> Loading additional parameters for solver specific abort criteria
128+ !! from the configuration file.
129+ subroutine load_aborts(me, conf, abort_table)
130+ use aotus_module, only: flu_State
131+ import tem_solverAborts_type
132+
133+ !> The solver specific type to hold additional abort parameters.
134+ class(tem_solverAborts_type), intent(inout) :: me
135+
136+ !> Handle to Lua configuration file to load parameters from.
137+ type(flu_state), intent(in) :: conf
138+
139+ !> Handle to the abort criteria table to read from.
140+ integer, intent(in) :: abort_table
141+ end subroutine load_aborts
142+
143+ end interface
144+
114145 !> Definition of the various abort criteria.
115146 !!
116147 !! Currently we only have two in addition to the time controlled and
117148 !! erroneous aborts.
149+ !! Solvers may pass an additional type to load extra parameters for
150+ !! aborts from the abortcriteria table.
118151 type tem_abortCriteria_type
119152 !> A file which should cause the simulation to stop.
120153 !! Default: ''.
@@ -217,7 +250,10 @@
217250 !!
218251 !! If steady_state is True then load convergence table for condition to
219252 !! check for steady state
220- subroutine tem_abortCriteria_load(me, conf, parent, key)
253+ !!
254+ !! Solvers may pass an additional solverAborts for specific abort parameters
255+ !! to be filled from the abort_criteria table.
256+ subroutine tem_abortCriteria_load(me, conf, parent, key, solverAborts)
221257 ! -------------------------------------------------------------------- !
222258 !> Abort criteria to load from the Lua table.
223259 type(tem_abortCriteria_type), intent(out) :: me
@@ -230,6 +266,9 @@
230266
231267 !> Name of the time control table. Default: 'time_control'
232268 character(len=*), intent(in), optional :: key
269+
270+ !> Solver specific abort criteria to load.
271+ class(tem_solverAborts_type), intent(inout), optional :: solverAborts
233272 ! -------------------------------------------------------------------- !
234273 character(len=labelLen) :: loc_key
235274 integer :: thandle
@@ -267,6 +306,11 @@
267306 & steady_state = me%steady_state )
268307 end if
269308
309+ if (present(solverAborts)) then
310+ call solverAborts%load( conf = conf, &
311+ & abort_table = thandle )
312+ end if
313+
270314 call aot_get_val( L = conf, &
271315 & thandle = thandle, &
272316 & val = me%velLat_max, &
diff -r 638a7c50b638 -r 6209c188ba7c source/control/tem_simControl_module.f90
--- a/source/control/tem_simControl_module.f90 Mon Feb 15 08:52:12 2021 +0100
+++ b/source/control/tem_simControl_module.f90 Fri Feb 19 11:22:50 2021 +0100
@@ -1,4 +1,4 @@
1-! Copyright (c) 2013-2014, 2019-2020 Harald Klimach <harald.klimach@uni-siegen.de>
1+! Copyright (c) 2013-2014, 2019-2021 Harald Klimach <harald.klimach@uni-siegen.de>
22 ! Copyright (c) 2014, 2018 Kannan Masilamani <kannan.masilamani@uni-siegen.de>
33 ! Copyright (c) 2014 Peter Vitt <peter.vitt2@uni-siegen.de>
44 ! Copyright (c) 2014 Simon Zimny <s.zimny@grs-sim.de>
@@ -117,7 +117,8 @@
117117 & tem_abortCriteria_load, &
118118 & tem_abortCriteria_out, &
119119 & tem_abortCriteria_dump, &
120- & tem_stop_file_exists
120+ & tem_stop_file_exists, &
121+ & tem_solverAborts_type
121122
122123 use tem_convergence_module, only: tem_convergence_reset
123124
@@ -196,7 +197,9 @@
196197 !! the current time.
197198 !! The main setting here, is the time_control, which is also attempted to
198199 !! be read directly, if there is no sim_control table provided.
199- subroutine tem_simControl_load(me, conf, parent, key)
200+ !! Solvers may pass solverAborts to load additional abort criteria that
201+ !! are to be loaded from the configuration.
202+ subroutine tem_simControl_load(me, conf, parent, key, solverAborts)
200203 ! -------------------------------------------------------------------- !
201204 !> Simulation control parameters to set.
202205 type(tem_simControl_type), intent(inout) :: me
@@ -210,6 +213,9 @@
210213
211214 !> Name for the simulation control table. Default is 'sim_control'.
212215 character(len=*), optional :: key
216+
217+ !> Solver specific abort criteria to load.
218+ class(tem_solverAborts_type), intent(inout), optional :: solverAborts
213219 ! -------------------------------------------------------------------- !
214220 character(len=labelLen) :: loc_key
215221 integer :: thandle
@@ -229,9 +235,10 @@
229235 & conf = conf, &
230236 & parent = thandle )
231237
232- call tem_abortCriteria_load(me = me%abortCriteria, &
233- & conf = conf, &
234- & parent = thandle )
238+ call tem_abortCriteria_load( me = me%abortCriteria, &
239+ & conf = conf, &
240+ & parent = thandle, &
241+ & solverAborts = solverAborts )
235242 else
236243 ! No sim control table found, try to load the time control table itself.
237244 call tem_timeControl_load(me%timeControl, conf, parent)
diff -r 638a7c50b638 -r 6209c188ba7c source/tem_general_module.f90
--- a/source/tem_general_module.f90 Mon Feb 15 08:52:12 2021 +0100
+++ b/source/tem_general_module.f90 Fri Feb 19 11:22:50 2021 +0100
@@ -1,4 +1,4 @@
1-! Copyright (c) 2013-2017, 2019 Harald Klimach <harald.klimach@uni-siegen.de>
1+! Copyright (c) 2013-2017, 2019, 2021 Harald Klimach <harald.klimach@uni-siegen.de>
22 ! Copyright (c) 2013-2014 Simon Zimny <s.zimny@grs-sim.de>
33 ! Copyright (c) 2013, 2016 Verena Krupp <verena.krupp@uni-siegen.de>
44 ! Copyright (c) 2013-2015, 2018 Kannan Masilamani <kannan.masilamani@uni-siegen.de>
@@ -44,6 +44,7 @@
4444 & print_self_status, null_device, pathLen, &
4545 & stdOutUnit, labelLen
4646 use tem_aux_module, only: tem_abort
47+ use tem_abortCriteria_module, only: tem_solverAborts_type
4748 use tem_comm_module, only: tem_commpattern_type, tem_load_commpattern
4849 use tem_logging_module, only: logUnit
4950 use tem_solveHead_module, only: tem_solveHead_type, tem_init_solveHead
@@ -114,7 +115,7 @@
114115 ! ************************************************************************** !
115116 !> Load general treelm settings from the Lua script in conf.
116117 !!
117- subroutine tem_load_general( me, conf, timingFile )
118+ subroutine tem_load_general( me, conf, timingFile, solverAborts )
118119 ! ----------------------------------------------------------------------
119120 !> global general parameter
120121 type( tem_general_type ), intent(inout) :: me
@@ -123,6 +124,13 @@
123124 !> Default timing filename provided by the caller, overwritten by config
124125 !! file.
125126 character(len=*), optional, intent(in) :: timingFile
127+
128+ !> Solver specific abort criteria to load.
129+ !!
130+ !! See [[tem_abortCriteria_module]] for details on this additional
131+ !! abortCriteria parameters, that the solver may define to be loaded
132+ !! from the configuration.
133+ class(tem_solverAborts_type), intent(inout), optional :: solverAborts
126134 ! ----------------------------------------------------------------------
127135 integer :: iError
128136 character(len=pathLen) :: def_timingFile
@@ -162,7 +170,9 @@
162170 end if
163171
164172 ! load simulation time control
165- call tem_simControl_load(me = me%simControl, conf = conf)
173+ call tem_simControl_load( me = me%simControl, &
174+ & conf = conf, &
175+ & solverAborts = solverAborts )
166176
167177 if ( me%proc%isRoot ) then
168178 call tem_simControl_dump(me = me%simControl, outUnit = logUnit(1))
Show on old repository browser