Builds the affine tet problem and assembles the diagnostic matrix.
291 {
293
294 int comm_size = 0;
295 MPI_Comm_size(PETSC_COMM_WORLD, &comm_size);
296 if (comm_size != 1) {
298 "affine_tet_stress_gram is a serial diagnostic; run with -np 1");
299 }
300
301 DMType dm_name = "DMMOFEM";
303
304 moab::Core moab_core;
305 moab::Interface &moab = moab_core;
306 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
307 if (pcomm == nullptr) {
308 pcomm = new ParallelComm(&moab, PETSC_COMM_SELF);
309 }
310
313
316
319 meshset, 3, bit_level0);
320
323
324 ep.bcSpatialDispVecPtr = boost::make_shared<BcDispVec>();
325 ep.bcSpatialRotationVecPtr = boost::make_shared<BcRotVec>();
326 ep.bcSpatialTractionVecPtr = boost::make_shared<TractionBcVec>();
327 ep.bcSpatialAnalyticalTractionVecPtr =
328 boost::make_shared<AnalyticalTractionBcVec>();
329 ep.bcSpatialPressureVecPtr = boost::make_shared<PressureBcVec>();
330 ep.bcSpatialNormalDisplacementVecPtr =
331 boost::make_shared<NormalDisplacementBcVec>();
332 ep.bcSpatialAnalyticalDisplacementVecPtr =
333 boost::make_shared<AnalyticalDisplacementBcVec>();
334 ep.externalStrainVecPtr = boost::make_shared<ExternalStrainVec>();
335 ep.bcSpatialFreeTractionVecPtr = boost::make_shared<TractionFreeBc>();
336 CHKERR ep.getTractionFreeBc(meshset, ep.bcSpatialFreeTractionVecPtr,
337 "CONTACT");
338
339 CHKERR ep.addFields(meshset, include_bubble);
340 CHKERR ep.projectGeometry(meshset, 0.0);
341 CHKERR ep.addVolumeFiniteElement(meshset, include_bubble);
343
354
356 CHKERR VecZeroEntries(ep.solTSStep);
357
364
365 switch (matrix_type) {
369 if (include_bubble) {
372 }
373 break;
375 if (!include_bubble) {
377 "P-only diagnostic is implemented for -diag_matrix_type gram");
378 }
379 for (
const auto field_name : {ep.stretchTensor, ep.bubbleField,
380 ep.piolaStress, ep.rotAxis,
381 ep.spatialL2Disp}) {
384 }
385 break;
386 }
388
389 CHKERR ep.addMaterial_Hencky(5.0, 0.25);
390
391 auto fe_lhs = boost::make_shared<VolumeElementForcesAndSourcesCore>(m_field);
392 CHKERR ep.setBaseVolumeElementOps(
adolc_tag,
false,
true,
false, fe_lhs,
393 include_bubble);
394 switch (matrix_type) {
396 if (include_bubble) {
397 CHKERR ep.pushStressGramOps(fe_lhs);
398 } else {
399 CHKERR ep.pushPiolaStressGramOps(fe_lhs);
400 }
401 break;
404 CHKERR ep.pushNoStretchVolumeA00Ops(fe_lhs);
405 } else {
406 CHKERR ep.pushStretchVolumeA00Ops(fe_lhs);
407 }
408 break;
409 }
410
416 fe_lhs->ts_u = ep.solTSStep;
417 fe_lhs->ts_u_t = ep.solTSStep;
418 fe_lhs->ts_a = 0.0;
422 CHKERR MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY);
423 CHKERR MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY);
424
427
429 rel_rank_tol, check_full_rank, view_matrix);
430
432}
static MoFEMErrorCode analyseDenseStressBlock(const MatrixDouble &dense, const DiagnosticMatrixType matrix_type, const PetscBool include_bubble, const double rel_rank_tol, const PetscBool check_full_rank, const PetscBool view_matrix)
Prints a compact rank summary for the assembled matrix.
static MoFEMErrorCode getDenseMatrix(Mat A, MatrixDouble &dense)
Copies a PETSc matrix into a dense uBLAS matrix.
static MoFEMErrorCode createAffineTet(moab::Interface &moab, EntityHandle &meshset)
Creates one unit affine tetrahedron mesh.
#define MYPCOMM_INDEX
default communicator number PCOMM
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
PetscErrorCode DMMoFEMCreateSubDM(DM subdm, DM dm, const char problem_name[])
Must be called by user to set Sub DM MoFEM data structures.
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
PetscErrorCode DMMoFEMAddSubFieldRow(DM dm, const char field_name[])
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
auto createDMVector(DM dm, RowColData rc=RowColData::COL)
Get smart vector from DM.
PetscErrorCode DMMoFEMAddSubFieldCol(DM dm, const char field_name[])
auto createDMMatrix(DM dm)
Get smart matrix from DM.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode DMMoFEMSetDestroyProblem(DM dm, PetscBool destroy_problem)
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
constexpr auto field_name
static enum StretchHandling stretchHandling
static bool hasNonHomogeneousMaterialBlock
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MPI_Comm & get_comm() const =0
Deprecated interface functions.
static constexpr Switches CtxSetA
Jacobian matrix switch.
static constexpr Switches CtxSetX
Solution vector switch.
static constexpr Switches CtxSetX_T
First time derivative switch.
static constexpr Switches CtxSetB
Preconditioner matrix switch.
Problem manager is used to build and partition problems.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.