36 #include <boost/format.hpp>
55 RegisterCreatorFunction(
"IterativeElasticSystem",
56 IterativeElasticSystem::create);
58 IterativeElasticSystem::IterativeElasticSystem(
68 const int nVel =
m_fields[0]->GetCoordim(0);
77 m_session->LoadSolverInfo(
"BCType", bcType,
"Normal");
84 &bndCond =
m_fields[0]->GetBndConditions();
86 for (
int i = 0; i < bndCond.num_elements(); ++i)
88 if (boost::iequals(bndCond[i]->GetUserDefined(),
"Wall"))
96 ASSERTL0(numDeform > 0,
"You must specify at least one WALL tag on"
97 "a boundary condition");
105 for (
int j = 0; j < nVel; ++j)
109 m_fields[j]->GetBndCondExpansions()[id];
110 int nCoeffs = bndCondExp->GetNcoeffs();
114 bndCondExp->GetCoeffs(), 1,
115 bndCondExp->UpdateCoeffs(), 1);
138 int invalidElmtId = -1;
146 for (j = 0; j <
m_fields[0]->GetExpSize(); ++j)
149 m_fields[0]->GetExp(j)->GetGeom()->GetGeomFactors();
151 if (!geomFac->IsValid())
154 m_fields[0]->GetExp(j)->GetGeom()->GetGlobalID();
162 if (invalidElmtId >= 0)
164 if (
m_session->GetComm()->GetRank() == 0)
166 cout <<
"- Detected negative Jacobian in element "
167 << invalidElmtId <<
"; terminating at"
174 if (
m_session->GetComm()->GetRank() == 0)
176 cout <<
"Step: " << i << endl;
182 for (j = 0; j <
m_fields.num_elements(); ++j)
184 string varName =
m_session->GetVariable(j);
190 for (j = 0; j <
m_fields.num_elements(); ++j)
193 &bndCondExp =
m_fields[j]->GetBndCondExpansions();
198 const int nCoeffs = bndCondExp[id]->GetNcoeffs();
201 bndCondExp[
id]->UpdateCoeffs(), 1);
216 s <<
m_session->GetSessionName() <<
"-" << i;
223 if(!fs::is_directory(ss))
225 fs::create_directory(ss);
230 filename = fs::path(ss) / fs::path(pad.str());
235 filename = fs::path(s.str());
239 m_fields[0]->GetGraph()->WriteGeometry(fname);
#define ASSERTL0(condition, msg)
virtual void v_InitObject()
Set up the linear elasticity system.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Generate summary at runtime.
NekDouble m_time
Current time of simulation.
std::vector< std::pair< std::string, std::string > > SummaryList
int m_numSteps
Number of steps to split deformation across.
virtual void v_DoSolve()
Solve elliptic linear elastic system.
bool m_repeatBCs
Flag determining whether to repeat boundary conditions.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
LibUtilities::CommSharedPtr m_comm
Communicator.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_savedBCs
Storage for boundary conditions.
Base class for linear elastic system.
std::vector< int > m_toDeform
Vector of boundary regions to deform.
virtual void v_InitObject()
Set up the linear elasticity system.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Generate summary at runtime.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::string PortablePath(const boost::filesystem::path &path)
create portable path on different platforms for boost::filesystem path
void UpdateGeometry(SpatialDomains::MeshGraphSharedPtr graph, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, bool modal)
Update geometry according to displacement that is in current fields.
EquationSystemFactory & GetEquationSystemFactory()
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
virtual void v_DoSolve()
Solve elliptic linear elastic system.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
void WriteGeometry(const int i)
Write out a file in serial or directory in parallel containing new mesh geometry. ...