Repository of the treelm library. Now found at https://github.com/apes-suite/treelm
Revision | 6209c188ba7c4e51f6377d2fe65af1db56f0e697 (tree) |
---|---|
Zeit | 2021-02-19 19:22:50 |
Autor | Harald Klimach <harald.klimach@uni-...> |
Commiter | Harald Klimach |
Added a solverAborts type to hold solver specific configurations for
aborts of the simulation to be loaded in the abort_criteria table.
@@ -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> | |
2 | 2 | ! Copyright (c) 2014 Peter Vitt <peter.vitt2@uni-siegen.de> |
3 | 3 | ! Copyright (c) 2014 Simon Zimny <s.zimny@grs-sim.de> |
4 | 4 | ! Copyright (c) 2014 Jiaxing Qi <jiaxing.qi@uni-siegen.de> |
@@ -28,6 +28,8 @@ | ||
28 | 28 | ! **************************************************************************** ! |
29 | 29 | !> This module provides the definition of various abort criteria upon which |
30 | 30 | !! 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. | |
31 | 33 | !! |
32 | 34 | !! There are two primary options that may be set: |
33 | 35 | !! |
@@ -111,10 +113,41 @@ | ||
111 | 113 | public :: tem_abortCriteria_dump |
112 | 114 | public :: tem_stop_file_exists |
113 | 115 | |
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 | + | |
114 | 145 | !> Definition of the various abort criteria. |
115 | 146 | !! |
116 | 147 | !! Currently we only have two in addition to the time controlled and |
117 | 148 | !! erroneous aborts. |
149 | + !! Solvers may pass an additional type to load extra parameters for | |
150 | + !! aborts from the abortcriteria table. | |
118 | 151 | type tem_abortCriteria_type |
119 | 152 | !> A file which should cause the simulation to stop. |
120 | 153 | !! Default: ''. |
@@ -217,7 +250,10 @@ | ||
217 | 250 | !! |
218 | 251 | !! If steady_state is True then load convergence table for condition to |
219 | 252 | !! 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) | |
221 | 257 | ! -------------------------------------------------------------------- ! |
222 | 258 | !> Abort criteria to load from the Lua table. |
223 | 259 | type(tem_abortCriteria_type), intent(out) :: me |
@@ -230,6 +266,9 @@ | ||
230 | 266 | |
231 | 267 | !> Name of the time control table. Default: 'time_control' |
232 | 268 | character(len=*), intent(in), optional :: key |
269 | + | |
270 | + !> Solver specific abort criteria to load. | |
271 | + class(tem_solverAborts_type), intent(inout), optional :: solverAborts | |
233 | 272 | ! -------------------------------------------------------------------- ! |
234 | 273 | character(len=labelLen) :: loc_key |
235 | 274 | integer :: thandle |
@@ -267,6 +306,11 @@ | ||
267 | 306 | & steady_state = me%steady_state ) |
268 | 307 | end if |
269 | 308 | |
309 | + if (present(solverAborts)) then | |
310 | + call solverAborts%load( conf = conf, & | |
311 | + & abort_table = thandle ) | |
312 | + end if | |
313 | + | |
270 | 314 | call aot_get_val( L = conf, & |
271 | 315 | & thandle = thandle, & |
272 | 316 | & val = me%velLat_max, & |
@@ -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> | |
2 | 2 | ! Copyright (c) 2014, 2018 Kannan Masilamani <kannan.masilamani@uni-siegen.de> |
3 | 3 | ! Copyright (c) 2014 Peter Vitt <peter.vitt2@uni-siegen.de> |
4 | 4 | ! Copyright (c) 2014 Simon Zimny <s.zimny@grs-sim.de> |
@@ -117,7 +117,8 @@ | ||
117 | 117 | & tem_abortCriteria_load, & |
118 | 118 | & tem_abortCriteria_out, & |
119 | 119 | & tem_abortCriteria_dump, & |
120 | - & tem_stop_file_exists | |
120 | + & tem_stop_file_exists, & | |
121 | + & tem_solverAborts_type | |
121 | 122 | |
122 | 123 | use tem_convergence_module, only: tem_convergence_reset |
123 | 124 |
@@ -196,7 +197,9 @@ | ||
196 | 197 | !! the current time. |
197 | 198 | !! The main setting here, is the time_control, which is also attempted to |
198 | 199 | !! 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) | |
200 | 203 | ! -------------------------------------------------------------------- ! |
201 | 204 | !> Simulation control parameters to set. |
202 | 205 | type(tem_simControl_type), intent(inout) :: me |
@@ -210,6 +213,9 @@ | ||
210 | 213 | |
211 | 214 | !> Name for the simulation control table. Default is 'sim_control'. |
212 | 215 | character(len=*), optional :: key |
216 | + | |
217 | + !> Solver specific abort criteria to load. | |
218 | + class(tem_solverAborts_type), intent(inout), optional :: solverAborts | |
213 | 219 | ! -------------------------------------------------------------------- ! |
214 | 220 | character(len=labelLen) :: loc_key |
215 | 221 | integer :: thandle |
@@ -229,9 +235,10 @@ | ||
229 | 235 | & conf = conf, & |
230 | 236 | & parent = thandle ) |
231 | 237 | |
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 ) | |
235 | 242 | else |
236 | 243 | ! No sim control table found, try to load the time control table itself. |
237 | 244 | call tem_timeControl_load(me%timeControl, conf, parent) |
@@ -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> | |
2 | 2 | ! Copyright (c) 2013-2014 Simon Zimny <s.zimny@grs-sim.de> |
3 | 3 | ! Copyright (c) 2013, 2016 Verena Krupp <verena.krupp@uni-siegen.de> |
4 | 4 | ! Copyright (c) 2013-2015, 2018 Kannan Masilamani <kannan.masilamani@uni-siegen.de> |
@@ -44,6 +44,7 @@ | ||
44 | 44 | & print_self_status, null_device, pathLen, & |
45 | 45 | & stdOutUnit, labelLen |
46 | 46 | use tem_aux_module, only: tem_abort |
47 | + use tem_abortCriteria_module, only: tem_solverAborts_type | |
47 | 48 | use tem_comm_module, only: tem_commpattern_type, tem_load_commpattern |
48 | 49 | use tem_logging_module, only: logUnit |
49 | 50 | use tem_solveHead_module, only: tem_solveHead_type, tem_init_solveHead |
@@ -114,7 +115,7 @@ | ||
114 | 115 | ! ************************************************************************** ! |
115 | 116 | !> Load general treelm settings from the Lua script in conf. |
116 | 117 | !! |
117 | - subroutine tem_load_general( me, conf, timingFile ) | |
118 | + subroutine tem_load_general( me, conf, timingFile, solverAborts ) | |
118 | 119 | ! ---------------------------------------------------------------------- |
119 | 120 | !> global general parameter |
120 | 121 | type( tem_general_type ), intent(inout) :: me |
@@ -123,6 +124,13 @@ | ||
123 | 124 | !> Default timing filename provided by the caller, overwritten by config |
124 | 125 | !! file. |
125 | 126 | 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 | |
126 | 134 | ! ---------------------------------------------------------------------- |
127 | 135 | integer :: iError |
128 | 136 | character(len=pathLen) :: def_timingFile |
@@ -162,7 +170,9 @@ | ||
162 | 170 | end if |
163 | 171 | |
164 | 172 | ! 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 ) | |
166 | 176 | |
167 | 177 | if ( me%proc%isRoot ) then |
168 | 178 | call tem_simControl_dump(me = me%simControl, outUnit = logUnit(1)) |