45 #ifndef _ELEMOPER_H_INCLUDED 46 #define _ELEMOPER_H_INCLUDED 49 #include <boost/numeric/ublas/matrix.hpp> 52 #include <lifev/core/LifeV.hpp> 54 #include <lifev/core/array/MatrixElemental.hpp> 55 #include <lifev/core/array/VectorElemental.hpp> 57 #include <lifev/core/fem/CurrentFEManifold.hpp> 58 #include <lifev/core/fem/ReferenceFEHybrid.hpp> 59 #include <lifev/core/fem/CurrentFE.hpp> 60 #include <lifev/core/fem/DOF.hpp> 67 typedef boost::numeric::ublas::vector<Real> Vector;
99 const Real& coefficient,
100 const UInt& fieldDim);
112 template<
typename localVector>
115 const Real& coefficient,
116 const localVector& localValues,
117 const UInt& fieldDim)
122 Real localCoefficient (0);
125 for (
UInt iterFDim (0); iterFDim < fieldDim; ++iterFDim)
131 for (
UInt iDof (0); iDof < nbFEDof ; ++iDof)
135 for (
UInt jDof (0); jDof <= iDof; ++jDof)
140 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
142 localCoefficient = 0.0;
143 for (
UInt iterDim (0); iterDim < fieldDim; ++iterDim)
145 localCoefficient += localValues[iQuadPt][iterDim] * localValues[iQuadPt][iterDim];
148 localValue += coefficient * localCoefficient
155 localView (iDof, jDof) += localValue;
159 localView (jDof, iDof) += localValue;
179 const Real& coefficient,
180 const UInt& fieldDim);
184 template<
typename localVector,
typename globalVector>
187 const UInt& spaceDim,
189 const UInt& elementID,
190 const globalVector& beta)
196 for (
UInt iterDim (0); iterDim < spaceDim; ++iterDim)
199 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
201 localValues[iQuadPt][iterDim] = 0.0;
204 for (
UInt iDof (0); iDof < nbFEDof ; ++iDof)
206 localValues[iQuadPt][iterDim] +=
208 * interpCFE
.phi (iDof
, iQuadPt
);
215 template<
typename localVector,
typename globalVector>
218 const UInt& spaceDim,
220 const UInt& elementID,
221 const globalVector& beta)
227 for (
UInt iterDim (0); iterDim < spaceDim; ++iterDim)
230 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
236 localGradient[ iQuadPt ][ iterDim ][ jDim ] = 0.0;
237 for (
UInt i = 0; i < nbFEDof; ++i )
238 localGradient[ iQuadPt ][ iterDim ][ jDim ] += interpCFE
.phiDer ( i
, jDim
, iQuadPt
) *
248 template<
typename localVector,
typename globalVector>
252 const UInt& elementID,
253 const globalVector& beta)
260 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
262 localDivergence[ iQuadPt ] = 0.0;
264 for (
UInt i = 0; i < nbFEDof; ++i )
267 localDivergence[ iQuadPt ] += interpCFE
.phiDer ( i
, jDim
, iQuadPt
) *
276 template<
typename localVector>
279 const Real& coefficient,
280 const localVector& localValues,
281 const UInt& fieldDim)
288 for (
UInt iterFDim (0); iterFDim < fieldDim; ++iterFDim)
294 for (
UInt iDof (0); iDof < nbFEDof ; ++iDof)
298 for (
UInt jDof (0); jDof <= iDof; ++jDof)
303 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
305 localValue += localValues[iQuadPt]
311 localValue *= coefficient;
314 localView (iDof, jDof) += localValue;
318 localView (jDof, iDof) += localValue;
326 template<
typename localVector>
329 const Real& coefficient,
330 const localVector& localValues,
331 const UInt& fieldDim)
335 Real localValue (0.0), advGrad (0.0);
341 for (
UInt iDof (0); iDof < nbFEDof ; ++iDof)
344 for (
UInt jDof (0); jDof < nbFEDof; ++jDof)
349 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
354 advGrad += localValues[iQuadPt][iDim]
358 localValue += advGrad * advCFE
.phi (iDof
, iQuadPt
) 362 matTmpView (iDof, jDof) = coefficient * localValue;
365 for (
UInt iterFDim (0); iterFDim < fieldDim; ++iterFDim)
371 localView = matTmpView;
381 int iblock,
int jblock );
384 template<
typename localTensor>
387 const Real& coefficient,
388 const localTensor& localGradient,
389 const UInt& fieldDim)
393 Real localValue (0.0);
395 ASSERT (fieldDim == nDimensions,
"Symmetrized operator works only with vectors of the same dimension as the space" );
398 for (
UInt iCoor (0); iCoor < fieldDim; ++iCoor)
400 for (
UInt jCoor (0); jCoor < fieldDim; ++jCoor)
406 for (
UInt iDof (0); iDof < nbFEDof ; ++iDof)
409 for (
UInt jDof (0); jDof < nbFEDof; ++jDof)
414 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
417 localGradient[iQuadPt][iCoor][jCoor]
425 localView (iDof, jDof) = coefficient * localValue;
435 const UInt& fieldDim);
440 const UInt& fieldDim,
441 const Real& coefficient = 1.0);
445 const Real& coefficient,
446 const UInt& fieldDim);
452 const UInt& fieldDim);
462 int iblock = 0,
int jblock = 0 );
464 int iblock,
int jblock,
UInt nb );
467 int iblock,
int jblock,
UInt nb );
470 int iblock = 0,
int jblock = 0 );
472 const CurrentFE& fe,
int iblock,
int jblock );
474 int iblock,
int jblock,
int nb );
477 int iblock,
int jblock,
int nb );
479 int iblock,
int jblock,
int nb );
546 int iblock = 0,
int jblock = 0 );
549 int iblock = 0,
int jblock = 0 );
554 template<
typename UsrFct>
558 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
561 Matrix v_grad (ZeroMatrix (fe.nbFEDof(), fe.nbQuadPt() ) );
569 v = beta (t, x, y, z, icoor);
572 v_grad (j, iq) += v * fe.phiDer (j, icoor, iq );
586 s += v_grad (j, iq) * fe.phi ( i, iq ) * fe.weightDet ( iq );
588 mat_tmp ( i, j ) = s * coef;
593 for (
int icomp = 0; icomp < nb; icomp++ )
600 mat_icomp ( i, j ) += mat_tmp ( i, j );
609 const CurrentFE& fe,
int iblock,
int jblock,
int nb );
667 int iblock,
int jblock,
int nb );
672 int iblock = 0,
int jblock = 0 );
686 int iblock = 0,
int jblock = 0 );
696 int iblock,
int jblock );
701 int iblock = 0,
int jblock = 0 );
709 void grad (
const int& icoor,
const std::vector<Real>& localVector,
MatrixElemental& elmat,
711 const int& iblock = 0,
const int& jblock = 0);
716 int iblock = 0,
int jblock = 0 );
720 const CurrentFE& fe2,
int iblock = 0,
int jblock = 0,
int nb = 1 );
726 template <
typename UsrFct>
748 template <
typename UsrFct>
768 int fblock = 0,
int eblock = 0 );
771 int fblock = 0,
int eblock = 0 );
847 bool wImplicit =
false,
879 int iblock,
int jblock,
UInt nb );
883 int iblock,
int jblock,
UInt nb );
923 int iblock = 0,
int jblock = 0 );
941 int iblock = 0,
int jblock = 0 );
1053 int iblock = 0,
int jblock = 0 );
void source_gradpv(Real alpha, VectorElemental &pLoc, VectorElemental &elvec, const CurrentFE &fe_p, const CurrentFE &fe_u, int iblock)
void grad_ss(const int icoor, const VectorElemental &vec_loc, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, int iblock, int jblock)
Convective term with a local vector coefficient for Navier-Stokes problem in Skew-Symmetric form...
void advection(Real coef, VectorElemental &vel, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int nb)
void source(const UsrFct &fct, VectorElemental &elvec, const CurrentFE &fe, Real t, int iblock=0)
source
void interpolateGradient(localVector &localGradient, const CurrentFE &interpCFE, const UInt &spaceDim, const DOF &betaDof, const UInt &elementID, const globalVector &beta)
Interpolation of the gradient.
void source(Real constant, VectorElemental &elvec, const CurrentFE &fe, Real t, int iblock)
void stiff_curl(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int)
void mass(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock)
coef(t,x,y,z,u)
void stiff_gradgrad(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void mass(MatrixElemental &localMass, const CurrentFE &massCFE, const Real &coefficient, const UInt &fieldDim)
Elementary mass for constant mass coefficient.
void stiff(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int nb)
void ipstab_bagrad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFE &fe3, const VectorElemental &beta, const CurrentFEManifold &bdfe, int iblock, int jblock)
p1 lives in fe1 q2 lives in fe2 beta lives in fe3
void cholsl(KNM< Real > &a, KN< Real > &p, KN< Real > &b, KN< Real > &x)
void source_advection(const Real &coefficient, const VectorElemental &beta_loc, const VectorElemental &uk_loc, VectorElemental &elvec, const CurrentFE &fe)
void ipstab_grad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFEManifold &bdfe, int iblock, int jblock, int nb)
void stiff_gradgradTr_gradbis_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void ipstab_bagrad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const VectorElemental &beta, const CurrentFEManifold &bdfe, int iblock, int jblock)
A class for a finite element on a manifold.
void source_fhn(Real coef_f, Real coef_a, VectorElemental &u, VectorElemental &elvec, const CurrentFE &fe, int fblock, int eblock)
void mass(const std::vector< Real > &coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, UInt nb)
Mass term with coefficients given for each quadrature point.
void TP_VdotN_Hdiv(Real coef, MatrixElemental &elmat, const ReferenceFEHybrid &hybridFE, const ReferenceFEHybrid &dualDotNFE, int iblock, int jblock)
void source_mass2(Real coef, const VectorElemental &uk_loc, const VectorElemental &dw_loc, VectorElemental &elvec, const CurrentFE &fe)
for Newton FSI
void source_divuq(Real alpha, VectorElemental &uLoc, VectorElemental &elvec, const CurrentFE &fe_u, const CurrentFE &fe_p, int iblock)
void stiff_divgrad_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void stiff_sd(Real coef, const VectorElemental &vec_loc, MatrixElemental &elmat, const CurrentFE &fe, const CurrentFE &fe2, int iblock, int jblock, int nb)
StreamLine Diffusion.
void weightedMass(MatrixElemental &localMass, const CurrentFE &massCFE, const Real &coefficient, const localVector &localValues, const UInt &fieldDim)
Elementary weighted mass for constant mass coefficient.
void stiff_dergrad(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
for Newton on St-Venant
void stiff_div(Real coef, MatrixElemental &elmat, const CurrentFE &fe)
void stiff_dergradbis(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void grad(const int &icoor, const std::vector< Real > &localVector, MatrixElemental &elmat, const CurrentFE ¤tFE1, const CurrentFE ¤tFE2, const int &iblock, const int &jblock)
Conective term with a local vector given by quadrature node.
void stiff_dergrad_gradbis_Tr_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void advectionNewton(Real coef, VectorElemental &vel, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock)
Assemble the term .
void stiff(const std::vector< Real > &coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int nb)
Stiff term with coefficient given for each quadrature node.
void shape_terms(Real rho, Real mu, const VectorElemental &un_loc, const VectorElemental &uk_loc, const VectorElemental &wk_loc, const VectorElemental &convect_loc, const VectorElemental &pk_loc, MatrixElemental &elmat, const CurrentFE &fe, const CurrentFE &fe_p, ID, MatrixElemental &, int, bool wImplicit, Real alpha, std::shared_ptr< MatrixElemental > elmat_convect)
Shape terms for the CE system in FSI Newton.
void ipstab_grad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFEManifold &bdfe, int iblock, int jblock)
boost::numeric::ublas::zero_matrix< Real > ZeroMatrix
void symmetrizedAdvection(MatrixElemental &localAdv, const CurrentFE &advCFE, const Real &coefficient, const localTensor &localGradient, const UInt &fieldDim)
Elementary advection, term u v.
void mass_Hdiv(Real coef, MatrixElemental &elmat, const CurrentFE &dualFE, int iblock, int jblock)
void stiff_gradgradTr_gradbis_3(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
UInt nbDiag() const
Getter for the diagonal entries in the pattern.
void stab_stokes(Real visc, Real coef_stab, MatrixElemental &elmat, const CurrentFE &fe, int block_pres)
void source(const UsrFct &fct, VectorElemental &elvec, const CurrentFE &fe, int iblock=0)
source
void mass_divw(Real coef, const VectorElemental &w_loc, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, UInt nb)
void updateInverseJacobian(const UInt &iQuadPt)
void source(Real coef, VectorElemental &f, VectorElemental &elvec, const CurrentFE &fe, int fblock, int eblock)
void source_Hdiv(const Vector &source, VectorElemental &elvec, const CurrentFE &dualFE, int iblock)
void mass_Hdiv(Matrix const &Invperm, MatrixElemental &elmat, const CurrentFE &dualFE, int iblock, int jblock)
void stiff_dergrad_gradbis_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void source_mass1(Real coef, const VectorElemental &uk_loc, const VectorElemental &wk_loc, const VectorElemental &convect_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe)
for Newton FSI
void grad_div(Real coef_grad, Real coef_div, MatrixElemental &elmat, const CurrentFE &fe_u, const CurrentFE &fe_p, int block_pres)
void grad(const int icoor, const VectorElemental &vec_loc, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, int iblock, int jblock)
Convective term with a local vector coefficient (useful for Navier-Stokes problem) ...
void interpolate(localVector &localValues, const CurrentFE &interpCFE, const UInt &spaceDim, const DOF &betaDof, const UInt &elementID, const globalVector &beta)
Interpolation procedure.
UInt nbLocalCoor() const
Getter for the number of local coordinates.
void ipstab_bgrad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const VectorElemental &beta, const CurrentFEManifold &bdfe, int iblock, int jblock, int nb)
void bodyForces(VectorElemental &localForce, const CurrentFE &massRhsCFE, const function_Type &fun, const Real &t, const UInt &fieldDim)
Real phiDer(UInt node, UInt derivative, UInt quadNode) const
Old accessor, use dphi instead.
Real dphi(UInt node, UInt derivative, UInt quadNode) const
Getter for the derivatives of the basis functions.
void advection(MatrixElemental &localAdv, const CurrentFE &advCFE, const Real &coefficient, const localVector &localValues, const UInt &fieldDim)
Elementary advection u v.
void mass(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, UInt nb)
void coorQuadPt(Real &x, Real &y, Real &z, int ig) const
void stiff_gradgrad_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void source_stiff(const std::vector< Real > &constant, VectorElemental &elvec, const CurrentFE ¤tFe, const int &iblock)
Assembly for the source term where is a given by the values in the quadrature nodes.
void massDivW(MatrixElemental &localMass, const CurrentFE &massCFE, const Real &coefficient, const localVector &localValues, const UInt &fieldDim)
void grad(const int icoor, Real coef, MatrixElemental &elmat, const CurrentFE &fe_u, const CurrentFE &fe_p, int iblock, int jblock)
const ID & localToGlobalMap(const ID ElId, const ID localNode) const
Return the specified entries of the localToGlobal table.
void stiffStrain(MatrixElemental &localStiff, const CurrentFE &stiffCFE, const Real &coefficient, const UInt &fieldDim)
void stiff_strain(Real coef, MatrixElemental &elmat, const CurrentFE &fe)
void stiff_derdiv(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
for Newton on St-Venant
std::function< const Real(const Real &, const Real &, const Real &, const Real &, const ID &) > function_Type
Use the portable syntax of the boost function.
const UInt & numTotalDof() const
The total number of Dof.
void TP_TP_Hdiv(Real coef, MatrixElemental &elmat, const ReferenceFEHybrid &hybridFE, int iblock, int jblock)
void mass_Hdiv(Real(*InvpermFun)(const Real &, const Real &, const Real &), MatrixElemental &elmat, const CurrentFE &dualFE, int iblock, int jblock)
void stiff_gradgradTr_gradbis(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
double Real
Generic real data.
CurrentFE - A primordial class for the assembly of the local matrices/vectors retaining the values on...
void ipstab_div(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFEManifold &bdfe, int iblock, int jblock)
void source_stress2(Real coef, const VectorElemental &uk_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe_u)
MatrixElemental(UInt nNode1, UInt nbr1, UInt nbc1)
void interpolateDivergence(localVector &localDivergence, const CurrentFE &interpCFE, const DOF &betaDof, const UInt &elementID, const globalVector &beta)
Interpolation of the divergence.
UInt nbFEDof() const
Getter for the number of nodes.
void divergence(MatrixElemental &elmat, const CurrentFE &uCFE, const CurrentFE &pCFE, const UInt &fieldDim, const Real &coefficient)
void div(const int icoor, Real coef, MatrixElemental &elmat, const CurrentFE &fe_u, const CurrentFE &fe_p, int iblock, int jblock)
Real wDetJacobian(UInt quadNode) const
Getter for the weighted jacobian determinant.
const UInt nDimensions(NDIM)
void choldc(KNM< Real > &a, KN< Real > &p)
Real phi(UInt node, UInt quadNode) const
Getter for basis function values (scalar FE case)
void source_press(Real coef, const VectorElemental &uk_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe_u, const CurrentFE &fe_p, int iblock)
for Newton FSI
void stiff_dergrad_gradbis_Tr(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void source_press2(Real coef, const VectorElemental &p_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe, int iblock)
void stiff(Real coef, Real(*fct)(Real, Real, Real), MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock)
void mass_divw(const std::vector< Real > &coef, const VectorElemental &w_loc, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, UInt nb)
Idem mass_divw , but with coefficient given by quadrature node.
void stiffness(MatrixElemental &localStiff, const CurrentFE &stiffCFE, const Real &coefficient, const UInt &fieldDim)
Elementary stiffness for constant coefficient.
void stiff_divgrad(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void advection(Real coef, const UsrFct &beta, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int nb, Real t=0.)
void grad(const int icoor, const VectorElemental &vec_loc, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFE &fe3, int iblock, int jblock)
Convective term with a local vector coefficient (useful for Navier-Stokes problem+adv-diff) ...
Real weightDet(UInt quadNode) const
Old accessor, use wDetJacobian instead.
void source_mass(const std::vector< Real > &constant, VectorElemental &elvec, const CurrentFE ¤tFe, const int &iblock)
Assembly for the source term where is a given by the values in the quadrature nodes.
void source_stress(Real coef, Real mu, const VectorElemental &uk_loc, const VectorElemental &pk_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe_u, const CurrentFE &fe_p)
for Newton FSI
void grad(MatrixElemental &elmat, const CurrentFE &uCFE, const CurrentFE &pCFE, const UInt &fieldDim)
void mass_gradu(Real coef, const VectorElemental &u0_loc, MatrixElemental &elmat, const CurrentFE &fe)
void grad_Hdiv(Real coef, MatrixElemental &elmat, const CurrentFE &dualFE, const CurrentFE &primalFE, int iblock, int jblock)
void div_Hdiv(Real coef, MatrixElemental &elmat, const CurrentFE &dualFE, const CurrentFE &primalFE, int iblock, int jblock)
void source(Real constant, VectorElemental &elvec, const CurrentFE &fe, int iblock)
UInt nbQuadPt() const
Getter for the number of quadrature nodes.
void stiff(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
void source_mass3(Real coef, const VectorElemental &un_loc, const VectorElemental &uk_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe)
boost::numeric::ublas::matrix< Real > Matrix
void source_press(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe_u, const CurrentFE &fe_p, ID mmDim, int iblock)
for Newton FSI
void stiff_dergrad_gradbis(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
Real quadPt(UInt node, UInt coordinate) const
Old accessor, use quadNode instead.