Various fixes related to the finite deformation plasticity solver. It now works for a single element, at least.

git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@870 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
kmo 2011-03-22 09:33:06 +00:00 committed by Knut Morten Okstad
parent 98c89cc9b2
commit f6dde60cb9
17 changed files with 208 additions and 180 deletions

View File

@ -4,7 +4,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Required defines
SET(CMAKE_CXX_FLAGS "-Dreal=double -DUSE_FTNMAT")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DINDEX_CHECK=2 -DINT_DEBUG=0")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DINDEX_CHECK=2 -DINT_DEBUG=5")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)

View File

@ -180,9 +180,9 @@ C
istrt = nint(pMAT(13))
C
if (Hk .gt. zero) then
Hkr = one / Hk
Hkr = one / Hk
else
Hkr = zero
Hkr = zero
endif
C
TwoG = two * Smod
@ -259,32 +259,26 @@ C
C COMPUTE TRIAL KIRCHHOFF STRESS ( pressure and deviator )
C
do a = 1, 3
ee_tr(a) = log( sqrt(ll2_tr(a)) ) ! log ( lambda(a)^TR )
ee_tr(a) = log( sqrt(ll2_tr(a)) ) ! log ( lambda(a)^TR )
end do ! a
C
th_tr = ee_tr(1) + ee_tr(2) + ee_tr(3)
C
do a = 1,3
ee_tr(a) = ee_tr(a) - one3*th_tr ! Trial deviators
end do ! a
ee_tr = ee_tr - one3*th_tr ! Trial deviators
C
pp = Bmod * th_tr ! Pressure: K*th_tr
pp = Bmod * th_tr ! Pressure: K*th_tr
Eppn = Epp
C
do a = 1, 3
tt(a) = TwoG * ee_tr(a) ! Trial deviatoric stress
tau(a) = tt(a) + pp
alp(a) = Hk * Epl(a)
alp_n(a) = alp(a)
end do ! a
tt = TwoG * ee_tr ! Trial deviatoric stress
tau = tt + pp
alp = Hk * Epl(1:3)
alp_n = alp
C
C Deviatoric: ta = tt - alp_dev
C
aatr = (alp(1) + alp(2) + alp(3))*one3
C
do a = 1,3
ta(a) = tt(a) - alp(a) + aatr ! Trial SigMA = ss - alp
end do ! a
ta = tt - alp + aatr ! Trial SigMA = ss - alp
C
C CHECK ELASTIC / PLASTIC STEP
C
@ -315,11 +309,9 @@ C
vol_tr = th_tr * one3
vol_e = K3inv * pp
C
do a = 1, 3
eps_tr(a) = ee_tr(a) + vol_tr
ee_e(a) = G2inv * tt(a)
eps_e(a) = ee_e(a) + vol_e
end do ! a
eps_tr = ee_tr + vol_tr
ee_e = G2inv * tt
eps_e = ee_e + vol_e
C
epse = 1.d0/(abs(eps_tr(1)) + abs(eps_tr(2)) + abs(eps_tr(3)))
C
@ -334,11 +326,11 @@ C
xx = f1 - f3 * two3 * J2
C
do a = 1, 3
nn(a) = xx + ( f2 + f3 * ta(a) ) * ta(a)
res(a) = eps_e(a) - eps_tr(a) + gam * nn(a)
res(a+3) = (alp_n(a) - alp(a))*Hkr + gam * nn(a)
nn(a) = xx + ( f2 + f3 * ta(a) ) * ta(a)
end do ! a
C
res(1:3) = eps_e - eps_tr + gam * nn
res(4:6) = (alp_n - alp)*Hkr + gam * nn
res(7) = yield
C
err = (abs(res(1)) + abs(res(2)) + abs(res(3)))*epse
@ -371,9 +363,7 @@ C
C
do a = 1, 3
C
do b = 1, 3
tres(a,b) = fss(a,b) + d_el
end do ! b
tres(a,1:3) = fss(a,1:3) + d_el
C
tres(a,a) = tres(a,a) + G2inv
C
@ -438,41 +428,31 @@ C
end do ! i
C
dsol(7) = dsol(4)
dsol(4) = zero
dsol(5) = zero
dsol(6) = zero
dsol(4:6) = zero
C
endif
C
C Update Kirchhoff stress and plastic flow
C
tau(1) = tau(1) + dsol(1)
tau(2) = tau(2) + dsol(2)
tau(3) = tau(3) + dsol(3)
gam = gam + dsol(7)
tau = tau + dsol(1:3)
gam = gam + dsol(7)
C
C Update accumulated plastic strain
C
Epp = Eppn + sqt23*gam
Epp = Eppn + sqt23*gam
C
C Update Back Stress
C
alp(1) = alp(1) + dsol(4)
alp(2) = alp(2) + dsol(5)
alp(3) = alp(3) + dsol(6)
alp = alp + dsol(4:6)
C
C Update vol.-dev. Kirchhoff stress and stress invariants
C
pp = ( tau(1) + tau(2) + tau(3) ) * one3
tt(1) = tau(1) - pp
tt(2) = tau(2) - pp
tt(3) = tau(3) - pp
pp = ( tau(1) + tau(2) + tau(3) ) * one3
tt = tau - pp
C
aatr = (alp(1) + alp(2) + alp(3))*one3
C
do a = 1,3
ta(a) = tt(a) - alp(a) + aatr
end do ! a
ta = tt - alp + aatr
C
I1 = three * (pp - aatr)
J2 = ( ta(1)*ta(1) + ta(2)*ta(2) +
@ -504,7 +484,7 @@ C
C Update elastic left Cauchy-Green tensor and plastic acc. strain
C
do a = 1, 3
ll2 (a) = exp( two * eps_e(a) )
ll2(a) = exp( two * eps_e(a) )
end do ! a
C
do i = 1, 6
@ -515,17 +495,11 @@ C
C
C Update plastic strains
C
Epl(1) = Epl(1) + gam * nn(1)
Epl(2) = Epl(2) + gam * nn(2)
Epl(3) = Epl(3) + gam * nn(3)
Epl(1:3) = Epl(1:3) + gam * nn
C
C Compute elasto-plastic tangent
C
do b = 1, 3
do a = 1, 3
dtde(a,b) = one2 * tres(a,b)
end do ! a
end do ! b
dtde = one2 * tres(1:3,1:3)
C
else
C
@ -547,14 +521,17 @@ C COMPUTE CAUCHY STRESS
C
detr = one / detF
C
do i = 1, ntm
do i = 1, min(6,ntm)
Sig(i) = (tau(1) * nn_t(p1(i),1)*nn_t(p2(i),1)
& + tau(2) * nn_t(p1(i),2)*nn_t(p2(i),2)
& + tau(3) * nn_t(p1(i),3)*nn_t(p2(i),3)) * detr
end do ! i
C
Sig( 9) = Epp ! Plastic strain for output
Sig(10) = sqrt(onep5)*(YY + yield) ! Yield stress value
if (ntm .ge. 10) then
Sig( 9) = Epp ! Plastic strain for output
Sig(10) = sqrt(onep5)*(YY + yield) ! Yield stress value
end if
C
C
C TANGENT TRANSFORMATION
C
@ -564,16 +541,13 @@ C
C
C Upper 3x3 block of Cstm()
C
do b = 1, 3
Cstm(b,a) = two * dtde(b,a)
end do ! b
Cstm(1:3,a) = two * dtde(1:3,a)
C
Cstm(a,a) = Cstm(a,a) - two * tau(a)
C
C Lower 3x3 block of Cstm() [ diagonal block ]
C
b = mod(a,3) + 1
C
if (abs(ll2_tr(a)-ll2_tr(b)).gt.tolb) then
Cstm(a+3,a+3) = ( ll2_tr(a)*tau(b) - ll2_tr(b)*tau(a) ) /
& ( ll2_tr(b) - ll2_tr(a))
@ -615,7 +589,7 @@ C
write(iwr,9030) 'Epp =', Epp
call rprin0(be , 1, ntm, 'be ', iwr)
call rprin0(Epl , 1, 3, 'Epl ', iwr)
call rprin0(Sig , 1, 10, 'Sig ', iwr)
call rprin0(Sig , 1, ntm, 'Sig ', iwr)
call rprin0(Cst , 6, 6, 'Cst ', iwr)
go to 8010
C
@ -630,9 +604,10 @@ C
write(iwr,9030) 'Epp =', Epp
call rprin0(be , 1, ntm, 'be ', iwr)
call rprin0(Epl , 1, 3, 'Epl ', iwr)
call rprin0(Sig , 1, 10, 'Sig ', iwr)
call rprin0(Sig , 1, ntm, 'Sig ', iwr)
call rprin0(Cst , 6, 6, 'Cst ', iwr)
endif
call flush(iwr)
endif
C
8010 continue
@ -686,16 +661,6 @@ C PERIPHERAL UNITS:
C None
C
C INTERNAL VARIABLES:
C vol - volumetric strain - vol = ( eps : 1 ) / 3
C nn_t(3,3) - principal directions (by columns) tensor form
C ll2(3) - squares of principal stretches = lambda^2
C tau(3) - principal values total Kirchhoff stress
C tt(3) - principal values deviatoric Kirchhoff stress
C pp - pressure volumetric Kirchhoff stress
C dtde(3,3) - Kirchhoff stress derivative
C dtde(a,b) = [ d tau_a / d (lambda_b^2) ] * lambda_b^2
C = [ d tau_a / d ( eps_b ) ] / 2.0d0
C Cstm(6,6) - spatial elastic moduli in principal basis
C yield - yield function value
C yfunct - yield function
C flg = .false. only yield function
@ -848,6 +813,8 @@ C
end if
C
yfunct = yield
C
return
C
C Format
C

View File

@ -61,9 +61,10 @@ NonlinearElasticity::NonlinearElasticity (unsigned short int n)
void NonlinearElasticity::print (std::ostream& os) const
{
this->Elasticity::print(os);
std::cout <<"NonlinearElasticity: Total Lagrangian formulation "
<<" (tensorial form)"<< std::endl;
this->Elasticity::print(os);
}
@ -243,5 +244,5 @@ bool NonlinearElasticity::formTangent (Matrix& Ctan, SymmTensor& S,
const Vec3& X, const Tensor& F) const
{
double U;
return material->evaluate(Ctan,S,U,X,F,E,!E.isZero());
return material->evaluate(Ctan,S,U,X,F,E, !E.isZero(1.0e-16));
}

View File

@ -28,8 +28,9 @@ NonlinearElasticityTL::NonlinearElasticityTL (unsigned short int n)
void NonlinearElasticityTL::print (std::ostream& os) const
{
this->Elasticity::print(os);
std::cout <<"NonlinearElasticityTL: Total Lagrangian formulation"<< std::endl;
this->Elasticity::print(os);
}

View File

@ -31,9 +31,10 @@ NonlinearElasticityUL::NonlinearElasticityUL (unsigned short int n, char lop)
void NonlinearElasticityUL::print (std::ostream& os) const
{
material->print(os);
std::cout <<"NonlinearElasticityUL: Updated Lagrangian formulation"
<< std::endl;
this->Elasticity::print(os);
}

View File

@ -53,9 +53,10 @@ NonlinearElasticityULMX::NonlinearElasticityULMX (unsigned short int n, int pp)
void NonlinearElasticityULMX::print (std::ostream& os) const
{
this->NonlinearElasticityUL::print(os);
std::cout <<"NonlinearElasticityULMX: Mixed formulation,"
<<" discontinuous pressure, p="<< p << std::endl;
this->NonlinearElasticityUL::print(os);
}
@ -170,8 +171,8 @@ bool NonlinearElasticityULMX::evalInt (LocalIntegral*& elmInt, double detJW,
ptData.F(3,3) = ptData.Fp(3,3) = 1.0;
// Invert the deformation gradient ==> Fi
Tensor Fi(nsd);
Fi = ptData.F;
Matrix Fi(nsd,nsd);
Fi.fill(ptData.F.ptr());
double J = Fi.inverse();
if (J == 0.0) return false;

View File

@ -206,10 +206,10 @@ NonlinearElasticityULMixed::NonlinearElasticityULMixed (unsigned short int n)
void NonlinearElasticityULMixed::print (std::ostream& os) const
{
this->NonlinearElasticityUL::print(os);
std::cout <<"NonlinearElasticityULMixed: "
<<"Continuous volumetric change and pressure fields"<< std::endl;
this->NonlinearElasticityUL::print(os);
}
@ -298,9 +298,8 @@ bool NonlinearElasticityULMixed::evalInt (LocalIntegral*& elmInt, double detJW,
const Vec3& X) const
{
// Evaluate the deformation gradient, F, and the Green-Lagrange strains, E
Tensor F(nsd);
SymmTensor E(nsd);
if (!this->kinematics(dNdX1,F,E))
if (!this->kinematics(dNdX1,Fbar,E))
return false;
bool lHaveStrains = !E.isZero();
@ -318,24 +317,23 @@ bool NonlinearElasticityULMixed::evalInt (LocalIntegral*& elmInt, double detJW,
double dVol = Theta*detJW;
// Compute the mixed model deformation gradient, F_bar
double r1 = pow(fabs(Theta/F.det()),1.0/3.0);
double r1 = pow(fabs(Theta/Fbar.det()),1.0/3.0);
unsigned short int i, j, k;
for (i = 1; i <= nsd; i++)
for (j = 1; j <= nsd; j++)
Fbar(i,j) = r1*F(i,j);
Matrix Fi(nsd,nsd);
Fi.fill(Fbar.ptr());
Fbar *= r1;
if (nsd == 2) // In 2D we always assume plane strain so set F(3,3)=1
Fbar(3,3) = r1;
else if (nsd != 3)
return false;
// Invert the deformation gradient ==> Fi
double J = F.inverse();
double J = Fi.inverse();
if (J == 0.0) return false;
// Push-forward the basis function gradients to current configuration
dNdx.multiply(dNdX1,F); // dNdx = dNdX * F^-1
dNdx.multiply(dNdX1,Fi); // dNdx = dNdX * F^-1
#if INT_DEBUG > 0
std::cout <<"NonlinearElasticityULMixed::dNdX ="<< dNdX1;
std::cout <<"NonlinearElasticityULMixed::dNdx ="<< dNdx;
@ -391,6 +389,7 @@ bool NonlinearElasticityULMixed::evalInt (LocalIntegral*& elmInt, double detJW,
// Integrate the volumetric change and pressure tangent terms
size_t a, b;
unsigned short int i, j, k;
for (a = 1; a <= N1.size(); a++)
for (b = 1; b <= N2.size(); b++)
for (i = 1; i <= nsd; i++)

View File

@ -7,7 +7,7 @@
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Plasticity material models.
//! \brief Elasto-plastic material models.
//!
//==============================================================================
@ -16,13 +16,13 @@
#ifdef USE_FTNMAT
extern "C" {
//! \brief Interface to 2D plastic material routines (FORTRAN-77 code).
//! \brief Interface to 2D elasto-plastic material routines (FORTRAN-77 code).
void plas2d_(const int& ipsw, const int& iwr, const int& iter,
const int& lfirst, const int& ntm, const double* pMAT,
const double& detF, const double* Fn1, const double* Fn,
const double* be, const double& Epp, const double* Epl,
const double* Sig, double* Cst, int& ierr);
//! \brief Interface to 3D plastic material routines (FORTRAN-77 code).
//! \brief Interface to 3D elasto-plastic material routines (FORTRAN-77 code).
void plas3d_(const int& ipsw, const int& iwr, const int& iter,
const int& lfirst, const int& ntm, const double* pMAT,
const double& detF, const double* Fn1, const double* Fn,
@ -35,11 +35,41 @@ extern "C" {
#endif
PlasticMaterial::PlasticMaterial (const PlasticPrm* prm, unsigned short int n)
: pMAT(prm->pMAT), Fp(n)
/*!
See the Fortran routine Material/plas3d.f for interpretation of \a pMAT.
*/
PlasticPrm::PlasticPrm (const RealArray& p) : pMAT(p)
{
memset(HVc,0,sizeof(HVc));
memset(HVp,0,sizeof(HVc));
if (pMAT.size() < 11) pMAT.resize(11,0.0);
double Emod = pMAT[0];
double nu = pMAT[1];
double Bmod, Smod;
if (nu > 0.5)
{
// Calculate E and nu from the Bulk and Shear moduli
Bmod = Emod;
Smod = nu;
Emod = 9.0*Bmod*Smod/(3.0*Bmod + Smod);
nu = (1.5*Bmod - Smod)/(3.0*Bmod + Smod);
}
else if (nu < 0.5)
{
// Calculate the Bulk and Shear moduli from E and nu
Smod = Emod / (2.0 + 2.0*nu);
Bmod = Emod / (3.0 - 6.0*nu);
}
else
{
Smod = Emod / 3.0;
Bmod = 0.0;
}
pMAT[0] = Emod;
pMAT[1] = nu;
pMAT.insert(pMAT.begin()+4,Bmod);
pMAT.insert(pMAT.begin()+5,Smod);
}
@ -48,12 +78,18 @@ void PlasticPrm::print (std::ostream& os) const
std::cout <<"PlasticMaterial: pMAT =";
for (size_t i = 0; i < pMAT.size(); i++)
std::cout <<" "<< pMAT[i];
if (rho > 0.0)
std::cout <<"\nPlasticMaterial: rho ="<< rho;
std::cout << std::endl;
}
PlasticMaterial::PlasticMaterial (const PlasticPrm* prm, unsigned short int n)
: pMAT(prm->pMAT), Fp(n)
{
memset(HVc,0,sizeof(HVc));
memset(HVp,0,sizeof(HVc));
}
bool PlasticMaterial::evaluate (Matrix& C, SymmTensor& sigma, double&,
const Vec3&, const Tensor& F, const SymmTensor&,
char, const TimeDomain* prm) const

View File

@ -7,7 +7,7 @@
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Plasticity material models.
//! \brief Elasto-plastic material models.
//!
//==============================================================================
@ -19,14 +19,14 @@
/*!
\brief Class containing parameters of a plasticity material model.
\brief Class containing parameters of an elasto-plastic material model.
*/
class PlasticPrm : public Material
{
public:
//! \brief Constructor initializing the material parameters.
PlasticPrm(const RealArray& p, double dens = 0.0) : pMAT(p), rho(dens) {}
PlasticPrm(const RealArray&);
//! \brief Empty destructor.
virtual ~PlasticPrm() {}
@ -34,7 +34,7 @@ public:
virtual void print(std::ostream&) const;
//! \brief Evaluates the mass density at current point.
virtual double getMassDensity(const Vec3&) const { return rho; }
virtual double getMassDensity(const Vec3&) const { return pMAT[3]; }
//! \brief Dummy method (should not be invoked).
virtual bool evaluate(Matrix&, SymmTensor&, double&,
@ -43,24 +43,28 @@ public:
private:
RealArray pMAT; //!< Material property parameters
double rho; //!< Mass density
friend class PlasticMaterial;
};
/*!
\brief Class representing a plasticity material model.
\brief Class representing an elasto-plastic material point.
*/
class PlasticMaterial : public Material
{
public:
//! \brief Constructor initializing the material parameters.
PlasticMaterial(const PlasticPrm* prm, unsigned short int n = 0);
//! \param[in] prm Pointer to actual material parameters object.
//! \param[in] n Number of space dimensions
PlasticMaterial(const PlasticPrm* prm, unsigned short int n);
//! \brief Empty destructor.
virtual ~PlasticMaterial() {}
//! \brief Evaluates the mass density at current point.
virtual double getMassDensity(const Vec3&) const { return pMAT[3]; }
//! \brief Evaluates the constitutive relation at an integration point.
//! \param[out] C Constitutive matrix at current point
//! \param[out] sigma Stress tensor at current point

View File

@ -36,8 +36,9 @@ PlasticityUL::~PlasticityUL ()
void PlasticityUL::print (std::ostream& os) const
{
material->print(os);
std::cout <<"PlasticityUL: Updated Lagrangian formulation"<< std::endl;
std::cout <<"PlasticityUL: Finite deformation plasticity"<< std::endl;
this->NonlinearElasticityUL::print(os);
}

View File

@ -67,6 +67,8 @@ bool SIMFiniteDefEl2D::parse (char* keyWord, std::istream& is)
if (myPid == 0)
std::cout <<"\nNumber of isotropic materials: "<< nmat << std::endl;
bool isUL = dynamic_cast<NonlinearElasticityUL*>(myProblem) ? true : false;
char* cline = 0;
for (int i = 0; i < nmat && (cline = utl::readLine(is)); i++)
{
@ -78,10 +80,13 @@ bool SIMFiniteDefEl2D::parse (char* keyWord, std::istream& is)
double nu = atof(strtok(NULL," "));
double rho = atof(strtok(NULL," "));
int matVer = (cline = strtok(NULL," ")) ? atoi(cline) : -1;
if (matVer >= 0)
if (matVer >= 0 && isUL)
mVec.push_back(new NeoHookeMaterial(E,nu,rho,matVer));
else
mVec.push_back(new LinearMaterial(new LinIsotropic(E,nu,rho)));
mVec.push_back(new LinIsotropic(E,nu,rho,!planeStrain));
if (matVer < 0 && isUL)
mVec.back() = new LinearMaterial(mVec.back());
if (myPid == 0)
std::cout <<"\tMaterial code "<< code <<": "
<< E <<" "<< nu <<" "<< rho <<" ("<< matVer <<")"<< std::endl;
@ -102,23 +107,27 @@ bool SIMFiniteDefEl2D::parse (char* keyWord, std::istream& is)
this->setPropertyType(code,Property::MATERIAL,mVec.size());
RealArray pMAT;
double rho = atof(strtok(NULL," "));
while ((cline = strtok(NULL," ")))
{
pMAT.push_back(rho);
rho = atof(cline);
}
mVec.push_back(new PlasticPrm(pMAT,rho));
pMAT.push_back(atof(cline));
mVec.push_back(new PlasticPrm(pMAT));
if (myPid == 0)
{
std::cout <<"\tMaterial code "<< code <<":";
for (size_t i = 0; i < pMAT.size(); i++)
std::cout <<" "<< pMAT[i];
std::cout <<" rho = "<< rho << std::endl;
std::cout << std::endl;
}
}
}
else if (!strncasecmp(keyWord,"MATERIAL",8))
{
std::cerr <<" *** SIMFiniteDefEl2D::parse: The keyword MATERIAL"
<<" is not supported\n for finite deformation analysis."
<<" You must use ISOTROPIC instead."<< std::endl;
return false;
}
else
return this->SIMLinEl2D::parse(keyWord,is);
@ -142,7 +151,7 @@ SIMFiniteDefEl3D::SIMFiniteDefEl3D (bool checkRHS,
switch (form)
{
case SIM::PLASTICITY:
myProblem = new PlasticityUL(2);
myProblem = new PlasticityUL();
break;
case SIM::MIXED_QnQn1:
nf[1] = 2; // continuous volumetric change and pressure fields
@ -182,6 +191,8 @@ bool SIMFiniteDefEl3D::parse (char* keyWord, std::istream& is)
if (myPid == 0)
std::cout <<"\nNumber of isotropic materials: "<< nmat << std::endl;
bool isUL = dynamic_cast<NonlinearElasticityUL*>(myProblem) ? true : false;
char* cline = 0;
for (int i = 0; i < nmat && (cline = utl::readLine(is)); i++)
{
@ -193,10 +204,13 @@ bool SIMFiniteDefEl3D::parse (char* keyWord, std::istream& is)
double nu = atof(strtok(NULL," "));
double rho = atof(strtok(NULL," "));
int matVer = (cline = strtok(NULL," ")) ? atoi(cline) : -1;
if (matVer >= 0)
if (matVer >= 0 && isUL)
mVec.push_back(new NeoHookeMaterial(E,nu,rho,matVer));
else
mVec.push_back(new LinearMaterial(new LinIsotropic(E,nu,rho)));
mVec.push_back(new LinIsotropic(E,nu,rho));
if (matVer < 0 && isUL)
mVec.back() = new LinearMaterial(mVec.back());
if (myPid == 0)
std::cout <<"\tMaterial code "<< code <<": "
<< E <<" "<< nu <<" "<< rho <<" ("<< matVer <<")"<< std::endl;
@ -217,23 +231,27 @@ bool SIMFiniteDefEl3D::parse (char* keyWord, std::istream& is)
this->setPropertyType(code,Property::MATERIAL,mVec.size());
RealArray pMAT;
double rho = atof(strtok(NULL," "));
while ((cline = strtok(NULL," ")))
{
pMAT.push_back(rho);
rho = atof(cline);
}
mVec.push_back(new PlasticPrm(pMAT,rho));
pMAT.push_back(atof(cline));
mVec.push_back(new PlasticPrm(pMAT));
if (myPid == 0)
{
std::cout <<"\tMaterial code "<< code <<":";
for (size_t i = 0; i < pMAT.size(); i++)
std::cout <<" "<< pMAT[i];
std::cout <<" rho = "<< rho << std::endl;
std::cout << std::endl;
}
}
}
else if (!strncasecmp(keyWord,"MATERIAL",8))
{
std::cerr <<" *** SIMFiniteDefEl2D::parse: The MATERIAL keyword"
<<" is not supported\n for finite deformation analysis."
<<" You must use ISOTROPIC instead."<< std::endl;
return false;
}
else
return this->SIMLinEl3D::parse(keyWord,is);

View File

@ -7,7 +7,7 @@
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Main program for the isogeometric nonlinear elasticity solver.
//! \brief Main program for the isogeometric finite deformation solver.
//!
//==============================================================================
@ -23,7 +23,7 @@
/*!
\brief Main program for the isogeometric nonlinear elasticity solver.
\brief Main program for the isogeometric finite deformation solver.
The input to the program is specified through the following
command-line arguments. The arguments may be given in arbitrary order.
@ -35,7 +35,7 @@
\arg -samg : Use the sparse algebraic multi-grid equation solver
\arg -petsc : Use equation solver from PETSc library
\arg -nGauss \a n : Number of Gauss points over a knot-span in each direction
\arg -vtf \a format : VTF-file format (0=ASCII, 1=BINARY)
\arg -vtf \a format : VTF-file format (-1=NONE, 0=ASCII, 1=BINARY)
\arg -nviz \a nviz : Number of visualization points over each knot-span
\arg -nu \a nu : Number of visualization points per knot-span in u-direction
\arg -nv \a nv : Number of visualization points per knot-span in v-direction
@ -51,6 +51,7 @@
\arg -2Dpstrain : Use two-parametric simulation driver (plane strain)
\arg -Tensor : Use tensorial total Lagrangian formulation (slow...)
\arg -UL : Use updated Lagrangian formulation with nonlinear material
\arg -PL : Use placticity solution driver
\arg -MX \a pord : Mixed formulation with internal discontinuous pressure
\arg -mixed : Mixed formulation with continuous pressure and volumetric change
\arg -lag : Use Lagrangian basis functions instead of splines/NURBS
@ -64,7 +65,7 @@ int main (int argc, char** argv)
SystemMatrix::Type solver = SystemMatrix::SPARSE;
int form = SIM::TOTAL_LAGRANGE;
int nGauss = 4;
int format = 0;
int format = -1;
int n[3] = { 2, 2, 2 };
std::vector<int> ignoredPatches;
double dtSave = 0.0;
@ -78,7 +79,7 @@ int main (int argc, char** argv)
LinAlgInit linalg(argc,argv);
std::vector<int> options(2,-1);
std::vector<int> options(2,0);
for (int i = 1; i < argc; i++)
if (!strcmp(argv[i],"-dense"))
solver = SystemMatrix::DENSE;
@ -145,6 +146,8 @@ int main (int argc, char** argv)
twoD = SIMLinEl2D::planeStrain = true;
else if (!strncmp(argv[i],"-2D",3))
twoD = true;
else if (!strcmp(argv[i],"-PL"))
form = SIM::PLASTICITY;
else if (!strcmp(argv[i],"-UL"))
{
if (form < SIM::UPDATED_LAGRANGE)
@ -155,8 +158,6 @@ int main (int argc, char** argv)
form = SIM::MIXED_QnPn1;
if (i < argc-1 && isdigit(argv[i+1][0]))
options[1] = atoi(argv[++i]);
else
options[1] = 0;
}
else if (!strcmp(argv[i],"-mixed"))
form = SIM::MIXED_QnQn1;
@ -188,21 +189,19 @@ int main (int argc, char** argv)
}
if (linalg.myPid == 0)
std::cout <<"\n >>> Spline FEM Nonlinear Elasticity solver <<<"
<<"\n ==============================================\n"
{
std::cout <<"\n >>> Spline FEM Finite Deformation Nonlinear solver <<<"
<<"\n ======================================================\n"
<<"\nInput file: "<< infile
<<"\nEquation solver: "<< solver
<<"\nNumber of Gauss points: "<< nGauss
<<"\nVTF file format: "<< (format ? "BINARY":"ASCII")
<<"\nNumber of visualization points: "
<< n[0] <<" "<< n[1];
if (twoD)
n[2] = 1;
else if (linalg.myPid == 0)
std::cout <<" "<< n[2];
if (linalg.myPid == 0)
{
<<"\nNumber of Gauss points: "<< nGauss;
if (format >= 0)
{
std::cout <<"\nVTF file format: "<< (format ? "BINARY":"ASCII")
<<"\nNumber of visualization points: "
<< n[0] <<" "<< n[1];
if (!twoD) std::cout <<" "<< n[2];
}
if (dtSave > 0.0)
std::cout <<"\nTime between each result save: "<< dtSave;
if (dtDump > 0.0)
@ -225,7 +224,7 @@ int main (int argc, char** argv)
}
utl::profiler->start("Model input");
// Create the finite deformation elasticity model
// Create the finite deformation continuum model
options[0] = form%100;
SIMbase* model;
if (twoD)
@ -245,9 +244,13 @@ int main (int argc, char** argv)
if (!model->preprocess(ignoredPatches,fixDup))
return 2;
// Save FE model to VTF file for visualization
if (!simulator.saveModel(infile,format,n))
return 3;
if (format >= 0)
{
// Save FE model to VTF file for visualization
if (twoD) n[2] = 1;
if (!simulator.saveModel(infile,format,n))
return 3;
}
std::ostream* oss = 0;
if (dtDump > 0.0 && !dumpWithID)
@ -270,11 +273,12 @@ int main (int argc, char** argv)
const double epsT = 1.0e-6;
if (dtDump <= 0.0) dtDump = params.stopTime + 1.0;
if (format < 0) dtSave = params.stopTime + 1.0;
double nextDump = params.time.t + dtDump;
double nextSave = params.time.t + dtSave;
int iStep = 0; // Save initial state to VTF
if (params.multiSteps())
if (format >= 0 && params.multiSteps())
if (!simulator.saveStep(-(++iStep),params.time.t,n,skip2nd))
return 4;

View File

@ -4,7 +4,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Required defines (well, PROFILE_LEVEL is not actually required, but...)
SET(CMAKE_CXX_FLAGS "-Dreal=double -DepsZ=1.0e-12 -DPROFILE_LEVEL=3")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DINDEX_CHECK=2 -DSP_DEBUG=1")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DINDEX_CHECK=2 -DSP_DEBUG=4")
ENABLE_LANGUAGE(Fortran)
IF(CMAKE_Fortran_COMPILER MATCHES ifort)

View File

@ -150,15 +150,18 @@ bool Elasticity::initElement (const std::vector<int>& MNPC)
if (eM) eM->resize(nsd*nen,nsd*nen,true);
if (eS) eS->resize(nsd*nen,true);
// Extract the current primary solution and store in the array *eV
int ierr = 0;
if (eV && !primsol.front().empty())
if ((ierr = utl::gather(MNPC,nsd,primsol.front(),*eV)))
std::cerr <<" *** Elasticity::initElement: Detected "
<< ierr <<" node numbers out of range."<< std::endl;
// If previous solutions are required, they are stored in the
// (primsol.size()-1) last entries in myMats->b
int j = 1+myMats->b.size()-primsol.size();
for (size_t i = 1; i < primsol.size() && ierr == 0; i++, j++)
ierr = utl::gather(MNPC,nsd,primsol[j],myMats->b[j]);
ierr = utl::gather(MNPC,nsd,primsol[i],myMats->b[j]);
if (myMats)
myMats->withLHS = true;
@ -353,7 +356,7 @@ bool Elasticity::formBmatrix (const Matrix& dNdX) const
void Elasticity::formKG (Matrix& EM, const Matrix& dNdX,
const Tensor& sigma, double detJW) const
{
#ifdef INT_DEBUG
#if SP_DEBUG > 3
std::cout <<"Elasticity::eV ="<< *eV;
std::cout <<"Elasticity::sigma =\n"<< sigma;
std::cout <<"Elasticity::kg =";
@ -367,14 +370,14 @@ void Elasticity::formKG (Matrix& EM, const Matrix& dNdX,
for (i = 1; i <= nsd; i++)
for (j = 1; j <= nsd; j++)
kg += dNdX(a,i)*sigma(i,j)*dNdX(b,j);
#ifdef INT_DEBUG
#if SP_DEBUG > 3
std::cout << (b == 1 ? '\n' : ' ') << kg;
#endif
for (i = 1; i <= nsd; i++)
EM(nsd*(a-1)+i,nsd*(b-1)+i) += kg*detJW;
}
#ifdef INT_DEBUG
#if SP_DEBUG > 3
std::cout << std::endl;
#endif
}

View File

@ -1,4 +1,4 @@
// $Id: LinearElasticity.C,v 1.27 2011-02-08 09:06:02 kmo Exp $
// $Id$
//==============================================================================
//!
//! \file LinearElasticity.C
@ -35,7 +35,7 @@ bool LinearElasticity::evalInt (LocalIntegral*& elmInt, double detJW,
{
// Compute the strain-displacement matrix B from dNdX
// and evaluate the symmetric strain tensor if displacements are available
if (!this->kinematics(dNdX,eps,sigma)) return false;
if (!this->kinematics(dNdX,eps,eps)) return false;
if (!eps.isZero(1.0e-16)) lHaveStrains = true;
// Evaluate the constitutive matrix and the stress tensor at this point

View File

@ -113,8 +113,8 @@ bool Poisson::evalInt (LocalIntegral*& elmInt, double detJW,
if (eM)
{
// Evaluate conductive matrix at this point.
if (!this->formCmatrix(C,X,false)) return false;
// Evaluate the constitutive matrix at this point
if (!this->formCmatrix(C,X)) return false;
CB.multiply(C,dNdX,false,true).multiply(detJW); // CB = C*dNdX^T*|J|*w
eM->multiply(dNdX,CB,false,false,true); // EK += dNdX * CB
@ -176,12 +176,9 @@ bool Poisson::writeGlvT (VTF* vtf, int iStep, int& nBlock) const
}
bool Poisson::formCmatrix (Matrix& C, const Vec3& X, bool inv) const
bool Poisson::formCmatrix (Matrix& C, const Vec3&, bool invers) const
{
double cx = this->getConductivety(X);
if (inv && cx != 0.0) cx = 1.0/cx;
C.diag(cx,nsd);
C.diag(invers && kappa != 0.0 ? 1.0/kappa : kappa, nsd);
return true;
}
@ -196,7 +193,7 @@ bool Poisson::evalSol (Vector& q, const Vector&,
<< std::endl;
return false;
}
else if (!this->formCmatrix(C,X,false))
else if (!this->formCmatrix(C,X))
return false;
Vector Dtmp;
@ -231,7 +228,7 @@ bool Poisson::evalSol (Vector& q, const Matrix& dNdX, const Vec3& X) const
<< dNdX.rows() <<","<< dNdX.cols() << std::endl;
return false;
}
else if (!this->formCmatrix(C,X,false))
else if (!this->formCmatrix(C,X))
return false;
// Evaluate the heat flux vector
@ -292,7 +289,7 @@ bool PoissonNorm::evalInt (LocalIntegral*& elmInt, double detJW,
return false;
}
// Evaluate the inverse conductivety matrix at this point
// Evaluate the inverse constitutive matrix at this point
Matrix Cinv;
if (!problem.formCmatrix(Cinv,X,true)) return false;

View File

@ -24,7 +24,7 @@ class VTF;
/*!
\brief Class representing the integrand of the Poisson problem.
\details This class supports constant isotrophic conductivity properties only.
\details This class supports constant isotropic constitutive properties only.
Properties with spatial variation has to be implemented as sub-classes.
*/
@ -49,7 +49,7 @@ public:
//! \brief Defines the heat source.
void setSource(RealFunc* src) { heatSrc = src; }
//! \brief Defines the conductivity.
//! \brief Defines the conductivity (constitutive property).
void setMaterial(double K) { kappa = K; }
//! \brief Initializes current element for numerical integration.
@ -126,12 +126,7 @@ public:
//! \param[in] prefix Name prefix for all components
virtual const char* getFieldLabel(size_t i, const char* prefix = 0) const;
protected:
//! \brief Returns the conductivety at current point.
virtual double getConductivety(const Vec3&) const { return kappa; }
public:
//! \brief Sets up the conductivity matrix at current point.
//! \brief Sets up the constitutive matrix at current point.
//! \param[out] C \f$ nsd\times nsd\f$-matrix
//! \param[in] X Cartesian coordinates of current point
//! \param[in] invers If \e true, set up the inverse matrix instead
@ -158,7 +153,7 @@ protected:
// Work arrays declared as members to avoid frequent re-allocation
// within the numerical integration loop (for reduced overhead)
mutable Matrix C; //!< Conductivity matrix
mutable Matrix C; //!< Constitutive matrix
mutable Matrix CB; //!< Result of the matrix-matrix product C*dNdX^T
};