25template<
class T,
int MatOrder>
36 unsigned m_iterationNumber;
38 T m_initAssembT, m_assembT, m_relNorm;
40 bool m_fileOutput, m_dispOutput;
41 std::ofstream m_outFile;
42 std::stringstream m_outStream;
50 m_assemblerPtr = NULL;
57 delete m_assemblerPtr;
58 m_assemblerPtr = NULL;
63 delete m_linSolverPtr;
64 m_linSolverPtr = NULL;
67 if (m_outFile.is_open())
114 virtual void nextIteration(
const unsigned numberOfIterations);
120 void solve(
const int maxIterations,
const T epsilon = 1e-3,
const int minIterations = 1);
156 {
return getAssembler()->constructSolution(m_solution, unk); }
173 virtual std::string
getName() {
return "gsFlowSolverBase"; }
214#ifndef GISMO_BUILD_LIB
215#include GISMO_HPP_HEADER(gsFlowSolverBase.hpp)
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
Interface for classes solving linear systems inside the incompressible flow solvers (classes derived ...
Definition gsFlowLinSystSolver.h:27
A base class for all flow solvers in gsIncompressibleFlow.
Definition gsFlowSolverBase.h:27
virtual void nextIteration()
Perform next iteration step.
Definition gsFlowSolverBase.h:110
virtual void setSolution(const gsMatrix< T > &solVector)
Set a given solution vector as current solution.
Definition gsFlowSolverBase.h:189
virtual gsFlowAssemblerBase< T, MatOrder > * getAssembler() const
Returns a pointer to the assembler.
Definition gsFlowSolverBase.h:179
virtual void initIteration(const gsSparseMatrix< T, MatOrder > &mat)
Prepare for the solution process.
Definition gsFlowSolverBase.h:101
virtual void initialize()
Initialize the solver.
Definition gsFlowSolverBase.hpp:96
T solutionChangeRelNorm() const
Compute and return the relative norm of the solution change.
Definition gsFlowSolverBase.hpp:158
virtual const T getInitAssemblyTime() const
Returns the time of the initial matrix assembly.
Definition gsFlowSolverBase.h:198
virtual void writeSolChangeRelNorm(gsMatrix< T > solOld, gsMatrix< T > solNew)
Compute and display the relative norm of the solution change given the two successive solutions.
Definition gsFlowSolverBase.hpp:182
virtual gsFlowSolverParams< T > getParams()
Retrurns the solver parameters.
Definition gsFlowSolverBase.h:176
virtual T residualRelNorm() const
Compute and return the relative residual norm for the current solution.
Definition gsFlowSolverBase.h:145
virtual const T getSolveTime() const
Returns the total time spent on solving of the linear systems.
Definition gsFlowSolverBase.h:207
virtual void applySolver(gsMatrix< T > &solution)
Solve the linear system.
Definition gsFlowSolverBase.h:106
real_t stopwatchStart()
Start measuring time (decides whether to use gsStopwatch or MPI_Wtime)
Definition gsFlowSolverBase.hpp:61
gsField< T > constructSolution(int unk) const
Construct solution field for the unknown unk for the current solution vector.
Definition gsFlowSolverBase.h:155
virtual void markDofsAsEliminatedZeros(const std::vector< gsMatrix< index_t > > &boundaryDofs, const int unk)
Eliminate given DOFs as homogeneous Dirichlet boundary.
Definition gsFlowSolverBase.hpp:195
virtual const T getSolverSetupTime() const
Returns the total time spent on linear solver setup.
Definition gsFlowSolverBase.h:204
virtual std::string getName()
Retrurns the name of the class as a string.
Definition gsFlowSolverBase.h:173
virtual void updateAssembler(bool updateSol=true)
Update the assembler with current solution.
Definition gsFlowSolverBase.h:128
void solve(const int maxIterations, const T epsilon=1e-3, const int minIterations=1)
Solve the incompressible Navier-Stokes problem.
Definition gsFlowSolverBase.hpp:122
virtual T residualRelNorm(const gsMatrix< T > &solution) const
Compute and return the relative residual norm for the given solution.
Definition gsFlowSolverBase.h:149
unsigned getIterationNumber() const
Returns the current iteration number.
Definition gsFlowSolverBase.h:192
virtual const T getAssemblyTime() const
Returns the total time spent on matrix assembly.
Definition gsFlowSolverBase.h:201
virtual void initMembers()
Initialize all members.
Definition gsFlowSolverBase.hpp:20
virtual void createOutputFile()
Create output file.
Definition gsFlowSolverBase.hpp:45
real_t stopwatchStop()
Stop measuring time (decides whether to use gsStopwatch or MPI_Wtime)
Definition gsFlowSolverBase.hpp:79
virtual void updateAssembler(const gsMatrix< T > &sol, bool updateSol=true)
Update the assembler with a given solution.
Definition gsFlowSolverBase.hpp:147
virtual void updateSizes()
Update sizes of members (when DOF numbers change, e.g. after markDofsAsEliminatedZeros()).
Definition gsFlowSolverBase.hpp:38
int checkGeoJacobian(int npts=-1, T dist=-1, T tol=-1)
Check values of jacobian near boundaries of all patches.
Definition gsFlowSolverBase.hpp:203
const gsMatrix< T > & getSolution() const
Returns the current solution vector.
Definition gsFlowSolverBase.h:185
int numDofs() const
Returns the total number of DOFs (the matrix size).
Definition gsFlowSolverBase.h:195
gsFlowLinSystSolver< T, MatOrder > * getLinSolver() const
Returns a pointer to the linear system solver.
Definition gsFlowSolverBase.h:182
virtual void initIteration()
Prepare for the solution process.
Definition gsFlowSolverBase.h:96
A class that holds all parameters needed by the incompressible flow solver.
Definition gsFlowSolverParams.h:34
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
A class that holds all parameters needed by the incompressible flow solver.
The G+Smo namespace, containing all definitions for the library.