|
| v0.14.0
|
Go to the documentation of this file.
12 using namespace MoFEM;
14 static char help[] =
"...\n\n";
16 int main(
int argc,
char *argv[]) {
20 auto core_log = logging::core::get();
30 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
32 PetscBool flg = PETSC_TRUE;
34 #if PETSC_VERSION_GE(3, 6, 4)
41 if (flg != PETSC_TRUE) {
42 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
61 enum bases { AINSWORTH, DEMKOWICZ, LASTBASEOP };
62 const char *list_bases[] = {
"ainsworth",
"demkowicz"};
64 PetscInt choice_base_value = AINSWORTH;
66 LASTBASEOP, &choice_base_value, &flg);
67 if (flg == PETSC_TRUE) {
69 if (choice_base_value == AINSWORTH)
71 else if (choice_base_value == DEMKOWICZ)
80 const char *list_spaces[] = {
"hdiv",
"hcurl"};
82 PetscInt choice_space_value =
HDIV;
84 LASTSPACEOP, &choice_space_value, &flg);
85 if (flg == PETSC_TRUE) {
87 if (choice_space_value ==
HDIV)
89 else if (choice_space_value ==
HCURL)
165 elemData(elem_data) {}
170 if (CN::Dimension(
type) == 3) {
172 getCoordsAtGaussPts() - getFaceCoordsAtGaussPts();
175 <<
"getCoordsAtGaussPts() " << getCoordsAtGaussPts();
177 <<
"getFaceCoordsAtGaussPts() " << getFaceCoordsAtGaussPts();
179 constexpr
double eps = 1e-12;
180 if (norm_inf(diff) >
eps) {
181 MOFEM_LOG(
"ATOM_TEST", Sev::error) <<
"diff " << diff;
183 "Coordinates at integration pts are different");
189 const size_t nb_integration_pts = getGaussPts().size2();
192 auto t_to_do_dot = getFTensor1Normal();
194 auto s1 = getFTensor1Tangent1();
195 auto s2 = getFTensor1Tangent2();
196 t_to_do_dot(
i) = s1(
i) + s2(
i);
200 if (getFEMethod()->nInTheLoop == 0)
201 ptr_dot_elem_data = &elemData.dotNormalEleLeft;
203 ptr_dot_elem_data = &elemData.dotNormalEleRight;
204 auto &dot_elem_data = *ptr_dot_elem_data;
205 if (dot_elem_data.size() == 0) {
206 dot_elem_data.resize(nb_integration_pts,
false);
207 dot_elem_data.clear();
211 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
213 for (
size_t bb = 0; bb != nb_dofs; ++bb) {
214 dot_elem_data(gg) += (t_to_do_dot(
i) * t_hdiv_base(
i)) * t_data;
228 volSideFe(m_field), elemData(elem_data) {
230 auto jac_ptr = boost::make_shared<MatrixDouble>();
231 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
232 auto det_ptr = boost::make_shared<VectorDouble>();
243 new SkeletonFE::OpVolSide(elemData));
251 const size_t nb_integration_pts = getGaussPts().size2();
253 if (side == 0 &&
type == MBEDGE) {
254 elemData.dotNormalFace.resize(nb_integration_pts,
false);
255 elemData.dotNormalFace.clear();
261 auto t_to_do_dot = getFTensor1Normal();
263 auto s1 = getFTensor1Tangent1();
264 auto s2 = getFTensor1Tangent2();
265 t_to_do_dot(
i) = s1(
i) + s2(
i);
268 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
270 for (
size_t bb = 0; bb != nb_dofs; ++bb) {
271 elemData.dotNormalFace(gg) +=
272 (t_to_do_dot(
i) * t_hdiv_base(
i)) * t_data;
279 if (CN::Dimension(
type) == 2) {
281 elemData.dotNormalEleLeft.resize(0,
false);
282 elemData.dotNormalEleRight.resize(0,
false);
283 CHKERR loopSideVolumes(
"V1", volSideFe);
285 auto check_continuity_of_base = [&](
auto &vol_dot_data) {
287 if (vol_dot_data.size() != elemData.dotNormalFace.size())
289 "Inconsistent number of integration points");
290 const double eps = 1e-12;
291 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
293 std::abs(vol_dot_data(gg) - elemData.dotNormalFace(gg));
294 MOFEM_LOG(
"ATOM_TEST", Sev::noisy) <<
"Error: " << error;
297 "Inconsistency %3.4e != %3.4e", vol_dot_data(gg),
298 elemData.dotNormalFace(gg));
302 if (elemData.dotNormalEleLeft.size() != 0)
303 CHKERR check_continuity_of_base(elemData.dotNormalEleLeft);
304 else if (elemData.dotNormalEleRight.size() != 0)
305 CHKERR check_continuity_of_base(elemData.dotNormalEleRight);
323 auto cache_ptr = boost::make_shared<CacheTuple>();
326 for (
auto &ent_ptr : (*field_ents_ptr)) {
327 MOFEM_LOG(
"ATOM_TEST", Sev::verbose) << *ent_ptr;
328 for(
auto &
v : ent_ptr->getEntFieldData())
332 for (
auto &
v : ent_ptr->getEntFieldData())
default operator for TET element
#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_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
Problem manager is used to build and partition problems.
RuleHookFun getRuleHook
Hook to get rule.
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
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
const VectorDouble & getFieldData() const
get dofs values
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
int main(int argc, char *argv[])
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
virtual MoFEMErrorCode add_ents_to_field_by_dim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
Deprecated interface functions.
DeprecatedCoreInterface Interface
FieldSpace
approximation spaces
#define CHKERR
Inline error check.
friend class UserDataOperator
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
implementation of Data Operators for Forces and Sources
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
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
default operator for TRI element
friend class UserDataOperator
virtual MoFEMErrorCode cache_problem_entities(const std::string prb_name, CacheTupleWeakPtr cache_ptr)=0
Cache variables.
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
virtual const FieldEntity_multiIndex * get_field_ents() const =0
Get the field ents object.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
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 modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
FTensor::Index< 'i', SPACE_DIM > i
MoFEMErrorCode partitionFiniteElements(const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
partition finite elements
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
const double v
phase velocity of light in medium (cm/ns)
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FieldData()
Resturn scalar files as a FTensor of rank 0.
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.
#define CATCH_ERRORS
Catch errors.
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
Set inverse jacobian to base functions.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
FieldSpace & getSpace()
Get field space.
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
@ HCURL
field with continuous tangents
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
FieldApproximationBase
approximation base
UBlasVector< double > VectorDouble
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
@ MOFEM_ATOM_TEST_INVALID
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Base volume element used to integrate on skeleton.
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ HDIV
field with continuous normal traction
virtual MoFEMErrorCode add_field(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_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode partitionProblem(const std::string name, int verb=VERBOSE)
partition problem dofs (collective)
@ OPROW
operator doWork function is executed on FE rows