 |
| v0.14.0
|
Go to the documentation of this file.
14 using namespace MoFEM;
16 static char help[] =
"...\n\n";
29 const int nb_int_pts = getGaussPts().size2();
31 auto t_w = getFTensor0IntegrationWeight();
32 double v = getMeasure();
34 for (
int gg = 0; gg != nb_int_pts; gg++) {
38 CHKERR VecSetValue(vOl, 0, vol, ADD_VALUES);
62 const int nb_int_pts = getGaussPts().size2();
63 auto t_normal = getFTensor1NormalsAtGaussPts();
64 auto t_w = getFTensor0IntegrationWeight();
65 auto t_coords = getFTensor1CoordsAtGaussPts();
68 for (
int gg = 0; gg != nb_int_pts; gg++) {
69 vol += (t_coords(
i) * t_normal(
i)) * t_w;
75 CHKERR VecSetValue(vOl, 0, vol, ADD_VALUES);
95 int main(
int argc,
char *argv[]) {
100 auto core_log = logging::core::get();
121 DMType dm_name =
"DMMOFEM";
150 CHKERR m_field.
get_moab().get_entities_by_type(0, MBVERTEX, verts);
164 auto dm = simple_interface->
getDM();
167 boost::make_shared<VolumeElementForcesAndSourcesCore>(m_field);
169 boost::make_shared<FaceElementForcesAndSourcesCore>(m_field);
172 domain_fe->getRuleHook =
VolRule();
173 boundary_fe->getRuleHook =
FaceRule();
183 auto material_grad_mat = boost::make_shared<MatrixDouble>();
184 auto material_det_vec = boost::make_shared<VectorDouble>();
186 domain_fe->getOpPtrVector().push_back(
189 domain_fe->getOpPtrVector().push_back(
191 domain_fe->getOpPtrVector().push_back(
193 domain_fe->getOpPtrVector().push_back(
195 domain_fe->getOpPtrVector().push_back(
196 new OpVolume(
"MESH_NODE_POSITIONS", vol));
198 boundary_fe->getOpPtrVector().push_back(
200 boundary_fe->getOpPtrVector().push_back(
201 new OpFace(
"MESH_NODE_POSITIONS", surf_vol));
209 auto skeleton_fe = boost::make_shared<FEMethod>();
220 skeleton_fe->x_t = x_t;
221 skeleton_fe->x_tt = x_tt;
223 skeleton_fe->preProcessHook = [&]() {
225 if (
f != skeleton_fe->ts_F)
227 if (
A != skeleton_fe->ts_A)
229 if (B != skeleton_fe->ts_B)
231 if (x != skeleton_fe->ts_u)
233 if (x_t != skeleton_fe->ts_u_t)
235 if (x_tt != skeleton_fe->ts_u_tt)
240 skeleton_fe->postProcessHook = []() {
return 0; };
241 skeleton_fe->operatorHook = []() {
return 0; };
247 CHKERR VecAssemblyBegin(vol);
248 CHKERR VecAssemblyEnd(vol);
249 CHKERR VecGhostUpdateBegin(vol, ADD_VALUES, SCATTER_REVERSE);
250 CHKERR VecGhostUpdateEnd(vol, ADD_VALUES, SCATTER_REVERSE);
251 CHKERR VecAssemblyBegin(surf_vol);
252 CHKERR VecAssemblyEnd(surf_vol);
253 CHKERR VecGhostUpdateBegin(surf_vol, ADD_VALUES, SCATTER_REVERSE);
254 CHKERR VecGhostUpdateEnd(surf_vol, ADD_VALUES, SCATTER_REVERSE);
257 CHKERR VecGetArray(vol, &a_vol);
259 CHKERR VecGetArray(surf_vol, &a_surf_vol);
260 MOFEM_LOG(
"TEST", Sev::inform) <<
"Volume = " << a_vol[0];
261 MOFEM_LOG(
"TEST", Sev::inform) <<
"Surf Volume = " << a_surf_vol[0];
262 if (fabs(a_vol[0] - a_surf_vol[0]) > 1e-12) {
265 CHKERR VecRestoreArray(vol, &a_vol);
266 CHKERR VecRestoreArray(vol, &a_surf_vol);
273 const auto type = numeredEntFiniteElementPtr->getEntType();
274 if (
type != MBENTITYSET) {
276 "Expected entity set as a finite element");
278 CHKERR loopOverOperators();
285 auto fe_ptr = boost::make_shared<MeshsetFE>(m_field);
298 MoFEMErrorCode doWork(
int row_side,
int col_side, EntityType row_type,
309 fe_ptr->getOpPtrVector().push_back(
310 new OpMeshset(
"GLOBAL", OpMeshset::OPROW));
311 fe_ptr->getOpPtrVector().push_back(
312 new OpMeshset(
"GLOBAL",
"GLOBAL", OpMeshset::OPROWCOL));
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Data on single entity (This is passed as argument to DataOperator::doWork)
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
virtual MPI_Comm & get_comm() const =0
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
int operator()(int, int, int) const
virtual int get_comm_rank() const =0
const std::string getSkeletonFEName() const
Get the Skeleton FE Name.
int main(int argc, char *argv[])
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Set integration rule to volume elements.
Projection of edge entities with one mid-node on hierarchical basis.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Simple interface for fast problem set-up.
Calculate HO coordinates at gauss points.
auto createDMMatrix(DM dm)
Get smart matrix from DM.
Deprecated interface functions.
DeprecatedCoreInterface Interface
MoFEMErrorCode addMeshsetField(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add meshset field.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getDM(DM *dm)
Get DM.
#define CHKERR
Inline error check.
auto createDMVector(DM dm)
Get smart vector from DM.
auto createGhostVector(MPI_Comm comm, PetscInt n, PetscInt N, PetscInt nghost, const PetscInt ghosts[])
Create smart ghost vector.
virtual moab::Interface & get_moab()=0
PetscErrorCode DMoFEMLoopFiniteElementsUpAndLowRank(DM dm, const char fe_name[], MoFEM::FEMethod *method, int low_rank, int up_rank, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
implementation of Data Operators for Forces and Sources
default operator for TRI element
auto & getMeshsetFiniteElementEntities()
Get the Domain Fields.
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
const VectorInt & getIndices() const
Get global indices of dofs on entity.
ForcesAndSourcesCore(Interface &m_field)
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
virtual int get_comm_size() const =0
const std::string getDomainFEName() const
Get the Domain FE Name.
MoFEMErrorCode addBoundaryField(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on boundary.
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.
Set integration rule to boundary elements.
int operator()(int, int, int) const
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
friend class UserDataOperator
Volume finite element base.
FTensor::Index< 'i', SPACE_DIM > i
constexpr auto field_name
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
structure to get information form mofem into EntitiesFieldData
OpFace(const std::string &field_name, Vec vol)
const double v
phase velocity of light in medium (cm/ns)
OpVolume(const std::string &field_name, Vec vol)
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define MOFEM_LOG(channel, severity)
Log.
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
#define CATCH_ERRORS
Catch errors.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Set inverse jacobian to base functions.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
const std::string getBoundaryFEName() const
Get the Boundary FE Name.
const FTensor::Tensor2< T, Dim, Dim > Vec
@ MOFEM_DATA_INCONSISTENCY
std::string & getMeshsetFEName()
Get the Skeleton FE Name.
MoFEMErrorCode addSkeletonField(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on skeleton.
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode addDomainField(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on domain.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
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.
@ NOFIELD
scalar or vector of scalars describe (no true field)