v0.14.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
NavierStokesElement::OpPostProcVorticity Struct Reference

Post processing output of the vorticity criterion levels. More...

#include <users_modules/basic_finite_elements/src/NavierStokesElement.hpp>

Inheritance diagram for NavierStokesElement::OpPostProcVorticity:
[legend]
Collaboration diagram for NavierStokesElement::OpPostProcVorticity:
[legend]

Public Member Functions

 OpPostProcVorticity (moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts, boost::shared_ptr< CommonData > &common_data, BlockData &block_data)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
double getVolume () const
 element volume (linear geometry) More...
 
doublegetVolume ()
 element volume (linear geometry) More...
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian More...
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian More...
 
VectorDoublegetCoords ()
 nodal coordinates More...
 
VolumeElementForcesAndSourcesCoregetVolumeFE () const
 return pointer to Generic Volume Finite Element object More...
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
int getFEDim () const
 Get dimension of finite element. More...
 
EntityType getFEType () const
 Get dimension of finite element. More...
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
std::string getFEName () const
 Get name of the element. More...
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Public Attributes

boost::shared_ptr< CommonDatacommonData
 
moab::Interface & postProcMesh
 
std::vector< EntityHandle > & mapGaussPts
 
BlockDatablockData
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity. More...
 
booldoVertices
 \deprectaed If false skip vertices More...
 
booldoEdges
 \deprectaed If false skip edges More...
 
booldoQuads
 \deprectaed More...
 
booldoTris
 \deprectaed More...
 
booldoTets
 \deprectaed More...
 
booldoPrisms
 \deprectaed More...
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0 , OPCOL = 1 << 1 , OPROWCOL = 1 << 2 , OPSPACE = 1 << 3 ,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
using AdjCache = std::map< EntityHandle, std::vector< boost::weak_ptr< NumeredEntFiniteElement > > >
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Post processing output of the vorticity criterion levels.

Definition at line 582 of file NavierStokesElement.hpp.

Constructor & Destructor Documentation

◆ OpPostProcVorticity()

NavierStokesElement::OpPostProcVorticity::OpPostProcVorticity ( moab::Interface &  post_proc_mesh,
std::vector< EntityHandle > &  map_gauss_pts,
boost::shared_ptr< CommonData > &  common_data,
BlockData block_data 
)
inline

Definition at line 589 of file NavierStokesElement.hpp.

594 commonData(common_data), postProcMesh(post_proc_mesh),
595 mapGaussPts(map_gauss_pts), blockData(block_data) {
596 doVertices = true;
597 doEdges = false;
598 doQuads = false;
599 doTris = false;
600 doTets = false;
601 doPrisms = false;
602 };
bool & doTris
\deprectaed
bool & doPrisms
\deprectaed
bool & doVertices
\deprectaed If false skip vertices
bool & doTets
\deprectaed
bool & doEdges
\deprectaed If false skip edges
bool & doQuads
\deprectaed
@ OPROW
operator doWork function is executed on FE rows
moab::Interface & postProcMesh
BlockData & blockData
std::vector< EntityHandle > & mapGaussPts
boost::shared_ptr< CommonData > commonData
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

MoFEMErrorCode NavierStokesElement::OpPostProcVorticity::doWork ( int  side,
EntityType  type,
EntData data 
)
virtual

Operator for linear form, usually to calculate values on right hand side.

Reimplemented from MoFEM::DataOperator.

Examples
NavierStokesElement.cpp, and NavierStokesElement.hpp.

Definition at line 931 of file NavierStokesElement.cpp.

933 {
935 if (type != MBVERTEX)
936 PetscFunctionReturn(0);
937 double def_VAL[9];
938 bzero(def_VAL, 9 * sizeof(double));
939
940 if (blockData.eNts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
941 blockData.eNts.end()) {
943 }
944 // commonData->getBlockData(blockData);
945
946 Tag th_vorticity;
947 Tag th_q;
948 Tag th_l2;
949 CHKERR postProcMesh.tag_get_handle("VORTICITY", 3, MB_TYPE_DOUBLE,
950 th_vorticity, MB_TAG_CREAT | MB_TAG_SPARSE,
951 def_VAL);
952 CHKERR postProcMesh.tag_get_handle("Q", 1, MB_TYPE_DOUBLE, th_q,
953 MB_TAG_CREAT | MB_TAG_SPARSE, def_VAL);
954 CHKERR postProcMesh.tag_get_handle("L2", 1, MB_TYPE_DOUBLE, th_l2,
955 MB_TAG_CREAT | MB_TAG_SPARSE, def_VAL);
956
957 auto t_u_grad = getFTensor2FromMat<3, 3>(*commonData->gradVelPtr);
958 // auto p = getFTensor0FromVec(*commonData->pressPtr);
959
960 const int nb_gauss_pts = commonData->gradVelPtr->size2();
961 // const int nb_gauss_pts2 = commonData->pressPtr->size();
962
963 // const double lambda = commonData->lAmbda;
964 // const double mu = commonData->mU;
965
966 // FTensor::Index<'i', 3> i;
967 // FTensor::Index<'j', 3> j;
968 // FTensor::Index<'j', 3> k;
970 // FTensor::Tensor2<double,3,3> t_s;
971 double q;
972 double l2;
973 // FTensor::Tensor2<double, 3, 3> stress;
974 MatrixDouble S;
975 MatrixDouble Omega;
977
978 S.resize(3, 3);
979 Omega.resize(3, 3);
980 M.resize(3, 3);
981
982 for (int gg = 0; gg != nb_gauss_pts; gg++) {
983
984 vorticity(0) = t_u_grad(2, 1) - t_u_grad(1, 2);
985 vorticity(1) = t_u_grad(0, 2) - t_u_grad(2, 0);
986 vorticity(2) = t_u_grad(1, 0) - t_u_grad(0, 1);
987
988 q = 0;
989 for (int i = 0; i != 3; i++) {
990 for (int j = 0; j != 3; j++) {
991 q += -0.5 * t_u_grad(i, j) * t_u_grad(j, i);
992 }
993 }
994 for (int i = 0; i != 3; i++) {
995 for (int j = 0; j != 3; j++) {
996 S(i, j) = 0.5 * (t_u_grad(i, j) + t_u_grad(j, i));
997 Omega(i, j) = 0.5 * (t_u_grad(i, j) - t_u_grad(j, i));
998 M(i, j) = 0.0;
999 }
1000 }
1001
1002 for (int i = 0; i != 3; i++) {
1003 for (int j = 0; j != 3; j++) {
1004 for (int k = 0; k != 3; k++) {
1005 M(i, j) += S(i, k) * S(k, j) + Omega(i, k) * Omega(k, j);
1006 }
1007 }
1008 }
1009
1010 MatrixDouble eigen_vectors = M;
1011 VectorDouble eigen_values(3);
1012
1013 // LAPACK - eigenvalues and vectors. Applied twice for initial creates
1014 // memory space
1015 int n = 3, lda = 3, info, lwork = -1;
1016 double wkopt;
1017 info = lapack_dsyev('V', 'U', n, &(eigen_vectors.data()[0]), lda,
1018 &(eigen_values.data()[0]), &wkopt, lwork);
1019 if (info != 0)
1020 SETERRQ1(PETSC_COMM_SELF, 1,
1021 "is something wrong with lapack_dsyev info = %d", info);
1022 lwork = (int)wkopt;
1023 double work[lwork];
1024 info = lapack_dsyev('V', 'U', n, &(eigen_vectors.data()[0]), lda,
1025 &(eigen_values.data()[0]), work, lwork);
1026 if (info != 0)
1027 SETERRQ1(PETSC_COMM_SELF, 1,
1028 "is something wrong with lapack_dsyev info = %d", info);
1029
1030 map<double, int> eigen_sort;
1031 eigen_sort[eigen_values[0]] = 0;
1032 eigen_sort[eigen_values[1]] = 1;
1033 eigen_sort[eigen_values[2]] = 2;
1034
1035 // prin_stress_vect.clear();
1036 VectorDouble prin_vals_vect(3);
1037 prin_vals_vect.clear();
1038
1039 int ii = 0;
1040 for (map<double, int>::reverse_iterator mit = eigen_sort.rbegin();
1041 mit != eigen_sort.rend(); mit++) {
1042 prin_vals_vect[ii] = eigen_values[mit->second];
1043 // for (int dd = 0; dd != 3; dd++) {
1044 // prin_stress_vect(ii, dd) = eigen_vectors.data()[3 * mit->second +
1045 // dd];
1046 // }
1047 ii++;
1048 }
1049
1050 l2 = prin_vals_vect[1];
1051 // cout << prin_vals_vect << endl;
1052 // cout << "-0.5 sum: " << -0.5 * (prin_vals_vect[0] + prin_vals_vect[1]
1053 // + prin_vals_vect[2]) << endl; cout << "q: " << q << endl;
1054
1055 // t_s(i,j) = 0.5*(t)
1056
1057 // vorticity(0) = t_u_grad(1, 2) - t_u_grad(2, 1);
1058 // vorticity(1) = t_u_grad(2, 0) - t_u_grad(0, 2);
1059 // vorticity(2) = t_u_grad(0, 1) - t_u_grad(1, 0);
1060
1061 CHKERR postProcMesh.tag_set_data(th_vorticity, &mapGaussPts[gg], 1,
1062 &vorticity(0));
1063 CHKERR postProcMesh.tag_set_data(th_q, &mapGaussPts[gg], 1, &q);
1064 CHKERR postProcMesh.tag_set_data(th_l2, &mapGaussPts[gg], 1, &l2);
1065 ++t_u_grad;
1066 }
1067
1069}
static Index< 'M', 3 > M
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
FTensor::Index< 'n', SPACE_DIM > n
FTensor::Index< 'i', SPACE_DIM > i
static __CLPK_integer lapack_dsyev(char jobz, char uplo, __CLPK_integer n, __CLPK_doublereal *a, __CLPK_integer lda, __CLPK_doublereal *w, __CLPK_doublereal *work, __CLPK_integer lwork)
Definition: lapack_wrap.h:261
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.

Member Data Documentation

◆ blockData

BlockData& NavierStokesElement::OpPostProcVorticity::blockData
Examples
NavierStokesElement.hpp.

Definition at line 587 of file NavierStokesElement.hpp.

◆ commonData

boost::shared_ptr<CommonData> NavierStokesElement::OpPostProcVorticity::commonData
Examples
NavierStokesElement.hpp.

Definition at line 584 of file NavierStokesElement.hpp.

◆ mapGaussPts

std::vector<EntityHandle>& NavierStokesElement::OpPostProcVorticity::mapGaussPts
Examples
NavierStokesElement.hpp.

Definition at line 586 of file NavierStokesElement.hpp.

◆ postProcMesh

moab::Interface& NavierStokesElement::OpPostProcVorticity::postProcMesh
Examples
NavierStokesElement.hpp.

Definition at line 585 of file NavierStokesElement.hpp.


The documentation for this struct was generated from the following files: