HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
HArDCore2D::NavierStokes Struct Reference

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 VHHOSpacevhhospace () const
 Returns the velocity space.
 
const GlobalDOFSpacepspace () const
 Returns the pressure space.
 
const Meshmesh () const
 Returns the mesh.
 
const SystemMatrixTypesystemMatrix () const
 Returns the linear system matrix.
 
SystemMatrixTypesystemMatrix ()
 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 SystemMatrixTypescMatrix () 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 VHHOSpacevhhospace () const
 Returns the velocity space.
 
const GlobalDOFSpacepspace () const
 Returns the pressure space.
 
const Meshmesh () const
 Returns the mesh.
 
const SystemMatrixTypesystemMatrix () const
 Returns the linear system matrix.
 
SystemMatrixTypesystemMatrix ()
 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 SystemMatrixTypescMatrix () 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 &degree, 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
 

Detailed Description

Class for the Navier-Stokes model.

Class for Navier-Stokes model.

The global unknowns are in the following order:

Member Typedef Documentation

◆ CompressibilityForcingTermType [1/2]

◆ CompressibilityForcingTermType [2/2]

◆ MomentumForcingTermType [1/2]

◆ MomentumForcingTermType [2/2]

◆ PressureGradientType [1/2]

◆ PressureGradientType [2/2]

◆ PressureType [1/2]

typedef std::function<double(const VectorRd &)> HArDCore2D::NavierStokes::PressureType

◆ PressureType [2/2]

typedef std::function<double(const VectorRd &)> HArDCore2D::NavierStokes::PressureType

◆ SystemMatrixType [1/2]

typedef Eigen::SparseMatrix<double> HArDCore2D::NavierStokes::SystemMatrixType

◆ SystemMatrixType [2/2]

typedef Eigen::SparseMatrix<double> HArDCore2D::NavierStokes::SystemMatrixType

◆ VelocityGradientType [1/2]

◆ VelocityGradientType [2/2]

◆ VelocityType [1/2]

typedef std::function<VectorRd(const VectorRd &)> HArDCore2D::NavierStokes::VelocityType

◆ VelocityType [2/2]

typedef std::function<VectorRd(const VectorRd &)> HArDCore2D::NavierStokes::VelocityType

◆ ViscosityType [1/2]

◆ ViscosityType [2/2]

Constructor & Destructor Documentation

◆ NavierStokes() [1/2]

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.

Parameters
vhho_spaceVelocity space and operators
p_spaceSpace for the pressure
BCBoundary conditions
use_threadsTrue for parallel execution, false for sequential execution
stokesTrue if we want to assemble the Stokes system without convective terms
outputOutput stream to print status messages

◆ NavierStokes() [2/2]

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.

Parameters
vhho_spaceVelocity space and operators
p_spaceSpace for the pressure
BCBoundary conditions
use_threadsTrue for parallel execution, false for sequential execution
stokesTrue if we want to assemble the Stokes system without convective terms
outputOutput stream to print status messages

Member Function Documentation

◆ assembleLinearisedSystem()

void NavierStokes::assembleLinearisedSystem ( const NavierStokesSolutions::IExactSolution isolution,
const Eigen::VectorXd &  uph_old 
)

Assemble the global system

Parameters
isolutionSolution data
uph_oldVelocity at the previous iteration

◆ assembleLinearSystem()

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

Parameters
fForcing term
gForcing term for the divergence equation
muViscosity

◆ computeEnergyNorms() [1/2]

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.

Parameters
list_dofsThe list of vectors representing the dofs

◆ computeEnergyNorms() [2/2]

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.

Parameters
list_dofsThe list of vectors representing the dofs

◆ dimPressure() [1/2]

size_t HArDCore2D::NavierStokes::dimPressure ( ) const
inline

Returns the dimension of pressure space.

◆ dimPressure() [2/2]

size_t HArDCore2D::NavierStokes::dimPressure ( ) const
inline

Returns the dimension of pressure space.

◆ dimVelocity() [1/2]

size_t HArDCore2D::NavierStokes::dimVelocity ( ) const
inline

Returns the dimension of velocity space.

◆ dimVelocity() [2/2]

size_t HArDCore2D::NavierStokes::dimVelocity ( ) const
inline

Returns the dimension of velocity space.

◆ imposingBC()

Eigen::VectorXd NavierStokes::imposingBC ( const VelocityType u,
const Eigen::VectorXd &  uph 
) const

impose boundary conditions

◆ interpolate() [1/2]

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.

Parameters
uContinuous velocity to interpolate
pContinuous pressure to interpolate
doe_cellThe optional degre of cell quadrature rules to compute the interpolate. If negative, then 2*degree()+3 will be used.
doe_faceThe optional degre of face quadrature rules to compute the interpolate. If negative, then 2*degree()+3 will be used.

◆ interpolate() [2/2]

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.

Parameters
uContinuous velocity to interpolate
pContinuous pressure to interpolate
doe_cellThe optional degre of cell quadrature rules to compute the interpolate. If negative, then 2*degree()+3 will be used.
doe_faceThe optional degre of face quadrature rules to compute the interpolate. If negative, then 2*degree()+3 will be used.

◆ isStokes() [1/2]

bool & HArDCore2D::NavierStokes::isStokes ( )
inline

Returns the Stokes status.

◆ isStokes() [2/2]

bool & HArDCore2D::NavierStokes::isStokes ( )
inline

Returns the Stokes status.

◆ mesh() [1/2]

const Mesh & HArDCore2D::NavierStokes::mesh ( ) const
inline

Returns the mesh.

◆ mesh() [2/2]

const Mesh & HArDCore2D::NavierStokes::mesh ( ) const
inline

Returns the mesh.

◆ newtonRaphson()

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

◆ nloc_sc_p() [1/2]

size_t HArDCore2D::NavierStokes::nloc_sc_p ( ) const
inline

Returns the local number of pressure statically condensed DOFs.

◆ nloc_sc_p() [2/2]

size_t HArDCore2D::NavierStokes::nloc_sc_p ( ) const
inline

Returns the local number of pressure statically condensed DOFs.

◆ nloc_sc_u() [1/2]

size_t HArDCore2D::NavierStokes::nloc_sc_u ( ) const
inline

Returns the local number of velocity statically condensed DOFs.

◆ nloc_sc_u() [2/2]

size_t HArDCore2D::NavierStokes::nloc_sc_u ( ) const
inline

Returns the local number of velocity statically condensed DOFs.

◆ numDirDOFs() [1/2]

size_t HArDCore2D::NavierStokes::numDirDOFs ( ) const
inline

Returns the number of Dirichlet DOFs.

◆ numDirDOFs() [2/2]

size_t HArDCore2D::NavierStokes::numDirDOFs ( ) const
inline

Returns the number of Dirichlet DOFs.

◆ numNonSCDOFs() [1/2]

size_t HArDCore2D::NavierStokes::numNonSCDOFs ( ) const
inline

Returns the number of DOFs after SC and with Lagrange multiplier, but before eliminating Dirichlet DOFs.

◆ numNonSCDOFs() [2/2]

size_t HArDCore2D::NavierStokes::numNonSCDOFs ( ) const
inline

Returns the number of DOFs after SC and with Lagrange multiplier, but before eliminating Dirichlet DOFs.

◆ numSCDOFs() [1/2]

size_t HArDCore2D::NavierStokes::numSCDOFs ( ) const
inline

Returns the number of statically condensed DOFs.

◆ numSCDOFs() [2/2]

size_t HArDCore2D::NavierStokes::numSCDOFs ( ) const
inline

Returns the number of statically condensed DOFs.

◆ numSCDOFs_p() [1/2]

size_t HArDCore2D::NavierStokes::numSCDOFs_p ( ) const
inline

Returns the number of pressure statically condensed DOFs.

◆ numSCDOFs_p() [2/2]

size_t HArDCore2D::NavierStokes::numSCDOFs_p ( ) const
inline

Returns the number of pressure statically condensed DOFs.

◆ numSCDOFs_u() [1/2]

size_t HArDCore2D::NavierStokes::numSCDOFs_u ( ) const
inline

Returns the number of velocity statically condensed DOFs.

◆ numSCDOFs_u() [2/2]

size_t HArDCore2D::NavierStokes::numSCDOFs_u ( ) const
inline

Returns the number of velocity statically condensed DOFs.

◆ pressureVertexValues()

Eigen::VectorXd NavierStokes::pressureVertexValues ( const Eigen::VectorXd &  p) const

Create vertex values for the pressure (from the element values), for plotting.

Parameters
pVector of pressure DOFs

◆ pspace() [1/2]

const GlobalDOFSpace & HArDCore2D::NavierStokes::pspace ( ) const
inline

Returns the pressure space.

◆ pspace() [2/2]

const GlobalDOFSpace & HArDCore2D::NavierStokes::pspace ( ) const
inline

Returns the pressure space.

◆ scMatrix() [1/2]

const SystemMatrixType & HArDCore2D::NavierStokes::scMatrix ( ) const
inline

Returns the static condensation recovery operator.

◆ scMatrix() [2/2]

const SystemMatrixType & HArDCore2D::NavierStokes::scMatrix ( ) const
inline

Returns the static condensation recovery operator.

◆ scVector() [1/2]

Eigen::VectorXd & HArDCore2D::NavierStokes::scVector ( )
inline

Returns the static condensation rhs.

◆ scVector() [2/2]

Eigen::VectorXd & HArDCore2D::NavierStokes::scVector ( )
inline

Returns the static condensation rhs.

◆ sizeSystem() [1/2]

size_t HArDCore2D::NavierStokes::sizeSystem ( ) const
inline

Returns the size of the final system with Lagrange multiplier, after application of SC and removal of Dirichlet BCs.

◆ sizeSystem() [2/2]

size_t HArDCore2D::NavierStokes::sizeSystem ( ) const
inline

Returns the size of the final system with Lagrange multiplier, after application of SC and removal of Dirichlet BCs.

◆ stabilizationParameter() [1/4]

double & HArDCore2D::NavierStokes::stabilizationParameter ( )
inline

Returns the stabilization parameter.

◆ stabilizationParameter() [2/4]

double & HArDCore2D::NavierStokes::stabilizationParameter ( )
inline

Returns the stabilization parameter.

◆ stabilizationParameter() [3/4]

const double & HArDCore2D::NavierStokes::stabilizationParameter ( ) const
inline

Returns the stabilization parameter (scaling)

◆ stabilizationParameter() [4/4]

const double & HArDCore2D::NavierStokes::stabilizationParameter ( ) const
inline

Returns the stabilization parameter (scaling)

◆ systemMatrix() [1/4]

SystemMatrixType & HArDCore2D::NavierStokes::systemMatrix ( )
inline

Returns the linear system matrix.

◆ systemMatrix() [2/4]

SystemMatrixType & HArDCore2D::NavierStokes::systemMatrix ( )
inline

Returns the linear system matrix.

◆ systemMatrix() [3/4]

const SystemMatrixType & HArDCore2D::NavierStokes::systemMatrix ( ) const
inline

Returns the linear system matrix.

◆ systemMatrix() [4/4]

const SystemMatrixType & HArDCore2D::NavierStokes::systemMatrix ( ) const
inline

Returns the linear system matrix.

◆ systemVector() [1/4]

Eigen::VectorXd & HArDCore2D::NavierStokes::systemVector ( )
inline

Returns the linear system right-hand side vector.

◆ systemVector() [2/4]

Eigen::VectorXd & HArDCore2D::NavierStokes::systemVector ( )
inline

Returns the linear system right-hand side vector.

◆ systemVector() [3/4]

const Eigen::VectorXd & HArDCore2D::NavierStokes::systemVector ( ) const
inline

Returns the linear system right-hand side vector.

◆ systemVector() [4/4]

const Eigen::VectorXd & HArDCore2D::NavierStokes::systemVector ( ) const
inline

Returns the linear system right-hand side vector.

◆ vhhospace() [1/2]

const VHHOSpace & HArDCore2D::NavierStokes::vhhospace ( ) const
inline

Returns the velocity space.

◆ vhhospace() [2/2]

const VHHOSpace & HArDCore2D::NavierStokes::vhhospace ( ) const
inline

Returns the velocity space.

◆ writeToVtuFile()

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.


The documentation for this struct was generated from the following files: