HArD::Core3D
Hybrid Arbitrary Degree::Core 3D - Library to implement 3D schemes with vertex, edge, face and cell polynomials as unknowns
Loading...
Searching...
No Matches
sddr-navier-stokes.hpp
Go to the documentation of this file.
1// Implementation of the discrete de Rham sequence for the Navier-Stokes problem in curl-curl formulation.
2//
3// Author: Jerome Droniou (jerome.droniou@monash.edu)
4//
5
6
7#ifndef SDDR_STOKES_HPP
8#define SDDR_STOKES_HPP
9
10#include <iostream>
11
12#include <boost/math/constants/constants.hpp>
13
14#include <Eigen/Sparse>
15#include <unsupported/Eigen/SparseExtra>
16
17#include <mesh.hpp>
18#include <mesh_builder.hpp>
20#include <linearsolver.hpp>
21
24
25#include <sxgrad.hpp>
26#include <sxcurl.hpp>
27#include <sxdiv.hpp>
28
52namespace HArDCore3D
53{
54
62 {
64 StokesNorms(double norm_u, double norm_curl_u, double norm_p, double norm_grad_p):
65 u(norm_u),
67 p(norm_p),
69 hcurl_u( std::sqrt( std::pow(norm_u, 2) + std::pow(norm_curl_u, 2) ) ),
70 hgrad_p( std::sqrt( std::pow(norm_p, 2) + std::pow(norm_grad_p, 2) ) )
71 {
72 // do nothing
73 };
74
75 // Constructor without arguments
76 StokesNorms() : StokesNorms(0., 0., 0., 0.) {};
77
78 double u;
79 double curl_u;
80 double p;
81 double grad_p;
82 double hcurl_u;
83 double hgrad_p;
84
85 };
86
89 {
90 typedef Eigen::SparseMatrix<double> SystemMatrixType;
91
92 typedef std::function<Eigen::Vector3d(const Eigen::Vector3d &)> ForcingTermType;
93 typedef std::function<Eigen::Vector3d(const Eigen::Vector3d &)> VelocityType;
94 typedef std::function<Eigen::Vector3d(const Eigen::Vector3d &)> VorticityType;
95 typedef std::function<double(const Eigen::Vector3d &)> PressureType;
96 typedef std::function<Eigen::Vector3d(const Eigen::Vector3d &)> PressureGradientType;
98
101 const DDRCore & ddrcore,
102 const BoundaryConditions & BC,
103 bool use_threads,
104 std::ostream & output = std::cout
105 );
106
107 //--------------------------------------------------
108 // Methods to assemble and solve
109 //--------------------------------------------------
110
112
114 Eigen::VectorXd vectorDirBC(
115 const VelocityType & u,
116 const PressureType & p
117 );
118
121 const ForcingTermType & f,
122 const VelocityType & u,
123 const VorticityType & omega,
124 const double & reynolds
125 );
126
129 const Eigen::VectorXd & Xn,
130 const double & reac
131 );
132
134 double normGlobalRHS(
135 const std::vector<Eigen::VectorXd> & locRHS
136 );
137
139 Eigen::VectorXd newtonIncrement(
141 const double & navier_scaling,
142 const double & relax,
143 double & norm_dX
144 );
145
147 std::vector<StokesNorms> computeStokesNorms(
148 const std::vector<Eigen::VectorXd> & list_dofs
149 ) const;
150
152 std::pair<StokesNorms, StokesNorms> computeContinuousErrorsNorms(
153 const Eigen::VectorXd & v,
154 const VelocityType & u,
155 const VorticityType & curl_u,
156 const PressureType & p,
157 const PressureGradientType & grad_p
158 ) const;
159
161 double computeFlux(
162 const Eigen::VectorXd & u,
163 const Hull & surface
164 ) const;
165
166 //------------------------------------------------------------------
167 // Getters: dimension of space and numbers of unknowns of various types
168 //------------------------------------------------------------------
169
171 inline size_t nDOFs_up() const
172 {
173 return m_sxcurl.dimension() + m_sxgrad.dimension();
174 }
175
176 // ------ Dirichlet DOFs ------
178 inline size_t nDOFs_dir_edge_u() const
179 {
180 return m_nDOFs_dir_edge_u;
181 }
182
184 inline size_t nDOFs_dir_face_u() const
185 {
186 return m_nDOFs_dir_face_u;
187 }
188
190 inline size_t nDOFs_dir_u() const
191 {
192 return m_nDOFs_dir_edge_u + m_nDOFs_dir_face_u;
193 }
194
196 inline size_t nDOFs_dir_vertex_p() const
197 {
198 return m_nDOFs_dir_vertex_p;
199 }
200
202 inline size_t nDOFs_dir_edge_p() const
203 {
204 return m_nDOFs_dir_edge_p;
205 }
206
208 inline size_t nDOFs_dir_face_p() const
209 {
210 return m_nDOFs_dir_face_p;
211 }
212
214 inline size_t nDOFs_dir_p() const
215 {
216 return m_nDOFs_dir_vertex_p + m_nDOFs_dir_edge_p + m_nDOFs_dir_face_p;
217 }
218
219 // ------ statically condensed and global UKN -----
221 inline size_t nSCUKN_u() const
222 {
223 return m_nloc_sc_u.sum();
224 }
225
227 inline size_t nSCUKN_p() const
228 {
229 return m_nloc_sc_p.sum();
230 }
231
233 inline size_t nSCUKN() const
234 {
235 return nSCUKN_u() + nSCUKN_p();
236 }
237
239 inline size_t nUKN_u() const
240 {
241 return m_sxcurl.dimension() - nDOFs_dir_u();
242 }
243
245 inline size_t nUKN_p() const
246 {
247 return m_sxgrad.dimension() - nDOFs_dir_p();
248 }
249
251 inline size_t nUKN_lambda() const
252 {
253 return m_nUKN_lambda;
254 }
255
257 inline size_t nUKN_uplambda() const
258 {
259 return nUKN_u() + nUKN_p() + nUKN_lambda();
260 }
261
263 inline size_t nGLUKN_u() const
264 {
265 return nUKN_u() - nSCUKN_u();
266 }
267
269 inline size_t nGLUKN_p() const
270 {
271 return nUKN_p() - nSCUKN_p();
272 }
273
275 inline size_t nGLUKN() const
276 {
277 return nUKN_uplambda() - nSCUKN();
278 }
279
280 //--------------------------------------------------------
281 // Getters: underlying SDDR spaces
282 //--------------------------------------------------------
283
285 inline const SXGrad & sxGrad() const
286 {
287 return m_sxgrad;
288 }
289
291 inline const SXCurl & sxCurl() const
292 {
293 return m_sxcurl;
294 }
295
297 inline const SXDiv & sxDiv() const
298 {
299 return m_sxdiv;
300 }
301
302 //-------------------------------------------------
303 // Matrices and RHS
304 //-------------------------------------------------
305
307 inline const SystemMatrixType & systemMatrix() const {
308 return m_A;
309 }
310
313 return m_A;
314 }
315
317 inline const Eigen::VectorXd & systemVector() const {
318 return m_b;
319 }
320
322 inline Eigen::VectorXd & systemVector() {
323 return m_b;
324 }
325
327 inline const SystemMatrixType & scMatrix() const {
328 return m_sc_A;
329 }
330
332 inline Eigen::VectorXd & scVector() {
333 return m_sc_b;
334 }
335
337 inline std::vector<Eigen::VectorXd> & rhsSourceNaturalBC() {
338 return m_rhs_source_naturalBC;
339 }
340
341 //-------------------------------------------
342 // Getters: various parameters
343 //-------------------------------------------
344
346 inline const double & stabilizationParameter() const {
347 return m_stab_par;
348 }
349
351 inline double & stabilizationParameter() {
352 return m_stab_par;
353 }
354
356 inline const bool & iterativeSolver() const {
357 return m_itsolver;
358 }
359
361 inline bool & iterativeSolver() {
362 return m_itsolver;
363 }
364
366 inline double & Reynolds() {
367 return m_reynolds;
368 }
369
370 private:
372 /* First matrix: (CT ., CT .)_div
373 Second matrix: (., GT .)_curl
374 RHS: of size velocity + pressure + nb lagrange multiplier (0 or 1), and includes natural BCs
375 */
376 std::tuple<Eigen::MatrixXd, Eigen::MatrixXd, Eigen::VectorXd, Eigen::MatrixXd>
377 _compute_linear_contributions(
378 const size_t iT,
379 const Eigen::VectorXd & interp_f,
380 const ForcingTermType & f
381 );
382
384 Eigen::MatrixXd _compute_Stokes_matrix(
385 const size_t iT
386 );
387
389 std::pair<Eigen::MatrixXd, Eigen::VectorXd>
390 _compute_jacobian_rhs(
391 const size_t iT,
392 const Eigen::VectorXd & Xn,
393 const double & reac
394 );
395
397 LocalStaticCondensation _compute_static_condensation(const size_t & iT) const;
398
400 void _assemble_local_contribution(
401 size_t iT,
402 const std::pair<Eigen::MatrixXd, Eigen::VectorXd> & lsT,
403 std::list<Eigen::Triplet<double> > & A1,
404 Eigen::VectorXd & b1,
405 std::list<Eigen::Triplet<double> > & A2,
406 Eigen::VectorXd & b2
407 );
408
409 // Constructor parameter
410 const DDRCore & m_ddrcore;
411 bool m_use_threads;
412 std::ostream & m_output;
413 SerendipityProblem m_ser_pro;
414 const SXGrad m_sxgrad;
415 const SXCurl m_sxcurl;
416 const SXDiv m_sxdiv;
417 const Eigen::VectorXi m_nloc_sc_u; // Nb of statically condensed DOFs for velocity in each cell (cell unknowns)
418 const Eigen::VectorXi m_nloc_sc_p; // Nb of statically condensed DOFs for pressure in each cell (cell unknowns)
419
420 // Boundary conditions
422 size_t m_nDOFs_dir_edge_u;
423 size_t m_nDOFs_dir_face_u;
424 size_t m_nDOFs_dir_vertex_p;
425 size_t m_nDOFs_dir_edge_p;
426 size_t m_nDOFs_dir_face_p;
427 size_t m_nUKN_lambda;
428 std::vector<std::pair<size_t,size_t>> m_locSCUKN; // Location, among the DOFs, of the statically condensed unknowns (removing Dirichlet and non-SC unknowns); the unknowns are between m_locSCUCK[i].first and m_locSCUCK[i].first+m_locSCUKN[i].second for all i
429 std::vector<std::pair<size_t,size_t>> m_locGLUKN; // Location, among the DOFs, of the globally coupled unknowns (removing Dirichlet and non-global unknowns); the unknowns are between m_locGLUCK[i].first and m_locGLUCK[i].first+m_locGLUKN[i].second for all i
430 Eigen::VectorXi m_DOFtoSCUKN; // Maps a dof i to its SC unknown in the recovery operator, or to -1 if the DOF is not a SCUKN
431 Eigen::VectorXi m_DOFtoGLUKN; // Maps a dof i to its GL unknown in the global system, or to -1 if the DOF is a not a GLUKN
432
433 // Scheme and solver parameters
434 double m_stab_par;
435 bool m_itsolver; // true if we use the iterative solver, false uses a direct solver
436
437 double m_reynolds = 1.; // Initialised at 1 by default, has to be adjusted after loading the value
438
439 // Local matrices and RHS (including BCs) for the linear part of the model. The boolean to flag that these quantities have been computed
440 std::vector<Eigen::MatrixXd> m_CTuCTu; // curl - curl matrix
441 std::vector<Eigen::MatrixXd> m_PTuGTp; // velocity - grad pressure matrix
442 std::vector<Eigen::VectorXd> m_rhs_source_naturalBC; // RHS from the source and natural BCs
443 std::vector<Eigen::MatrixXd> m_massT; // mass-matrix for pseudo-temporal iterations
444 bool m_linear_computed;
445 // Global matrix and RHS of statically condensed system, at each Newton iteration
446 SystemMatrixType m_A;
447 Eigen::VectorXd m_b;
448 // Global static condensation operator and RHS (to recover statically condensed DOFs), at each Newton iteration
449 SystemMatrixType m_sc_A;
450 Eigen::VectorXd m_sc_b;
451
452 };
453
454 //------------------------------------------------------------------------------
455 // Exact solutions
456 //------------------------------------------------------------------------------
457
458 static const double PI = boost::math::constants::pi<double>();
459 using std::sin;
460 using std::cos;
461 using std::pow;
462
463 // To scale the pressure, the viscosity and the nonlinear term (curl u) x u
464 double pressure_scaling = 1.;
465 double reynolds = 1.;
466 double navier_scaling = 1.;
467
468 //------------------------------------------------------------------------------
469 // Trigonometric solution
470 //------------------------------------------------------------------------------
471
473 trigonometric_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
474 return Eigen::Vector3d(
475 0.5 * sin(2. * PI * x(0)) * cos(2. * PI * x(1)) * cos(2. * PI * x(2)),
476 0.5 * cos(2. * PI * x(0)) * sin(2. * PI * x(1)) * cos(2. * PI * x(2)),
477 -cos(2. * PI * x(0)) * cos(2. * PI * x(1)) * sin(2. * PI * x(2))
478 );
479 };
480
482 trigonometric_curl_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
483 return 3. * PI * Eigen::Vector3d(
484 cos(2. * PI * x(0)) * sin(2. * PI * x(1)) * sin(2. * PI * x(2)),
485 -sin(2. * PI * x(0)) * cos(2. * PI * x(1)) * sin(2. * PI * x(2)),
486 0.
487 );
488 };
489
491 trigonometric_p = [](const Eigen::Vector3d & x) -> double {
492 return pressure_scaling * sin(2. * PI * x(0)) * sin(2. * PI * x(1)) * sin(2. * PI * x(2));
493 };
494
496 trigonometric_grad_p = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
497 return pressure_scaling * 2. * PI * Eigen::Vector3d(
498 cos(2. * PI * x(0)) * sin(2. * PI * x(1)) * sin(2. * PI * x(2)),
499 sin(2. * PI * x(0)) * cos(2. * PI * x(1)) * sin(2. * PI * x(2)),
500 sin(2. * PI * x(0)) * sin(2. * PI * x(1)) * cos(2. * PI * x(2))
501 );
502 };
503
505 trigonometric_curl_u_cross_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
506 return Eigen::Vector3d (3.0*PI*sin(2*PI*x.x())*pow(sin(2*PI*x.z()), 2)*cos(2*PI*x.x())*pow(cos(2*PI*x.y()), 2),
507 3.0*PI*sin(2*PI*x.y())*pow(sin(2*PI*x.z()), 2)*pow(cos(2*PI*x.x()), 2)*cos(2*PI*x.y()),
508 1.5*PI*pow(sin(2*PI*x.x()), 2)*sin(2*PI*x.z())*pow(cos(2*PI*x.y()), 2)*cos(2*PI*x.z()) + 1.5*PI*pow(sin(2*PI*x.y()), 2)*sin(2*PI*x.z())*pow(cos(2*PI*x.x()), 2)*cos(2*PI*x.z())
509 );
510 };
511
513 trigonometric_f = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
514 return (1./reynolds) * 6. * std::pow(PI, 2) * Eigen::Vector3d(
515 sin(2. * PI * x(0)) * cos(2. * PI * x(1)) * cos(2. * PI * x(2)),
516 cos(2. * PI * x(0)) * sin(2. * PI * x(1)) * cos(2. * PI * x(2)),
517 -2. * cos(2. * PI * x(0)) * cos(2. * PI * x(1)) * sin(2. * PI * x(2))
518 )
521 };
522
523 //------------------------------------------------------------------------------
524 // Constant solution
525 //------------------------------------------------------------------------------
526
528 constant_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
529 return Eigen::Vector3d(1., 1., 1.);
530 };
531
533 constant_curl_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
534 return Eigen::Vector3d::Zero();
535 };
536
538 constant_curl_u_cross_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
539 return Eigen::Vector3d::Zero();
540 };
541
543 constant_p = [](const Eigen::Vector3d & x) -> double {
544 return 0.;
545 };
546
548 constant_grad_p = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
549 return Eigen::Vector3d::Zero();
550 };
551
553 constant_f = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
554 return Eigen::Vector3d::Zero();
555 };
556
557 //------------------------------------------------------------------------------
558 // Linear solution
559 //------------------------------------------------------------------------------
560
562 linear_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
563 return 1e3*Eigen::Vector3d(x(0), -x(1), 0.);
564 };
565
567 linear_curl_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
568 return Eigen::Vector3d::Zero();
569 };
570
572 linear_curl_u_cross_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
573 return Eigen::Vector3d::Zero();
574 };
575
577 linear_p = [](const Eigen::Vector3d & x) -> double {
578 return pressure_scaling * (x(0) - x(1));
579 };
580
582 linear_grad_p = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
583 return pressure_scaling * Eigen::Vector3d(1., -1., 0.);
584 };
585
587 linear_f = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
588 return linear_grad_p(x);
589 };
590
591 //------------------------------------------------------------------------------
592 // Vertical flow
593 //------------------------------------------------------------------------------
594
595 constexpr double scal_u = 1.;
597 vertical_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
598 return scal_u * Eigen::Vector3d( cos(PI*x.y()), cos(PI*x.x()), 1.);
599 };
600
602 vertical_curl_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
603 return scal_u * Eigen::Vector3d(0, 0, -PI*sin(PI*x.x()) + PI*sin(PI*x.y()) );
604 };
605
608
611
613 vertical_curl_u_cross_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
614 return std::pow(scal_u, 2)
615 * Eigen::Vector3d (
616 -(-PI*sin(PI*x.x()) + PI*sin(PI*x.y()))*cos(PI*x.x()),
617 (-PI*sin(PI*x.x()) + PI*sin(PI*x.y()))*cos(PI*x.y()),
618 0.
619 );
620 };
621
623 vertical_f = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
624 return (1./reynolds) * scal_u * Eigen::Vector3d(pow(PI, 2)*cos(PI*x.y()), pow(PI, 2)*cos(PI*x.x()), 0.)
626 + vertical_grad_p(x);
627// return Eigen::Vector3d::Zero();
628 };
629
630
631 //------------------------------------------------------------------------------
632 // Impose BC: p=1 at entrance x=0, u.n=1 at exit x=1 on lower bottom corner
633 //------------------------------------------------------------------------------
635 pressflux_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
636 return ( lower_bottom_corner_x_one.is_in(x) ? VectorRd(1., 0., 0.) : VectorRd::Zero());
637 };
638
640 pressflux_curl_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
641 return Eigen::Vector3d::Zero();
642 };
643
645 pressflux_p = [](const Eigen::Vector3d & x) -> double {
646 // return (x.x()<1e-8 ? 1. : 0.);
647 return pressure_scaling * (-x.z());
648 };
649
651 pressflux_grad_p = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
652 return Eigen::Vector3d::Zero();
653 };
654
656 pressflux_curl_u_cross_u = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
657 return Eigen::Vector3d::Zero();
658 };
659
661 pressflux_f = [](const Eigen::Vector3d & x) -> Eigen::Vector3d {
662 return Eigen::Vector3d::Zero();
663 };
664
665
668} // end of namespace HArDCore3D
669
670#endif
const Hull lower_bottom_corner_x_one({VectorRd(1., 0., 0.), VectorRd(1.,.25, 0.), VectorRd(1.,.25,.25), VectorRd(1., 0.,.25)}, VectorRd(1., 0., 0.))
The BoundaryConditions class provides definition of boundary conditions.
Definition BoundaryConditions.hpp:129
Construct all polynomial spaces for the DDR sequence.
Definition ddrcore.hpp:62
This structure is a wrapper to allow a given code to select various linear solvers.
Definition linearsolver.hpp:106
Discrete Serendipity Hcurl space: local operators, L2 product and global interpolator.
Definition sxcurl.hpp:21
Discrete Serendipity Hdiv space: local operators, L2 product and global interpolator.
Definition sxdiv.hpp:18
Discrete Serendipity Hgrad space: local operators, L2 product and global interpolator.
Definition sxgrad.hpp:20
Construct all polynomial spaces for the DDR sequence.
Definition serendipity_problem.hpp:40
@ Matrix
Definition basis.hpp:67
size_t dimension() const
Returns the dimension of the global space (all DOFs for all geometric entities)
Definition variabledofspace.hpp:158
static const double PI
Definition ddr-magnetostatics.hpp:187
static Magnetostatics::SolutionPotentialType linear_u
Definition ddr-magnetostatics.hpp:214
static Magnetostatics::SolutionPotentialType constant_u
Definition ddr-magnetostatics.hpp:194
static Magnetostatics::SolutionPotentialType trigonometric_u
Definition ddr-magnetostatics.hpp:238
static Magnetostatics::ForcingTermType constant_f
Definition ddr-magnetostatics.hpp:204
static Magnetostatics::ForcingTermType trigonometric_f
Definition ddr-magnetostatics.hpp:256
static Magnetostatics::ForcingTermType linear_f
Definition ddr-magnetostatics.hpp:228
static NavierStokes::PressureType vertical_p
Definition sddr-navier-stokes.hpp:607
static NavierStokes::ForcingTermType vertical_curl_u_cross_u
Definition sddr-navier-stokes.hpp:613
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::ForcingTermType linear_curl_u_cross_u
Definition sddr-navier-stokes.hpp:572
static NavierStokes::VorticityType constant_curl_u
Definition sddr-navier-stokes.hpp:533
static NavierStokes::ForcingTermType trigonometric_curl_u_cross_u
Definition sddr-navier-stokes.hpp:505
double navier_scaling
Definition sddr-navier-stokes.hpp:466
static NavierStokes::ForcingTermType vertical_f
Definition sddr-navier-stokes.hpp:623
static NavierStokes::VorticityType pressflux_curl_u
Definition sddr-navier-stokes.hpp:640
constexpr double scal_u
Definition sddr-navier-stokes.hpp:595
static NavierStokes::VelocityType pressflux_u
Definition sddr-navier-stokes.hpp:635
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::PressureType constant_p
Definition sddr-navier-stokes.hpp:543
static NavierStokes::VorticityType linear_curl_u
Definition sddr-navier-stokes.hpp:567
static NavierStokes::VorticityType vertical_curl_u
Definition sddr-navier-stokes.hpp:602
double reynolds
Definition sddr-navier-stokes.hpp:465
static NavierStokes::ForcingTermType pressflux_f
Definition sddr-navier-stokes.hpp:661
static NavierStokes::PressureGradientType vertical_grad_p
Definition sddr-navier-stokes.hpp:610
static NavierStokes::VelocityType vertical_u
Definition sddr-navier-stokes.hpp:597
static NavierStokes::PressureType pressflux_p
Definition sddr-navier-stokes.hpp:645
static NavierStokes::PressureGradientType constant_grad_p
Definition sddr-navier-stokes.hpp:548
static NavierStokes::ForcingTermType pressflux_curl_u_cross_u
Definition sddr-navier-stokes.hpp:656
static NavierStokes::PressureGradientType pressflux_grad_p
Definition sddr-navier-stokes.hpp:651
double pressure_scaling
Definition sddr-navier-stokes.hpp:464
static NavierStokes::ForcingTermType constant_curl_u_cross_u
Definition sddr-navier-stokes.hpp:538
double grad_p
Norm of grad of pressure.
Definition sddr-navier-stokes.hpp:81
double hgrad_p
Hgrad norm of p.
Definition sddr-navier-stokes.hpp:83
double hcurl_u
Hcurl norm of u.
Definition sddr-navier-stokes.hpp:82
double u
Norm of velocity.
Definition sddr-navier-stokes.hpp:78
double p
Norm of pressure.
Definition sddr-navier-stokes.hpp:80
double curl_u
Norm of curl of velocity (vorticity)
Definition sddr-navier-stokes.hpp:79
bool use_threads
Definition HHO_DiffAdvecReac.hpp:47
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
Class to assemble and solve a Navier-Stokes problem.
Definition sddr-navier-stokes.hpp:89
void computeLinearComponents(const ForcingTermType &f, const VelocityType &u, const VorticityType &omega, const double &reynolds)
Create the linear part of the system ( curl-curl velocity matrix, vel-grad pressure matrix,...
Definition sddr-navier-stokes.cpp:680
std::function< Eigen::Vector3d(const Eigen::Vector3d &)> PressureGradientType
Definition sddr-navier-stokes.hpp:96
const double & stabilizationParameter() const
Returns the stabilization parameter.
Definition sddr-navier-stokes.hpp:346
size_t nDOFs_dir_edge_u() const
Number of DOFs on Dirichlet edges for the velocity.
Definition sddr-navier-stokes.hpp:178
Eigen::VectorXd newtonIncrement(LinearSolver< SystemMatrixType > &solver, const double &navier_scaling, const double &relax, double &norm_dX)
Solve the linear system and computes the Newton increment (taking into account relaxation)
Definition sddr-navier-stokes.cpp:832
const SystemMatrixType & systemMatrix() const
Returns the linear system matrix.
Definition sddr-navier-stokes.hpp:307
size_t nDOFs_dir_u() const
Total number of Dirichlet DOFs for the velocity.
Definition sddr-navier-stokes.hpp:190
size_t nGLUKN_p() const
Number of globally coupled unknowns for the pressure (statically condensed unknowns removed)
Definition sddr-navier-stokes.hpp:269
const Eigen::VectorXd & systemVector() const
Returns the linear system right-hand side vector.
Definition sddr-navier-stokes.hpp:317
size_t nUKN_p() const
Number of pressure unknowns (statically condensed and global)
Definition sddr-navier-stokes.hpp:245
std::function< Eigen::Vector3d(const Eigen::Vector3d &)> VelocityType
Definition sddr-navier-stokes.hpp:93
const SystemMatrixType & scMatrix() const
Returns the static condensation recovery operator.
Definition sddr-navier-stokes.hpp:327
const SXDiv & sxDiv() const
Returns the space XDiv.
Definition sddr-navier-stokes.hpp:297
std::function< double(const Eigen::Vector3d &)> PressureType
Definition sddr-navier-stokes.hpp:95
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 sddr-navier-stokes.cpp:1141
SystemMatrixType & systemMatrix()
Returns the linear system matrix.
Definition sddr-navier-stokes.hpp:312
size_t nDOFs_dir_p() const
Total number of Dirichlet DOFs for the pressure.
Definition sddr-navier-stokes.hpp:214
size_t nGLUKN_u() const
Number of globally coupled unknowns for the velocity (statically condensed unknowns removed)
Definition sddr-navier-stokes.hpp:263
std::vector< Eigen::VectorXd > & rhsSourceNaturalBC()
Returns local RHS for Stokes problem (useful to compute relative residual)
Definition sddr-navier-stokes.hpp:337
size_t nDOFs_dir_vertex_p() const
Number of DOFs on Dirichlet vertices for the pressure.
Definition sddr-navier-stokes.hpp:196
IntegralWeight ViscosityType
Definition sddr-navier-stokes.hpp:97
size_t nUKN_lambda() const
Number of Lagrange multiplier unknowns (1 if BC=N to impose \int p=0, 0 otherwise)
Definition sddr-navier-stokes.hpp:251
size_t nSCUKN_u() const
Number of statically condensed unknowns (velocity)
Definition sddr-navier-stokes.hpp:221
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 sddr-navier-stokes.cpp:1085
size_t nGLUKN() const
Number of globally coupled unknowns for velocity, pressure, Lagrange multiplier.
Definition sddr-navier-stokes.hpp:275
size_t nDOFs_dir_face_p() const
Number of DOFs on Dirichlet faces for the pressure.
Definition sddr-navier-stokes.hpp:208
size_t nDOFs_dir_face_u() const
Number of DOFs on Dirichlet faces for the velocity.
Definition sddr-navier-stokes.hpp:184
const SXGrad & sxGrad() const
Returns the space SXGrad.
Definition sddr-navier-stokes.hpp:285
size_t nUKN_u() const
Number of velocity unknowns (statically condensed and global, but no Dirichlet)
Definition sddr-navier-stokes.hpp:239
size_t nDOFs_up() const
Number of DOFs for velocity and pressure.
Definition sddr-navier-stokes.hpp:171
Eigen::SparseMatrix< double > SystemMatrixType
Definition sddr-navier-stokes.hpp:90
double & stabilizationParameter()
Returns the stabilization parameter.
Definition sddr-navier-stokes.hpp:351
double assembleLinearSystem(const Eigen::VectorXd &Xn, const double &reac)
Assemble the global system at each Newton iteration, and returns the residual (norm of F(Xn)-b)
Definition sddr-navier-stokes.cpp:860
Eigen::VectorXd vectorDirBC(const VelocityType &u, const PressureType &p)
Create a vector of Dirichlet boundary conditions.
Definition sddr-navier-stokes.cpp:639
size_t nSCUKN() const
Number of statically condensed unknowns (both velocity and pressure)
Definition sddr-navier-stokes.hpp:233
double computeFlux(const Eigen::VectorXd &u, const Hull &surface) const
Compute the flux (based on the polynomial reconstructions) for a discrete velocity across a flat conv...
Definition sddr-navier-stokes.cpp:1236
Eigen::VectorXd & systemVector()
Returns the linear system right-hand side vector.
Definition sddr-navier-stokes.hpp:322
size_t nSCUKN_p() const
Number of statically condensed unknowns (pressure)
Definition sddr-navier-stokes.hpp:227
const bool & iterativeSolver() const
Returns the selection of iterative solver.
Definition sddr-navier-stokes.hpp:356
const SXCurl & sxCurl() const
Returns the space SXCurl.
Definition sddr-navier-stokes.hpp:291
Eigen::VectorXd & scVector()
Returns the static condensation rhs.
Definition sddr-navier-stokes.hpp:332
double normGlobalRHS(const std::vector< Eigen::VectorXd > &locRHS)
Computes the norm of a vector (in Xcurl-Xgrad space) from the element-wise contributions to that vect...
Definition sddr-navier-stokes.cpp:1055
size_t nDOFs_dir_edge_p() const
Number of DOFs on Dirichlet edges for the pressure.
Definition sddr-navier-stokes.hpp:202
size_t nUKN_uplambda() const
Number of unknowns (velocity-pressure-Lagrange multiplier, including statically condensed and globall...
Definition sddr-navier-stokes.hpp:257
std::function< Eigen::Vector3d(const Eigen::Vector3d &)> VorticityType
Definition sddr-navier-stokes.hpp:94
double & Reynolds()
Returns the reynolds number.
Definition sddr-navier-stokes.hpp:366
bool & iterativeSolver()
Returns the selection of iterative solver.
Definition sddr-navier-stokes.hpp:361
std::function< Eigen::Vector3d(const Eigen::Vector3d &)> ForcingTermType
Definition sddr-navier-stokes.hpp:92
Structure to store norm components (for velocity, its curl, pressure, and its gradient),...
Definition sddr-navier-stokes.hpp:62
StokesNorms()
Definition sddr-navier-stokes.hpp:76
StokesNorms(double norm_u, double norm_curl_u, double norm_p, double norm_grad_p)
Constructor.
Definition sddr-navier-stokes.hpp:64
Structure to define a flat convex hull (nodes and normal) and check if a mesh entity is inside.
Definition BoundaryConditions.hpp:84
bool is_in(const VectorRd &x) const
Check if a point is in the convex hull.
Definition BoundaryConditions.cpp:26