G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsFlowAssemblerBase.h
Go to the documentation of this file.
1
12#pragma once
13
16
17namespace gismo
18{
19
23template<class T, int MatOrder>
25{
26
27protected: // *** Class members ***
28
29 gsFlowSolverParams<T> m_params;
30 index_t m_dofs;
31 short_t m_tarDim;
32 bool m_isInitialized;
33 bool m_isBaseReady;
34 bool m_isSystemReady;
35 std::vector<gsDofMapper> m_dofMappers;
36 std::vector<gsMatrix<T> > m_ddof;
37 gsMatrix<T> m_solution;
38
39
40public: // *** Constructor/destructor ***
41
43 m_params(params)
44 { }
45
46 virtual ~gsFlowAssemblerBase()
47 { }
48
49
50protected: // *** Member functions ***
51
53 void initMembers();
54
56 virtual void updateSizes()
58
62
67 void computeDirichletDofs(const index_t unk, const index_t basisID, gsMatrix<T>& ddofVector);
68
74 void computeDirichletDofsIntpl(const index_t unk, const gsDofMapper & mapper, const gsMultiBasis<T> & mbasis, gsMatrix<T>& ddofVector);
75
81 void computeDirichletDofsL2Proj(const index_t unk, const gsDofMapper & mapper, const gsMultiBasis<T> & mbasis, gsMatrix<T>& ddofVector);
82
88 void assembleBlock(gsFlowVisitor<T, MatOrder>& visitor, index_t testBasisID, gsSparseMatrix<T, MatOrder>& block, gsMatrix<T>& blockRhs);
89
94 void assembleRhs(gsFlowVisitor<T, MatOrder>& visitor, index_t testBasisID, gsMatrix<T>& rhs);
95
99
103
105 virtual void updateAssembly();
106
107
111 virtual void updateCurrentSolField(const gsMatrix<T> & solVector, bool updateSol)
113
114
115public: // *** Member functions ***
116
118 virtual void initialize();
119
123 virtual void update(const gsMatrix<T> & solVector, bool updateSol = true);
124
128 virtual void markDofsAsEliminatedZeros(const std::vector< gsMatrix< index_t > > & boundaryDofs, const index_t unk)
130
135 virtual gsField<T> constructSolution(const gsMatrix<T>& solVector, index_t unk) const
137
138
139public: // *** Getters/setters ***
140
143 {
144 GISMO_ASSERT(m_dofs > 0, "Something went wrong, number of DOFs is zero!");
145 return m_dofs;
146 }
147
149 short_t getTarDim() const { return m_tarDim; }
150
152 bool isInitialized() { return m_isInitialized; }
153
159 const std::vector<gsDofMapper>& getMappers() const { return m_dofMappers; }
160
166 const std::vector<gsMatrix<T> >& getDirichletDofs() const { return m_ddof; }
167
169 const gsMatrix<T>& getSolution() const { return m_solution; }
170
172 const gsMultiPatch<T>& getPatches() const { return m_params.getPde().patches(); }
173
181 std::vector< gsMultiBasis<T> >& getBases() { return m_params.getBases(); }
182 const std::vector< gsMultiBasis<T> >& getBases() const { return m_params.getBases(); }
183
185 const gsBoundaryConditions<T>& getBCs() const { return m_params.getBCs(); }
186
188 const gsFunction<T>* getRhsFcn() const { return m_params.getPde().rhs(); }
189
192
194 gsOptionList options() const { return m_params.options(); }
195
199
202 virtual const gsSparseMatrix<T, MatOrder>& matrix(index_t unk) const
204
209
210 virtual const gsSparseMatrix<T, MatOrder>& getMassMatrix(index_t unkID) const
212
214 virtual const gsMatrix<T>& rhs() const
216
219 virtual const gsMatrix<T>& rhs(index_t unk) const
221
222};
223
224} // namespace gismo
225
226#ifndef GISMO_BUILD_LIB
227#include GISMO_HPP_HEADER(gsFlowAssemblerBase.hpp)
228#endif
Class containing a set of boundary conditions.
Definition gsBoundaryConditions.h:342
Maintains a mapping from patch-local dofs to global dof indices and allows the elimination of individ...
Definition gsDofMapper.h:69
A scalar of vector field defined on a m_parametric geometry.
Definition gsField.h:55
A base class for all assemblers in gsIncompressibleFlow.
Definition gsFlowAssemblerBase.h:25
bool isInitialized()
Returns true if the assembler has been initialized.
Definition gsFlowAssemblerBase.h:152
void assembleBlock(gsFlowVisitor< T, MatOrder > &visitor, index_t testBasisID, gsSparseMatrix< T, MatOrder > &block, gsMatrix< T > &blockRhs)
Assemble a matrix block.
Definition gsFlowAssemblerBase.hpp:270
index_t numDofs() const
Returns the number of degrees of freedom (DOFs).
Definition gsFlowAssemblerBase.h:142
virtual void assembleNonlinearPart()
Assemble the nonlinear part of the problem.
Definition gsFlowAssemblerBase.h:101
virtual void initialize()
Initialize the assembler.
Definition gsFlowAssemblerBase.hpp:352
virtual void updateSizes()
Update sizes of members (when DOF numbers change, e.g. after markDofsAsEliminatedZeros()).
Definition gsFlowAssemblerBase.h:56
virtual const gsMatrix< T > & rhs(index_t unk) const
Returns the assembled right-hand side for unknown with index unk (e.g. from two-equation turbulence m...
Definition gsFlowAssemblerBase.h:219
virtual void updateCurrentSolField(const gsMatrix< T > &solVector, bool updateSol)
Update current solution field stored in the assembler.
Definition gsFlowAssemblerBase.h:111
const gsFunction< T > * getRhsFcn() const
Returns a pointer to the right-hand-side function.
Definition gsFlowAssemblerBase.h:188
virtual const gsMatrix< T > & rhs() const
Returns the assembled right-hand side.
Definition gsFlowAssemblerBase.h:214
const std::vector< gsDofMapper > & getMappers() const
Returns a const reference to the DOF mappers.
Definition gsFlowAssemblerBase.h:159
virtual const gsSparseMatrix< T, MatOrder > & matrix() const
Returns the assembled matrix.
Definition gsFlowAssemblerBase.h:197
void computeDirichletDofs(const index_t unk, const index_t basisID, gsMatrix< T > &ddofVector)
Compute the coefficients of the basis functions at the Dirichlet boundaries.
Definition gsFlowAssemblerBase.hpp:30
void computeDirichletDofsIntpl(const index_t unk, const gsDofMapper &mapper, const gsMultiBasis< T > &mbasis, gsMatrix< T > &ddofVector)
Compute the coefficients of the basis functions at the Dirichlet boundaries using interpolation.
Definition gsFlowAssemblerBase.hpp:70
const std::vector< gsMatrix< T > > & getDirichletDofs() const
Returns a const reference to the vectors of coefficients at the Dirichlet boundaries.
Definition gsFlowAssemblerBase.h:166
void computeDirichletDofsL2Proj(const index_t unk, const gsDofMapper &mapper, const gsMultiBasis< T > &mbasis, gsMatrix< T > &ddofVector)
Compute the coefficients of the basis functions at the Dirichlet boundaries using L2-projection.
Definition gsFlowAssemblerBase.hpp:154
virtual void assembleLinearPart()
Assemble the linear part of the problem.
Definition gsFlowAssemblerBase.h:97
virtual void updateDofMappers()
Update the DOF mappers in all visitors (when DOF numbers change, e.g. after markDofsAsEliminatedZeros...
Definition gsFlowAssemblerBase.h:60
short_t getTarDim() const
Returns the target dimension.
Definition gsFlowAssemblerBase.h:149
const gsBoundaryConditions< T > & getBCs() const
Returns a const reference to the boundary conditions.
Definition gsFlowAssemblerBase.h:185
std::vector< gsMultiBasis< T > > & getBases()
Returns a reference to the discretization bases.
Definition gsFlowAssemblerBase.h:181
virtual gsField< T > constructSolution(const gsMatrix< T > &solVector, index_t unk) const
Construct solution from computed solution vector for unknown unk.
Definition gsFlowAssemblerBase.h:135
gsAssemblerOptions getAssemblerOptions() const
Returns the assembler options.
Definition gsFlowAssemblerBase.h:191
void assembleRhs(gsFlowVisitor< T, MatOrder > &visitor, index_t testBasisID, gsMatrix< T > &rhs)
Assemble the right-hand side.
Definition gsFlowAssemblerBase.hpp:310
void initMembers()
Initialize the class members.
Definition gsFlowAssemblerBase.hpp:19
virtual void update(const gsMatrix< T > &solVector, bool updateSol=true)
Update the assembler in new nonlinear iteration.
Definition gsFlowAssemblerBase.hpp:360
gsOptionList options() const
Returns the flow solver option list.
Definition gsFlowAssemblerBase.h:194
virtual const gsSparseMatrix< T, MatOrder > & matrix(index_t unk) const
Returns the assembled matrix for unknown with index unk (e.g. from two-equation turbulence models).
Definition gsFlowAssemblerBase.h:202
const gsMultiPatch< T > & getPatches() const
Returns a const reference to the multipatch representing the computational domain.
Definition gsFlowAssemblerBase.h:172
virtual void markDofsAsEliminatedZeros(const std::vector< gsMatrix< index_t > > &boundaryDofs, const index_t unk)
Eliminate given DOFs as homogeneous Dirichlet boundary.
Definition gsFlowAssemblerBase.h:128
virtual gsSparseMatrix< T, MatOrder > & getMassMatrix(index_t unkID)
Returns the mass matrix for unknown with index unk. There is also a const version.
Definition gsFlowAssemblerBase.h:207
const gsMatrix< T > & getSolution() const
Returns a const reference to the current computed solution.
Definition gsFlowAssemblerBase.h:169
virtual void updateAssembly()
Assemble all that needs to be updated in each nonlinear iteration.
Definition gsFlowAssemblerBase.hpp:345
A class that holds all parameters needed by the incompressible flow solver.
Definition gsFlowSolverParams.h:34
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
gsOptionList & options()
Returns a reference to the INS solver option list.
Definition gsFlowSolverParams.h:185
Base class for incompressible flow visitors.
Definition gsFlowVisitors.h:29
A function from a n-dimensional domain to an m-dimensional image.
Definition gsFunction.h:60
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Holds a set of patch-wise bases and their topology information.
Definition gsMultiBasis.h:37
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
A class that holds all parameters needed by the incompressible flow solver.
The G+Smo namespace, containing all definitions for the library.
Definition gsAssemblerOptions.h:243