NANDRAD Data Model Library  Version 2.0
NANDRAD
NANDRAD_SolverParameter.h
1 /* The NANDRAD data model library.
2 
3  Copyright (c) 2012-today, Institut für Bauklimatik, TU Dresden, Germany
4 
5  Primary authors:
6  Andreas Nicolai <andreas.nicolai -[at]- tu-dresden.de>
7  Anne Paepcke <anne.paepcke -[at]- tu-dresden.de>
8 
9  This library is part of SIM-VICUS (https://github.com/ghorwin/SIM-VICUS)
10 
11  This library is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 */
21 
22 #ifndef NANDRAD_SolverParameterH
23 #define NANDRAD_SolverParameterH
24 
25 #include <string>
26 #include <IBK_Parameter.h>
27 #include <IBK_IntPara.h>
28 #include <IBK_Flag.h>
29 
30 #include "NANDRAD_CodeGenMacros.h"
31 
32 namespace NANDRAD {
33 
34 /*! Solver parameters define options/flags related to the numerical engine, and are
35  typically independent of the physical model evaluation.
36 
37  \sa SimulationParameter
38 */
40 public:
41 
42  /*! Parameter. */
43  enum para_t {
44  /*! Relative tolerance for solver error check, default 1e-5. */
45  P_RelTol, // Keyword: RelTol [---] 'Relative tolerance for solver error check.'
46  /*! Absolute tolerance for solver error check, default 1e-10. */
47  P_AbsTol, // Keyword: AbsTol [---] 'Absolute tolerance for solver error check.'
48  /*! Maximum permitted time step for integration, default 1 h. */
49  P_MaxTimeStep, // Keyword: MaxTimeStep [min] 'Maximum permitted time step for integration.'
50  /*! Minimum accepted time step, before solver aborts with error, default 1e-12 s. */
51  P_MinTimeStep, // Keyword: MinTimeStep [s] 'Minimum accepted time step, before solver aborts with error.'
52  /*! Initial time step size (or constant step size for ExplicitEuler integrator), default 0.1 s. */
53  P_InitialTimeStep, // Keyword: InitialTimeStep [s] 'Initial time step size (or constant step size for ExplicitEuler integrator).'
54  P_NonlinSolverConvCoeff, // Keyword: NonlinSolverConvCoeff [---] 'Coefficient reducing nonlinear equation solver convergence limit.'
55  P_IterativeSolverConvCoeff, // Keyword: IterativeSolverConvCoeff [---] 'Coefficient reducing iterative equation solver convergence limit.'
56  /*! Minimum element width for wall discretization, default 2 mm. */
57  P_DiscMinDx, // Keyword: DiscMinDx [m] 'Minimum element width for wall discretization.'
58  /*! Stretch factor for variable wall discretizations (0-no disc, 1-equidistance, larger than 1 - variable), default 4. */
59  P_DiscStretchFactor, // Keyword: DiscStretchFactor [---] 'Stretch factor for variable wall discretizations (0-no disc, 1-equidistance, larger than 1 - variable).'
60  P_ViewfactorTileWidth, // Keyword: ViewfactorTileWidth [m] 'Maximum dimension of a tile for calculation of view factors.'
61  P_SurfaceDiscretizationDensity, // Keyword: SurfaceDiscretizationDensity [---] 'Number of surface discretization elements of a wall in each direction.'
62  P_ControlTemperatureTolerance, // Keyword: ControlTemperatureTolerance [K] 'Temperature tolerance for ideal heating or cooling.'
63  P_KinsolRelTol, // Keyword: KinsolRelTol [---] 'Relative tolerance for Kinsol solver.'
64  P_KinsolAbsTol, // Keyword: KinsolAbsTol [---] 'Absolute tolerance for Kinsol solver.'
65  NUM_P
66  };
67 
68  /*! Integer parameters. */
69  enum intPara_t {
70  IP_PreILUWidth, // Keyword: PreILUWidth 'Maximum level of fill-in to be used for ILU preconditioner.'
71  IP_MaxKrylovDim, // Keyword: MaxKrylovDim 'Maximum dimension of Krylov subspace.'
72  IP_MaxNonlinIter, // Keyword: MaxNonlinIter 'Maximum number of nonlinear iterations.'
73  IP_MaxOrder, // Keyword: MaxOrder 'Maximum order allowed for multi-step solver.'
74  IP_KinsolMaxNonlinIter, // Keyword: KinsolMaxNonlinIter 'Maximum nonlinear iterations for Kinsol solver.'
75  IP_DiscMaxElementsPerLayer, // Keyword: DiscMaxElementsPerLayer 'Maximum number of elements per layer.'
76  NUM_IP
77  };
78 
79  /*! Flags. */
80  enum flag_t {
81  F_DetectMaxTimeStep, // Keyword: DetectMaxTimeStep 'Check schedules to determine minimum distances between steps and adjust MaxTimeStep.'
82  F_KinsolDisableLineSearch, // Keyword: KinsolDisableLineSearch 'Disable line search for steady state cycles.'
83  F_KinsolStrictNewton, // Keyword: KinsolStrictNewton 'Enable strict Newton for steady state cycles.'
84  NUM_F
85  };
86 
87  /*! Enumeration of available integrators. */
88  enum integrator_t {
89  I_CVODE, // Keyword: CVODE 'CVODE based solver'
90  I_ExplicitEuler, // Keyword: ExplicitEuler 'Explicit Euler solver'
91  I_ImplicitEuler, // Keyword: ImplicitEuler 'Implicit Euler solver'
92  NUM_I // Keyword: auto 'Automatic selection of integrator'
93  };
94 
95  /*! Enumeration of available linear equation system (LES) solvers, to be used with
96  implicit integrators.
97  */
98  enum lesSolver_t {
99  LES_Dense, // Keyword: Dense 'Dense solver'
100  LES_KLU, // Keyword: KLU 'KLU sparse solver'
101  LES_GMRES, // Keyword: GMRES 'GMRES iterative solver'
102  LES_BiCGStab, // Keyword: BiCGStab 'BICGSTAB iterative solver'
103  NUM_LES // Keyword: auto 'Automatic selection of linear equation system solver'
104  };
105 
106  /*! Enumeration of available preconditioners, to be used with iterative LES solvers. */
107  enum precond_t {
108  PRE_ILU, // Keyword: ILU 'Incomplete LU preconditioner'
109  NUM_PRE // Keyword: auto 'Automatic selection of preconditioner'
110  };
111 
112 
113  // *** PUBLIC MEMBER FUNCTIONS ***
114 
115  /*! Init default values (called before readXML()).
116  \note These values will be overwritten in readXML() when the respective property is set
117  in the project file.
118  */
119  void initDefaults();
120 
121  NANDRAD_READWRITE
122  NANDRAD_COMP(SolverParameter)
123 
124  /*! To be called after readXML() and mainly used to check whether user-provided parameters are in the valid ranges. */
125  void checkParameters() const;
126 
127  // *** PUBLIC MEMBER VARIABLES ***
128 
129  /*! List of parameters. */
130  IBK::Parameter m_para[NUM_P]; // XML:E
131  /*! List of integer value parameters. */
132  IBK::IntPara m_intPara[NUM_IP]; // XML:E
133  /*! List of flags. */
134  IBK::Flag m_flag[NUM_F]; // XML:E
135 
136  /*! Selected integrator engine.
137  \sa integrator_t
138  */
139  integrator_t m_integrator = NUM_I; // XML:E
140 
141  /*! Selected LES solver.
142  \sa lesSolver_t
143  */
144  lesSolver_t m_lesSolver = NUM_LES; // XML:E
145 
146  /*! Selected preconditioner.
147  \sa precond_t
148  */
149  precond_t m_preconditioner = NUM_PRE; // XML:E
150 };
151 
152 } // namespace NANDRAD
153 
154 #endif // NANDRAD_SolverParameterH
Initial time step size (or constant step size for ExplicitEuler integrator), default 0...
Relative tolerance for solver error check, default 1e-5.
IBK::Parameter m_para[NUM_P]
List of parameters.
lesSolver_t m_lesSolver
Selected LES solver.
Maximum permitted time step for integration, default 1 h.
NANDRAD_READWRITE void checkParameters() const
To be called after readXML() and mainly used to check whether user-provided parameters are in the val...
integrator_t
Enumeration of available integrators.
void initDefaults()
Init default values (called before readXML()).
precond_t m_preconditioner
Selected preconditioner.
lesSolver_t
Enumeration of available linear equation system (LES) solvers, to be used with implicit integrators...
IBK::IntPara m_intPara[NUM_IP]
List of integer value parameters.
Minimum element width for wall discretization, default 2 mm.
Absolute tolerance for solver error check, default 1e-10.
Minimum accepted time step, before solver aborts with error, default 1e-12 s.
integrator_t m_integrator
Selected integrator engine.
Solver parameters define options/flags related to the numerical engine, and are typically independent...
The namespace NANDRAD contains the data model classes that make up the NANDRAD solver input data...
precond_t
Enumeration of available preconditioners, to be used with iterative LES solvers.
Stretch factor for variable wall discretizations (0-no disc, 1-equidistance, larger than 1 - variable...
IBK::Flag m_flag[NUM_F]
List of flags.