Skip to content

Commit

Permalink
Merge branch 'develop' into erosion_changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMaas1978 committed Oct 24, 2024
2 parents d4174dc + 8fb2d34 commit 29c30d8
Show file tree
Hide file tree
Showing 59 changed files with 1,534 additions and 109 deletions.
6 changes: 3 additions & 3 deletions Documentation/Doxygen/register.dox
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ The following code excerpt presents an example of PluginInitialize.
\code
FECORE_EXPORT void PluginInitialize(FECoreKernel& fecore)
{
\\ Set the kernel to match FEBio's kernel
// Set the kernel to match FEBio's kernel
FECoreKernel::SetInstance(&fecore);

\\ set the active module to which to add this new feature
// set the active module to which to add this new feature
fecore.SetActiveModule("solid");

\\ Register the classes in this plugin
// Register the classes in this plugin
REGISTER_FECORE_CLASS(MyMaterial, "My material");
}
\endcode
Expand Down
8 changes: 3 additions & 5 deletions FEBio/FEBioApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,14 @@ int FEBioApp::RunModel()
{
// read the input file
if (fem.Input(m_ops.szfile) == false) nret = 1;
else
{
// apply configuration overrides
ApplyConfig(fem);
}
}

// solve the model with the task and control file
if (nret == 0)
{
// apply configuration overrides
ApplyConfig(fem);

bool bret = febio::SolveModel(fem, m_ops.sztask, m_ops.szctrl);

nret = (bret ? 0 : 1);
Expand Down
2 changes: 1 addition & 1 deletion FEBioFluid/FEFluidFSISolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ bool FEFluidFSISolver::StiffnessMatrix()
// get the mesh
FEMesh& mesh = fem.GetMesh();

FESolidLinearSystem LS(this, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alphaf, m_nreq);
FESolidLinearSystem LS(&fem, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alphaf, m_nreq);

// calculate the stiffness matrix for each domain
for (int i=0; i<mesh.Domains(); ++i)
Expand Down
2 changes: 1 addition & 1 deletion FEBioFluid/FEMultiphasicFSISolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ bool FEMultiphasicFSISolver::StiffnessMatrix()
// get the mesh
FEMesh& mesh = fem.GetMesh();

FESolidLinearSystem LS(this, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alphaf, m_nreq);
FESolidLinearSystem LS(&fem, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alphaf, m_nreq);

// calculate the stiffness matrix for each domain
for (int i=0; i<mesh.Domains(); ++i)
Expand Down
38 changes: 28 additions & 10 deletions FEBioLib/FEBioModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ ModelStats FEBioModel::GetModelStats() const

ModelStats FEBioModel::GetStepStats(size_t n) const
{
assert((n >= 0) && (n < Steps()));
return m_stepStats[n];
}

Expand Down Expand Up @@ -1336,6 +1335,28 @@ void FEBioModel::Serialize(DumpStream& ar)

// --- Save IO Data
SerializeIOData(ar);

if (ar.IsSaving())
{
int n = (int)m_stepStats.size();
ar << n;
for (ModelStats& s : m_stepStats)
{
ar << s.ntimeSteps << s.ntotalIters << s.ntotalReforms << s.ntotalRHS;
}
}
else
{
m_stepStats.clear();
int n = 0;
ar >> n;
for (int i = 0; i < n; ++i)
{
ModelStats s;
ar >> s.ntimeSteps >> s.ntotalIters >> s.ntotalReforms >> s.ntotalRHS;
m_stepStats.push_back(s);
}
}
}
}

Expand Down Expand Up @@ -1546,7 +1567,7 @@ bool FEBioModel::Init()
}

m_report.clear();
m_stepStats.resize(Steps());
m_stepStats.clear();

FEBioPlotFile* pplt = nullptr;
m_lastUpdate = -1;
Expand Down Expand Up @@ -1640,6 +1661,9 @@ bool FEBioModel::InitLogFile()

bool FEBioModel::Solve()
{
// The total time is usually started on calling Input,
// however, in a restart Input is not called, so we start it here.
if (!m_TotalTime.isRunning()) m_TotalTime.start();
bool b = FEModel::Solve();
m_TotalTime.stop();
return b;
Expand Down Expand Up @@ -1693,13 +1717,7 @@ bool FEBioModel::Reset()
m_modelStats.ntotalIters = 0;
m_modelStats.ntotalRHS = 0;
m_modelStats.ntotalReforms = 0;
for (auto& s : m_stepStats)
{
s.ntimeSteps = 0;
s.ntotalIters = 0;
s.ntotalRHS = 0;
s.ntotalReforms = 0;
}
m_stepStats.clear();

// do the callback
DoCallback(CB_INIT);
Expand Down Expand Up @@ -1860,7 +1878,7 @@ void FEBioModel::on_cb_stepSolved()
stats.ntotalIters = step->m_ntotiter;
stats.ntotalRHS = step->m_ntotrhs;
stats.ntotalReforms = step->m_ntotref;
m_stepStats[GetCurrentStepIndex()] = stats;
m_stepStats.push_back(stats);
m_modelStats.ntimeSteps += stats.ntimeSteps;
m_modelStats.ntotalIters += stats.ntotalIters;
m_modelStats.ntotalRHS += stats.ntotalRHS;
Expand Down
2 changes: 2 additions & 0 deletions FEBioLib/FEBioRestart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SOFTWARE.*/
#include <FEBioXML/FERestartImport.h>
#include <FECore/DumpFile.h>
#include <FECore/FEAnalysis.h>
#include "FEBioModelBuilder.h"

//-----------------------------------------------------------------------------
FEBioRestart::FEBioRestart(FEModel* pfem) : FECoreTask(pfem) {}
Expand Down Expand Up @@ -75,6 +76,7 @@ bool FEBioRestart::Init(const char* szfile)

// the file is assumed to be a xml-text input file
FERestartImport file;
file.SetModelBuilder(new FEBioModelBuilder(fem));
if (file.Load(fem, szfile) == false)
{
char szerr[256];
Expand Down
6 changes: 6 additions & 0 deletions FEBioMech/FEDonnanEquilibrium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ bool FEDonnanEquilibrium::Init()
return FEElasticMaterial::Init();
}

void FEDonnanEquilibrium::Serialize(DumpStream& ar)
{
FEElasticMaterial::Serialize(ar);
ar & m_Rgas & m_Tabs & m_binit & m_bnew & m_phiwr;
}

//-----------------------------------------------------------------------------
mat3ds FEDonnanEquilibrium::Stress(FEMaterialPoint& mp)
{
Expand Down
2 changes: 2 additions & 0 deletions FEBioMech/FEDonnanEquilibrium.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class FEDonnanEquilibrium : public FEElasticMaterial
//! Initialization routine
bool Init() override;

void Serialize(DumpStream& ar) override;

//! Returns the Cauchy stress
mat3ds Stress(FEMaterialPoint& mp) override;

Expand Down
2 changes: 1 addition & 1 deletion FEBioMech/FEFacet2FacetSliding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ void FEFacet2FacetSliding::StiffnessMatrix(FELinearSystem& LS, const FETimeInfo&
FEMesh* pm = m_ss.GetMesh();

// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

// get the "size" of the model
// We need this to scale the insertion distance
Expand Down
6 changes: 6 additions & 0 deletions FEBioMech/FEReactiveViscoelastic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,3 +762,9 @@ double FEReactiveViscoelasticMaterial::Damage(FEMaterialPoint& mp)
}
return D;
}

void FEReactiveViscoelasticMaterial::Serialize(DumpStream& ar)
{
FEElasticMaterial::Serialize(ar);
ar & m_nmax;
}
4 changes: 3 additions & 1 deletion FEBioMech/FEReactiveViscoelastic.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class FEReactiveViscoelasticMaterial : public FEElasticMaterial
//! data initialization
bool Init() override;

void Serialize(DumpStream& ar) override;

//! stress function
mat3ds Stress(FEMaterialPoint& pt) override;
mat3ds StressStrongBonds(FEMaterialPoint& pt);
Expand Down Expand Up @@ -105,7 +107,7 @@ class FEReactiveViscoelasticMaterial : public FEElasticMaterial

//! evaluate scalar strain measure (same type as trigger strain for bond breaking)
double ScalarStrain(FEMaterialPoint& mp);

private:
FEElasticMaterial* m_pBase; //!< pointer to elastic solid material for strong bonds
FEElasticMaterial* m_pBond; //!< pointer to elastic solid material for reactive bonds
Expand Down
2 changes: 1 addition & 1 deletion FEBioMech/FESlidingElasticInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ void FESlidingElasticInterface::LoadVector(FEGlobalVector& R, const FETimeInfo&
void FESlidingElasticInterface::StiffnessMatrix(FELinearSystem& LS, const FETimeInfo& tp)
{
// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

const int MN = FEElement::MAX_NODES;

Expand Down
6 changes: 3 additions & 3 deletions FEBioMech/FESolidLinearSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ SOFTWARE.*/
#include <FECore/FELinearConstraintManager.h>
#include <FECore/FEModel.h>

FESolidLinearSystem::FESolidLinearSystem(FESolver* solver, FERigidSolver* rigidSolver, FEGlobalMatrix& K, std::vector<double>& F, std::vector<double>& u, bool bsymm, double alpha, int nreq) : FELinearSystem(solver, K, F, u, bsymm)
FESolidLinearSystem::FESolidLinearSystem(FEModel* fem, FERigidSolver* rigidSolver, FEGlobalMatrix& K, std::vector<double>& F, std::vector<double>& u, bool bsymm, double alpha, int nreq) : FELinearSystem(fem, K, F, u, bsymm)
{
m_fem = fem;
m_rigidSolver = rigidSolver;
m_alpha = alpha;
m_nreq = nreq;
Expand Down Expand Up @@ -73,8 +74,7 @@ void FESolidLinearSystem::Assemble(const FEElementMatrix& ke)
vector<double>& ui = m_u;

// adjust for linear constraints
FEModel* fem = m_solver->GetFEModel();
FELinearConstraintManager& LCM = fem->GetLinearConstraintManager();
FELinearConstraintManager& LCM = m_fem->GetLinearConstraintManager();
if (LCM.LinearConstraints() > 0)
{
#pragma omp critical (LCM_assemble)
Expand Down
3 changes: 2 additions & 1 deletion FEBioMech/FESolidLinearSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FERigidSolver;
class FEBIOMECH_API FESolidLinearSystem : public FELinearSystem
{
public:
FESolidLinearSystem(FESolver* solver, FERigidSolver* rigidSolver, FEGlobalMatrix& K, std::vector<double>& F, std::vector<double>& u, bool bsymm, double alpha, int nreq);
FESolidLinearSystem(FEModel* fem, FERigidSolver* rigidSolver, FEGlobalMatrix& K, std::vector<double>& F, std::vector<double>& u, bool bsymm, double alpha, int nreq);

// Assembly routine
// This assembles the element stiffness matrix ke into the global matrix.
Expand All @@ -46,6 +46,7 @@ class FEBIOMECH_API FESolidLinearSystem : public FELinearSystem
void StiffnessAssemblyScaleFactor(double a);

private:
FEModel* fem;
FERigidSolver* m_rigidSolver;
double m_alpha;
int m_nreq;
Expand Down
2 changes: 1 addition & 1 deletion FEBioMech/FESolidSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ bool FESolidSolver::StiffnessMatrix()
const FETimeInfo& tp = fem.GetTime();

// setup the linear syster
FESolidLinearSystem LS(this, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), 1.0, m_nreq);
FESolidLinearSystem LS(&fem, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), 1.0, m_nreq);

// get the mesh
FEMesh& mesh = fem.GetMesh();
Expand Down
4 changes: 2 additions & 2 deletions FEBioMech/FESolidSolver2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ bool FESolidSolver2::InitAccelerations()

// setup the linear system
m_pK->Zero();
FESolidLinearSystem LS(this, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), 1.0, m_nreq);
FESolidLinearSystem LS(&fem, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), 1.0, m_nreq);

// build the global mass matrix
FEMesh& mesh = fem.GetMesh();
Expand Down Expand Up @@ -1324,7 +1324,7 @@ bool FESolidSolver2::StiffnessMatrix()
FEMesh& mesh = fem.GetMesh();

// setup the linear system
FESolidLinearSystem LS(this, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alpha, m_nreq);
FESolidLinearSystem LS(&fem, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alpha, m_nreq);

// calculate the stiffness matrix for each domain
for (int i=0; i<mesh.Domains(); ++i)
Expand Down
2 changes: 1 addition & 1 deletion FEBioMech/FETiedElasticInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ void FETiedElasticInterface::StiffnessMatrix(FELinearSystem& LS, const FETimeInf
FEElementMatrix ke;

// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

// set higher order stiffness mutliplier
// NOTE: this algrotihm doesn't really need this
Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FEBiphasicSoluteSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ bool FEBiphasicSoluteSolver::StiffnessMatrix()
FEMesh& mesh = fem.GetMesh();

// setup the linear system
FESolidLinearSystem LS(this, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alpha, m_nreq);
FESolidLinearSystem LS(&fem, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alpha, m_nreq);

// calculate the stiffness matrix for each domain
FEAnalysis* pstep = fem.GetCurrentStep();
Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FEBiphasicSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ bool FEBiphasicSolver::StiffnessMatrix()
FEMesh& mesh = fem.GetMesh();

// setup the linear system of equations
FESolidLinearSystem LS(this, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alpha, m_nreq);
FESolidLinearSystem LS(&fem, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alpha, m_nreq);

// calculate the stiffness matrix for each domain
FEAnalysis* pstep = fem.GetCurrentStep();
Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FEMultiphasicSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ bool FEMultiphasicSolver::StiffnessMatrix()
// get the mesh
FEMesh& mesh = fem.GetMesh();

FESolidLinearSystem LS(this, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alpha, m_nreq);
FESolidLinearSystem LS(&fem, &m_rigidSolver, *m_pK, m_Fd, m_ui, (m_msymm == REAL_SYMMETRIC), m_alpha, m_nreq);

// calculate the stiffness matrix for each domain
FEAnalysis* pstep = fem.GetCurrentStep();
Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FESlidingInterface2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ void FESlidingInterface2::StiffnessMatrix(FELinearSystem& LS, const FETimeInfo&
double psf = GetPenaltyScaleFactor();

// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

// set higher order stiffness mutliplier
// NOTE: this algrotihm doesn't really need this
Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FESlidingInterface3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ void FESlidingInterface3::StiffnessMatrix(FELinearSystem& LS, const FETimeInfo&
double psf = GetPenaltyScaleFactor();

// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

// set higher order stiffness mutliplier
// NOTE: this algrotihm doesn't really need this
Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FESlidingInterfaceBiphasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ void FESlidingInterfaceBiphasic::LoadVector(FEGlobalVector& R, const FETimeInfo&
void FESlidingInterfaceBiphasic::StiffnessMatrix(FELinearSystem& LS, const FETimeInfo& tp)
{
// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

const int MN = FEElement::MAX_NODES;

Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FESlidingInterfaceBiphasicMixed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,7 @@ void FESlidingInterfaceBiphasicMixed::StiffnessMatrix(FESlidingSurfaceBiphasicMi
int degree_p = dofs.GetVariableInterpolationOrder(ss.m_varP);

// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

const int MN = FEElement::MAX_NODES;

Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FESlidingInterfaceMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2011,7 +2011,7 @@ void FESlidingInterfaceMP::StiffnessMatrix(FELinearSystem& LS, const FETimeInfo&
double psf = GetPenaltyScaleFactor();

// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

// set higher order stiffness mutliplier
// NOTE: this algorithm doesn't really need this
Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FETiedBiphasicInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ void FETiedBiphasicInterface::StiffnessMatrix(FELinearSystem& LS, const FETimeIn
FEMesh* pm = m_ss.GetMesh();

// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

// set higher order stiffness mutliplier
// NOTE: this algrotihm doesn't really need this
Expand Down
2 changes: 1 addition & 1 deletion FEBioMix/FETiedMultiphasicInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ void FETiedMultiphasicInterface::StiffnessMatrix(FELinearSystem& LS, const FETim
FEModel& fem = *GetFEModel();

// see how many reformations we've had to do so far
int nref = LS.GetSolver()->m_nref;
int nref = GetSolver()->m_nref;

// set higher order stiffness mutliplier
// NOTE: this algorithm doesn't really need this
Expand Down
Loading

0 comments on commit 29c30d8

Please sign in to comment.