v0.15.0
Loading...
Searching...
No Matches
BoneRemodeling::Remodeling Struct Reference

Implementation of bone remodeling finite element. More...

#include "users_modules/bone_remodelling/src/Remodeling.hpp"

Collaboration diagram for BoneRemodeling::Remodeling:
[legend]

Classes

struct  CommonData
 
struct  Fe
 Volume finite element. More...
 
struct  FePrePostProcessLhs
 Not used at this stage. Could be used to do some calculations, before assembly of local elements. More...
 
struct  FePrePostProcessRhs
 Not used at this stage. Could be used to do some calculations, before assembly of local elements. More...
 

Public Member Functions

 Remodeling (MoFEM::Interface &m_field, CommonData &common_data)
 
MoFEMErrorCode getParameters ()
 Get parameters form line command or config file.
 
MoFEMErrorCode addFields ()
 Set and add entities to approximation fields.
 
MoFEMErrorCode addElements ()
 Set and add finite elements.
 
MoFEMErrorCode addElementsTestingDensity ()
 (Testing only) Set finite element to run mass transport problem only
 
MoFEMErrorCode addElementsTestingElasticty ()
 (Testing only) Set finite element to run elastic problem only
 
MoFEMErrorCode addMomentumFluxes ()
 Finite elements to calculate tractions.
 
MoFEMErrorCode buildDM ()
 Set problem and DM.
 
MoFEMErrorCode solveDM ()
 Solve problem set up in DM.
 

Public Attributes

MoFEM::InterfacemField
 
CommonDatacommonData
 

Detailed Description

Implementation of bone remodeling finite element.

Implementation base on paper [61] http://biomechanics.stanford.edu/paper/IJSS12.pdf

Examples
bone_adaptation.cpp.

Definition at line 36 of file Remodeling.hpp.

Constructor & Destructor Documentation

◆ Remodeling()

BoneRemodeling::Remodeling::Remodeling ( MoFEM::Interface & m_field,
CommonData & common_data )
inline
Examples
Remodeling.hpp.

Definition at line 209 of file Remodeling.hpp.

210 : mField(m_field), commonData(common_data) {}
MoFEM::Interface & mField

Member Function Documentation

◆ addElements()

MoFEMErrorCode BoneRemodeling::Remodeling::addElements ( )

Set and add finite elements.

Returns
Error code
Examples
Remodeling.cpp, Remodeling.hpp, and bone_adaptation.cpp.

Definition at line 1690 of file Remodeling.cpp.

1690 {
1692
1693 CHKERR mField.add_finite_element("FE_REMODELLING", MF_ZERO);
1695 "DISPLACEMENTS");
1697 "DISPLACEMENTS");
1699 "DISPLACEMENTS");
1700 CHKERR mField.modify_finite_element_add_field_data("FE_REMODELLING", "RHO");
1702 "MESH_NODE_POSITIONS");
1703 CHKERR mField.modify_finite_element_add_field_row("FE_REMODELLING", "RHO");
1704 CHKERR mField.modify_finite_element_add_field_col("FE_REMODELLING", "RHO");
1706 "FE_REMODELLING");
1707
1708 CHKERR mField.add_finite_element("ELASTIC");
1709 CHKERR mField.modify_finite_element_add_field_row("ELASTIC", "DISPLACEMENTS");
1710 CHKERR mField.modify_finite_element_add_field_col("ELASTIC", "DISPLACEMENTS");
1712 "DISPLACEMENTS");
1714 "MESH_NODE_POSITIONS");
1715
1718 MBTET, "ELASTIC");
1719 }
1720
1722 boost::shared_ptr<ElasticMaterials>(new ElasticMaterials(mField));
1723 commonData.elasticPtr = boost::shared_ptr<NonlinearElasticElement>(
1726 commonData.elasticPtr->setOfBlocks);
1727 CHKERR commonData.elasticPtr->addElement("ELASTIC", "DISPLACEMENTS");
1728 CHKERR commonData.elasticPtr->setOperators(
1729 "DISPLACEMENTS", "MESH_NODE_POSITIONS", false, true);
1730
1733
1734 // Allocate memory for density and gradient of displacements at integration
1735 // points
1736 commonData.data.rhoPtr = boost::shared_ptr<VectorDouble>(new VectorDouble());
1738 boost::shared_ptr<MatrixDouble>(new MatrixDouble());
1740 boost::shared_ptr<MatrixDouble>(new MatrixDouble());
1741
1742 // Add operators Rhs
1743 CHKERR addHOOpsVol("MESH_NODE_POSITIONS", *(commonData.feRhs), true, false,
1744 false, false);
1745 auto &list_of_operators_rhs = commonData.feRhs->getOpPtrVector();
1746 // Get density at integration points
1747 list_of_operators_rhs.push_back(
1749 list_of_operators_rhs.push_back(
1751 list_of_operators_rhs.push_back(new OpGetRhoTimeDirevative(commonData));
1752 // Get displacement gradient at integration points
1753 list_of_operators_rhs.push_back(new OpCalculateVectorFieldGradient<3, 3>(
1754 "DISPLACEMENTS", commonData.data.gradDispPtr));
1755 list_of_operators_rhs.push_back(new OpCalculateStress(commonData));
1756 list_of_operators_rhs.push_back(new OpAssmbleStressRhs(commonData));
1757 list_of_operators_rhs.push_back(new OpAssmbleRhoRhs(commonData));
1758
1759 // Add operators Lhs
1760 CHKERR addHOOpsVol("MESH_NODE_POSITIONS", *(commonData.feLhs), true, false,
1761 false, false);
1762 auto &list_of_operators_lhs = commonData.feLhs->getOpPtrVector();
1763 // Get density at integration points
1764 list_of_operators_lhs.push_back(
1766 list_of_operators_rhs.push_back(
1768 // Get displacement gradient at integration points
1769 list_of_operators_lhs.push_back(new OpCalculateVectorFieldGradient<3, 3>(
1770 "DISPLACEMENTS", commonData.data.gradDispPtr));
1771 if (commonData.with_adol_c) {
1772 list_of_operators_lhs.push_back(
1773 new OpCalculateStressTangentWithAdolc(commonData));
1774 list_of_operators_lhs.push_back(
1775 new OpAssmbleStressLhs_dF<true>(commonData));
1776 } else {
1777 list_of_operators_lhs.push_back(new OpCalculateStressTangent(commonData));
1778 list_of_operators_lhs.push_back(
1779 new OpAssmbleStressLhs_dF<false>(commonData));
1780 }
1781 list_of_operators_lhs.push_back(new OpAssmbleRhoLhs_dRho(commonData));
1782 list_of_operators_lhs.push_back(new OpAssmbleRhoLhs_dF(commonData));
1783 list_of_operators_lhs.push_back(new OpAssmbleStressLhs_dRho(commonData));
1784
1786}
@ MF_ZERO
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#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 build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
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 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
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
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
UBlasVector< double > VectorDouble
Definition Types.hpp:68
MoFEMErrorCode addHOOpsVol(const std::string field, E &e, bool h1, bool hcurl, bool hdiv, bool l2)
boost::shared_ptr< MatrixDouble > gradDispPtr
Ptr to gradient of displacements matrix container.
boost::shared_ptr< VectorDouble > rhoPtr
Ptr to density matrix container.
boost::shared_ptr< MatrixDouble > gradRhoPtr
Gradient of density field.
boost::shared_ptr< Fe > feLhs
FE to make left hand side.
boost::shared_ptr< Fe > feRhs
FE to make right hand side.
boost::shared_ptr< ElasticMaterials > elasticMaterialsPtr
boost::shared_ptr< NonlinearElasticElement > elasticPtr
Manage setting parameters and constitutive equations for nonlinear/linear elastic materials.
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Get value at integration points for scalar field.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
structure grouping operators and data used for calculation of nonlinear elastic element

◆ addElementsTestingDensity()

MoFEMErrorCode BoneRemodeling::Remodeling::addElementsTestingDensity ( )

(Testing only) Set finite element to run mass transport problem only

Returns
Error code
Examples
Remodeling.hpp.

◆ addElementsTestingElasticty()

MoFEMErrorCode BoneRemodeling::Remodeling::addElementsTestingElasticty ( )

(Testing only) Set finite element to run elastic problem only

Returns
Error code
Examples
Remodeling.hpp.

◆ addFields()

MoFEMErrorCode BoneRemodeling::Remodeling::addFields ( )

Set and add entities to approximation fields.

Returns
Error code
Examples
Remodeling.cpp, Remodeling.hpp, and bone_adaptation.cpp.

Definition at line 1603 of file Remodeling.cpp.

1603 {
1604
1606
1607 // Seed all mesh entities to MoFEM database, those entities can be potentially
1608 // used as finite elements or as entities which carry some approximation
1609 // field.
1610 commonData.bitLevel.set(0);
1611 CHKERR mField.getInterface<BitRefManager>()->setBitRefLevelByDim(
1612 0, 3, commonData.bitLevel);
1613 int order = commonData.oRder;
1614
1615 // Add displacement field
1616 CHKERR mField.add_field("DISPLACEMENTS", H1,
1617 /*AINSWORTH_LOBATTO_BASE*/ AINSWORTH_LEGENDRE_BASE, 3,
1618 MB_TAG_SPARSE, MF_ZERO);
1619 // Add field representing ho-geometry
1620 CHKERR mField.add_field("MESH_NODE_POSITIONS", H1, AINSWORTH_LEGENDRE_BASE, 3,
1621 MB_TAG_SPARSE, MF_ZERO);
1622
1623 // Check if density is available, if not add density field.
1624 bool add_rho_field = false;
1625 if (!mField.check_field("RHO")) {
1627 MB_TAG_SPARSE, MF_ZERO);
1628 // FIXME
1630 // CHKERR mField.add_ents_to_field_by_type(0,MBTET,"RHO");
1632 add_rho_field = true;
1633
1634 CHKERR mField.set_field_order(0, MBVERTEX, "RHO", 1);
1635 CHKERR mField.set_field_order(0, MBEDGE, "RHO", order - 1);
1636 CHKERR mField.set_field_order(0, MBTRI, "RHO", order - 1);
1637 CHKERR mField.set_field_order(0, MBTET, "RHO", order - 1);
1638 }
1639
1640 // Add entities to field
1641 CHKERR mField.add_ents_to_field_by_type(0, MBTET, "DISPLACEMENTS");
1642 CHKERR mField.add_ents_to_field_by_type(0, MBTET, "MESH_NODE_POSITIONS");
1643
1644 // Set approximation order to entities
1645 CHKERR mField.set_field_order(0, MBVERTEX, "DISPLACEMENTS", 1);
1646 CHKERR mField.set_field_order(0, MBEDGE, "DISPLACEMENTS", order);
1647 CHKERR mField.set_field_order(0, MBTRI, "DISPLACEMENTS", order);
1648 CHKERR mField.set_field_order(0, MBTET, "DISPLACEMENTS", order);
1649
1650 // Assumes that geometry is approximated using 2nd order polynomials.
1651
1652 // Apply 2nd order only on skin
1653 {
1654 // Skinner skin(&mField.get_moab());
1655 // Range faces,tets;
1656 // CHKERR mField.get_moab().get_entities_by_type(0,MBTET,tets);
1657 // CHKERR skin.find_skin(0,tets,false,faces);
1658 // Range edges;
1659 // CHKERR mField.get_moab().get_adjacencies(
1660 // faces,1,false,edges,moab::Interface::UNION
1661 // );
1662 CHKERR mField.set_field_order(0, MBEDGE, "MESH_NODE_POSITIONS", 2);
1663 }
1664
1665 CHKERR mField.set_field_order(0, MBVERTEX, "MESH_NODE_POSITIONS", 1);
1666
1667 // Build fields
1669
1670 // If order was not set from CT scans set homogenous order equal to
1671 // reference bone density
1672 if (add_rho_field) {
1674 MBVERTEX, "RHO");
1675 // const DofEntity_multiIndex *dofs_ptr;
1676 // CHKERR mField.get_dofs(&dofs_ptr);
1677 // for(_IT_GET_DOFS_FIELD_BY_NAME_FOR_LOOP_(mField,"RHO",dit)) {
1678 // cerr << (*dit)->getFieldData() << endl;
1679 // }
1680 }
1681
1682 // Project geometry given on 10-node tets on ho-geometry
1683 Projection10NodeCoordsOnField ent_method_material(mField,
1684 "MESH_NODE_POSITIONS");
1685 CHKERR mField.loop_dofs("MESH_NODE_POSITIONS", ent_method_material);
1686
1688}
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base nme:nme847.
Definition definitions.h:60
@ H1
continuous field
Definition definitions.h:85
constexpr int order
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
DEPRECATED MoFEMErrorCode synchronise_field_entities(const std::string &name, int verb=DEFAULT_VERBOSITY)
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.
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.
virtual bool check_field(const std::string &name) const =0
check if field is in database
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.
Managing BitRefLevels.
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.
Basic algebra on fields.
Definition FieldBlas.hpp:21
Projection of edge entities with one mid-node on hierarchical basis.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ addMomentumFluxes()

MoFEMErrorCode BoneRemodeling::Remodeling::addMomentumFluxes ( )

Finite elements to calculate tractions.

Returns
Error code
Examples
Remodeling.cpp, Remodeling.hpp, and bone_adaptation.cpp.

Definition at line 1788 of file Remodeling.cpp.

1788 {
1789
1791 // Add Neumann forces elements
1792 CHKERR MetaNeummanForces::addNeumannBCElements(mField, "DISPLACEMENTS");
1793 CHKERR MetaNodalForces::addElement(mField, "DISPLACEMENTS");
1794 CHKERR MetaEdgeForces::addElement(mField, "DISPLACEMENTS");
1795
1796 // forces and pressures on surface
1797 CHKERR MetaNeummanForces::setMomentumFluxOperators(
1798 mField, commonData.neumannForces, PETSC_NULL, "DISPLACEMENTS");
1799 // noadl forces
1801 PETSC_NULL, "DISPLACEMENTS");
1802 // edge forces
1804 "DISPLACEMENTS");
1805
1806 for (boost::ptr_map<string, NeummanForcesSurface>::iterator mit =
1807 commonData.neumannForces.begin();
1808 mit != commonData.neumannForces.end(); mit++) {
1809 mit->second->methodsOp.push_back(
1810 new TimeForceScale("-my_load_history", false));
1811 }
1812 for (boost::ptr_map<string, NodalForce>::iterator mit =
1813 commonData.nodalForces.begin();
1814 mit != commonData.nodalForces.end(); mit++) {
1815 mit->second->methodsOp.push_back(
1816 new TimeForceScale("-my_load_history", false));
1817 }
1818 for (boost::ptr_map<string, EdgeForce>::iterator mit =
1819 commonData.edgeForces.begin();
1820 mit != commonData.edgeForces.end(); mit++) {
1821 mit->second->methodsOp.push_back(
1822 new TimeForceScale("-my_load_history", false));
1823 }
1824
1826}
boost::ptr_map< string, NeummanForcesSurface > neumannForces
Forces on surface.
boost::ptr_map< string, EdgeForce > edgeForces
Forces on edges.
boost::ptr_map< string, NodalForce > nodalForces
Nodal forces.
static MoFEMErrorCode setOperators(MoFEM::Interface &m_field, boost::ptr_map< std::string, EdgeForce > &edge_forces, Vec F, const std::string field_name, std::string mesh_node_positions="MESH_NODE_POSITIONS")
Set integration point operators.
Definition EdgeForce.hpp:97
static MoFEMErrorCode addElement(MoFEM::Interface &m_field, const std::string field_name, Range *intersect_ptr=NULL)
Add element taking information from NODESET.
Definition EdgeForce.hpp:62
static MoFEMErrorCode setOperators(MoFEM::Interface &m_field, boost::ptr_map< std::string, NodalForce > &nodal_forces, Vec F, const std::string field_name)
Set integration point operators.
static MoFEMErrorCode addElement(MoFEM::Interface &m_field, const std::string field_name, Range *intersect_ptr=NULL)
Add element taking information from NODESET.
Force scale operator for reading two columns.

◆ buildDM()

MoFEMErrorCode BoneRemodeling::Remodeling::buildDM ( )

Set problem and DM.

Returns
Error code
Examples
Remodeling.cpp, Remodeling.hpp, and bone_adaptation.cpp.

Definition at line 1828 of file Remodeling.cpp.

1828 {
1829
1831 commonData.dm_name = "DM_REMODELING";
1832 // Register DM problem
1834 CHKERR DMCreate(PETSC_COMM_WORLD, &commonData.dm);
1837 // Create DM instance
1840 // Configure DM form line command options (DM itself, solvers,
1841 // pre-conditioners, ... )
1842 CHKERR DMSetFromOptions(commonData.dm);
1843 // Add elements to dm (only one here)
1844 CHKERR DMMoFEMAddElement(commonData.dm, "FE_REMODELLING");
1846
1847 if (mField.check_finite_element("FORCE_FE")) {
1849 }
1850 if (mField.check_finite_element("PRESSURE_FE")) {
1851 CHKERR DMMoFEMAddElement(commonData.dm, "PRESSURE_FE");
1852 }
1853 mField.getInterface<ProblemsManager>()->buildProblemFromFields = PETSC_TRUE;
1854 CHKERR DMSetUp(commonData.dm);
1855
1857}
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
Definition DMMoFEM.cpp:1113
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Definition DMMoFEM.cpp:488
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.
Definition DMMoFEM.cpp:114
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
virtual bool check_finite_element(const std::string &name) const =0
Check if finite element is in database.
Problem manager is used to build and partition problems.

◆ getParameters()

MoFEMErrorCode BoneRemodeling::Remodeling::getParameters ( )

Get parameters form line command or config file.

Read command line and config file to setup material and model parameters.

Returns
Error code
Examples
Remodeling.cpp, Remodeling.hpp, and bone_adaptation.cpp.

Definition at line 1576 of file Remodeling.cpp.

1576 {
1577
1579 PetscOptionsBegin(PETSC_COMM_WORLD, "", "Bone remodeling", "none");
1580
1581 commonData.oRder = 2;
1582 CHKERR PetscOptionsInt("-my_order", "default approximation order", "", 2,
1583 &commonData.oRder, PETSC_NULL);
1584
1585 PetscOptionsEnd();
1586
1587 CHKERR mField.get_moab().get_entities_by_type(0, MBTET, commonData.tEts_all);
1589 string name = it->getName();
1590 if (name.compare(0, 14, "NO_REMODELLING") == 0) {
1592 EntityHandle meshset = it->getMeshset();
1593 CHKERR this->mField.get_moab().get_entities_by_type(
1594 meshset, MBTET, commonData.tEts_block, true);
1597 }
1598 }
1599
1601}
@ BLOCKSET
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
virtual moab::Interface & get_moab()=0

◆ solveDM()

MoFEMErrorCode BoneRemodeling::Remodeling::solveDM ( )

Solve problem set up in DM.

Returns
Error code
Examples
Remodeling.cpp, Remodeling.hpp, and bone_adaptation.cpp.

Definition at line 1859 of file Remodeling.cpp.

1859 {
1860
1862
1863 Vec F = commonData.F;
1864 Vec D = commonData.D;
1865 Mat A = commonData.A;
1866 DM dm = commonData.dm;
1867 TS ts = commonData.ts;
1868
1869 CHKERR TSSetIFunction(ts, F, PETSC_NULL, PETSC_NULL);
1870 CHKERR TSSetIJacobian(ts, A, A, PETSC_NULL, PETSC_NULL);
1871 double ftime = 1;
1872#if PETSC_VERSION_GE(3, 8, 0)
1873 CHKERR TSSetMaxTime(ts, ftime);
1874#endif
1875 CHKERR TSSetFromOptions(ts);
1876 CHKERR TSSetDM(ts, dm);
1877
1878 SNES snes;
1879 CHKERR TSGetSNES(ts, &snes);
1880 KSP ksp;
1881 CHKERR SNESGetKSP(snes, &ksp);
1882 PC pc;
1883 CHKERR KSPGetPC(ksp, &pc);
1884 PetscBool is_pcfs = PETSC_FALSE;
1885 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1886
1887 // Set up FIELDSPLIT
1888 // Only is user set -pc_type fieldsplit
1889 if (is_pcfs == PETSC_TRUE) {
1890 IS is_disp, is_rho;
1891 const MoFEM::Problem *problem_ptr;
1892 CHKERR DMMoFEMGetProblemPtr(dm, &problem_ptr);
1893 CHKERR mField.getInterface<ISManager>()->isCreateProblemFieldAndRank(
1894 problem_ptr->getName(), ROW, "DISPLACEMENTS", 0, 3, &is_disp);
1895 CHKERR mField.getInterface<ISManager>()->isCreateProblemFieldAndRank(
1896 problem_ptr->getName(), ROW, "RHO", 0, 1, &is_rho);
1897 CHKERR ISSort(is_disp);
1898 CHKERR ISSort(is_rho);
1899 CHKERR PCFieldSplitSetIS(pc, NULL, is_disp);
1900 CHKERR PCFieldSplitSetIS(pc, NULL, is_rho);
1901 CHKERR ISDestroy(&is_disp);
1902 CHKERR ISDestroy(&is_rho);
1903 }
1904
1905 // Monitor
1906 MonitorPostProc post_proc(mField, commonData);
1907 TsCtx *ts_ctx;
1908 DMMoFEMGetTsCtx(dm, &ts_ctx);
1909 {
1910 ts_ctx->getPostProcessMonitor().push_back(&post_proc);
1911 CHKERR TSMonitorSet(ts, TsMonitorSet, ts_ctx, PETSC_NULL);
1912 }
1913
1914#if PETSC_VERSION_GE(3, 7, 0)
1915 CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_STEPOVER);
1916#endif
1917 CHKERR TSSolve(ts, D);
1918 CHKERR TSGetTime(ts, &ftime);
1919 PetscInt steps, snesfails, rejects, nonlinits, linits;
1920#if PETSC_VERSION_LE(3, 8, 0)
1921 CHKERR TSGetTimeStepNumber(ts, &steps);
1922#else
1923 CHKERR TSGetStepNumber(ts, &steps);
1924#endif
1925
1926 CHKERR TSGetSNESFailures(ts, &snesfails);
1927 CHKERR TSGetStepRejections(ts, &rejects);
1928 CHKERR TSGetSNESIterations(ts, &nonlinits);
1929 CHKERR TSGetKSPIterations(ts, &linits);
1930 PetscPrintf(PETSC_COMM_WORLD,
1931 "steps %D (%D rejected, %D SNES fails), ftime %g, nonlinits %D, "
1932 "linits %D\n",
1933 steps, rejects, snesfails, ftime, nonlinits, linits);
1934
1936 if (commonData.cUrrent_psi < 1.67 || commonData.cUrrent_psi > 1.68)
1937 SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID, "atom test diverged");
1938 }
1939
1941}
@ ROW
@ MOFEM_ATOM_TEST_INVALID
Definition definitions.h:40
@ F
PetscErrorCode DMMoFEMGetProblemPtr(DM dm, const MoFEM::Problem **problem_ptr)
Get pointer to problem data structure.
Definition DMMoFEM.cpp:422
PetscErrorCode DMMoFEMGetTsCtx(DM dm, MoFEM::TsCtx **ts_ctx)
get MoFEM::TsCtx data structure
Definition DMMoFEM.cpp:1132
double D
MoFEM::TsCtx * ts_ctx
PetscErrorCode TsMonitorSet(TS ts, PetscInt step, PetscReal t, Vec u, void *ctx)
Set monitor for TS solver.
Definition TsCtx.cpp:263
PetscBool is_atom_testing
for atom tests
double cUrrent_psi
current free energy for evaluating equilibrium state
Section manager is used to create indexes and sections.
Definition ISManager.hpp:23
keeps basic data about problem
Interface for Time Stepping (TS) solver.
Definition TsCtx.hpp:17
BasicMethodsSequence & getPostProcessMonitor()
Get the postProcess to do Monitor object.
Definition TsCtx.hpp:148

Member Data Documentation

◆ commonData

CommonData& BoneRemodeling::Remodeling::commonData
Examples
Remodeling.cpp, and Remodeling.hpp.

Definition at line 207 of file Remodeling.hpp.

◆ mField

MoFEM::Interface& BoneRemodeling::Remodeling::mField
Examples
Remodeling.cpp, and Remodeling.hpp.

Definition at line 206 of file Remodeling.hpp.


The documentation for this struct was generated from the following files: