G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsINSSolver< T, MatOrder > Class Template Reference

Detailed Description

template<class T, int MatOrder>
class gismo::gsINSSolver< T, MatOrder >

A base class for incompressible Navier-Stokes solvers.

Template Parameters
Treal number type
MatOrdersparse matrix storage order (ColMajor/RowMajor)
+ Inheritance diagram for gsINSSolver< T, MatOrder >:
+ Collaboration diagram for gsINSSolver< T, MatOrder >:

Public Member Functions

virtual void applySolver (gsMatrix< T > &solution)
 Solve the linear system.
 
int checkGeoJacobian (int npts=-1, T dist=-1, T tol=-1)
 Check values of jacobian near boundaries of all patches.
 
gsField< T > constructSolution (int unk) const
 Construct solution field for the unknown unk for the current solution vector.
 
virtual gsINSAssembler< T, MatOrder > * getAssembler () const
 Returns a pointer to the assembler.
 
virtual const T getAssemblyTime () const
 Returns the total time spent on matrix assembly.
 
virtual const T getInitAssemblyTime () const
 Returns the time of the initial matrix assembly.
 
unsigned getIterationNumber () const
 Returns the current iteration number.
 
gsFlowLinSystSolver< T, MatOrder > * getLinSolver () const
 Returns a pointer to the linear system solver.
 
virtual std::string getName ()
 Retrurns the name of the class as a string.
 
virtual gsFlowSolverParams< T > getParams ()
 Retrurns the solver parameters.
 
const gsMatrix< T > & getSolution () const
 Returns the current solution vector.
 
virtual const T getSolverSetupTime () const
 Returns the total time spent on linear solver setup.
 
virtual const T getSolveTime () const
 Returns the total time spent on solving of the linear systems.
 
 gsINSSolver (gsFlowSolverParams< T > &params)
 Constructor.
 
virtual void initialize ()
 Initialize the solver.
 
virtual void initIteration ()
 Prepare for the solution process.
 
virtual void initIteration (const gsSparseMatrix< T, MatOrder > &mat)
 Prepare for the solution process.
 
virtual void markDofsAsEliminatedZeros (const std::vector< gsMatrix< index_t > > &boundaryDofs, const int unk)
 Eliminate given DOFs as homogeneous Dirichlet boundary.
 
virtual void nextIteration ()
 Perform next iteration step.
 
virtual void nextIteration (const unsigned numberOfIterations)
 Perform several iteration steps.
 
int numDofs () const
 Returns the total number of DOFs (the matrix size).
 
virtual T residualRelNorm () const
 Compute and return the relative residual norm for the current solution.
 
virtual T residualRelNorm (const gsMatrix< T > &solution) const
 Compute and return the relative residual norm for the given solution.
 
virtual void setSolution (const gsMatrix< T > &solVector)
 Set a given solution vector as current solution.
 
solutionChangeRelNorm () const
 Compute and return the relative norm of the solution change.
 
solutionChangeRelNorm (gsMatrix< T > solOld, gsMatrix< T > solNew) const
 Compute and return the relative norm of the solution change given the two successive solutions.
 
void solve (const int maxIterations, const T epsilon=1e-3, const int minIterations=1)
 Solve the incompressible Navier-Stokes problem.
 
virtual void solveStokes ()
 Compute the Stokes problem and save the solution into m_solution.
 
virtual void updateAssembler (bool updateSol=true)
 Update the assembler with current solution.
 
virtual void updateAssembler (const gsMatrix< T > &sol, bool updateSol=true)
 Update the assembler with a given solution.
 
virtual void writeSolChangeRelNorm (gsMatrix< T > solOld, gsMatrix< T > solNew)
 Compute and display the relative norm of the solution change given the two successive solutions.
 

Protected Member Functions

virtual void createOutputFile ()
 Create output file.
 
virtual void initMembers ()
 Initialize all members.
 
real_t stopwatchStart ()
 Start measuring time (decides whether to use gsStopwatch or MPI_Wtime)
 
real_t stopwatchStop ()
 Stop measuring time (decides whether to use gsStopwatch or MPI_Wtime)
 
virtual void updateSizes ()
 Update sizes of members (when DOF numbers change, e.g. after markDofsAsEliminatedZeros()).
 

Member Function Documentation

◆ applySolver()

template<class T , int MatOrder>
virtual void applySolver ( gsMatrix< T > &  solution)
inlinevirtualinherited

Solve the linear system.

Parameters
[out]solutiona reference to the vector, where the computed solution will be stored

◆ checkGeoJacobian()

template<class T , int MatOrder>
int checkGeoJacobian ( int  npts = -1,
dist = -1,
tol = -1 
)
inherited

Check values of jacobian near boundaries of all patches.

Parameters
npts[in]number of evaluation points along a patch side in each direction
dist[in]distance from patch boundaries (in the parametric space)
tol[in]critical (positive) value of jacobian to throw warning (too close to zero)
Returns
error code (0 = all jacobians OK, 1 = jacobian close to zero in some points, -1 = jacobian negative in some points)

◆ constructSolution()

template<class T , int MatOrder>
gsField< T > constructSolution ( int  unk) const
inlineinherited

Construct solution field for the unknown unk for the current solution vector.

Parameters
unkthe considered unknown (0 - velocity, 1 - pressure)
Returns

◆ initIteration()

template<class T , int MatOrder>
virtual void initIteration ( const gsSparseMatrix< T, MatOrder > &  mat)
inlinevirtualinherited

Prepare for the solution process.

Parameters
[in]thelinear system matrix

◆ markDofsAsEliminatedZeros()

template<class T , int MatOrder>
void markDofsAsEliminatedZeros ( const std::vector< gsMatrix< index_t > > &  boundaryDofs,
const int  unk 
)
virtualinherited

Eliminate given DOFs as homogeneous Dirichlet boundary.

Parameters
[in]boundaryDofsindices of the given boundary DOFs
[in]unkthe considered unknown

◆ nextIteration()

template<class T , int MatOrder>
void nextIteration ( const unsigned  numberOfIterations)
virtualinherited

Perform several iteration steps.

Parameters
[in]numberOfIterationsthe number of iterations to be performed

◆ setSolution()

template<class T , int MatOrder>
virtual void setSolution ( const gsMatrix< T > &  solVector)
inlinevirtualinherited

Set a given solution vector as current solution.

Parameters
[in]solVectorthe given solution

◆ solutionChangeRelNorm()

template<class T , int MatOrder>
T solutionChangeRelNorm ( gsMatrix< T >  solOld,
gsMatrix< T >  solNew 
) const
inherited

Compute and return the relative norm of the solution change given the two successive solutions.

Parameters
[in]solOldthe old solution
[in]solNewthe new solution

◆ solve()

template<class T , int MatOrder>
void solve ( const int  maxIterations,
const T  epsilon = 1e-3,
const int  minIterations = 1 
)
inherited

Solve the incompressible Navier-Stokes problem.

Parameters
[in]maxIterationsthe maximum number of linearization method iterations (in the steady case) or time steps (in the unsteady case)
[in]epsilonthe stopping tolerance
[in]minIterationsthe minimum number of iterations/time steps

◆ updateAssembler() [1/2]

template<class T , int MatOrder>
virtual void updateAssembler ( bool  updateSol = true)
inlinevirtualinherited

Update the assembler with current solution.

Parameters
[in]updateSolsave current solution into m_solution in the assembler

◆ updateAssembler() [2/2]

template<class T , int MatOrder>
void updateAssembler ( const gsMatrix< T > &  sol,
bool  updateSol = true 
)
virtualinherited

Update the assembler with a given solution.

Parameters
[in]updateSolsave the given solution into m_solution in the assembler

◆ writeSolChangeRelNorm()

template<class T , int MatOrder>
void writeSolChangeRelNorm ( gsMatrix< T >  solOld,
gsMatrix< T >  solNew 
)
virtualinherited

Compute and display the relative norm of the solution change given the two successive solutions.

Parameters
[in]solOldthe old solution
[in]solNewthe new solution