Skip to content

Commit 2d5570c

Browse files
committed
Updated plotting of damage to differentiate between mixtures of solids that include damage and single damage materials. For mixtures of solid, the damage is averaged over all components that include damage models.
1 parent 3e7be50 commit 2d5570c

1 file changed

Lines changed: 51 additions & 25 deletions

File tree

FEBioMech/FEBioMechPlot.cpp

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,34 +3023,60 @@ bool FEPlotDamage::Save(FEDomain &dom, FEDataStream& a)
30233023
{
30243024
if (m_comp == -1) {
30253025
writeAverageElementValue<double>(dom, a, [](const FEMaterialPoint& pt) {
3026-
const FEReactiveMaterialPoint* ppd = pt.ExtractData<FEReactiveMaterialPoint>();
3026+
const FEReactiveMaterialPoint* prv = pt.ExtractData<FEReactiveMaterialPoint>();
30273027
FEElasticMixtureMaterialPoint* pem = const_cast<FEElasticMixtureMaterialPoint*>(pt.ExtractData<FEElasticMixtureMaterialPoint>());
30283028
FEMultigenerationMaterialPoint* pmg = const_cast<FEMultigenerationMaterialPoint*>(pt.ExtractData<FEMultigenerationMaterialPoint>());
30293029
double D = 0.0;
3030-
if (ppd) D += (float)ppd->BrokenBonds();
3031-
else if (pem) {
3032-
for (int k = 0; k < pem->Components(); ++k)
3033-
{
3034-
const FEReactiveMaterialPoint* ppd = pem->GetPointData(k)->ExtractData<FEReactiveMaterialPoint>();
3035-
if (ppd) D += (float)ppd->BrokenBonds();
3036-
}
3037-
}
3038-
else if (pmg) {
3039-
for (int k = 0; k < pmg->Components(); ++k)
3040-
{
3041-
FEReactiveMaterialPoint* ppd = pmg->GetPointData(k)->ExtractData<FEReactiveMaterialPoint>();
3042-
FEElasticMixtureMaterialPoint* pem = pmg->GetPointData(k)->ExtractData<FEElasticMixtureMaterialPoint>();
3043-
if (ppd) D += (float)ppd->BrokenBonds();
3044-
else if (pem)
3045-
{
3046-
for (int l = 0; l < pem->Components(); ++l)
3047-
{
3048-
FEReactiveMaterialPoint* ppd = pem->GetPointData(l)->ExtractData<FEReactiveMaterialPoint>();
3049-
if (ppd) D += (float)ppd->BrokenBonds();
3050-
}
3051-
}
3052-
}
3053-
}
3030+
if (prv && pem) {
3031+
int n = 0;
3032+
for (int k = 0; k < pem->Components(); ++k)
3033+
{
3034+
const FEReactiveMaterialPoint* prm = pem->GetPointData(k)->ExtractData<FEReactiveMaterialPoint>();
3035+
if (prm) {
3036+
n++;
3037+
D += (float)prm->BrokenBonds();
3038+
}
3039+
}
3040+
if (n > 0) D /= n;
3041+
}
3042+
else if (prv && pmg) {
3043+
int n = 0;
3044+
for (int k = 0; k < pmg->Components(); ++k) {
3045+
FEReactiveMaterialPoint* prm = pmg->GetPointData(k)->ExtractData<FEReactiveMaterialPoint>();
3046+
if (prm) {
3047+
n++;
3048+
D += (float)prm->BrokenBonds();
3049+
}
3050+
}
3051+
if (n > 0) D /= n;
3052+
}
3053+
else if (pem) {
3054+
int n = 0;
3055+
for (int k = 0; k < pem->Components(); ++k)
3056+
{
3057+
FEElasticMixtureMaterialPoint* pep = pem->GetPointData(k)->ExtractData<FEElasticMixtureMaterialPoint>();
3058+
FEDamageMaterialPoint* pdm = pep->ExtractData<FEDamageMaterialPoint>();
3059+
if (pdm) {
3060+
n++;
3061+
D += (float)pdm->m_D;
3062+
}
3063+
}
3064+
if (n > 0) D /= n;
3065+
}
3066+
else if (pmg) {
3067+
int n = 0;
3068+
for (int k = 0; k < pmg->Components(); ++k)
3069+
{
3070+
FEMultigenerationMaterialPoint* pmp = pmg->GetPointData(k)->ExtractData<FEMultigenerationMaterialPoint>();
3071+
FEDamageMaterialPoint* ppd = pmp->ExtractData<FEDamageMaterialPoint>();
3072+
if (ppd) {
3073+
n++;
3074+
D += (float)ppd->m_D;
3075+
}
3076+
}
3077+
if (n > 0) D /= n;
3078+
}
3079+
else if (prv) D += (float)prv->BrokenBonds();
30543080
return D;
30553081
});
30563082
return true;

0 commit comments

Comments
 (0)