13#include <boost/math/constants/constants.hpp>
15#include <Eigen/Sparse>
16#include <unsupported/Eigen/SparseExtra>
72 typedef std::function<Eigen::Vector3d(
const Eigen::Vector3d &)>
VelocityType;
73 typedef std::function<Eigen::Vector3d(
const Eigen::Vector3d &)>
VorticityType;
82 std::ostream &
output = std::cout
114 return m_ddrcore.
mesh().
n_cells() * (m_nloc_sc_u + m_nloc_sc_p);
183 const std::vector<Eigen::VectorXd> &
list_dofs
188 const Eigen::VectorXd &
v,
204 std::pair<Eigen::MatrixXd, Eigen::VectorXd>
205 _compute_local_contribution(
215 void _assemble_local_contribution(
217 const std::pair<Eigen::MatrixXd, Eigen::VectorXd> &
lsT,
218 std::list<Eigen::Triplet<double> > &
A1,
219 Eigen::VectorXd &
b1,
220 std::list<Eigen::Triplet<double> > &
A2,
226 std::ostream & m_output;
230 const size_t m_nloc_sc_u;
231 const size_t m_nloc_sc_p;
235 Eigen::VectorXd m_sc_b;
243 static const double PI = boost::math::constants::pi<double>();
255 return Eigen::Vector3d(
256 0.5 * sin(2. *
PI * x(0)) * cos(2. *
PI * x(1)) * cos(2. *
PI * x(2)),
257 0.5 * cos(2. *
PI * x(0)) * sin(2. *
PI * x(1)) * cos(2. *
PI * x(2)),
258 -cos(2. *
PI * x(0)) * cos(2. *
PI * x(1)) * sin(2. *
PI * x(2))
264 return 3. *
PI * Eigen::Vector3d(
265 cos(2. *
PI * x(0)) * sin(2. *
PI * x(1)) * sin(2. *
PI * x(2)),
266 -sin(2. *
PI * x(0)) * cos(2. *
PI * x(1)) * sin(2. *
PI * x(2)),
279 cos(2. *
PI * x(0)) * sin(2. *
PI * x(1)) * sin(2. *
PI * x(2)),
280 sin(2. *
PI * x(0)) * cos(2. *
PI * x(1)) * sin(2. *
PI * x(2)),
281 sin(2. *
PI * x(0)) * sin(2. *
PI * x(1)) * cos(2. *
PI * x(2))
287 return 6. * std::pow(
PI, 2) * Eigen::Vector3d(
288 sin(2. *
PI * x(0)) * cos(2. *
PI * x(1)) * cos(2. *
PI * x(2)),
289 cos(2. *
PI * x(0)) * sin(2. *
PI * x(1)) * cos(2. *
PI * x(2)),
290 -2. * cos(2. *
PI * x(0)) * cos(2. *
PI * x(1)) * sin(2. *
PI * x(2))
303 linear_u = [](
const Eigen::Vector3d & x) -> Eigen::Vector3d {
304 return Eigen::Vector3d(x(0), -x(1), 0.);
309 return Eigen::Vector3d::Zero();
313 linear_p = [](
const Eigen::Vector3d & x) ->
double {
323 linear_f = [](
const Eigen::Vector3d & x) -> Eigen::Vector3d {
339 field_u = [](
const Eigen::Vector3d & x) -> Eigen::Vector3d {
340 double ux =
PI*cos(
PI*x(1))*pow(sin(
PI*x(0)),3.0)*pow(sin(
PI*x(1)),2.0)*pow(sin(
PI*x(2)),3.0)*3.0;
341 double uy =
PI*cos(
PI*x(0))*pow(sin(
PI*x(0)),2.0)*pow(sin(
PI*x(1)),3.0)*pow(sin(
PI*x(2)),3.0)*(-3.0);
342 return Eigen::Vector3d(
ux,
uy, 0.);
347 double cux = (
PI*
PI)*cos(
PI*x(0))*cos(
PI*x(2))*pow(sin(
PI*x(0)),2.0)*pow(sin(
PI*x(1)),3.0)*pow(sin(
PI*x(2)),2.0)*9.0;
348 double cuy = (
PI*
PI)*cos(
PI*x(1))*cos(
PI*x(2))*pow(sin(
PI*x(0)),3.0)*pow(sin(
PI*x(1)),2.0)*pow(sin(
PI*x(2)),2.0)*9.0;
349 double cuz = (
PI*
PI)*pow(sin(
PI*x(0)),3.0)*pow(sin(
PI*x(1)),3.0)*pow(sin(
PI*x(2)),3.0)*6.0-(
PI*
PI)*pow(cos(
PI*x(0)),2.0)*sin(
PI*x(0))*pow(sin(
PI*x(1)),3.0)*pow(sin(
PI*x(2)),3.0)*6.0-(
PI*
PI)*pow(cos(
PI*x(1)),2.0)*pow(sin(
PI*x(0)),3.0)*sin(
PI*x(1))*pow(sin(
PI*x(2)),3.0)*6.0;
355 field_p = [](
const Eigen::Vector3d & x) ->
double {
361 return Eigen::Vector3d(0., 0., 0.);
365 field_f = [](
const Eigen::Vector3d & x) -> Eigen::Vector3d {
366 double fx = (
PI*
PI*
PI)*pow(cos(
PI*x(1)),3.0)*pow(sin(
PI*x(0)),3.0)*pow(sin(
PI*x(2)),3.0)*-6.0+(
PI*
PI*
PI)*cos(
PI*x(1))*pow(sin(
PI*x(0)),3.0)*pow(sin(
PI*x(1)),2.0)*pow(sin(
PI*x(2)),3.0)*3.9E+1-(
PI*
PI*
PI)*pow(cos(
PI*x(0)),2.0)*cos(
PI*x(1))*sin(
PI*x(0))*pow(sin(
PI*x(1)),2.0)*pow(sin(
PI*x(2)),3.0)*1.8E+1-(
PI*
PI*
PI)*cos(
PI*x(1))*pow(cos(
PI*x(2)),2.0)*pow(sin(
PI*x(0)),3.0)*pow(sin(
PI*x(1)),2.0)*sin(
PI*x(2))*1.8E+1;
368 double fy = (
PI*
PI*
PI)*pow(cos(
PI*x(0)),3.0)*pow(sin(
PI*x(1)),3.0)*pow(sin(
PI*x(2)),3.0)*6.0-(
PI*
PI*
PI)*cos(
PI*x(0))*pow(sin(
PI*x(0)),2.0)*pow(sin(
PI*x(1)),3.0)*pow(sin(
PI*x(2)),3.0)*3.9E+1+(
PI*
PI*
PI)*cos(
PI*x(0))*pow(cos(
PI*x(1)),2.0)*pow(sin(
PI*x(0)),2.0)*sin(
PI*x(1))*pow(sin(
PI*x(2)),3.0)*1.8E+1+(
PI*
PI*
PI)*cos(
PI*x(0))*pow(cos(
PI*x(2)),2.0)*pow(sin(
PI*x(0)),2.0)*pow(sin(
PI*x(1)),3.0)*sin(
PI*x(2))*1.8E+1;
371 return Eigen::Vector3d(
fx,
fy,
fz);
Construct all polynomial spaces for the DDR sequence.
Definition ddrcore.hpp:62
Discrete Hcurl space: local operators, L2 product and global interpolator.
Definition xcurl.hpp:19
Discrete Hdiv space: local operators, L2 product and global interpolator.
Definition xdiv.hpp:20
Discrete H1 space: local operators, L2 product and global interpolator.
Definition xgrad.hpp:18
@ Matrix
Definition basis.hpp:67
size_t dimension() const
Returns the dimension of the global space (all DOFs for all geometric entities)
Definition localdofspace.hpp:80
const Mesh & mesh() const
Return a const reference to the mesh.
Definition ddrcore.hpp:134
static const double PI
Definition ddr-magnetostatics.hpp:187
static Magnetostatics::SolutionPotentialType linear_u
Definition ddr-magnetostatics.hpp:214
static Magnetostatics::SolutionPotentialType trigonometric_u
Definition ddr-magnetostatics.hpp:238
static Magnetostatics::ForcingTermType trigonometric_f
Definition ddr-magnetostatics.hpp:256
static Magnetostatics::ForcingTermType linear_f
Definition ddr-magnetostatics.hpp:228
static NavierStokes::PressureType linear_p
Definition sddr-navier-stokes.hpp:577
static NavierStokes::PressureGradientType linear_grad_p
Definition sddr-navier-stokes.hpp:582
static NavierStokes::VorticityType trigonometric_curl_u
Definition sddr-navier-stokes.hpp:482
static NavierStokes::PressureGradientType trigonometric_grad_p
Definition sddr-navier-stokes.hpp:496
static NavierStokes::PressureType trigonometric_p
Definition sddr-navier-stokes.hpp:491
static NavierStokes::VorticityType linear_curl_u
Definition sddr-navier-stokes.hpp:567
double pressure_scaling
Definition sddr-navier-stokes.hpp:464
double grad_p
Norm of grad of pressure.
Definition sddr-navier-stokes.hpp:81
static Stokes::ForcingTermType field_f
Definition ddr-stokes.hpp:365
double & stabilizationParameter()
Returns the stabilization parameter.
Definition ddr-stokes.hpp:177
void assembleLinearSystem(const ForcingTermType &f, const VelocityType &u, const VorticityType &omega, const ViscosityType &nu)
Assemble the global system
Definition ddr-stokes.cpp:298
static Stokes::ViscosityType field_nu
Definition ddr-stokes.hpp:375
size_t nbSCDOFs_u() const
Returns the number of statically condensed DOFs (velocity)
Definition ddr-stokes.hpp:100
std::pair< StokesNorms, StokesNorms > computeContinuousErrorsNorms(const Eigen::VectorXd &v, const VelocityType &u, const VorticityType &curl_u, const PressureType &p, const PressureGradientType &grad_p) const
Compute the continuous Hcurl errors in u and Hgrad error in p (1st component), and same with continuo...
Definition ddr-stokes.cpp:572
static Stokes::ViscosityType trigonometric_nu
Definition ddr-stokes.hpp:296
Eigen::SparseMatrix< double > SystemMatrixType
Definition ddr-stokes.hpp:69
double hgrad_p
Hgrad norm of p.
Definition sddr-navier-stokes.hpp:83
std::vector< StokesNorms > computeStokesNorms(const std::vector< Eigen::VectorXd > &list_dofs) const
Compute the discrete L2 norms, for a family of Eigen::VectorXd representing velocities & pressures,...
Definition ddr-stokes.cpp:516
static Stokes::VelocityType field_u
Definition ddr-stokes.hpp:339
size_t nbSCDOFs_p() const
Returns the number of statically condensed DOFs (pressure)
Definition ddr-stokes.hpp:106
static Stokes::PressureGradientType field_grad_p
Definition ddr-stokes.hpp:360
double hcurl_u
Hcurl norm of u.
Definition sddr-navier-stokes.hpp:82
double evaluateDefectCommutationGradInterp(const PressureType &p, const PressureGradientType &grad_p, const size_t deg_quad_interpolate) const
Evaluate the defect of commutation G_h (Igrad p) = Icurl (grad p) by computing the norm of the differ...
Definition ddr-stokes.cpp:666
const double & stabilizationParameter() const
Returns the stabilization parameter.
Definition ddr-stokes.hpp:172
const SystemMatrixType & systemMatrix() const
Returns the linear system matrix.
Definition ddr-stokes.hpp:142
static Stokes::ViscosityType linear_nu
Definition ddr-stokes.hpp:328
std::function< Eigen::Vector3d(const Eigen::Vector3d &)> VelocityType
Definition ddr-stokes.hpp:72
size_t nbSCDOFs() const
Returns the number of statically condensed DOFs (both velocity and pressure)
Definition ddr-stokes.hpp:112
size_t sizeSystem() const
Returns the size of the statically condensed system (with Lagrange multiplier)
Definition ddr-stokes.hpp:118
StokesNorms()
Definition ddr-stokes.hpp:55
std::function< Eigen::Vector3d(const Eigen::Vector3d &)> PressureGradientType
Definition ddr-stokes.hpp:75
Eigen::VectorXd & scVector()
Returns the static condensation rhs.
Definition ddr-stokes.hpp:167
std::function< Eigen::Vector3d(const Eigen::Vector3d &)> VorticityType
Definition ddr-stokes.hpp:73
double u
Norm of velocity.
Definition sddr-navier-stokes.hpp:78
std::function< double(const Eigen::Vector3d &)> PressureType
Definition ddr-stokes.hpp:74
Eigen::VectorXd & systemVector()
Returns the linear system right-hand side vector.
Definition ddr-stokes.hpp:157
size_t dimension() const
Returns the global problem dimension (without Lagrange multiplier, just velocity & pressure)
Definition ddr-stokes.hpp:94
IntegralWeight ViscosityType
Definition ddr-stokes.hpp:76
StokesNorms(double norm_u, double norm_curl_u, double norm_p, double norm_grad_p)
Constructor.
Definition ddr-stokes.hpp:43
const SystemMatrixType & scMatrix() const
Returns the static condensation recovery operator.
Definition ddr-stokes.hpp:162
const XCurl & xCurl() const
Returns the space XCurl.
Definition ddr-stokes.hpp:130
double p
Norm of pressure.
Definition sddr-navier-stokes.hpp:80
const XDiv & xDiv() const
Returns the space XDiv.
Definition ddr-stokes.hpp:136
static Stokes::VorticityType field_curl_u
Definition ddr-stokes.hpp:346
const XGrad & xGrad() const
Returns the space XGrad.
Definition ddr-stokes.hpp:124
const Eigen::VectorXd & systemVector() const
Returns the linear system right-hand side vector.
Definition ddr-stokes.hpp:152
std::function< Eigen::Vector3d(const Eigen::Vector3d &)> ForcingTermType
Definition ddr-stokes.hpp:71
SystemMatrixType & systemMatrix()
Returns the linear system matrix.
Definition ddr-stokes.hpp:147
double curl_u
Norm of curl of velocity (vorticity)
Definition sddr-navier-stokes.hpp:79
static Stokes::PressureType field_p
Definition ddr-stokes.hpp:355
bool use_threads
Definition HHO_DiffAdvecReac.hpp:47
std::size_t n_cells() const
number of cells in the mesh.
Definition MeshND.hpp:60
Definition ddr-magnetostatics.hpp:41
Structure for weights (scalar, at the moment) in integral.
Definition integralweight.hpp:36
Structure to store information for, and perform, local static condensation.
Definition local_static_condensation.hpp:25
Structure to store norm components (for velocity, its curl, pressure, and its gradient),...
Definition sddr-navier-stokes.hpp:62
Assemble a Stokes problem.
Definition ddr-stokes.hpp:68