|
| v0.14.0
|
Go to the documentation of this file.
3 #include <boost/iostreams/tee.hpp>
4 #include <boost/iostreams/stream.hpp>
8 namespace bio = boost::iostreams;
10 using bio::tee_device;
13 using namespace MoFEM;
15 #include <MethodForForceScaling.hpp>
22 #include <boost/shared_ptr.hpp>
23 #include <boost/numeric/ublas/vector_proxy.hpp>
26 #include <boost/iostreams/tee.hpp>
27 #include <boost/iostreams/stream.hpp>
32 static char help[] =
"...\n\n";
36 std::vector<VectorDouble>
val;
38 std::vector<VectorDouble> &
operator()(
double x,
double y,
double z) {
41 (val[0])[0] = pow(x, 1);
46 int main(
int argc,
char *argv[]) {
55 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
57 PetscBool flg = PETSC_TRUE;
61 if (flg != PETSC_TRUE) {
62 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
77 CHKERR moab.create_meshset(MESHSET_SET, meshset_level0);
97 "MESH_NODE_POSITIONS");
112 if (flg != PETSC_TRUE) {
127 CHKERR moab.get_entities_by_type(it->getMeshset(), MBTRI, bc_tris,
true);
149 "MESH_NODE_POSITIONS");
172 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(
"TEST_PROBLEM", &
A);
175 true,
false,
false,
false);
177 true,
false,
false,
false);
194 boost::shared_ptr<AnalyticalFunction> testing_function =
199 analytical_dirichlet_bc);
205 analytical_dirichlet_bc);
208 thermal_elements.getLoopFeRhs());
210 thermal_elements.getLoopFeLhs());
217 analytical_dirichlet_bc);
219 CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
220 CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
223 CHKERR MatAssemblyBegin(
A, MAT_FINAL_ASSEMBLY);
224 CHKERR MatAssemblyEnd(
A, MAT_FINAL_ASSEMBLY);
234 CHKERR KSPCreate(PETSC_COMM_WORLD, &solver);
235 CHKERR KSPSetOperators(solver,
A,
A);
236 CHKERR KSPSetFromOptions(solver);
240 CHKERR VecGhostUpdateBegin(T, INSERT_VALUES, SCATTER_FORWARD);
241 CHKERR VecGhostUpdateEnd(T, INSERT_VALUES, SCATTER_FORWARD);
247 "TEST_PROBLEM",
ROW, T, ADD_VALUES, SCATTER_REVERSE);
249 "TEST_PROBLEM",
ROW, T, INSERT_VALUES, SCATTER_FORWARD);
255 PetscReal pointwisenorm;
256 CHKERR VecMax(T, NULL, &pointwisenorm);
257 std::cout <<
"\n The Global Pointwise Norm of error for this problem is : "
258 << pointwisenorm << std::endl;
268 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"sum = %9.8e\n", sum);
270 CHKERR VecNorm(T, NORM_2, &fnorm);
271 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"fnorm = %9.8e\n", fnorm);
272 if (fabs(sum + 6.46079983e-01) > 1e-7) {
275 if (fabs(fnorm - 4.26080052e+00) > 1e-6) {
296 CHKERR KSPDestroy(&solver);
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MoFEMErrorCode setFiniteElement(MoFEM::Interface &m_field, string fe, string field, Range &tris, string nodals_positions="MESH_NODE_POSITIONS")
set finite element
virtual MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
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.
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.
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.
MoFEMErrorCode addHOOpsVol(const std::string field, E &e, bool h1, bool hcurl, bool hdiv, bool l2)
MoFEMErrorCode destroyProblem()
Destroy problem.
MoFEMErrorCode addThermalElements(const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
add thermal element on tets
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.
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.
MyTriFE & getLoopFeFlux()
DeprecatedCoreInterface Interface
MoFEMErrorCode setUpProblem(MoFEM::Interface &m_field, string problem)
set problem solver and create matrices and vectors
virtual MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
#define CHKERR
Inline error check.
MoFEMErrorCode setThermalFluxFiniteElementRhsOperators(string field_name, Vec &F, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
this function is used in case of stationary problem for heat flux terms
implementation of Data Operators for Forces and Sources
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
Structure used to enforce analytical boundary conditions.
Operators and data structures for thermal analysis.
MoFEMErrorCode setApproxOps(MoFEM::Interface &m_field, const std::string field_name, boost::shared_ptr< FUNEVAL > function_evaluator, const int field_number=0, const string nodals_positions="MESH_NODE_POSITIONS")
Set operators used to calculate the rhs vector and the lhs matrix.
MoFEMErrorCode solveProblem(MoFEM::Interface &m_field, string problem, string fe, DirichletBC &bc, Range &tris)
solve boundary problem
MoFEMErrorCode writeFile(const std::string file_name, const char *file_type="MOAB", const char *file_options="PARALLEL=WRITE_PART")
wrote results in (MOAB) format, use "file_name.h5m"
MoFEMErrorCode setThermalFiniteElementRhsOperators(string field_name, Vec &F)
this function is used in case of stationary problem to set elements for rhs
MoFEMErrorCode generateReferenceElementMesh()
Generate reference mesh on single element.
MoFEMErrorCode addFieldValuesGradientPostProc(const std::string field_name, Vec v=PETSC_NULL)
Add operator to post-process L2 or H1 field gradient.
Post-process fields on refined mesh.
std::vector< VectorDouble > val
int main(int argc, char *argv[])
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
Vector manager is used to create vectors \mofem_vectors.
Matrix manager is used to build and partition problems.
structure grouping operators and data used for thermal problems
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 .
const FTensor::Tensor2< T, Dim, Dim > Vec
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
#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT)
Iterator that loops over Cubit BlockSet having a particular name.
Analytical Dirichlet boundary conditions.
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
virtual bool check_finite_element(const std::string &name) const =0
Check if finite element is in database.
MoFEMErrorCode setThermalFiniteElementLhsOperators(string field_name, Mat A)
this function is used in case of stationary heat conductivity problem for lhs
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 partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
std::vector< VectorDouble > & operator()(double x, double y, double z)
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
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.
MoFEMErrorCode addFieldValuesPostProc(const std::string field_name, Vec v=PETSC_NULL)
Add operator to post-process L2, H1, Hdiv, Hcurl field value.