HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
|
Class for the Navier-Stokes model. More...
#include <hho-ns.hpp>
Public Types | |
typedef Eigen::SparseMatrix< double > | SystemMatrixType |
typedef std::function< VectorRd(const VectorRd &)> | MomentumForcingTermType |
typedef std::function< double(const VectorRd &)> | CompressibilityForcingTermType |
typedef std::function< VectorRd(const VectorRd &)> | VelocityType |
typedef std::function< MatrixRd(const VectorRd &)> | VelocityGradientType |
typedef std::function< double(const VectorRd &)> | PressureType |
typedef std::function< VectorRd(const VectorRd &)> | PressureGradientType |
typedef IntegralWeight | ViscosityType |
typedef Eigen::SparseMatrix< double > | SystemMatrixType |
typedef std::function< VectorRd(const VectorRd &)> | MomentumForcingTermType |
typedef std::function< double(const VectorRd &)> | CompressibilityForcingTermType |
typedef std::function< VectorRd(const VectorRd &)> | VelocityType |
typedef std::function< MatrixRd(const VectorRd &)> | VelocityGradientType |
typedef std::function< double(const VectorRd &)> | PressureType |
typedef std::function< VectorRd(const VectorRd &)> | PressureGradientType |
typedef IntegralWeight | ViscosityType |
Public Member Functions | |
NavierStokes (const VHHOSpace &vhho_space, const GlobalDOFSpace &p_space, const BoundaryConditions &BC, bool use_threads, bool stokes=false, std::ostream &output=std::cout) | |
Constructor. | |
void | assembleLinearisedSystem (const NavierStokesSolutions::IExactSolution *isolution, const Eigen::VectorXd &uph_old) |
Assemble the global system | |
size_t | nloc_sc_u () const |
Returns the local number of velocity statically condensed DOFs. | |
size_t | nloc_sc_p () const |
Returns the local number of pressure statically condensed DOFs. | |
size_t | numSCDOFs_u () const |
Returns the number of velocity statically condensed DOFs. | |
size_t | numSCDOFs_p () const |
Returns the number of pressure statically condensed DOFs. | |
size_t | numSCDOFs () const |
Returns the number of statically condensed DOFs. | |
size_t | numDirDOFs () const |
Returns the number of Dirichlet DOFs. | |
size_t | dimVelocity () const |
Returns the dimension of velocity space. | |
size_t | dimPressure () const |
Returns the dimension of pressure space. | |
size_t | numNonSCDOFs () const |
Returns the number of DOFs after SC and with Lagrange multiplier, but before eliminating Dirichlet DOFs. | |
size_t | sizeSystem () const |
Returns the size of the final system with Lagrange multiplier, after application of SC and removal of Dirichlet BCs. | |
const VHHOSpace & | vhhospace () const |
Returns the velocity space. | |
const GlobalDOFSpace & | pspace () const |
Returns the pressure space. | |
const Mesh & | mesh () const |
Returns the mesh. | |
const SystemMatrixType & | systemMatrix () const |
Returns the linear system matrix. | |
SystemMatrixType & | systemMatrix () |
Returns the linear system matrix. | |
const Eigen::VectorXd & | systemVector () const |
Returns the linear system right-hand side vector. | |
Eigen::VectorXd & | systemVector () |
Returns the linear system right-hand side vector. | |
const double & | stabilizationParameter () const |
Returns the stabilization parameter (scaling) | |
double & | stabilizationParameter () |
Returns the stabilization parameter. | |
const SystemMatrixType & | scMatrix () const |
Returns the static condensation recovery operator. | |
Eigen::VectorXd & | scVector () |
Returns the static condensation rhs. | |
bool & | isStokes () |
Returns the Stokes status. | |
Eigen::VectorXd | interpolate (const VelocityType &u, const PressureType &p, const int doe_cell=-1, const int doe_face=-1) const |
Interpolates velocity and pressure. | |
std::vector< double > | computeEnergyNorms (const std::vector< Eigen::VectorXd > &list_dofs) const |
Compute the discrete energy norm of a family of vectors representing the dofs. | |
NavierStokes (const VHHOSpace &vhho_space, const GlobalDOFSpace &p_space, const BoundaryConditions &BC, bool use_threads, bool stokes=false, std::ostream &output=std::cout) | |
Constructor. | |
void | assembleLinearSystem (const MomentumForcingTermType &f, const CompressibilityForcingTermType &g, const ViscosityType &mu, const Eigen::VectorXd &u0, const Eigen::VectorXd &uold, const double &time_step) |
Assemble the global system | |
size_t | nloc_sc_u () const |
Returns the local number of velocity statically condensed DOFs. | |
size_t | nloc_sc_p () const |
Returns the local number of pressure statically condensed DOFs. | |
size_t | numSCDOFs_u () const |
Returns the number of velocity statically condensed DOFs. | |
size_t | numSCDOFs_p () const |
Returns the number of pressure statically condensed DOFs. | |
size_t | numSCDOFs () const |
Returns the number of statically condensed DOFs. | |
size_t | numDirDOFs () const |
Returns the number of Dirichlet DOFs. | |
size_t | dimVelocity () const |
Returns the dimension of velocity space. | |
size_t | dimPressure () const |
Returns the dimension of pressure space. | |
size_t | numNonSCDOFs () const |
Returns the number of DOFs after SC and with Lagrange multiplier, but before eliminating Dirichlet DOFs. | |
size_t | sizeSystem () const |
Returns the size of the final system with Lagrange multiplier, after application of SC and removal of Dirichlet BCs. | |
const VHHOSpace & | vhhospace () const |
Returns the velocity space. | |
const GlobalDOFSpace & | pspace () const |
Returns the pressure space. | |
const Mesh & | mesh () const |
Returns the mesh. | |
const SystemMatrixType & | systemMatrix () const |
Returns the linear system matrix. | |
SystemMatrixType & | systemMatrix () |
Returns the linear system matrix. | |
const Eigen::VectorXd & | systemVector () const |
Returns the linear system right-hand side vector. | |
Eigen::VectorXd & | systemVector () |
Returns the linear system right-hand side vector. | |
const double & | stabilizationParameter () const |
Returns the stabilization parameter (scaling) | |
double & | stabilizationParameter () |
Returns the stabilization parameter. | |
const SystemMatrixType & | scMatrix () const |
Returns the static condensation recovery operator. | |
Eigen::VectorXd & | scVector () |
Returns the static condensation rhs. | |
bool & | isStokes () |
Returns the Stokes status. | |
Eigen::VectorXd | interpolate (const VelocityType &u, const PressureType &p, const int doe_cell=-1, const int doe_face=-1) const |
Interpolates velocity and pressure. | |
std::vector< double > | computeEnergyNorms (const std::vector< Eigen::VectorXd > &list_dofs) const |
Compute the discrete energy norm of a family of vectors representing the dofs. | |
Eigen::VectorXd | pressureVertexValues (const Eigen::VectorXd &p) const |
Create vertex values for the pressure (from the element values), for plotting. | |
void | writeToVtuFile (const Eigen::VectorXd &uph, const Eigen::VectorXd &upI, const std::unique_ptr< Mesh > &mesh_ptr, const std::string &solution_name, const std::string &mesh_name, const size_t °ree, const int &time_it) |
Write solution to vut file. | |
Eigen::VectorXd | imposingBC (const VelocityType &u, const Eigen::VectorXd &uph) const |
impose boundary conditions | |
Eigen::VectorXd | newtonRaphson (LinearSolver< NavierStokes::SystemMatrixType > &solver, const std::unique_ptr< Mesh > &mesh_ptr, const size_t &newton_maxit, const double &newton_tol, const Eigen::VectorXd &u_newt, const Eigen::VectorXd &un, const MomentumForcingTermType &f, const CompressibilityForcingTermType &g, const ViscosityType &mu, const double &time_step) |
newton method | |
Class for the Navier-Stokes model.
Class for Navier-Stokes model.
The global unknowns are in the following order:
typedef std::function<double(const VectorRd &)> HArDCore2D::NavierStokes::CompressibilityForcingTermType |
typedef std::function<double(const VectorRd &)> HArDCore2D::NavierStokes::CompressibilityForcingTermType |
typedef std::function<VectorRd(const VectorRd &)> HArDCore2D::NavierStokes::MomentumForcingTermType |
typedef std::function<VectorRd(const VectorRd &)> HArDCore2D::NavierStokes::MomentumForcingTermType |
typedef std::function<VectorRd(const VectorRd &)> HArDCore2D::NavierStokes::PressureGradientType |
typedef std::function<VectorRd(const VectorRd &)> HArDCore2D::NavierStokes::PressureGradientType |
typedef std::function<double(const VectorRd &)> HArDCore2D::NavierStokes::PressureType |
typedef std::function<double(const VectorRd &)> HArDCore2D::NavierStokes::PressureType |
typedef Eigen::SparseMatrix<double> HArDCore2D::NavierStokes::SystemMatrixType |
typedef Eigen::SparseMatrix<double> HArDCore2D::NavierStokes::SystemMatrixType |
typedef std::function<MatrixRd(const VectorRd &)> HArDCore2D::NavierStokes::VelocityGradientType |
typedef std::function<MatrixRd(const VectorRd &)> HArDCore2D::NavierStokes::VelocityGradientType |
typedef std::function<VectorRd(const VectorRd &)> HArDCore2D::NavierStokes::VelocityType |
typedef std::function<VectorRd(const VectorRd &)> HArDCore2D::NavierStokes::VelocityType |
NavierStokes::NavierStokes | ( | const VHHOSpace & | vhho_space, |
const GlobalDOFSpace & | p_space, | ||
const BoundaryConditions & | BC, | ||
bool | use_threads, | ||
bool | stokes = false , |
||
std::ostream & | output = std::cout |
||
) |
Constructor.
vhho_space | Velocity space and operators |
p_space | Space for the pressure |
BC | Boundary conditions |
use_threads | True for parallel execution, false for sequential execution |
stokes | True if we want to assemble the Stokes system without convective terms |
output | Output stream to print status messages |
HArDCore2D::NavierStokes::NavierStokes | ( | const VHHOSpace & | vhho_space, |
const GlobalDOFSpace & | p_space, | ||
const BoundaryConditions & | BC, | ||
bool | use_threads, | ||
bool | stokes = false , |
||
std::ostream & | output = std::cout |
||
) |
Constructor.
vhho_space | Velocity space and operators |
p_space | Space for the pressure |
BC | Boundary conditions |
use_threads | True for parallel execution, false for sequential execution |
stokes | True if we want to assemble the Stokes system without convective terms |
output | Output stream to print status messages |
void NavierStokes::assembleLinearisedSystem | ( | const NavierStokesSolutions::IExactSolution * | isolution, |
const Eigen::VectorXd & | uph_old | ||
) |
Assemble the global system
isolution | Solution data |
uph_old | Velocity at the previous iteration |
void NavierStokes::assembleLinearSystem | ( | const MomentumForcingTermType & | f, |
const CompressibilityForcingTermType & | g, | ||
const ViscosityType & | mu, | ||
const Eigen::VectorXd & | u0, | ||
const Eigen::VectorXd & | uold, | ||
const double & | time_step | ||
) |
Assemble the global system
f | Forcing term |
g | Forcing term for the divergence equation |
mu | Viscosity |
std::vector< double > NavierStokes::computeEnergyNorms | ( | const std::vector< Eigen::VectorXd > & | list_dofs | ) | const |
Compute the discrete energy norm of a family of vectors representing the dofs.
list_dofs | The list of vectors representing the dofs |
std::vector< double > HArDCore2D::NavierStokes::computeEnergyNorms | ( | const std::vector< Eigen::VectorXd > & | list_dofs | ) | const |
Compute the discrete energy norm of a family of vectors representing the dofs.
list_dofs | The list of vectors representing the dofs |
|
inline |
Returns the dimension of pressure space.
|
inline |
Returns the dimension of pressure space.
|
inline |
Returns the dimension of velocity space.
|
inline |
Returns the dimension of velocity space.
Eigen::VectorXd NavierStokes::imposingBC | ( | const VelocityType & | u, |
const Eigen::VectorXd & | uph | ||
) | const |
impose boundary conditions
Eigen::VectorXd NavierStokes::interpolate | ( | const VelocityType & | u, |
const PressureType & | p, | ||
const int | doe_cell = -1 , |
||
const int | doe_face = -1 |
||
) | const |
Interpolates velocity and pressure.
u | Continuous velocity to interpolate |
p | Continuous pressure to interpolate |
doe_cell | The optional degre of cell quadrature rules to compute the interpolate. If negative, then 2*degree()+3 will be used. |
doe_face | The optional degre of face quadrature rules to compute the interpolate. If negative, then 2*degree()+3 will be used. |
Eigen::VectorXd HArDCore2D::NavierStokes::interpolate | ( | const VelocityType & | u, |
const PressureType & | p, | ||
const int | doe_cell = -1 , |
||
const int | doe_face = -1 |
||
) | const |
Interpolates velocity and pressure.
u | Continuous velocity to interpolate |
p | Continuous pressure to interpolate |
doe_cell | The optional degre of cell quadrature rules to compute the interpolate. If negative, then 2*degree()+3 will be used. |
doe_face | The optional degre of face quadrature rules to compute the interpolate. If negative, then 2*degree()+3 will be used. |
|
inline |
Returns the Stokes status.
|
inline |
Returns the Stokes status.
|
inline |
Returns the mesh.
|
inline |
Returns the mesh.
Eigen::VectorXd NavierStokes::newtonRaphson | ( | LinearSolver< NavierStokes::SystemMatrixType > & | solver, |
const std::unique_ptr< Mesh > & | mesh_ptr, | ||
const size_t & | newton_maxit, | ||
const double & | newton_tol, | ||
const Eigen::VectorXd & | u_newt, | ||
const Eigen::VectorXd & | un, | ||
const MomentumForcingTermType & | f, | ||
const CompressibilityForcingTermType & | g, | ||
const ViscosityType & | mu, | ||
const double & | time_step | ||
) |
newton method
initializing parameters
|
inline |
Returns the local number of pressure statically condensed DOFs.
|
inline |
Returns the local number of pressure statically condensed DOFs.
|
inline |
Returns the local number of velocity statically condensed DOFs.
|
inline |
Returns the local number of velocity statically condensed DOFs.
|
inline |
Returns the number of Dirichlet DOFs.
|
inline |
Returns the number of Dirichlet DOFs.
|
inline |
Returns the number of DOFs after SC and with Lagrange multiplier, but before eliminating Dirichlet DOFs.
|
inline |
Returns the number of DOFs after SC and with Lagrange multiplier, but before eliminating Dirichlet DOFs.
|
inline |
Returns the number of statically condensed DOFs.
|
inline |
Returns the number of statically condensed DOFs.
|
inline |
Returns the number of pressure statically condensed DOFs.
|
inline |
Returns the number of pressure statically condensed DOFs.
|
inline |
Returns the number of velocity statically condensed DOFs.
|
inline |
Returns the number of velocity statically condensed DOFs.
Eigen::VectorXd NavierStokes::pressureVertexValues | ( | const Eigen::VectorXd & | p | ) | const |
Create vertex values for the pressure (from the element values), for plotting.
p | Vector of pressure DOFs |
|
inline |
Returns the pressure space.
|
inline |
Returns the pressure space.
|
inline |
Returns the static condensation recovery operator.
|
inline |
Returns the static condensation recovery operator.
|
inline |
Returns the static condensation rhs.
|
inline |
Returns the static condensation rhs.
|
inline |
Returns the size of the final system with Lagrange multiplier, after application of SC and removal of Dirichlet BCs.
|
inline |
Returns the size of the final system with Lagrange multiplier, after application of SC and removal of Dirichlet BCs.
|
inline |
Returns the stabilization parameter.
|
inline |
Returns the stabilization parameter.
|
inline |
Returns the stabilization parameter (scaling)
|
inline |
Returns the stabilization parameter (scaling)
|
inline |
Returns the linear system matrix.
|
inline |
Returns the linear system matrix.
|
inline |
Returns the linear system matrix.
|
inline |
Returns the linear system matrix.
|
inline |
Returns the linear system right-hand side vector.
|
inline |
Returns the linear system right-hand side vector.
|
inline |
Returns the linear system right-hand side vector.
|
inline |
Returns the linear system right-hand side vector.
|
inline |
Returns the velocity space.
|
inline |
Returns the velocity space.
void NavierStokes::writeToVtuFile | ( | const Eigen::VectorXd & | uph, |
const Eigen::VectorXd & | upI, | ||
const std::unique_ptr< Mesh > & | mesh_ptr, | ||
const std::string & | solution_name, | ||
const std::string & | mesh_name, | ||
const size_t & | degree, | ||
const int & | time_it | ||
) |
Write solution to vut file.
Write solution to vtu file.