5 #ifndef _STRUCTUREPLASTICDISCRETIZATION_H_
6 #define _STRUCTUREPLASTICDISCRETIZATION_H_
20 template<
class T,
class Diag,
class OffDiag>
42 const Field& lambdaField,
43 const Field& alphaField,
44 const Field& varGradientField,
45 const Field& temperatureField,
46 const T& referenceTemperature,
47 const T& residualXXStress,
48 const T& residualYYStress,
49 const T& residualZZStress,
51 const bool& residualStress,
52 const Field& devStressField,
53 const Field& VMStressField,
54 Field& plasticStrainField,
62 const int& creepModel,
63 bool fullLinearization=
true) :
104 const TArray& creepConstant =
106 const int nCells = cells.
getCount();
108 const T onethird(1.0/3.0);
110 const T twothirds(2.0/3.0);
112 const T onepointfive(1.5);
119 for(
int n=0; n<nCells; n++)
121 _A = creepConstant[n];
122 T VMPlasticStrain =
sqrt(half*
123 (pow(((plasticStrain[n])[0][0]-(plasticStrain[n])[1][1]),2.0) +
124 pow(((plasticStrain[n])[1][1]-(plasticStrain[n])[2][2]),2.0) +
125 pow(((plasticStrain[n])[2][2]-(plasticStrain[n])[0][0]),2.0) +
126 six*(pow(((plasticStrain[n])[0][1]),2.0) +
127 pow(((plasticStrain[n])[1][2]),2.0) +
128 pow(((plasticStrain[n])[2][0]),2.0))));
131 T Sy =
_Sy0*(one +
_B*pow(VMPlasticStrain,
_n));
132 T mult =
_A*(pow((VMStress[n]/Sy),
_m))/VMStress[n];
133 if (isnan(mult)) mult = 0.0;
136 (plasticStrain[n])[i][j] += mult*((devStress[n])[i][j])*
_timeStep;
141 for(
int n=0; n<nCells; n++)
143 _A = creepConstant[n];
145 cout<<
"creep initiated"<<endl;
146 T mult = (VMStress[n]/
_B)-1.;
150 cout<<
"yielding has begun"<<endl;
152 mult =
_A*pow(mult,
_n)*onepointfive/VMStress[n];
156 (plasticStrain[n])[i][j] += mult*((devStress[n])[i][j])*
_timeStep;
190 const bool isBoundary,
const bool isSymmetry)
199 const TArray& faceAreaMag =
209 const TArray& cellVolume =
226 const TArray& lambdaCell =
232 const TArray& temperatureCell =
241 const int nFaces = faces.
getCount();
253 for(
int f=0; f<nFaces; f++)
255 const int c0 = faceCells(f,0);
256 const int c1 = faceCells(f,1);
259 const VectorT3 en = Af/faceAreaMag[f];
261 VectorT3 ds=cellCentroid[c1]-cellCentroid[c0];
263 T vol0 = cellVolume[c0];
264 T vol1 = cellVolume[c1];
266 T wt0 = vol0/(vol0+vol1);
267 T wt1 = vol1/(vol0+vol1);
269 if (isBoundary && !isSymmetry)
278 T faceTemperature(1.0);
280 Diag& a00 = diag[c0];
281 Diag& a11 = diag[c1];
288 faceLambda = lambdaCell[c1];
289 faceAlpha = alphaCell[c1];
290 faceTemperature = temperatureCell[c1];
295 faceLambda = lambdaCell[c0];
296 faceAlpha = alphaCell[c0];
297 faceTemperature = temperatureCell[c0];
304 faceTemperature =
harmonicAverage(temperatureCell[c0],temperatureCell[c1]);
307 faceMu = muCell[c0]*wt0 + muCell[c1]*wt1;
308 faceLambda = lambdaCell[c0]*wt0 + lambdaCell[c1]*wt1;
309 faceAlpha = alphaCell[c0]*wt0 + alphaCell[c1]*wt1;
310 faceTemperature = temperatureCell[c0]*wt0 + temperatureCell[c1]*wt1;
312 const VGradType gradF = (vGradCell[c0]*wt0 + vGradCell[c1]*wt1);
313 const VGradType plasticStrainF = (plasticStrain[c0]*wt0 + plasticStrain[c1]*wt1);
318 const T divU = (gradF[0][0] + gradF[1][1] + gradF[2][2]);
320 const T diffMetric = faceAreaMag[f]*faceAreaMag[f]/
dot(faceArea[f],ds);
321 const VectorT3 secondaryCoeff = faceMu*(faceArea[f]-ds*diffMetric);
324 source[0] = faceMu*(gradF[0][0]*Af[0] + gradF[0][1]*Af[1] + gradF[0][2]*Af[2])
325 + faceLambda*divU*Af[0];
327 source[1] = faceMu*(gradF[1][0]*Af[0] + gradF[1][1]*Af[1] + gradF[1][2]*Af[2])
328 + faceLambda*divU*Af[1];
330 source[2] = faceMu*(gradF[2][0]*Af[0] + gradF[2][1]*Af[1] + gradF[2][2]*Af[2])
331 + faceLambda*divU*Af[2];
349 T divEP = (plasticStrainF[0][0] + plasticStrainF[1][1] + plasticStrainF[2][2]);
352 divEP = plasticStrainF[0][0] + plasticStrainF[1][1];
355 creepSource[0] -= (two*faceMu*(plasticStrainF[0][0]*Af[0] + plasticStrainF[1][0]*Af[1] +
356 plasticStrainF[2][0]*Af[2]) + faceLambda*divEP*Af[0]);
357 creepSource[1] -= (two*faceMu*(plasticStrainF[0][1]*Af[0] + plasticStrainF[1][1]*Af[1] +
358 plasticStrainF[2][1]*Af[2]) + faceLambda*divEP*Af[1]);
359 creepSource[2] -= (two*faceMu*(plasticStrainF[0][2]*Af[0] + plasticStrainF[1][2]*Af[1] +
360 plasticStrainF[2][2]*Af[2]) + faceLambda*divEP*Af[2]);
366 for(
int nnb = ccRow[c0]; nnb<ccRow[c0+1]; nnb++)
368 const int nb = ccCol[nnb];
376 const T gnb_dot_nx2 = T(2.0)*
dot(en,g_nb);
377 g_nb = gnb_dot_nx2*en;
382 for(
int i=0; i<3; i++)
384 for(
int j=0; j<3; j++)
386 coeff(i,j) = wt0*(faceMu*Af[j]*g_nb[i]
387 + faceLambda*Af[i]*g_nb[j]
391 for(
int k=0; k<3; k++)
392 coeff(i,i) += wt0*secondaryCoeff[k]*g_nb[k];
400 for(
int j=0; j<3; j++)
403 R(i,j) = 1.0 - 2*en[i]*en[j];
405 R(i,j) = - 2*en[i]*en[j];
408 Diag coeff1(R*coeff*R);
413 OffDiag& a0_nb = matrix.
getCoeff(c0,nb);
426 OffDiag& a1_nb = matrix.
getCoeff(c1,nb);
437 for(
int nnb = ccRow[c1]; nnb<ccRow[c1+1]; nnb++)
439 const int nb = ccCol[nnb];
444 for(
int i=0; i<3; i++)
446 for(
int j=0; j<3; j++)
448 coeff(i,j) = wt1*(faceMu*Af[j]*g_nb[i]
449 + faceLambda*Af[i]*g_nb[j]
453 for(
int k=0; k<3; k++)
454 coeff(i,i) += wt1*secondaryCoeff[k]*g_nb[k];
460 OffDiag& a1_nb = matrix.
getCoeff(c1,nb);
469 OffDiag& a0_nb = matrix.
getCoeff(c0,nb);
483 source += faceMu*diffMetric*(xCell[c1]-xCell[c0]);
488 source += gradF*secondaryCoeff;
495 rCell[c0] += thermalSource;
496 rCell[c1] -= thermalSource;
499 rCell[c0] += residualSource;
500 rCell[c1] -= residualSource;
503 rCell[c0] += creepSource;
504 rCell[c1] -= creepSource;
507 const T faceDiffusivity = faceMu;
508 const T diffCoeff = faceDiffusivity*diffMetric;
const Array< int > & getCol() const
const Array< int > & getRow() const
const FaceGroup & getInteriorFaceGroup() const
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
shared_ptr< FaceGroup > FaceGroupPtr
const Field & _temperatureField
const T _residualYYStress
T harmonicAverage(const T &x0, const T &x1)
const T _referenceTemperature
VGradModelType::GradMatrixType VGradMatrix
const FaceGroupList & getAllFaceGroups() const
OffDiag & getCoeff(const int i, const int j)
bool hasCoeff(const int i, const int j)
OffDiag & getCoeff10(const int np)
Coord & getCoeff(const int i, const int j)
const Field & _alphaField
Array< Diag > & getDiag()
const Field & _lambdaField
CRMatrix< Diag, OffDiag, VectorT3 > CCMatrix
const bool _fullLinearization
Tangent sqrt(const Tangent &a)
void discretize(const Mesh &mesh, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField)
GradientModel< VectorT3 > VGradModelType
const CRConnectivity & getConnectivity() const
const GeomFields & _geomFields
pair< const Field *, const StorageSite * > ArrayIndex
Array< Gradient< VectorT3 > > VGradArray
const Field & _varGradientField
StructurePlasticDiscretization(const MeshList &meshes, const GeomFields &geomFields, Field &varField, const Field &muField, const Field &lambdaField, const Field &alphaField, const Field &varGradientField, const Field &temperatureField, const T &referenceTemperature, const T &residualXXStress, const T &residualYYStress, const T &residualZZStress, const bool &thermo, const bool &residualStress, const Field &devStressField, const Field &VMStressField, Field &plasticStrainField, Field &creepConstant, T &A, const T &B, const T &mm, const T &nn, const T &Sy0, const T &timeStep, const int &creepModel, bool fullLinearization=true)
CCMatrix::PairWiseAssembler CCAssembler
const T _residualZZStress
CCMatrix::DiagArray DiagArray
const StorageSite & getCells() const
Gradient< VectorT3 > VGradType
OffDiag & getCoeff01(const int np)
const CRConnectivity & getFaceCells(const StorageSite &site) const
static GradMatrixType & getGradientMatrix(const Mesh &mesh, const GeomFields &geomFields)
Field & _plasticStrainField
const bool _residualStress
void discretizeFaces(const Mesh &mesh, const StorageSite &faces, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField, const bool isBoundary, const bool isSymmetry)
Array< VectorT3 > VectorT3Array
const T _residualXXStress
const Field & _VMStressField
PairWiseAssembler & getPairWiseAssembler(const CRConnectivity &pairs)
T dot(const Vector< T, 3 > &a, const Vector< T, 3 > &b)
vector< Mesh * > MeshList
const Field & _devStressField