LifeV
|
OneDFSISolver - Solver class for the 1D model. More...
#include <OneDFSISolver.hpp>
Constructors & Destructor | |
OneDFSISolver () | |
Empty Constructor. More... | |
virtual | ~OneDFSISolver () |
Destructor. More... | |
Methods | |
void | buildConstantMatrices () |
Build constant matrices (mass and grad) More... | |
void | setupSolution (solution_Type &solution) |
Setup the solution using the default FESpace map. More... | |
void | setupSolution (solution_Type &solution, const MapEpetra &map, const bool &onlyMainQuantities=false) |
Setup the solution using user defined FESpace map. More... | |
void | initialize (solution_Type &solution) |
Initialize all the variables of the solution to a reference condition with , , and . More... | |
void | computeW1W2 (solution_Type &solution) |
Update the Riemann variables. More... | |
void | computePressure (solution_Type &solution, const Real &timeStep) |
Update the pressure. More... | |
void | computeAreaRatio (solution_Type &solution) |
Update the ratio between and . More... | |
void | computeArea (solution_Type &solution) |
Compute A from the area ratio: . More... | |
void | updateRHS (const solution_Type &solution, const Real &timeStep) |
Compute the right hand side. More... | |
void | iterate (OneDFSIBCHandler &bcH, solution_Type &solution, const Real &time, const Real &timeStep) |
Update convective term and BC. Then solve the linearized system. More... | |
vector_Type | viscoelasticFlowRateCorrection (const vector_Type &newArea, const vector_Type &newElasticFlowRate, const vector_Type &oldViscoelasticFlowRate, const Real &timeStep, OneDFSIBCHandler &bcHandler, const bool &updateSystemMatrix=true) |
Apply the viscoelastic flow rate correction. More... | |
Real | computeCFL (const solution_Type &solution, const Real &timeStep) const |
CFL computation (correct for constant mesh) More... | |
void | resetOutput (const solution_Type &solution) |
Reset the output files. More... | |
void | postProcess (const solution_Type &solution, const Real &time) |
Save results on output files. More... | |
Set Methods | |
void | setProblem (const physicsPtr_Type &physicsPtr, const fluxPtr_Type &fluxPtr, const sourcePtr_Type &sourcePtr) |
Set problem classes. More... | |
void | setCommunicator (const commPtr_Type &commPtr) |
Set the communicator. More... | |
void | setFESpace (const feSpacePtr_Type &feSpacePtr) |
Set the FEspace. More... | |
void | setLinearSolver (const linearSolverPtr_Type &linearSolverPtr) |
Set the linear solver. More... | |
void | setLinearViscoelasticSolver (const linearSolverPtr_Type &linearViscoelasticSolverPtr) |
Set the viscoelastic linear solver. More... | |
Get Methods | |
const physicsPtr_Type & | physics () const |
Get the physics class. More... | |
const fluxPtr_Type & | flux () const |
Get the flux class. More... | |
const sourcePtr_Type & | source () const |
Get the source class. More... | |
UInt | boundaryDOF (const bcSide_Type &bcSide) const |
Return the ID of the boundary node given a side. More... | |
Real | boundaryValue (const solution_Type &solution, const bcType_Type &bcType, const bcSide_Type &bcSide) const |
Return the value of a quantity ( , , , , ) on a specified boundary. More... | |
void | boundaryEigenValuesEigenVectors (const bcSide_Type &bcSide, const solution_Type &solution, container2D_Type &eigenvalues, container2D_Type &leftEigenvector1, container2D_Type &leftEigenvector2) |
Return the value of the eigenvalues and eigenvectors on a specified boundary. More... | |
const vectorPtrContainer_Type & | residual () const |
Get the residual container. More... | |
const matrixPtr_Type & | massMatrix () const |
Get the system matrix without BC. More... | |
Private Methods | |
void | updateFlux (const solution_Type &solution) |
Update the P1 flux vector from U: M_fluxi = F_h(Un) i=1,2 (works only for P1Seg elements) More... | |
void | updatedFdU (const solution_Type &solution) |
Call _updateFlux and update the P0 derivative of flux vector from U: More... | |
void | updateSource (const solution_Type &solution) |
Update the P1 source vector from U: M_sourcei = S_h(Un) i=1,2 (works only for P1Seg elements) More... | |
void | updatedSdU (const solution_Type &solution) |
Call _updateSource and update the P0 derivative of source vector from U: More... | |
void | updateMatrices () |
Update the matrices. More... | |
void | updateElementalMatrices (const Real &dFdU, const Real &dSdU) |
Update the element matrices with the current element. More... | |
void | matrixAssemble (const UInt &ii, const UInt &jj) |
Assemble the matrices. More... | |
void | applyDirichletBCToMatrix (matrix_Type &matrix) |
Update the matrices to take into account Dirichlet BC. More... | |
vector_Type | inertialFlowRateCorrection (const vector_Type &) |
Apply the inertial Flux correction: More... | |
vector_Type | longitudinalFlowRateCorrection () |
Apply the longitudinal Flux correction: More... | |
Unimplemented Methods | |
OneDFSISolver (const OneDFSISolver &solver) | |
OneDFSISolver & | operator= (const OneDFSISolver &solver) |
OneDFSISolver - Solver class for the 1D model.
EQUATIONS:
The conservative form of the generic hyperbolic problem is
where are the conservative variables, the corresponding fluxes, and represents the source terms.
NUMERICAL DISCRETIZATION:
We discretize the problem by a second-order Taylor–Galerkin scheme. Let us consider the time interval , for , with being the time step. Given we compute by using the following scheme
IMPLEMENTATION:
The implementation of the Taylor-Galerkin scheme is the following:
(Un+1, phi) = //! massFactor^{-1} * Un+1
(Un, phi) //! mass * U
+dt * ( Fh(Un), dphi/dz ) //! grad * F(U)
-dt^2/2 * (diffFh(Un) Sh(Un), dphi/dz ) //! gradDiffFlux(U) * S(U)
+dt^2/2 * (diffSh(Un) dFh/dz(Un), phi ) //! divDiffSrc(U) * F(U)
-dt^2/2 * (diffFh(Un) dFh/dz(Un), dphi/dz ) //!stiffDiffFlux(U) * F(U)
-dt * ( Sh(Un), phi ) //! mass * S(U)
+dt^2/2 * (diffSh(Un) Sh(Un), phi ) //! massDiffSrc(U) * S(U)
Let's define:
Then:
DEVELOPMENT NOTES:
The option taken here is to define the different tridiagonal matrix operators (div, grad, mass, stiff) and reconstruct them at each time step (as they depend on diffFlux and diffSrc). They are thus rebuilt at the element level and reassembled. Afterwards, there remains to do only some tridiagonal matrix vector products to obtain the right hand side. This procedure might appear a bit memory consuming (there are 18 tridiagonal matrices stored), but it has the advantage of being very clear. If it is too costly, it should be quite easy to improve it.
Definition at line 149 of file OneDFSISolver.hpp.
typedef OneDFSIPhysics physics_Type |
Definition at line 156 of file OneDFSISolver.hpp.
typedef std::shared_ptr< physics_Type > physicsPtr_Type |
Definition at line 157 of file OneDFSISolver.hpp.
typedef OneDFSIFlux flux_Type |
Definition at line 159 of file OneDFSISolver.hpp.
typedef std::shared_ptr< flux_Type > fluxPtr_Type |
Definition at line 160 of file OneDFSISolver.hpp.
typedef OneDFSISource source_Type |
Definition at line 162 of file OneDFSISolver.hpp.
typedef std::shared_ptr< source_Type > sourcePtr_Type |
Definition at line 163 of file OneDFSISolver.hpp.
typedef OneDFSIData data_Type |
Definition at line 165 of file OneDFSISolver.hpp.
typedef data_Type::mesh_Type mesh_Type |
Definition at line 166 of file OneDFSISolver.hpp.
Definition at line 168 of file OneDFSISolver.hpp.
Definition at line 169 of file OneDFSISolver.hpp.
typedef std::array< scalarVector_Type, 4 > scalarVectorContainer_Type |
Definition at line 170 of file OneDFSISolver.hpp.
typedef FESpace< mesh_Type, MapEpetra > feSpace_Type |
Definition at line 172 of file OneDFSISolver.hpp.
typedef std::shared_ptr< feSpace_Type > feSpacePtr_Type |
Definition at line 173 of file OneDFSISolver.hpp.
typedef Epetra_Comm comm_Type |
Definition at line 175 of file OneDFSISolver.hpp.
typedef std::shared_ptr< comm_Type > commPtr_Type |
Definition at line 176 of file OneDFSISolver.hpp.
typedef SolverAmesos linearSolver_Type |
Definition at line 178 of file OneDFSISolver.hpp.
typedef std::shared_ptr< linearSolver_Type > linearSolverPtr_Type |
Definition at line 179 of file OneDFSISolver.hpp.
Definition at line 181 of file OneDFSISolver.hpp.
typedef std::shared_ptr< vector_Type > vectorPtr_Type |
Definition at line 182 of file OneDFSISolver.hpp.
typedef std::array< vectorPtr_Type, 2 > vectorPtrContainer_Type |
Definition at line 183 of file OneDFSISolver.hpp.
Definition at line 185 of file OneDFSISolver.hpp.
typedef std::shared_ptr<matrix_Type> matrixPtr_Type |
Definition at line 186 of file OneDFSISolver.hpp.
typedef std::array<matrixPtr_Type, 4 > matrixPtrContainer_Type |
Definition at line 187 of file OneDFSISolver.hpp.
typedef std::map< std::string, vectorPtr_Type > solution_Type |
Definition at line 189 of file OneDFSISolver.hpp.
typedef std::shared_ptr< solution_Type > solutionPtr_Type |
Definition at line 190 of file OneDFSISolver.hpp.
typedef solution_Type::const_iterator solutionConstIterator_Type |
Definition at line 191 of file OneDFSISolver.hpp.
typedef OneDFSI::bcLine_Type bcLine_Type |
Definition at line 193 of file OneDFSISolver.hpp.
typedef OneDFSI::bcSide_Type bcSide_Type |
Definition at line 194 of file OneDFSISolver.hpp.
typedef OneDFSI::bcType_Type bcType_Type |
Definition at line 195 of file OneDFSISolver.hpp.
|
explicit |
Empty Constructor.
Need a call to: setCommunicator()
, setProblem()
, setFESpace()
Definition at line 61 of file OneDFSISolver.cpp.
|
inlinevirtual |
Destructor.
Definition at line 210 of file OneDFSISolver.hpp.
|
explicitprivate |
void buildConstantMatrices | ( | ) |
Build constant matrices (mass and grad)
Definition at line 93 of file OneDFSISolver.cpp.
|
inline |
Setup the solution using the default FESpace map.
solution | solution container |
Definition at line 225 of file OneDFSISolver.hpp.
void setupSolution | ( | solution_Type & | solution, |
const MapEpetra & | map, | ||
const bool & | onlyMainQuantities = false |
||
) |
Setup the solution using user defined FESpace map.
solution | solution container |
map | map for initializing the solution vectors |
onlyMainQuantities | if true setup only , , and |
Definition at line 138 of file OneDFSISolver.cpp.
void initialize | ( | solution_Type & | solution | ) |
Initialize all the variables of the solution to a reference condition with , , and .
solution | the solution container |
Definition at line 180 of file OneDFSISolver.cpp.
void computeW1W2 | ( | solution_Type & | solution | ) |
Update the Riemann variables.
solution | the solution container is passed with , and it is updated with , |
Definition at line 200 of file OneDFSISolver.cpp.
void computePressure | ( | solution_Type & | solution, |
const Real & | timeStep | ||
) |
Update the pressure.
This method compute the value of the pressure (elastic and if necessary also viscoelastic) adding it to the solution.
solution | the solution container is passed with , , , and is updated with |
timeStep | time step |
Definition at line 210 of file OneDFSISolver.cpp.
void computeAreaRatio | ( | solution_Type & | solution | ) |
Update the ratio between and .
solution | the solution container is passed with , is updated with |
Definition at line 226 of file OneDFSISolver.cpp.
void computeArea | ( | solution_Type & | solution | ) |
Compute A from the area ratio: .
solution | the solution container is passed with and is updated with |
Definition at line 235 of file OneDFSISolver.cpp.
void updateRHS | ( | const solution_Type & | solution, |
const Real & | timeStep | ||
) |
Compute the right hand side.
solution | the solution container |
timeStep | the time step. |
Definition at line 244 of file OneDFSISolver.cpp.
void iterate | ( | OneDFSIBCHandler & | bcH, |
solution_Type & | solution, | ||
const Real & | time, | ||
const Real & | timeStep | ||
) |
Update convective term and BC. Then solve the linearized system.
bcH | the BC handler |
time | the time |
timeStep | the time step |
Definition at line 304 of file OneDFSISolver.cpp.
OneDFSISolver::vector_Type viscoelasticFlowRateCorrection | ( | const vector_Type & | newArea, |
const vector_Type & | newElasticFlowRate, | ||
const vector_Type & | oldViscoelasticFlowRate, | ||
const Real & | timeStep, | ||
OneDFSIBCHandler & | bcHandler, | ||
const bool & | updateSystemMatrix = true |
||
) |
Apply the viscoelastic flow rate correction.
To introduce the viscoelastic component of the wall within the formulation, we use an operator-splitting technique, where the flow rate is splitted into two components such that , where is the solution of the pure elastic problem and is the viscoelastic correction. On each time interval with , firstly we solve the elastic part for , using to compute the contributions in such equation to the right hand side, and then we correct the flow rate by solving the following equation By using the mass conservation equation, we remove the time dependence from the viscoelastic wall term. The resulting problem is
which is closed by a proper set of homogeneous boundary conditions for . The corresponding finite element formulation reads: given , find such that
area | area |
flowRate | flow rate |
timeStep | the time step |
bcH | the BC handler |
updateSystemMatrix | flag for the recomputation of the system matrix |
Definition at line 351 of file OneDFSISolver.cpp.
Real computeCFL | ( | const solution_Type & | solution, |
const Real & | timeStep | ||
) | const |
CFL computation (correct for constant mesh)
solution | the solution container |
timeStep | the time step |
Definition at line 430 of file OneDFSISolver.cpp.
void resetOutput | ( | const solution_Type & | solution | ) |
Reset the output files.
solution | the solution container |
Definition at line 453 of file OneDFSISolver.cpp.
void postProcess | ( | const solution_Type & | solution, |
const Real & | time | ||
) |
Save results on output files.
solution | solution container |
time | solution time |
Definition at line 465 of file OneDFSISolver.cpp.
void setProblem | ( | const physicsPtr_Type & | physicsPtr, |
const fluxPtr_Type & | fluxPtr, | ||
const sourcePtr_Type & | sourcePtr | ||
) |
Set problem classes.
physicsPtr | pointer to the physics class. |
fluxPtr | pointer to the flux class. |
sourcePtr | pointer to the source class. |
Definition at line 489 of file OneDFSISolver.cpp.
void setCommunicator | ( | const commPtr_Type & | commPtr | ) |
Set the communicator.
commPtr | pointer to the Epetra MPI communicator |
Definition at line 499 of file OneDFSISolver.cpp.
void setFESpace | ( | const feSpacePtr_Type & | feSpacePtr | ) |
Set the FEspace.
feSpacePtr | pointer to the FE space |
Definition at line 506 of file OneDFSISolver.cpp.
void setLinearSolver | ( | const linearSolverPtr_Type & | linearSolverPtr | ) |
Set the linear solver.
linearSolverPtr | pointer to the linear solver for the hyperbolic problem |
Definition at line 531 of file OneDFSISolver.cpp.
void setLinearViscoelasticSolver | ( | const linearSolverPtr_Type & | linearViscoelasticSolverPtr | ) |
Set the viscoelastic linear solver.
linearViscoelasticSolverPtr | pointer to the linear solver for the viscoelastic problem |
Definition at line 537 of file OneDFSISolver.cpp.
|
inline |
Get the physics class.
Definition at line 395 of file OneDFSISolver.hpp.
|
inline |
Get the flux class.
Definition at line 404 of file OneDFSISolver.hpp.
|
inline |
Get the source class.
Definition at line 413 of file OneDFSISolver.hpp.
UInt boundaryDOF | ( | const bcSide_Type & | bcSide | ) | const |
Return the ID of the boundary node given a side.
bcSide | Side of the boundary. |
Definition at line 546 of file OneDFSISolver.cpp.
Real boundaryValue | ( | const solution_Type & | solution, |
const bcType_Type & | bcType, | ||
const bcSide_Type & | bcSide | ||
) | const |
Return the value of a quantity ( , , , , ) on a specified boundary.
Given a bcType and a bcSide it return the value of the quantity.
bcType | Type of the asked boundary value. |
bcSide | Side of the boundary. |
Definition at line 571 of file OneDFSISolver.cpp.
void boundaryEigenValuesEigenVectors | ( | const bcSide_Type & | bcSide, |
const solution_Type & | solution, | ||
container2D_Type & | eigenvalues, | ||
container2D_Type & | leftEigenvector1, | ||
container2D_Type & | leftEigenvector2 | ||
) |
Return the value of the eigenvalues and eigenvectors on a specified boundary.
bcSide | Side of the boundary. |
solution | solution container. |
eigenvalues | output eigenvalues. |
leftEigenvector1 | output left eigenvector associated to the first eigenvalue. |
leftEigenvector1 | output left eigenvector associated to the second eigenvalue. |
Definition at line 623 of file OneDFSISolver.cpp.
|
inline |
Get the residual container.
Definition at line 451 of file OneDFSISolver.hpp.
|
inline |
Get the system matrix without BC.
Definition at line 460 of file OneDFSISolver.hpp.
|
private |
Update the P1 flux vector from U: M_fluxi = F_h(Un) i=1,2 (works only for P1Seg elements)
Definition at line 641 of file OneDFSISolver.cpp.
|
private |
Call _updateFlux and update the P0 derivative of flux vector from U:
M_diffFluxij = dF_h/dU(Un) i,j=1,2 M_diffFluxij(elem) = 1/2 [ dF/dU(U(node1(elem))) + dF/dU(U(node2(elem))) ]
(mean value of the two extremal values of dF/dU) BEWARE: works only for P1Seg elements
Definition at line 656 of file OneDFSISolver.cpp.
|
private |
Update the P1 source vector from U: M_sourcei = S_h(Un) i=1,2 (works only for P1Seg elements)
Definition at line 689 of file OneDFSISolver.cpp.
|
private |
Call _updateSource and update the P0 derivative of source vector from U:
M_diffSrcij = dS_h/dU(Un) i,j=1,2 M_diffSrcij(elem) = 1/2 [ dS/dU(U(node1(elem))) + dS/dU(U(node2(elem))) ]
(mean value of the two extremal values of dS/dU) BEWARE: works only for P1Seg elements
Definition at line 704 of file OneDFSISolver.cpp.
|
private |
Update the matrices.
M_massMatrixDiffSrcij, M_stiffMatrixDiffFluxij M_gradMatrixDiffFluxij, and M_divMatrixDiffSrcij (i,j=1,2)
from the values of diffFlux(Un) and diffSrc(Un) that are computed with _updateMatrixCoefficients.
call of _updateMatrixCoefficients, _updateMatrixElementalrices and _assemble_matrices.
Definition at line 736 of file OneDFSISolver.cpp.
Update the element matrices with the current element.
Update the gradient matrix gradient operator: grad_{ij} = {fe} coeff {d }{d x}
BEWARE :
0 | the first argument "0" corresponds to the first and only coordinate (1D!), and HERE it starts from 0... (Damm'!) |
- | M_coeffGrad: the sign "-" in the second argument is added to correspond to the described operator. (There is a minus in the elemOper implementation). |
update the divergence matrix divergence operator: (transpose of the gradient) div_{ij} = {fe} coeff {d }{d x}
BEWARE : same remarks as grad (see above).
Definition at line 768 of file OneDFSISolver.cpp.
Assemble the matrices.
Definition at line 819 of file OneDFSISolver.cpp.
|
private |
Update the matrices to take into account Dirichlet BC.
Modify the matrix to take into account the Dirichlet boundary conditions (works for P1Seg and canonic numbering!)
Definition at line 835 of file OneDFSISolver.cpp.
|
private |
Apply the inertial Flux correction:
We use a finite element scheme for the correction term: given the solution of Taylor-Galerkin scheme, solve ( 1/Ah(n+1) Qtildeh(n+1), phi) + //! 1/A * massFactor^{-1} * Un+1 ( m / rho ) * ( dQtildeh(n+1)/dz, dphi/dz ) //! stiff * Qtilde(U) = ( m / rho ) * ( dQhath(n+1)/dz, dphi/dz ) //! stiff * Qhat(U)
m = rho_w h0 / ( 2 sqrt(pi) sqrt(A0) )
Definition at line 846 of file OneDFSISolver.cpp.
|
private |
Apply the longitudinal Flux correction:
We use a finite element scheme for the correction term: given the solution of Taylor-Galerkin scheme, solve ( 1/Ah(n+1) Qtildeh(n+1), phi) + //! 1/A * massFactor^{-1} * Un+1 = ( 1/Ah(n+1) Qtildeh(n), phi) + //! 1/A * massFactor^{-1} * Un+1
Definition at line 940 of file OneDFSISolver.cpp.
|
private |
|
private |
L2 Projection of the second derivative of Q over P1 space.
Definition at line 572 of file OneDFSISolver.hpp.
|
private |
Definition at line 573 of file OneDFSISolver.hpp.
|
private |
Definition at line 574 of file OneDFSISolver.hpp.
|
private |
Definition at line 575 of file OneDFSISolver.hpp.
|
private |
Definition at line 576 of file OneDFSISolver.hpp.
|
private |
Definition at line 577 of file OneDFSISolver.hpp.
|
private |
element mass matrix
Definition at line 579 of file OneDFSISolver.hpp.
|
private |
element stiffness matrix
Definition at line 580 of file OneDFSISolver.hpp.
|
private |
element gradient matrix
Definition at line 581 of file OneDFSISolver.hpp.
|
private |
element divergence matrix
Definition at line 582 of file OneDFSISolver.hpp.
|
private |
Right hand sides of the linear system i: "mass * M_Ui = M_rhsi".
Definition at line 585 of file OneDFSISolver.hpp.
|
private |
Residual of the linear system.
Definition at line 588 of file OneDFSISolver.hpp.
|
private |
Flux F(U) (in P1)
Definition at line 591 of file OneDFSISolver.hpp.
|
private |
Source term S (in P1)
Definition at line 594 of file OneDFSISolver.hpp.
|
private |
diffFlux = dF(U)/dU (in P0)
Definition at line 597 of file OneDFSISolver.hpp.
|
private |
diffSrc = dSource(U)/dU (in P0)
Definition at line 600 of file OneDFSISolver.hpp.
|
private |
tridiagonal mass matrix
Definition at line 603 of file OneDFSISolver.hpp.
|
private |
tridiagonal gradient matrix
Definition at line 606 of file OneDFSISolver.hpp.
|
private |
tridiagonal mass matrices multiplied by diffSrcij
Definition at line 609 of file OneDFSISolver.hpp.
|
private |
tridiagonal stiffness matrices multiplied by diffFluxij
Definition at line 612 of file OneDFSISolver.hpp.
|
private |
tridiagonal gradient matrices multiplied by diffFluxij
Definition at line 615 of file OneDFSISolver.hpp.
|
private |
tridiagonal divergence matrices multiplied by diffSrcij
Definition at line 618 of file OneDFSISolver.hpp.
|
private |
The linear solver.
Definition at line 621 of file OneDFSISolver.hpp.
|
private |
Definition at line 622 of file OneDFSISolver.hpp.