Skip to content

Commit

Permalink
Added explicit check for zero shell thicknesses.
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMaas1978 committed Aug 6, 2024
1 parent 66314f0 commit 3feca5d
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 25 deletions.
6 changes: 4 additions & 2 deletions FEBioMech/FEMechModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ bool FEMechModel::InitMesh()

//-----------------------------------------------------------------------------
//! Initialize shells
void FEMechModel::InitShells()
bool FEMechModel::InitShells()
{
// Base class does most of the work
FEModel::InitShells();
if (!FEModel::InitShells()) return false;

// NOTE: This was moved here because I wanted to FEMaterial::IsRigid to FESolidMaterial::IsRigid
// This was part of the move to rid the FECore library of rigid stuff
Expand Down Expand Up @@ -206,6 +206,8 @@ void FEMechModel::InitShells()
}
}
}

return true;
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion FEBioMech/FEMechModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class FEBIOMECH_API FEMechModel : public FEModel
bool InitMesh() override;

//! Initialize shells
void InitShells() override;
bool InitShells() override;

// find a parameter value
FEParamValue GetParameterValue(const ParamString& param) override;
Expand Down
28 changes: 23 additions & 5 deletions FEBioMech/FESSIShellDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,29 @@ void FESSIShellDomain::Serialize(DumpStream& ar)
//-----------------------------------------------------------------------------
//! Calculate all shell normals (i.e. the shell directors).
//! And find shell nodes
void FESSIShellDomain::InitShells()
bool FESSIShellDomain::InitShells()
{
FEShellDomain::InitShells();

if (!FEShellDomain::InitShells()) return false;

FEMesh& mesh = *GetMesh();

// check for zero shell thickness
for (int i = 0; i < Elements(); ++i)
{
FEShellElementNew& el = ShellElement(i);
int nn = el.Nodes();
for (int j = 0; j < nn; ++j)
{
if (el.m_h0[j] <= 0.0)
{
string name = GetName();
feLogError("Zero shell thickness found in \"%s\"", name.c_str());
return false;
}
}
}

if (!m_bnodalnormals) {
FEMesh& mesh = *GetMesh();
for (int i = 0; i<Elements(); ++i)
{
FEShellElementNew& el = ShellElement(i);
Expand All @@ -122,7 +139,6 @@ void FESSIShellDomain::InitShells()
}
}

FEMesh& mesh = *GetMesh();
for (int i = 0; i < Elements(); ++i)
{
FEShellElementNew& el = ShellElement(i);
Expand All @@ -142,6 +158,8 @@ void FESSIShellDomain::InitShells()
el.m_G0[2][j] = el.m_Gt[2][j] = g0[2];
}
}

return true;
}

//-----------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions FEBioMech/FESSIShellDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ class FEBIOMECH_API FESSIShellDomain : public FEShellDomainNew
public:
FESSIShellDomain(FEModel* pfem);

//! initialize domain
//! one-time initialization, called during model initialization
//! initialize domain
//! one-time initialization, called during model initialization
bool Init() override;

//! serialization
void Serialize(DumpStream& ar) override;

//! Update element data prior to solving time step
void PreSolveUpdate(const FETimeInfo& timeInfo) override;
//! Initialize shell normals
void InitShells() override;

//! Initialize shell normals
bool InitShells() override;

protected:
//! Find interfaces between solid element faces and shell elements
void FindSSI();
Expand Down
2 changes: 1 addition & 1 deletion FEBioOpt/FEBioParamRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool FEBioParamRun::Init(const char* szfile)
FEShellDomainNew* shellDomain = dynamic_cast<FEShellDomainNew*>(&mesh.Domain(i));
if (shellDomain) shellDomain->AssignDefaultShellThickness();
}
fem->InitShells();
if (!fem->InitShells()) return false;

return true;
}
Expand Down
12 changes: 9 additions & 3 deletions FECore/FEModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,11 @@ bool FEModel::InitMesh()

// Initialize shell data
// This has to be done before the domains are initialized below
InitShells();
if (!InitShells())
{
feLogError("Errors found during initialization of shells.");
return false;
}

// reset data
// TODO: Not sure why this is here
Expand Down Expand Up @@ -1064,7 +1068,7 @@ void FEModel::ValidateMesh()
}

//-----------------------------------------------------------------------------
void FEModel::InitShells()
bool FEModel::InitShells()
{
FEMesh& mesh = GetMesh();

Expand Down Expand Up @@ -1120,9 +1124,11 @@ void FEModel::InitShells()
if (dom.Class() == FE_DOMAIN_SHELL)
{
FEShellDomain& shellDom = static_cast<FEShellDomain&>(dom);
shellDom.InitShells();
if (!shellDom.InitShells()) return false;
}
}

return true;
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion FECore/FEModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class FECORE_API FEModel : public FECoreBase, public CallbackHandler
void ValidateMesh();

//! Initialize shells
virtual void InitShells();
virtual bool InitShells();

//! Build the matrix profile for this model
virtual void BuildMatrixProfile(FEGlobalMatrix& G, bool breset);
Expand Down
10 changes: 7 additions & 3 deletions FECore/FEShellDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ void FEShellDomain::Reset()
}

//-----------------------------------------------------------------------------
void FEShellDomain::InitShells()
bool FEShellDomain::InitShells()
{
ForEachShellElement([](FEShellElement& el) {
int n = el.Nodes();
for (int j = 0; j<n; ++j) el.m_ht[j] = el.m_h0[j];
});

return true;
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -205,9 +207,9 @@ double FEShellDomainOld::Volume(FEShellElement& se)
//-----------------------------------------------------------------------------
//! Calculate all shell normals (i.e. the shell directors).
//! And find shell nodes
void FEShellDomainOld::InitShells()
bool FEShellDomainOld::InitShells()
{
FEShellDomain::InitShells();
if (!FEShellDomain::InitShells()) return false;

FEMesh& mesh = *GetMesh();
for (int i = 0; i<Elements(); ++i)
Expand All @@ -221,6 +223,8 @@ void FEShellDomainOld::InitShells()
el.m_D0[j] = d0 * el.m_h0[j];
}
}

return true;
}

//=================================================================================================
Expand Down
4 changes: 2 additions & 2 deletions FECore/FEShellDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class FECORE_API FEShellDomain : public FEDomain
virtual double CurrentVolume(FEShellElement& el) { return 0.0; }

// Initialize shell data (Called from FEMesh::InitShells)
virtual void InitShells();
virtual bool InitShells();

virtual void AssignDefaultShellThickness() {}

Expand Down Expand Up @@ -102,7 +102,7 @@ class FECORE_API FEShellDomainOld : public FEShellDomain

double Volume(FEShellElement& el) override;

void InitShells() override;
bool InitShells() override;

protected:
vector<FEShellElementOld> m_Elem; //!< array of elements
Expand Down

0 comments on commit 3feca5d

Please sign in to comment.