Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
navier_stokes_assemblers.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2021-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_navier_stokes_assemblers_h
5#define lethe_navier_stokes_assemblers_h
6
9
10#include <solvers/copy_data.h>
13
14#include <utility>
15
16/*
17 * Exceptions used to capture incoherent setup of assemblers
18 */
19
21 PhaseChangePermeabilityModelRequiresTemperature,
22 "Using a phase change permeability model requires running a multiphysics simulation with the heat transfer solver enabled.");
23
25 PhaseChangePermeabilityModelDoesNotSupportCHN,
26 "The phase change permeability models do not currently have a Cahn-Hilliard implementation.");
27
29 SingleFluidPhaseChangeDarcyModelDoesNotSupportDensityMultiplication,
30 "Single-fluid simulations with Darcy phase change model does not support the multiplication by density since the kinematic pressure is used in the momentum equation.");
31
32
33/**
34 * @brief A pure virtual class that serves as an interface for all
35 * of the assemblers for the Navier-Stokes Equations
36 *
37 * @tparam dim An integer that denotes the number of spatial dimensions
38 *
39 * @ingroup assemblers
40 */
41template <int dim>
45
46
47/**
48 * @brief Class that assembles the core of the Navier-Stokes equation.
49 * According to the following weak form:
50 * \f$\mathbf{u} \cdot \nabla \mathbf{u} - \nabla p - \nu \nabla^2 \mathbf{u}
51 * =0 \f$ with an SUPG and PSPG stabilization
52 *
53 * @tparam dim An integer that denotes the number of spatial dimensions
54 *
55 * @ingroup assemblers
56 */
57template <int dim>
59{
60public:
62 const std::shared_ptr<SimulationControl> &simulation_control)
64 {}
65
66 /**
67 * @brief assemble_matrix Assembles the matrix
68 * @param scratch_data (see base class)
69 * @param copy_data (see base class)
70 */
71 virtual void
73 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
74
75 /**
76 * @brief assemble_rhs Assembles the rhs
77 * @param scratch_data (see base class)
78 * @param copy_data (see base class)
79 */
80 virtual void
82 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
83
84 const std::shared_ptr<SimulationControl> simulation_control;
85};
86
87
88/**
89 * @brief Class that assembles the core of the Navier-Stokes equation.
90 * According to the following weak form:
91 * \f$\mathbf{u} \cdot \nabla \mathbf{u} - \nabla p - \nu \nabla^2 \mathbf{u}
92 * =0 \f$ with a full GLS stabilization including the laplacian of the test
93 * function.
94 *
95 * @tparam dim An integer that denotes the number of spatial dimensions
96 *
97 * @ingroup assemblers
98 */
99template <int dim>
101{
102public:
104 const std::shared_ptr<SimulationControl> &simulation_control)
106 {}
107
108 /**
109 * @brief assemble_matrix Assembles the matrix
110 * @param scratch_data (see base class)
111 * @param copy_data (see base class)
112 */
113 virtual void
115 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
116
117 /**
118 * @brief assemble_rhs Assembles the rhs
119 * @param scratch_data (see base class)
120 * @param copy_data (see base class)
121 */
122 virtual void
123 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
124 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
125
126 const std::shared_ptr<SimulationControl> simulation_control;
127};
128
129
130/**
131 * @brief Class that assembles the coriolis and the centrifugal
132 * if a simulation is carried out in a rotating frame of reference
133 * according to the following term:
134 * \f$2\mathbf{\omega} \times \mathbf{u} + \mathbf{\omega}\times
135 * (\mathbf{\omega} \times \mathbf{r})\f$ Where $\mathbf{\omega}$ is the
136 * rotation vector of the frame of reference and $\mathbf{r}$ is the position
137 * vector (e.g. a vector between a point on the rotation axis and the gauss
138 * point) By default, it is assumed that the rotation vector passes through the
139 * point (0,0) in 2D or (0,0,0) in 3D
140 *
141 *
142 * @tparam dim An integer that denotes the number of spatial dimensions
143 *
144 * @ingroup assemblers
145 */
146template <int dim>
148{
149public:
153
154 /**
155 * @brief assemble_matrix Assembles the matrix
156 * @param scratch_data (see base class)
157 * @param copy_data (see base class)
158 */
159 virtual void
161 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
162
163 /**
164 * @brief assemble_rhs Assembles the rhs
165 * @param scratch_data (see base class)
166 * @param copy_data (see base class)
167 */
168 virtual void
169 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
170 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
171
173};
174
175
176/**
177 * @brief Class that assembles the core of the Navier-Stokes equation
178 * using a Rheological model to predict non-Newtonian behaviors
179 *
180 * @tparam dim An integer that denotes the number of spatial dimensions
181 *
182 * @ingroup assemblers
183 */
184template <int dim>
186 : public NavierStokesAssemblerBase<dim>
187{
188public:
190 const std::shared_ptr<SimulationControl> &simulation_control)
192 {}
193
194 /**
195 * @brief Calculates an approximation of the gradient of the kinematic viscosity
196 * @param velocity_gradient The velocity gradient tensor on the quadrature point
197 @param velocity_hessians The velocity hessian tensor on the quadrature point
198 @param non_newtonian_viscosity The viscosity at which the gradient is calculated
199 @param d_gamma_dot The difference in the shear rate magnitude to approximate the
200 viscosity variation with a slight change in the shear_rate magnitude
201 */
202 inline Tensor<1, dim>
204 const Tensor<2, dim> &velocity_gradient,
205 const Tensor<3, dim> &velocity_hessians,
206 const double shear_rate_magnitude,
207 const double grad_kinematic_viscosity_shear_rate) const
208 {
209 // Calculates an approximation of the shear rate magnitude gradient using
210 // the derived form, since it does not change with rheological models
211 Tensor<1, dim> grad_shear_rate;
212 for (int d = 0; d < dim; ++d)
213 {
214 if (dim == 2)
215 {
216 for (int k = 0; k < dim; ++k)
217 {
218 grad_shear_rate[d] +=
219 2 * (velocity_gradient[k][k] * velocity_hessians[k][d][k]) /
220 shear_rate_magnitude;
221 }
222 grad_shear_rate[d] +=
223 (velocity_gradient[0][1] + velocity_gradient[1][0]) *
224 (velocity_hessians[0][d][1] + velocity_hessians[1][d][0]) /
225 shear_rate_magnitude;
226 }
227 else
228 {
229 for (int k = 0; k < dim; ++k)
230 {
231 grad_shear_rate[d] +=
232 2 * (velocity_gradient[k][k] * velocity_hessians[k][d][k]) /
233 shear_rate_magnitude +
234 (velocity_gradient[(k + 1) % dim][(k + 2) % dim] +
235 velocity_gradient[(k + 2) % dim][(k + 1) % dim]) *
236 (velocity_hessians[(k + 1) % dim][d][(k + 2) % dim] +
237 velocity_hessians[(k + 2) % dim][d][(k + 1) % dim]) /
238 shear_rate_magnitude;
239 }
240 }
241 }
242 return grad_shear_rate * grad_kinematic_viscosity_shear_rate;
243 };
244
245 /**
246 * @brief assemble_matrix Assembles the matrix
247 * @param scratch_data (see base class)
248 * @param copy_data (see base class)
249 */
250 virtual void
252 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
253
254 /**
255 * @brief assemble_rhs Assembles the rhs
256 * @param scratch_data (see base class)
257 * @param copy_data (see base class)
258 */
259 virtual void
260 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
261 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
262
263 /**
264 * Enables SUPG stabilization for the Navier-Stokes formulation.
265 * We have not found any scenarios where it is relevant not to use SUPG
266 * stabilization yet.
267 */
268 const bool SUPG = true;
269
270 const std::shared_ptr<SimulationControl> simulation_control;
271};
272
273
274/**
275 * @brief Class that assembles the transient time arising from BDF time
276 * integration for the Navier Stokes equations. For example, if a BDF1 scheme is
277 * chosen, the following is assembled
278 * \f$\frac{\mathbf{u}^{t+\Delta t}-\mathbf{u}^{t}}{\Delta t}\f$
279 *
280 * @tparam dim An integer that denotes the number of spatial dimensions
281 *
282 * @ingroup assemblers
283 */
284template <int dim>
286{
287public:
289 const std::shared_ptr<SimulationControl> &simulation_control)
291 {}
292
293 /**
294 * @brief assemble_matrix Assembles the matrix
295 * @param scratch_data (see base class)
296 * @param copy_data (see base class)
297 */
298
299 virtual void
301 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
302
303 /**
304 * @brief assemble_rhs Assembles the rhs
305 * @param scratch_data (see base class)
306 * @param copy_data (see base class)
307 */
308 virtual void
309 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
310 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
311
312 const std::shared_ptr<SimulationControl> simulation_control;
313};
314
315/**
316 * @brief Class that assembles the transient term arising from SDIRK time
317 * integration for the Navier Stokes equations.
318 * For a given stage \f[ i \f], the following expression is assembled and
319 * treated implicitly: \f[ \frac{\mathbf{u}_i^* - \mathbf{u}_n}{h a_{ii}} -
320 * \sum_{j=0}^{i-1} \frac{a_{ij}}{a_{ii}} \mathbf{k}_j \f] where:
321 * - \f[ \mathbf{u}_i^* \f] is the current stage solution,
322 * - \f[ \mathbf{u}_n \f] is the solution at the previous time step,
323 * - \f[ \mathbf{k}_j \f] coefficients are the solution increments at the
324 * previous stages,
325 * - \f[ h \f] is the time step size,
326 * - \f[ a_{ij} \‍), \‍( a_{ii} \f] are coefficients from the SDIRK Butcher
327 * tableau. These coefficients are given data by the method and constant for the
328 * entire simulation.
329 *
330 * @tparam dim An integer that denotes the number of spatial dimensions
331 *
332 * @ingroup assemblers
333 */
334template <int dim>
336{
337public:
339 const std::shared_ptr<SimulationControl> &simulation_control)
341 {}
342
343 /**
344 * @brief assemble_matrix Assembles the matrix
345 * @param scratch_data (see base class)
346 * @param copy_data (see base class)
347 */
348
349 virtual void
351 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
352
353 /**
354 * @brief assemble_rhs Assembles the rhs
355 * @param scratch_data (see base class)
356 * @param copy_data (see base class)
357 */
358 virtual void
359 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
360 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
361
362 const std::shared_ptr<SimulationControl> simulation_control;
363};
364
365
366/**
367 * @brief Class that assembles the core of the Navier-Stokes equation.
368 * According to the following weak form:
369 * \f$\mathbf{u} \cdot \nabla \mathbf{u} - \nabla p - \nu \nabla^2 \mathbf{u}
370 * =0 \f$ with a grad-div stabilization
371 *
372 * @tparam dim An integer that denotes the number of spatial dimensions
373 *
374 * @ingroup assemblers
375 */
376template <int dim>
378{
379public:
381 const std::shared_ptr<SimulationControl> &simulation_control,
382 const double gamma)
384 , gamma(gamma)
385 {}
386
387 /**
388 * @brief assemble_matrix Assembles the matrix
389 * @param scratch_data (see base class)
390 * @param copy_data (see base class)
391 */
392 virtual void
394 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
395
396 /**
397 * @brief assemble_rhs Assembles the rhs
398 * @param scratch_data (see base class)
399 * @param copy_data (see base class)
400 */
401 virtual void
402 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
403 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
404
405 const std::shared_ptr<SimulationControl> simulation_control;
406 const double gamma;
407};
408
409
410template <int dim>
412 : public NavierStokesAssemblerBase<dim>
413{
414public:
416 const std::shared_ptr<SimulationControl> &simulation_control,
417 const double gamma)
419 , gamma(gamma)
420 {}
421
422 /**
423 * @brief assemble_matrix Assembles the matrix
424 * @param scratch_data (see base class)
425 * @param copy_data (see base class)
426 */
427 virtual void
429 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
430
431 /**
432 * @brief assemble_rhs Assembles the rhs
433 * @param scratch_data (see base class)
434 * @param copy_data (see base class)
435 */
436 virtual void
437 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
438 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
439
440 const std::shared_ptr<SimulationControl> simulation_control;
441 const double gamma;
442};
443
444
445/**
446 * @brief Class that assembles a Poisson problem for all velocity components and pressure variables.
447 * According to the following weak form: d^2 U/dx^2=0 and d^2 P/dx^2=0
448 *
449 * @tparam dim An integer that denotes the number of spatial dimensions
450 *
451 * @ingroup assemblers
452 */
453template <int dim>
455{
456public:
457 LaplaceAssembly(const std::shared_ptr<SimulationControl> &simulation_control)
459 {}
460
461 /**
462 * @brief assemble_matrix Assembles the matrix
463 * @param scratch_data (see base class)
464 * @param copy_data (see base class)
465 */
466 virtual void
468 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
469
470 /**
471 * @brief assemble_rhs Assembles the rhs
472 * @param scratch_data (see base class)
473 * @param copy_data (see base class)
474 */
475 virtual void
476 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
477 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
478
479 const std::shared_ptr<SimulationControl> simulation_control;
480};
481
482
483/**
484 * @brief Class that assembles a Neumann boundary condition.
485 * According to the following weak form: (p-mu*grad_u)*n at the boundary
486 *
487 * @tparam dim An integer that denotes the number of spatial dimensions
488 * @param pressure_boundary_condition The boundary condition objects use to store the function.
489 * @ingroup assemblers
490 */
491template <int dim>
493{
494public:
496 const std::shared_ptr<SimulationControl> &simulation_control,
498 &pressure_boundary_conditions_input)
500 , pressure_boundary_conditions(pressure_boundary_conditions_input)
501 {}
502
503 /**
504 * @brief assemble_matrix Assembles the matrix
505 * @param scratch_data (see base class)
506 * @param copy_data (see base class)
507 */
508 virtual void
510 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
511
512 /**
513 * @brief assemble_rhs Assembles the rhs
514 * @param scratch_data (see base class)
515 * @param copy_data (see base class)
516 */
517 virtual void
518 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
519 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
520
521 const std::shared_ptr<SimulationControl> simulation_control;
524};
525
526/**
527 * @brief Class that assembles a Neumann traction boundary condition.
528 * According to the following weak form: \f$(p-\mu\nabla \mathbf{u})\cdot
529 * \mathbf{n}\f$ at the boundary.
530 *
531 * @tparam dim An integer that denotes the number of spatial dimensions.
532 * @param neumann_traction_boundary_condition The boundary condition objects use to store the function.
533 * @ingroup assemblers
534 */
535template <int dim>
537{
538public:
540 const std::shared_ptr<SimulationControl> &simulation_control,
542 &neumann_traction_boundary_condition_input)
545 neumann_traction_boundary_condition_input)
546 {}
547
548 /**
549 * @brief assemble_matrix Assembles the matrix
550 * @param scratch_data (see base class)
551 * @param copy_data (see base class)
552 * @note This method is just for consistency and Neumann boundary traction doesn't
553 * require matrix assembly
554 */
555 virtual void
557 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
558
559 /**
560 * @brief assemble_rhs Assembles the rhs
561 * @param scratch_data (see base class)
562 * @param copy_data (see base class)
563 */
564 virtual void
565 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
566 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
567
568 const std::shared_ptr<SimulationControl> simulation_control;
571};
572
573
574
575/**
576 * @brief Class that assembles the weak formulation of a Dirichlet boundary condition using the Nitsche method.
577 * According to the following weak form: (u_ib-u)-(u,grad v)
578 *
579 * @tparam dim An integer that denotes the number of spatial dimensions
580 * @param boundary_condition The boundary condition objects us to store the function.
581 * @ingroup assemblers
582 */
583template <int dim>
585{
586public:
588 const std::shared_ptr<SimulationControl> &simulation_control,
590 &boundary_conditions_input)
592 , boundary_conditions(boundary_conditions_input)
593 {}
594
595 /**
596 * @brief assemble_matrix Assembles the matrix
597 * @param scratch_data (see base class)
598 * @param copy_data (see base class)
599 */
600 virtual void
602 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
603
604 /**
605 * @brief assemble_rhs Assembles the rhs
606 * @param scratch_data (see base class)
607 * @param copy_data (see base class)
608 */
609 virtual void
610 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
611 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
612
613 const std::shared_ptr<SimulationControl> simulation_control;
616};
617
618
619/**
620 * @brief Class that assembles the special case of partial slip condition using the weak formulation of a Dirichlet boundary condition using the Nitsche method.
621 * According to the following weak form: beta n(nu-nv) +
622 * mu/boundary_layer_thickness t(tu-tv)
623 *
624 * @tparam dim An integer that denotes the number of spatial dimensions
625 * @param boundary_condition The boundary condition objects us to store the function.
626 * @ingroup assemblers
627 */
628template <int dim>
630 : public NavierStokesAssemblerBase<dim>
631{
632public:
634 const std::shared_ptr<SimulationControl> &simulation_control,
636 &boundary_conditions_input)
638 , boundary_conditions(boundary_conditions_input)
639 {}
640
641 /**
642 * @brief assemble_matrix Assembles the matrix
643 * @param scratch_data (see base class)
644 * @param copy_data (see base class)
645 */
646 virtual void
648 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
649
650 /**
651 * @brief assemble_rhs Assembles the rhs
652 * @param scratch_data (see base class)
653 * @param copy_data (see base class)
654 */
655 virtual void
656 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
657 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
658
659 const std::shared_ptr<SimulationControl> simulation_control;
662};
663
664
665/**
666 * @brief Class that assembles the weak formulation of an outlet boundary condition
667 * according to the following equation: (nu grad(u) * grad(v) + pI - (beta *
668 * u)_ * n. See the paper by Arndt, Braack and Lube
669 * https://www.mathsim.eu/~darndt/files/ENUMATH_2015.pdf
670 *
671 * @tparam dim An integer that denotes the number of spatial dimensions
672 * @param boundary_condition The boundary condition objects us to store the function.
673 * @ingroup assemblers
674 */
675template <int dim>
677{
678public:
680 const std::shared_ptr<SimulationControl> &simulation_control,
682 &boundary_conditions_input)
684 , boundary_conditions(boundary_conditions_input)
685 {}
686
687 /**
688 * @brief assemble_matrix Assembles the matrix
689 * @param scratch_data (see base class)
690 * @param copy_data (see base class)
691 */
692 virtual void
694 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
695
696 /**
697 * @brief assemble_rhs Assembles the rhs
698 * @param scratch_data (see base class)
699 * @param copy_data (see base class)
700 */
701 virtual void
702 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
703 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
704
705 const std::shared_ptr<SimulationControl> simulation_control;
708};
709
710
711/**
712 * @brief Class that assembles a thermal buoyancy forcing term using the Boussinesq
713 * approximation. For more information, read Chapter 10 of Transport phenomena
714 * by Bird et al., or "Boussinesq approximation (buoyancy)" page on Wikipedia.
715 *
716 * @tparam dim An integer that denotes the number of spatial dimensions
717 *
718 * @ingroup assemblers
719 */
720template <int dim>
722{
723public:
730
731 /**
732 * @brief assemble_matrix Adds the buoyancy force to the strong residual used
733 * by the stabilization terms of the Jacobian. The force does not depend on
734 * the velocity or the pressure, so nothing is added to the local matrix.
735 * @param scratch_data (see base class)
736 * @param copy_data (see base class)
737 */
738 virtual void
740 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
741
742 /**
743 * @brief assemble_rhs Assembles the weak form of: \f$-\mathbf{g} \times \alpha \times (T - T_0)\f$
744 * @param scratch_data (see base class)
745 * @param copy_data (see base class)
746 */
747 virtual void
748 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
749 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
750
751
752private:
753 const std::shared_ptr<SimulationControl> simulation_control;
755};
756
757
758/**
759 * @brief Class that assembles a phase change Darcy forcing term. This term adds
760 * \f$-\beta_D \mathbf{u} \f$ to the right hand-side of the Navier-Stokes
761 * equations to prohibit the motion of a material. In the phase change model,
762 * the value of the \f$ \beta_D \f$ coefficient depends on the temperature
763 * field. Generally, this is used to prohibit fluid motion in the solid phase
764 * within phase change problem. This generally leads to a better conditioning of
765 * the linear system than increasing the viscosity of the solid phase.
766 *
767 *
768 * @tparam dim An integer that denotes the number of spatial dimensions
769 *
770 * @ingroup assemblers
771 */
772template <int dim>
774{
775public:
780
781 /**
782 * @brief assemble_matrix Assembles the matrix of: \f$-\beta_D \mathbf{u} \f$
783 * @param scratch_data (see base class)
784 * @param copy_data (see base class)
785 */
786 virtual void
788 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
789
790
791 /**
792 * @brief assemble_rhs Assembles the weak form of: \f$-\beta_D \mathbf{u} \f$
793 * @param scratch_data (see base class)
794 * @param copy_data (see base class)
795 */
796 virtual void
797 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
798 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
799
800
801private:
802 /*
803 * Phase change parameters are kept within the assembler and are used to
804 * calculate, on the fly, the inverse permeability (\f$ \beta_D \f$).
805 */
807};
808
809/**
810 * @brief Assembler of the non-linear Carman-Kozeny permeability model for
811 * simulations with phase change.
812 *
813 * @tparam dim An integer that denotes the number of spatial dimensions
814 */
815template <int dim>
817{
818public:
819 /**
820 * @brief Assembler for the Carman-Kozeny permeability source term used for
821 * phase change modelling.
822 *
823 * \f[
824 * \boldsymbol{F}_\mathrm{Carman-Kozeny} = \frac{-\nu}{A_\mathrm{perm}}
825 * \left[ \frac{(1-\alpha_\mathrm{l})^2}{(\alpha_\mathrm{l})^3 +
826 * \delta}\right] \boldsymbol{u}
827 * \f]
828 *
829 * with \f$\nu\f$ the kinematic viscosity, \f$A_\mathrm{perm}\f$ the
830 * permeability area, \f$\alpha_\mathrm{l}\f$ the liquid fraction,
831 * \f$\delta\f$ a tolerance to avoid division by zero in the solid, and
832 * \f$\boldsymbol{u}\f$ the velocity.
833 *
834 * @param[in] carman_kozeny_permeability_area Permeability area of the solid
835 * (pseudo-porous media).
836 * @param[in] carman_kozeny_tolerance Tolerance to avoid division by zero in
837 * the solid.
838 * @param[in] liquidus_temperature Liquidus temperature of the fluid used for
839 * computing the liquid fraction.
840 * @param[in] solidus_temperature Solidus temperature of the fluid used for
841 * computing the liquid fraction.
842 */
843 PhaseChangeCarmanKozenyAssembler(const double carman_kozeny_permeability_area,
844 const double carman_kozeny_tolerance,
845 const double liquidus_temperature,
846 const double solidus_temperature)
847 : carman_kozeny_permeability_area_inv(1. / carman_kozeny_permeability_area)
851 {}
852
853 /**
854 * @brief Assembles the matrix of:
855 * \f[
856 * \boldsymbol{F}_\mathrm{Carman-Kozeny} = \frac{-\nu}{A_\mathrm{perm}}
857 * \left[ \frac{(1-\alpha_\mathrm{l})^2}{(\alpha_\mathrm{l})^3 +
858 * \delta}\right] \boldsymbol{u} \f]
859 *
860 * with \f$\nu\f$ the kinematic viscosity, \f$A_\mathrm{perm}\f$ the
861 * permeability area, \f$\alpha_\mathrm{l}\f$ the liquid fraction,
862 * \f$\delta\f$ a tolerance to avoid division by zero in the solid, and
863 * \f$\boldsymbol{u}\f$ the velocity.
864 *
865 * @param[in] scratch_data Scratch data containing the information required
866 * for system assembly.
867 * It is important to note that the scratch data has to have been re-inited
868 * before calling for matrix assembly.
869 *
870 * @param[in,out] copy_data Destination where the local_matrix is copied to.
871 */
872 virtual void
874 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
875
876 /**
877 * @brief Assemble the right-hand side (rhs) of:
878 * \f[
879 * \boldsymbol{F}_\mathrm{Carman-Kozeny} = \frac{-\nu}{A_\mathrm{perm}}
880 * \left[ \frac{(1-\alpha_\mathrm{l})^2}{(\alpha_\mathrm{l})^3 +
881 * \delta}\right] \boldsymbol{u} \f]
882 *
883 * with \f$\nu\f$ the kinematic viscosity, \f$A_\mathrm{perm}\f$ the
884 * permeability area, \f$\alpha_\mathrm{l}\f$ the liquid fraction,
885 * \f$\delta\f$ a tolerance to avoid division by zero in the solid, and
886 * \f$\boldsymbol{u}\f$ the velocity.
887 *
888 * @param[in] scratch_data Scratch data containing the information required
889 * for system assembly.
890 * It is important to note that the scratch data has to have been re-inited
891 * before calling for rhs assembly.
892 *
893 * @param[in,out] copy_data Destination where the local_rhs is copied to.
894 */
895 virtual void
896 assemble_rhs(const NavierStokesScratchData<dim> &scratch_data,
897 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
898
899private:
900 /// One over the permeability area of the pseudo-porous bed (solid phase).
902
903 /// Tolerance in the Carman-Kozeny source term that avoids division by zero.
905
906 /// Liquidus temperature
908
909 /// Solidus temperature
911};
912
913
914#endif
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
BlockNavierStokesAssemblerCore(const std::shared_ptr< SimulationControl > &simulation_control, const double gamma)
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
BlockNavierStokesAssemblerNonNewtonianCore(const std::shared_ptr< SimulationControl > &simulation_control, const double gamma)
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
const std::shared_ptr< SimulationControl > simulation_control
This class manages the boundary conditions forhe fluid dynamics solver It introduces the boundary fun...
GLSNavierStokesAssemblerBDF(const std::shared_ptr< SimulationControl > &simulation_control)
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
const std::shared_ptr< SimulationControl > simulation_control
GLSNavierStokesAssemblerCore(const std::shared_ptr< SimulationControl > &simulation_control)
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
const std::shared_ptr< SimulationControl > simulation_control
Tensor< 1, dim > get_kinematic_viscosity_gradient(const Tensor< 2, dim > &velocity_gradient, const Tensor< 3, dim > &velocity_hessians, const double shear_rate_magnitude, const double grad_kinematic_viscosity_shear_rate) const
Calculates an approximation of the gradient of the kinematic viscosity.
GLSNavierStokesAssemblerNonNewtonianCore(const std::shared_ptr< SimulationControl > &simulation_control)
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
GLSNavierStokesAssemblerSDIRK(const std::shared_ptr< SimulationControl > &simulation_control)
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
GLSNavierStokesAssemblerSRF(Parameters::VelocitySource velocity_sources)
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
Parameters::VelocitySource velocity_sources
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
LaplaceAssembly(const std::shared_ptr< SimulationControl > &simulation_control)
Class that stores the information required by the assembly procedure for a Navier-Stokes equation....
NeumannTractionBoundaryCondition(const std::shared_ptr< SimulationControl > &simulation_control, const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > &neumann_traction_boundary_condition_input)
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > & neumann_traction_boundary_condition
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
OutletBoundaryCondition(const std::shared_ptr< SimulationControl > &simulation_control, const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > &boundary_conditions_input)
const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > & boundary_conditions
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
PSPGSUPGNavierStokesAssemblerCore(const std::shared_ptr< SimulationControl > &simulation_control)
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
const std::shared_ptr< SimulationControl > simulation_control
PartialSlipDirichletBoundaryCondition(const std::shared_ptr< SimulationControl > &simulation_control, const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > &boundary_conditions_input)
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > & boundary_conditions
const double carman_kozeny_permeability_area_inv
One over the permeability area of the pseudo-porous bed (solid phase).
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
Assemble the right-hand side (rhs) of:
const double liquidus_temperature
Liquidus temperature.
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
Assembles the matrix of:
const double solidus_temperature
Solidus temperature.
PhaseChangeCarmanKozenyAssembler(const double carman_kozeny_permeability_area, const double carman_kozeny_tolerance, const double liquidus_temperature, const double solidus_temperature)
Assembler for the Carman-Kozeny permeability source term used for phase change modelling.
const double carman_kozeny_tolerance
Tolerance in the Carman-Kozeny source term that avoids division by zero.
const Parameters::PhaseChange phase_change_parameters
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix of:
PhaseChangeDarcyAssembly(const Parameters::PhaseChange phase_change_parameters)
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the weak form of:
Base class for assembler objects of physics and subequations.
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
PressureBoundaryCondition(const std::shared_ptr< SimulationControl > &simulation_control, const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > &pressure_boundary_conditions_input)
const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > & pressure_boundary_conditions
const std::shared_ptr< SimulationControl > simulation_control
Class responsible for storing the information calculated using the assembly of stabilized Tensor<1,...
Definition copy_data.h:166
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the weak form of:
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Adds the buoyancy force to the strong residual used by the stabilization terms of the...
ThermalBuoyancyAssembly(const std::shared_ptr< SimulationControl > &simulation_control, const double reference_temperature)
const std::shared_ptr< SimulationControl > simulation_control
WeakDirichletBoundaryCondition(const std::shared_ptr< SimulationControl > &simulation_control, const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > &boundary_conditions_input)
virtual void assemble_rhs(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_rhs Assembles the rhs
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_matrix(const NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
assemble_matrix Assembles the matrix
const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > & boundary_conditions
DeclExceptionMsg(PhaseChangePermeabilityModelRequiresTemperature, "Using a phase change permeability model requires running a multiphysics simulation with the heat transfer solver enabled.")
PhysicsAssemblerBase< NavierStokesScratchData< dim >, StabilizedMethodsTensorCopyData< dim > > NavierStokesAssemblerBase
A pure virtual class that serves as an interface for all of the assemblers for the Navier-Stokes Equa...
Simulation control classes for managing time-stepping and iteration control in Lethe.
Phase change model for melting/freezing liquids The model assumes that the phase change occurs betwee...
Definition parameters.h:264
VelocitySource - Adds velocity-dependent source term to the Navier-Stokes equations with the appropri...