G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsFlowSolverParams.h
Go to the documentation of this file.
1
14#pragma once
15
18
19namespace gismo
20{
21
32template<class T>
34{
35
36protected: // *** Class members ***
37
39 std::vector<gsMultiBasis<T> > m_bases;
40 gsAssemblerOptions m_assembOpt;
41 gsOptionList m_opt;
42 gsOptionList m_precOpt;
43
44 bool m_isBndSet;
45 std::vector<std::pair<int, boxSide> > m_bndIn, m_bndOut, m_bndWall;
46
47public: // *** Constructor/destructor ***
48
50
51
55 gsFlowSolverParams(const gsNavStokesPde<T>& pde, const std::vector<gsMultiBasis<T> >& bases)
56 : m_pde(pde), m_bases(bases)
57 {
58 m_assembOpt.dirStrategy = dirichlet::elimination;
59 m_assembOpt.dirValues = dirichlet::interpolation;
60 m_assembOpt.intStrategy = iFace::glue;
61
63 m_precOpt = gsINSPreconditioner<T, RowMajor>::defaultOptions();
64
65 m_isBndSet = false;
66 }
67
69 {
70 }
71
72public: // *** Static functions ***
73
76 {
77 gsOptionList opt;
78
79 // nonlinear iteration
80 opt.addInt("nonlin.maxIt", "Maximum number of Picard iterations in one time step", 10);
81 opt.addReal("nonlin.tol", "Stopping tolerance for Picard iteration", 1e-5);
82
83 // solving linear systems
84 opt.addString("lin.solver", "The type of linear system solver (direct / iter / petsc)", "direct");
85 opt.addString("lin.krylov", "The Krylov subspace method from G+Smo/Eigen (for lin.solver = iter)", "gmres");
86 opt.addString("lin.precType", "Preconditioner to be used with iterative linear solver", "MSIMPLER_FdiagEqual");
87 opt.addInt("lin.maxIt", "Maximum number of iterations for linear solver (if iterative)", 200);
88 opt.addReal("lin.tol", "Stopping tolerance for linear solver (if iterative)", 1e-6);
89
90 // asssembly
91 //opt.addString("assemb.quad", "The numerical quadrature (Gauss/WQ)", "Gauss");
92 opt.addString("assemb.loop", "EbE = element by element, RbR = row by row", "EbE");
93 //opt.addSwitch("assemb.sumFact", "Use sum factorization for integration", false);
94 opt.addSwitch("fillGlobalSyst", "Fill the global linear systems from blocks", true);
95
96 // time-dependent problem
97 opt.addSwitch("unsteady", "Assemble the velocity mass matrix", false);
98 opt.addReal("timeStep", "Time step size", 0.1);
99
100 // output
101 opt.addSwitch("fileOutput", "Create an output file", false);
102 opt.addSwitch("quiet", "Do not display output in terminal", false);
103 opt.addString("outFile", "Name of the output file (or the full path to it)", "");
104
105 // parallel
106 opt.addSwitch("parallel", "Currently running in parallel", false);
107
108 // geometry jacobian evaluation
109 opt.addInt("jac.npts", "Number of points along a patch side (in each direction) for geometry jacobian check", 100);
110 opt.addReal("jac.dist", "Distance from boundary (in the parametric space) for geometry jacobian check", 1e-2);
111 opt.addReal("jac.tol", "Critical value of geometry jacobian to throw warning", 1e-4);
112
113 return opt;
114 }
115
116
117public: // *** Member functions ***
118
120 void createDofMappers(std::vector<gsDofMapper>& mappers)
121 {
122 mappers.resize(2);
123
124 m_bases.front().getMapper(m_assembOpt.dirStrategy, m_assembOpt.intStrategy, m_pde.bc(), mappers.front(), 0);
125 m_bases.back().getMapper(m_assembOpt.dirStrategy, m_assembOpt.intStrategy, m_pde.bc(), mappers.back(), 1);
126 }
127
132 void setBndParts(std::vector<std::pair<int, boxSide> > bndIn, std::vector<std::pair<int, boxSide> > bndOut, std::vector<std::pair<int, boxSide> > bndWall)
133 {
134 m_bndIn = bndIn;
135 m_bndOut = bndOut;
136 m_bndWall = bndWall;
137
138 m_isBndSet = true;
139 }
140
141
142public: // *** Getters/setters ***
143
145 const gsNavStokesPde<T>& getPde() const { return m_pde; }
146
148 const gsBoundaryConditions<T>& getBCs() const { return m_pde.bc(); }
149
155 std::vector<gsMultiBasis<T> >& getBases() { return m_bases; }
156 const std::vector<gsMultiBasis<T> >& getBases() const { return m_bases; }
157
163 gsAssemblerOptions& assemblerOptions() { return m_assembOpt; }
164 const gsAssemblerOptions& assemblerOptions() const { return m_assembOpt; }
165
167 void setAssemblerOptions(const gsAssemblerOptions& opt) { m_assembOpt = opt; }
168
174 gsOptionList& precOptions() { return m_precOpt; }
175 const gsOptionList& precOptions() const { return m_precOpt; }
176
178 void setPrecOptions(const gsOptionList& opt) { m_precOpt = opt; }
179
185 gsOptionList& options() { return m_opt; }
186 const gsOptionList& options() const { return m_opt; }
187
189 void setOptions(const gsOptionList& opt) { m_opt = opt; }
190
192 std::vector<std::pair<int, boxSide> > getBndIn()
193 {
194 GISMO_ASSERT(m_isBndSet, "Boundary parts are not set in gsFlowSolverParams, call setBndParts(...).");
195 return m_bndIn;
196 }
197
199 std::vector<std::pair<int, boxSide> > getBndOut()
200 {
201 GISMO_ASSERT(m_isBndSet, "Boundary parts are not set in gsFlowSolverParams, call setBndParts(...).");
202 return m_bndOut;
203 }
204
206 std::vector<std::pair<int, boxSide> > getBndWall()
207 {
208 GISMO_ASSERT(m_isBndSet, "Boundary parts are not set in gsFlowSolverParams, call setBndParts(...).");
209 return m_bndWall;
210 }
211
212
213}; // class gsFlowSolverParams
214
215} // namespace gismo
Class containing a set of boundary conditions.
Definition gsBoundaryConditions.h:342
A class that holds all parameters needed by the incompressible flow solver.
Definition gsFlowSolverParams.h:34
void setBndParts(std::vector< std::pair< int, boxSide > > bndIn, std::vector< std::pair< int, boxSide > > bndOut, std::vector< std::pair< int, boxSide > > bndWall)
Set boundary parts (vectors of pairs [patch, side]).
Definition gsFlowSolverParams.h:132
void setOptions(const gsOptionList &opt)
Set INS solver options given in opt.
Definition gsFlowSolverParams.h:189
std::vector< std::pair< int, boxSide > > getBndIn()
Get vector of [patch, side] corresponding to the inflow boundary.
Definition gsFlowSolverParams.h:192
gsFlowSolverParams(const gsNavStokesPde< T > &pde, const std::vector< gsMultiBasis< T > > &bases)
Constructor of the object.
Definition gsFlowSolverParams.h:55
void setAssemblerOptions(const gsAssemblerOptions &opt)
Set assembler options given in opt.
Definition gsFlowSolverParams.h:167
std::vector< std::pair< int, boxSide > > getBndWall()
Get vector of [patch, side] corresponding to the solid wall boundary.
Definition gsFlowSolverParams.h:206
void setPrecOptions(const gsOptionList &opt)
Set preconditioner options given in opt.
Definition gsFlowSolverParams.h:178
const gsNavStokesPde< T > & getPde() const
Returns a const reference to the PDE.
Definition gsFlowSolverParams.h:145
const gsBoundaryConditions< T > & getBCs() const
Returns a const reference to the boundary conditions.
Definition gsFlowSolverParams.h:148
std::vector< gsMultiBasis< T > > & getBases()
Returns a reference to the discretization bases.
Definition gsFlowSolverParams.h:155
gsAssemblerOptions & assemblerOptions()
Returns a reference to the assembler option list.
Definition gsFlowSolverParams.h:163
std::vector< std::pair< int, boxSide > > getBndOut()
Get vector of [patch, side] corresponding to the outflow boundary.
Definition gsFlowSolverParams.h:199
gsOptionList & precOptions()
Returns a reference to the preconditioner option list.
Definition gsFlowSolverParams.h:174
gsOptionList & options()
Returns a reference to the INS solver option list.
Definition gsFlowSolverParams.h:185
void createDofMappers(std::vector< gsDofMapper > &mappers)
Creates DOF mappers for velocity and pressure.
Definition gsFlowSolverParams.h:120
static gsOptionList defaultOptions()
Returns a list of default options for the incompressible flow solver.
Definition gsFlowSolverParams.h:75
Holds a set of patch-wise bases and their topology information.
Definition gsMultiBasis.h:37
An incompressible Navier-Stokes PDE.
Definition gsNavStokesPde.h:33
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
void addInt(const std::string &label, const std::string &desc, const index_t &value)
Adds a option named label, with description desc and value value.
Definition gsOptionList.cpp:201
void addReal(const std::string &label, const std::string &desc, const Real &value)
Adds a option named label, with description desc and value value.
Definition gsOptionList.cpp:211
void addSwitch(const std::string &label, const std::string &desc, const bool &value)
Adds a option named label, with description desc and value value.
Definition gsOptionList.cpp:235
void addString(const std::string &label, const std::string &desc, const std::string &value)
Adds a option named label, with description desc and value value.
Definition gsOptionList.cpp:190
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
The G+Smo namespace, containing all definitions for the library.
Definition gsAssemblerOptions.h:243