Added evaluation for solution at user-defined points
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@900 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
@@ -22,10 +22,8 @@
|
||||
|
||||
|
||||
NonlinearElasticityUL::NonlinearElasticityUL (unsigned short int n, char lop)
|
||||
: Elasticity(n)
|
||||
: Elasticity(n), loadOp(lop), plam(-999.9)
|
||||
{
|
||||
loadOp = lop;
|
||||
|
||||
// Only the current solution is needed
|
||||
primsol.resize(1);
|
||||
}
|
||||
@@ -94,10 +92,13 @@ void NonlinearElasticityUL::initIntegration (const TimeDomain& prm)
|
||||
}
|
||||
|
||||
|
||||
void NonlinearElasticityUL::initResultPoints ()
|
||||
void NonlinearElasticityUL::initResultPoints (double lambda)
|
||||
{
|
||||
if (material)
|
||||
if (material && lambda > plam)
|
||||
{
|
||||
material->initResultPoints();
|
||||
plam = lambda;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ public:
|
||||
//! \param[in] prm Nonlinear solution algorithm parameters
|
||||
virtual void initIntegration(const TimeDomain& prm);
|
||||
//! \brief Initializes the integrand for a result point loop.
|
||||
virtual void initResultPoints();
|
||||
//! \param[in] lambda Load parameter
|
||||
virtual void initResultPoints(double lambda);
|
||||
|
||||
//! \brief Evaluates the integrand at an interior point.
|
||||
//! \param elmInt The local integral object to receive the contributions
|
||||
@@ -94,6 +95,7 @@ protected:
|
||||
|
||||
private:
|
||||
char loadOp; //!< Load option
|
||||
double plam; //!< Load parameter of the previous result evaluation
|
||||
|
||||
friend class ElasticityNormUL;
|
||||
};
|
||||
|
||||
@@ -104,12 +104,14 @@ void PlasticMaterial::initIntegration (const TimeDomain& prm)
|
||||
|
||||
if (prm.it > 0 || prm.first) return;
|
||||
|
||||
int nUpdated = 0;
|
||||
for (size_t i = 0; i < itgPoints.size(); i++)
|
||||
itgPoints[i]->updateHistoryVars();
|
||||
if (itgPoints[i]->updateHistoryVars())
|
||||
nUpdated++;
|
||||
|
||||
#if INT_DEBUG > 0
|
||||
std::cout <<"PlasticMaterial::initIntegration: History updated "
|
||||
<< itgPoints.size() << std::endl;
|
||||
<< nUpdated << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -123,12 +125,14 @@ void PlasticMaterial::initResultPoints ()
|
||||
iP2 = 0;
|
||||
iAmIntegrating = false;
|
||||
|
||||
int nUpdated = 0;
|
||||
for (size_t i = 0; i < resPoints.size(); i++)
|
||||
resPoints[i]->updateHistoryVars();
|
||||
if (resPoints[i]->updateHistoryVars())
|
||||
nUpdated++;
|
||||
|
||||
#if INT_DEBUG > 0
|
||||
std::cout <<"PlasticMaterial::initResultPoints: History updated "
|
||||
<< resPoints.size() << std::endl;
|
||||
<< nUpdated << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -170,7 +174,7 @@ bool PlasticMaterial::evaluate (Matrix& C, SymmTensor& sigma, double&,
|
||||
|
||||
PlasticMaterial::PlasticPoint::PlasticPoint (const PlasticMaterial* prm,
|
||||
unsigned short int n)
|
||||
: pMAT(prm->pMAT), Fp(n)
|
||||
: pMAT(prm->pMAT), updated(false), Fp(n)
|
||||
{
|
||||
// Initialize the history variables
|
||||
memset(HVc,0,sizeof(HVc));
|
||||
@@ -179,10 +183,15 @@ PlasticMaterial::PlasticPoint::PlasticPoint (const PlasticMaterial* prm,
|
||||
}
|
||||
|
||||
|
||||
void PlasticMaterial::PlasticPoint::updateHistoryVars ()
|
||||
bool PlasticMaterial::PlasticPoint::updateHistoryVars ()
|
||||
{
|
||||
if (!updated) return false;
|
||||
|
||||
// Update history variables with values of the new converged solution
|
||||
memcpy(HVp,HVc,sizeof(HVc));
|
||||
updated = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -209,6 +218,12 @@ bool PlasticMaterial::PlasticPoint::evaluate (Matrix& C,
|
||||
int ierr = -99;
|
||||
#ifdef USE_FTNMAT
|
||||
// Invoke the FORTRAN routine for plasticity material models
|
||||
#if INT_DEBUG > 0
|
||||
std::cout <<"PlasticMaterial::Fp =\n"<< Fp;
|
||||
std::cout <<"PlasticMaterial::HV =";
|
||||
for (int i = 0; i < 10; i++) std::cout <<" "<< HVc[i];
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
if (ndim == 2)
|
||||
plas2d_(INT_DEBUG,6,prm.it,prm.first,4,&pMAT.front(),J,F.dim(),
|
||||
F.ptr(),Fp.ptr(),HVc,HVc[6],HVc+7,sigma.ptr(),C.ptr(),ierr);
|
||||
@@ -223,5 +238,6 @@ bool PlasticMaterial::PlasticPoint::evaluate (Matrix& C,
|
||||
std::cerr <<" *** PlasticMaterial::evaluate: Not included."<< std::endl;
|
||||
#endif
|
||||
|
||||
const_cast<PlasticPoint*>(this)->updated = true;
|
||||
return ierr == 0;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class PlasticMaterial : public Material
|
||||
PlasticPoint(const PlasticMaterial* prm, unsigned short int n);
|
||||
|
||||
//! \brief Updates the internal history variables after convergence.
|
||||
void updateHistoryVars();
|
||||
bool updateHistoryVars();
|
||||
|
||||
//! \brief Evaluates the constitutive relation at this point.
|
||||
//! \param[out] C Constitutive matrix at current point
|
||||
@@ -67,6 +67,7 @@ class PlasticMaterial : public Material
|
||||
|
||||
double HVc[10]; //!< History variables, current configuration
|
||||
double HVp[10]; //!< History variables, previous configuration
|
||||
bool updated; //!< Flag indicating whether history variables are updated
|
||||
|
||||
public:
|
||||
Tensor Fp; //!< Deformation gradient, previous configuration
|
||||
|
||||
@@ -76,7 +76,7 @@ int main (int argc, char** argv)
|
||||
bool twoD = false;
|
||||
char* infile = 0;
|
||||
|
||||
LinAlgInit linalg(argc,argv);
|
||||
const LinAlgInit& linalg = LinAlgInit::Init(argc,argv);
|
||||
|
||||
std::vector<int> options(2,0);
|
||||
for (int i = 1; i < argc; i++)
|
||||
@@ -294,6 +294,9 @@ int main (int argc, char** argv)
|
||||
if (!simulator.solveStep(params,SIM::STATIC))
|
||||
return 5;
|
||||
|
||||
// Print solution components at the user-defined points
|
||||
simulator.dumpResults(params.time.t,std::cout);
|
||||
|
||||
if (params.time.t + epsT*params.time.dt > nextDump)
|
||||
{
|
||||
// Dump primary solution for inspection or external processing
|
||||
|
||||
Reference in New Issue
Block a user