Implementation of operators for fluid flowImplementation of operators for computations of the fluid flow, governed by for Stokes and Navier-Stokes equations, and computation of the drag force
#ifndef __NAVIERSTOKESELEMENT_HPP__
#define __NAVIERSTOKESELEMENT_HPP__
#ifndef __BASICFINITEELEMENTS_HPP__
#include <BasicFiniteElements.hpp>
#endif
using namespace boost::numeric;
int iD;
double fluidViscosity;
double fluidDensity;
double inertiaCoef;
double viscousCoef;
Range eNts;
: iD(-1), fluidViscosity(-1), fluidDensity(-1), inertiaCoef(-1),
viscousCoef(-1) {}
};
boost::shared_ptr<MatrixDouble> gradVelPtr;
boost::shared_ptr<MatrixDouble> velPtr;
boost::shared_ptr<VectorDouble> pressPtr;
boost::shared_ptr<MatrixDouble> pressureDragTract;
boost::shared_ptr<MatrixDouble> shearDragTract;
boost::shared_ptr<MatrixDouble> totalDragTract;
SmartPetscObj<Vec> pressureDragForceVec;
SmartPetscObj<Vec> shearDragForceVec;
SmartPetscObj<Vec> totalDragForceVec;
SmartPetscObj<Vec> volumeFluxVec;
std::map<int, BlockData> setOfBlocksData;
std::map<int, BlockData> setOfFacesData;
gradVelPtr = boost::shared_ptr<MatrixDouble>(
new MatrixDouble());
velPtr = boost::shared_ptr<MatrixDouble>(
new MatrixDouble());
pressPtr = boost::shared_ptr<VectorDouble>(
new VectorDouble());
pressureDragTract = boost::shared_ptr<MatrixDouble>(
new MatrixDouble());
shearDragTract = boost::shared_ptr<MatrixDouble>(
new MatrixDouble());
totalDragTract = boost::shared_ptr<MatrixDouble>(
new MatrixDouble());
int vec_size;
vec_size = 3;
else
vec_size = 0;
}
CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Problem",
"none");
ierr = PetscOptionsEnd();
}
};
}
};
const string element_name,
const string velocity_field_name,
const string pressure_field_name,
const string mesh_field_name,
Range *ents = nullptr) {
velocity_field_name);
velocity_field_name);
velocity_field_name);
pressure_field_name);
pressure_field_name);
pressure_field_name);
mesh_field_name);
if (ents != nullptr) {
element_name);
} else {
}
}
boost::shared_ptr<VolumeElementForcesAndSourcesCore> feRhs,
boost::shared_ptr<VolumeElementForcesAndSourcesCore> feLhs,
const std::string velocity_field, const std::string pressure_field,
boost::shared_ptr<CommonData> common_data,
const EntityType
type = MBTET);
boost::shared_ptr<VolumeElementForcesAndSourcesCore> feRhs,
boost::shared_ptr<VolumeElementForcesAndSourcesCore> feLhs,
const std::string velocity_field, const std::string pressure_field,
boost::shared_ptr<CommonData> common_data,
const EntityType
type = MBTET);
boost::shared_ptr<FaceElementForcesAndSourcesCore> dragFe,
boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> sideDragFe,
std::string side_fe_name, const std::string velocity_field,
const std::string pressure_field,
boost::shared_ptr<CommonData> common_data);
boost::shared_ptr<PostProcFaceOnRefinedMesh> postProcDragPtr,
boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> sideDragFe,
std::string side_fe_name, const std::string velocity_field,
const std::string pressure_field,
boost::shared_ptr<CommonData> common_data);
boost::shared_ptr<VolumeElementForcesAndSourcesCore> fe_flux_ptr,
const std::string velocity_field,
boost::shared_ptr<CommonData> common_data,
const EntityType
type = MBTET);
int operator()(int order_row, int order_col, int order_data) const {
return 2 * order_data;
}
};
int operator()(int order_row, int order_col, int order_data) const {
return order_data + 2;
}
};
boost::shared_ptr<CommonData> commonData;
bool diagonalBlock;
int row_nb_dofs;
int col_nb_dofs;
int row_nb_gauss_pts;
bool isOnDiagonal;
OpAssembleLhs(const string field_name_row, const string field_name_col,
boost::shared_ptr<CommonData> common_data,
UserDataOperator::OPROWCOL),
commonData(common_data), blockData(block_data) {
sYmm = false;
diagonalBlock = false;
};
MoFEMErrorCode doWork(
int row_side,
int col_side, EntityType row_type,
EntityType col_type,
EntData &row_data,
};
};
struct OpAssembleLhsOffDiag : public OpAssembleLhs {
OpAssembleLhsOffDiag(const string field_name_row,
const string field_name_col,
boost::shared_ptr<CommonData> common_data,
: OpAssembleLhs(field_name_row, field_name_col, common_data,
block_data) {
sYmm = false;
diagonalBlock = false;
};
};
struct OpAssembleLhsDiagLin : public OpAssembleLhs {
OpAssembleLhsDiagLin(const string field_name_row,
const string field_name_col,
boost::shared_ptr<CommonData> common_data,
: OpAssembleLhs(field_name_row, field_name_col, common_data,
block_data) {
sYmm = true;
diagonalBlock = true;
};
};
struct OpAssembleLhsDiagNonLin : public OpAssembleLhs {
OpAssembleLhsDiagNonLin(const string field_name_row,
const string field_name_col,
boost::shared_ptr<CommonData> common_data,
: OpAssembleLhs(field_name_row, field_name_col, common_data,
block_data) {
sYmm = false;
diagonalBlock = true;
};
};
boost::shared_ptr<CommonData> commonData;
int nbRows;
int nbIntegrationPts;
OpAssembleRhs(const string field_name,
boost::shared_ptr<CommonData> common_data,
commonData(common_data), blockData(block_data){};
};
};
struct OpAssembleRhsVelocityLin : public OpAssembleRhs {
OpAssembleRhsVelocityLin(const string field_name,
boost::shared_ptr<CommonData> common_data,
: OpAssembleRhs(field_name, common_data, block_data){};
};
struct OpAssembleRhsVelocityNonLin : public OpAssembleRhs {
OpAssembleRhsVelocityNonLin(const string field_name,
boost::shared_ptr<CommonData> common_data,
: OpAssembleRhs(field_name, common_data, block_data){};
};
struct OpAssembleRhsPressure : public OpAssembleRhs {
OpAssembleRhsPressure(const string field_name,
boost::shared_ptr<CommonData> common_data,
: OpAssembleRhs(field_name, common_data, block_data){};
};
boost::shared_ptr<CommonData> commonData;
OpCalcDragForce(const string field_name,
boost::shared_ptr<CommonData> &common_data,
field_name, UserDataOperator::OPROW),
commonData(common_data), blockData(block_data) {
doVertices = true;
doEdges = false;
doQuads = false;
doTris = false;
doTets = false;
doPrisms = false;
};
};
boost::shared_ptr<CommonData> commonData;
boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> sideFe;
std::string sideFeName;
OpCalcDragTraction(
const string field_name,
boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> &side_fe,
std::string side_fe_name, boost::shared_ptr<CommonData> &common_data,
field_name, UserDataOperator::OPROW),
sideFe(side_fe), sideFeName(side_fe_name), commonData(common_data),
blockData(block_data) {
doVertices = true;
doEdges = false;
doQuads = false;
doTris = false;
doTets = false;
doPrisms = false;
};
};
boost::shared_ptr<CommonData> commonData;
std::vector<EntityHandle> &mapGaussPts;
std::vector<EntityHandle> &map_gauss_pts,
boost::shared_ptr<CommonData> &common_data,
field_name, UserDataOperator::OPROW),
commonData(common_data), postProcMesh(post_proc_mesh),
mapGaussPts(map_gauss_pts), blockData(block_data) {
doVertices = true;
doEdges = false;
doQuads = false;
doTris = false;
doTets = false;
doPrisms = false;
};
};
boost::shared_ptr<CommonData> commonData;
std::vector<EntityHandle> &mapGaussPts;
std::vector<EntityHandle> &map_gauss_pts,
boost::shared_ptr<CommonData> &common_data,
commonData(common_data), postProcMesh(post_proc_mesh),
mapGaussPts(map_gauss_pts), blockData(block_data) {
doVertices = true;
doEdges = false;
doQuads = false;
doTris = false;
doTets = false;
doPrisms = false;
};
};
boost::shared_ptr<CommonData> commonData;
int nbRows;
int nbIntegrationPts;
OpCalcVolumeFlux(const string field_name,
boost::shared_ptr<CommonData> common_data,
commonData(common_data), blockData(block_data){};
};
};
#endif
ForcesAndSourcesCore::UserDataOperator UserDataOperator
EntitiesFieldData::EntData EntData
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
NonlinearElasticElement::BlockData BlockData
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string &name_row)=0
set field row which finite element use
virtual MoFEMErrorCode add_ents_to_finite_element_by_dim(const EntityHandle entities, const int dim, const std::string &name, const bool recursive=true)=0
add entities to finite element
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string &name_filed)=0
set finite element field data
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string &name_row)=0
set field col which finite element use
FaceElementForcesAndSourcesCore::UserDataOperator FaceUserDataOperator
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
UBlasVector< double > VectorDouble
auto createSmartVectorMPI
Create MPI Vector.
DeprecatedCoreInterface Interface
Set integration rule to boundary elements.
Class used to scale loads, f.e. in arc-length control.
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
VolumeElementForcesAndSourcesCoreBase::UserDataOperator UserDataOperator
Element for simulating viscous fluid flow.