|
| v0.14.0
|
Atom test checking with blessed file how Jacobian's are calculated on elements.
More...
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
|
static char | help [] = "...\n\n" |
|
Atom test checking with blessed file how Jacobian's are calculated on elements.
Definition in file forces_and_sources_calculate_jacobian.cpp.
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 20 of file forces_and_sources_calculate_jacobian.cpp.
29 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
31 PetscBool flg = PETSC_TRUE;
33 #if PETSC_VERSION_GE(3, 6, 4)
40 if (flg != PETSC_TRUE) {
41 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
117 typedef tee_device<std::ostream, std::ofstream>
TeeDevice;
127 PrintJacobian(
TeeStream &_my_split) : my_split(_my_split) {}
129 ~PrintJacobian() { my_split.close(); }
134 const double eps = 1e-6;
135 for (
unsigned int ii = 0; ii != data.
getDiffN().size1(); ii++) {
136 for (
unsigned int jj = 0; jj != data.
getDiffN().size2(); jj++) {
142 my_split <<
"side: " << side <<
" type: " <<
type << std::fixed
143 << std::setprecision(4) << data.
getDiffN() << std::endl;
152 PrintJacobian opPrintJac;
158 ofs(
"forces_and_sources_calculate_jacobian.txt"),
159 my_tee(
std::cout, ofs), my_split(my_tee),
invJac(3, 3),
160 opPrintJac(my_split), opSetInvJac(
invJac),
161 opGetData_FIELD1(dataFIELD1, dataDiffFIELD1), data(MBTET) {}
175 CHKERR getEntitySense<MBEDGE>(data);
176 CHKERR getEntitySense<MBTRI>(data);
177 CHKERR getEntityDataOrder<MBEDGE>(data,
H1);
178 CHKERR getEntityDataOrder<MBTRI>(data,
H1);
179 CHKERR getEntityDataOrder<MBTET>(data,
H1);
182 const auto bit_number = mField.get_field_bit_number(
"FIELD1");
190 for (
int gg = 0; gg < 4; gg++) {
201 EntityHandle ent = numeredEntFiniteElementPtr->getEnt();
204 CHKERR mField.get_moab().get_connectivity(ent, conn, num_nodes,
true);
205 coords.resize(num_nodes * 3);
206 CHKERR mField.get_moab().get_coords(conn, num_nodes,
207 &*coords.data().begin());
211 &*coords.begin(), &*
invJac.data().begin());
215 CHKERR opPrintJac.opRhs(data);
218 my_split <<
"data FIELD1:" << std::endl;
219 my_split << dataFIELD1 << std::endl;
220 my_split <<
"data diff FIELD1:" << std::endl;
221 my_split << dataDiffFIELD1 << std::endl;
232 ForcesAndSourcesCore_TestFE fe1(m_field);
◆ help
#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.
MoFEMErrorCode getEntityRowIndices(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
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
base operator to do operations at Gauss Pt. level
virtual MoFEMErrorCode opRhs(EntitiesFieldData &data, const bool error_if_no_base=false)
Problem manager is used to build and partition problems.
Class used to pass element data to calculate base functions on tet,triangle,edge.
MoFEMErrorCode getFaceNodes(EntitiesFieldData &data) const
Get nodes on faces.
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
Transform local reference derivatives of shape function to global derivatives.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
MatrixDouble & getDiffN(const FieldApproximationBase base)
get derivatives of base functions
virtual MoFEMErrorCode preProcess()
function is run at the beginning of loop
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
Deprecated interface functions.
MoFEMErrorCode getEntityFieldData(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
DeprecatedCoreInterface Interface
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
#define CHKERR
Inline error check.
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_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.
virtual MoFEMErrorCode operator()()
function is run for every 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
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
MoFEMErrorCode getSpacesAndBaseOnEntities(EntitiesFieldData &data) const
Get field approximation space and base on entities.
MoFEMErrorCode getRowNodesIndices(EntitiesFieldData &data, const int bit_number) const
get row node indices from FENumeredDofEntity_multiIndex
structure to get information form mofem into EntitiesFieldData
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define CATCH_ERRORS
Catch errors.
MoFEMErrorCode partitionSimpleProblem(const std::string name, int verb=VERBOSE)
partition problem dofs
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
MatrixBoundedArray< double, 9 > MatrixDouble3by3
UBlasVector< double > VectorDouble
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
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.
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 ...
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.
MoFEMErrorCode getNodesFieldData(EntitiesFieldData &data, const int bit_number) const
Get data on nodes.
data structure for finite element entity
virtual MoFEMErrorCode postProcess()
function is run at the end of loop
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
@ CONTINUOUS
Regular field.
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()
Get field values and gradients at Gauss points.
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 ...
Calculate base functions on tetrahedral.