Added setting of initial condition
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@869 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
@@ -90,7 +90,7 @@ bool NonLinSIM::parse (char* keyWord, std::istream& is)
|
||||
}
|
||||
|
||||
|
||||
void NonLinSIM::init (SolvePrm& param)
|
||||
void NonLinSIM::init (SolvePrm& param, const Vector& initVal)
|
||||
{
|
||||
param.startTime = startTime;
|
||||
param.stopTime = stopTime;
|
||||
@@ -103,12 +103,15 @@ void NonLinSIM::init (SolvePrm& param)
|
||||
param.divgLim = divgLim;
|
||||
param.eta = eta;
|
||||
|
||||
// TODO perhaps set initial conditions for time-dependent problems here
|
||||
size_t nSols = model->getNoSolutions();
|
||||
if (nSols < 2) nSols = 2;
|
||||
solution.resize(nSols);
|
||||
for (size_t n = 0; n < nSols; n++)
|
||||
solution[n].resize(model->getNoDOFs(),true);
|
||||
|
||||
// Set initial conditions for time-dependent problems
|
||||
if (initVal.size() == model->getNoDOFs())
|
||||
solution.front() = initVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ public:
|
||||
};
|
||||
|
||||
//! \brief Initializes the solution parameters with values read from file.
|
||||
virtual void init(SolvePrm& param);
|
||||
//! \param param Solution algorithm parameters
|
||||
//! \param[in] initVal Initial values of the primary solution
|
||||
virtual void init(SolvePrm& param, const Vector& initVal = Vector());
|
||||
//! \brief Advances the time/load step one step forward.
|
||||
virtual bool advanceStep(SolvePrm& param);
|
||||
|
||||
@@ -65,6 +67,10 @@ public:
|
||||
//! \param[in] nViz Number of visualization points over a knot-span
|
||||
bool saveModel(char* fileName, int format, int* nViz);
|
||||
|
||||
//! \brief Sets the initial guess in the Newton-Raphson iterations.
|
||||
//! \param value The initial guess to use
|
||||
void setInitialGuess(const Vector& value) { solution.front() = value; }
|
||||
|
||||
//! \brief Solves the nonlinear equations by Newton-Raphson iterations.
|
||||
//! \param param Solution algorithm parameters
|
||||
//! \param[in] mode Solution mode to use for this step
|
||||
@@ -98,6 +104,9 @@ public:
|
||||
void dumpStep(int iStep, double time, std::ostream& os,
|
||||
bool withID = true) const;
|
||||
|
||||
//! \brief Returns a const reference to current solution vector.
|
||||
const Vector& getSolution() const { return solution.front(); }
|
||||
|
||||
protected:
|
||||
//! \brief Convergence status enum.
|
||||
enum ConvStatus { NONE, CONVERGED, DIVERGED };
|
||||
|
||||
@@ -602,7 +602,9 @@ bool SIMbase::solutionNorms (const TimeDomain& time, const Vectors& psol,
|
||||
NormBase* norm = myProblem->getNormIntegrand(mySol);
|
||||
if (!norm)
|
||||
{
|
||||
#ifdef SP_DEBUG
|
||||
std::cerr <<" *** SIMbase::solutionNorms: No integrand."<< std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user