5 #ifndef _PLATESOURCEDISCRETIZATION_H_
6 #define _PLATESOURCEDISCRETIZATION_H_
20 template<
class T,
class Diag,
class OffDiag>
45 const Field& varGradientField,
46 const Field& residualStressField,
47 const Field& thicknessField,
48 const Field& forceField,
50 const Field& devStressField,
51 const Field& VMStressField,
52 Field& plasticStrainField,
53 Field& plasticStrainOutField,
54 Field& plasticStrainN1Field,
55 Field& plasticMomentField,
63 const int& creepModel,
65 bool fullLinearization=
true) :
105 const TArray& cellVolume =
146 rCell[c][2]-=forceCell[c]*cellVolume[c];
152 const T HSigmazzV = tCell[c]*(residualCell[c])[2][2]*cellVolume[c];
153 rCell[c][0] += HSigmazzV*xCell[c][0];
154 (diag[c])(0,0) += HSigmazzV;
155 rCell[c][1] += HSigmazzV*xCell[c][1];
156 (diag[c])(1,1) += HSigmazzV;
173 for(
int n=0; n<nCells; n++)
176 for(
int k=0; k<=
_nz; k++)
179 T VMPlasticStrain =
sqrt(half*
180 (pow(plasticStrain[nn+k][0]-plasticStrain[nn+k][1],2.0) +
181 pow(plasticStrain[nn+k][1]-plasticStrain[nn+k][2],2.0) +
182 pow(plasticStrain[nn+k][2]-plasticStrain[nn+k][0],2.0) +
183 six*(pow(plasticStrain[nn+k][3],2.0))));
186 T Sy =
_Sy0*(one +
_B*pow(VMPlasticStrain,
_n));
187 T mult =
_A*(pow((VMStress[nn+k]/Sy),
_m))/VMStress[nn+k];
191 plasticStrain[nn+k][i] = plasticStrainN1[nn+k][i]+mult*devStress[nn+k][i]*
_timeStep;
193 plasticStrainOut[n][0] = plasticStrain[nn+
_nz][0];
194 plasticStrainOut[n][1] = plasticStrain[nn+
_nz][1];
195 plasticStrainOut[n][2] = plasticStrain[nn+
_nz][3];
199 for(
int n=0; n<nCells; n++)
201 T var1 = ymCell[n]/(one - pow(nuCell[n],two));
202 T var2 = one - nuCell[n];
203 T var3 = (tCell[n]/T(
_nz))/three;
208 tHalf = tCell[n]/two;
211 tempxx += (-tHalf)*(plasticStrain[nn][0] + nuCell[n]*plasticStrain[nn][1]);
212 tempyy += (-tHalf)*(plasticStrain[nn][1] + nuCell[n]*plasticStrain[nn][0]);
213 tempxy += (-tHalf)*var2*plasticStrain[nn][3];
214 for(
int k=1; k<
_nz; k++)
217 if((k%2)==0)n1 = two;
218 T zz(tCell[n]*(T(k)-(T(_nz)/T(2)))/T(_nz));
219 tempxx += T(n1)*zz*(plasticStrain[nn+k][0] + nuCell[n]*plasticStrain[nn+k][1]);
220 tempyy += T(n1)*zz*(plasticStrain[nn+k][1] + nuCell[n]*plasticStrain[nn+k][0]);
221 tempxy += T(n1)*zz*var2*plasticStrain[nn+k][3];
223 tempxx += (tHalf)*(plasticStrain[nn+_nz][0] + nuCell[n]*plasticStrain[nn+_nz][1]);
224 tempyy += (tHalf)*(plasticStrain[nn+_nz][1] + nuCell[n]*plasticStrain[nn+_nz][0]);
225 tempxy += (tHalf)*var2*plasticStrain[nn+_nz][3];
227 plasticMoment[n][0] = var1*var3*tempxx;
228 plasticMoment[n][1] = var1*var3*tempyy;
229 plasticMoment[n][2] = var1*var3*tempxy;
265 const bool isBoundary,
const bool isSymmetry)
274 const TArray& faceAreaMag =
283 const TArray& cellVolume =
314 const int nFaces = faces.
getCount();
327 const T twelve(12.0);
329 for(
int f=0; f<nFaces; f++)
331 const int c0 = faceCells(f,0);
332 const int c1 = faceCells(f,1);
335 const VectorT3 en = Af/faceAreaMag[f];
337 VectorT3 ds=cellCentroid[c1]-cellCentroid[c0];
338 VectorT3 dzeta0 = faceCentroid[f]-cellCentroid[c0];
339 VectorT3 dzeta1 = faceCentroid[f]-cellCentroid[c1];
341 const T diffMetric = faceAreaMag[f]*faceAreaMag[f]/
dot(faceArea[f],ds);
342 const VectorT3 secondaryCoeff = (faceArea[f]-ds*diffMetric);
344 const T dfx0(dzeta0[0]);
345 const T dfy0(dzeta0[1]);
347 const T dfx1(dzeta1[0]);
348 const T dfy1(dzeta1[1]);
350 T vol0 = cellVolume[c0];
351 T vol1 = cellVolume[c1];
353 T wt0 = vol0/(vol0+vol1);
354 T wt1 = vol1/(vol0+vol1);
358 if (isBoundary && !isSymmetry)
385 D0 = ymCell[c0]*pow(tCell[c0],three)/(twelve*(one - nuCell[c0]*nuCell[c0]));
386 D1 = ymCell[c1]*pow(tCell[c1],three)/(twelve*(one - nuCell[c1]*nuCell[c1]));
388 G0 =
_scf*ymCell[c0]*tCell[c0]/(two*(one+nuCell[c0]));
389 G1 =
_scf*ymCell[c1]*tCell[c1]/(two*(one+nuCell[c1]));
391 Diag& a00 = diag[c0];
392 Diag& a11 = diag[c1];
415 faceD = D0*wt0 + D1*wt1;
416 faceG = G0*wt0 + G1*wt1;
417 faceNu = nuCell[c0]*wt0 + nuCell[c1]*wt1;
419 faceB0 = xCell[c0][0]*bwt0 + xCell[c1][0]*bwt1;
420 faceB1 = xCell[c0][1]*bwt0 + xCell[c1][1]*bwt1;
422 faceT = tCell[c0]*bwt0 + tCell[c1]*bwt1;
426 faceM0 = plasticMoment[c0][0]*bwt0 + plasticMoment[c1][0]*bwt1;
427 faceM1 = plasticMoment[c0][1]*bwt0 + plasticMoment[c1][1]*bwt1;
428 faceM2 = plasticMoment[c0][2]*bwt0 + plasticMoment[c1][2]*bwt1;
432 const VGradType residualStressF = (residualCell[c0]*wt0 + residualCell[c1]*wt1);
433 const T diffRMetric =
dot(faceArea[f],(residualStressF*faceArea[f]))/
dot(faceArea[f],ds);
434 VectorT3 secondaryRCoeff = (residualStressF*faceArea[f]-ds*diffRMetric);
435 secondaryRCoeff[0] *= pow(faceT,three)/twelve;
436 secondaryRCoeff[1] *= pow(faceT,three)/twelve;
437 secondaryRCoeff[2] *= faceT;
440 const VGradType gradF = (vGradCell[c0]*wt0 + vGradCell[c1]*wt1);
446 T wFlux = faceG*diffMetric*(xCell[c1][2]-xCell[c0][2]);
449 wFlux += faceG*(gradF*secondaryCoeff)[2];
453 wFlux += faceG*(faceB0*Af[0]+faceB1*Af[1]);
456 T MxFlux = -faceD*diffMetric*(xCell[c1][0]-xCell[c0][0]);
459 MxFlux -= faceD*(gradF*secondaryCoeff)[0];
462 T MyFlux = -faceD*diffMetric*(xCell[c1][1]-xCell[c0][1]);
465 MyFlux -= faceD*(gradF*secondaryCoeff)[1];
468 source[0] = -faceD*((faceNu*gradF[1][1])*Af[0]+
469 ((one-faceNu)/two)*(gradF[0][1])*Af[1]-
470 ((one+faceNu)/two)*(gradF[1][0])*Af[1])+
471 + dfx0*wFlux + MxFlux;
473 source[1] = -faceD*(((one-faceNu)/two)*(gradF[1][0])*Af[0]-
474 ((one+faceNu)/two)*(gradF[0][1])*Af[0]+
475 (faceNu*gradF[0][0])*Af[1])+
476 + dfy0*wFlux + MyFlux ;
482 source[0] += faceM0*Af[0] + faceM2*Af[1];
483 source[1] += faceM2*Af[0] + faceM1*Af[1];
491 source[0] = -faceD*((faceNu*gradF[1][1])*Af[0]+
492 ((one-faceNu)/two)*(gradF[0][1])*Af[1]-
493 ((one+faceNu)/two)*(gradF[1][0])*Af[1])+
494 + dfx1*wFlux + MxFlux;
496 source[1] = -faceD*(((one-faceNu)/two)*(gradF[1][0])*Af[0]-
497 ((one+faceNu)/two)*(gradF[0][1])*Af[0]+
498 (faceNu*gradF[0][0])*Af[1])+
499 + dfy1*wFlux + MyFlux ;
505 source[0] += faceM0*Af[0] + faceM2*Af[1];
506 source[1] += faceM2*Af[0] + faceM1*Af[1];
514 a00(0,2) += -diffMetric*faceG*dfx0;
515 a00(1,2) += -diffMetric*faceG*dfy0;
516 a00(2,2) += diffMetric*faceG;
518 a01(0,2) += diffMetric*faceG*dfx0;
519 a01(1,2) += diffMetric*faceG*dfy0;
520 a01(2,2) += -diffMetric*faceG;
522 a11(0,2) += -diffMetric*faceG*dfx1;
523 a11(1,2) += -diffMetric*faceG*dfy1;
524 a11(2,2) += diffMetric*faceG;
526 a10(0,2) += diffMetric*faceG*dfx1;
527 a10(1,2) += diffMetric*faceG*dfy1;
528 a10(2,2) += -diffMetric*faceG;
532 a00(0,0) += diffMetric*faceD;
533 a00(1,1) += diffMetric*faceD;
535 a01(0,0) += -diffMetric*faceD;
536 a01(1,1) += -diffMetric*faceD;
538 a11(0,0) += diffMetric*faceD;
539 a11(1,1) += diffMetric*faceD;
541 a10(0,0) += -diffMetric*faceD;
542 a10(1,1) += -diffMetric*faceD;
547 coeffPair(0,0)=faceG*dfx0*Af[0];
548 coeffPair(0,1)=faceG*dfx0*Af[1];
551 coeffPair(1,0)=faceG*dfy0*Af[0];
552 coeffPair(1,1)=faceG*dfy0*Af[1];
555 coeffPair(2,0)=-faceG*Af[0];
556 coeffPair(2,1)=-faceG*Af[1];
559 a00 += bwt0*coeffPair;
560 a01 += bwt1*coeffPair;
562 coeffPair(0,0)=faceG*dfx1*Af[0];
563 coeffPair(0,1)=faceG*dfx1*Af[1];
566 coeffPair(1,0)=faceG*dfy1*Af[0];
567 coeffPair(1,1)=faceG*dfy1*Af[1];
570 coeffPair(2,0)=-faceG*Af[0];
571 coeffPair(2,1)=-faceG*Af[1];
575 a10 -= bwt0*coeffPair;
576 a11 -= bwt1*coeffPair;
583 for(
int nnb = ccRow[c0]; nnb<ccRow[c0+1]; nnb++)
585 const int nb = ccCol[nnb];
593 const T gnb_dot_nx2 = T(2.0)*
dot(en,g_nb);
594 g_nb = gnb_dot_nx2*en;
599 coeff(0,0)=-wt0*faceD*(-((one+faceNu)/two)*Af[1]*g_nb[1]);
600 coeff(0,1)=-wt0*faceD*(((one-faceNu)/two)*Af[1]*g_nb[0]+faceNu*Af[0]*g_nb[1]);
601 coeff(0,2)=wt0*faceG*dfx0*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
603 coeff(1,0)=-wt0*faceD*(((one-faceNu)/two)*Af[0]*g_nb[1]+faceNu*Af[1]*g_nb[0]);
604 coeff(1,1)=-wt0*faceD*(-((one+faceNu)/two)*Af[0]*g_nb[0]);
605 coeff(1,2)=wt0*faceG*dfy0*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
609 coeff(2,2)=-wt0*faceG*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
612 for(
int k=0; k<3; k++)
614 coeff(0,0) -= wt0*faceD*secondaryCoeff[k]*g_nb[k];
615 coeff(1,1) -= wt0*faceD*secondaryCoeff[k]*g_nb[k];
619 for(
int i=0; i<3; i++)
621 for(
int k=0; k<3; k++)
622 coeff(i,i) -= wt0*secondaryRCoeff[k]*g_nb[k];
626 OffDiag& a0_nb = matrix.
getCoeff(c0,nb);
632 coeff(0,0)=-wt0*faceD*(-((one+faceNu)/two)*Af[1]*g_nb[1]);
633 coeff(0,1)=-wt0*faceD*(((one-faceNu)/two)*Af[1]*g_nb[0]+faceNu*Af[0]*g_nb[1]);
634 coeff(0,2)=wt0*faceG*dfx1*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
636 coeff(1,0)=-wt0*faceD*(((one-faceNu)/two)*Af[0]*g_nb[1]+faceNu*Af[1]*g_nb[0]);
637 coeff(1,1)=-wt0*faceD*(-((one+faceNu)/two)*Af[0]*g_nb[0]);
638 coeff(1,2)=wt0*faceG*dfy1*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
642 coeff(2,2)=-wt0*faceG*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
645 for(
int k=0; k<3; k++)
647 coeff(0,0) -= wt0*faceD*secondaryCoeff[k]*g_nb[k];
648 coeff(1,1) -= wt0*faceD*secondaryCoeff[k]*g_nb[k];
652 for(
int i=0; i<3; i++)
654 for(
int k=0; k<3; k++)
655 coeff(i,i) -= wt0*secondaryRCoeff[k]*g_nb[k];
663 OffDiag& a1_nb = matrix.
getCoeff(c1,nb);
675 for(
int nnb = ccRow[c1]; nnb<ccRow[c1+1]; nnb++)
677 const int nb = ccCol[nnb];
682 coeff(0,0)=-wt1*faceD*(-((one+faceNu)/two)*Af[1]*g_nb[1]);
683 coeff(0,1)=-wt1*faceD*(((one-faceNu)/two)*Af[1]*g_nb[0]+faceNu*Af[0]*g_nb[1]);
684 coeff(0,2)=wt1*faceG*dfx1*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
686 coeff(1,0)=-wt1*faceD*(((one-faceNu)/two)*Af[0]*g_nb[1]+faceNu*Af[1]*g_nb[0]);
687 coeff(1,1)=-wt1*faceD*(-((one+faceNu)/two)*Af[0]*g_nb[0]);
688 coeff(1,2)=wt1*faceG*dfy1*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
692 coeff(2,2)=-wt1*faceG*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
695 for(
int k=0; k<3; k++)
697 coeff(0,0) -= wt1*faceD*secondaryCoeff[k]*g_nb[k];
698 coeff(1,1) -= wt1*faceD*secondaryCoeff[k]*g_nb[k];
702 for(
int i=0; i<3; i++)
704 for(
int k=0; k<3; k++)
705 coeff(i,i) -= wt1*secondaryRCoeff[k]*g_nb[k];
709 OffDiag& a1_nb = matrix.
getCoeff(c1,nb);
714 coeff(0,0)=-wt1*faceD*(-((one+faceNu)/two)*Af[1]*g_nb[1]);
715 coeff(0,1)=-wt1*faceD*(((one-faceNu)/two)*Af[1]*g_nb[0]+faceNu*Af[0]*g_nb[1]);
716 coeff(0,2)=wt1*faceG*dfx0*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
718 coeff(1,0)=-wt1*faceD*(((one-faceNu)/two)*Af[0]*g_nb[1]+faceNu*Af[1]*g_nb[0]);
719 coeff(1,1)=-wt1*faceD*(-((one+faceNu)/two)*Af[0]*g_nb[0]);
720 coeff(1,2)=wt1*faceG*dfy0*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
724 coeff(2,2)=-wt1*faceG*(g_nb[0]*secondaryCoeff[0]+g_nb[1]*secondaryCoeff[1]);
727 for(
int k=0; k<3; k++)
729 coeff(0,0) -= wt1*faceD*secondaryCoeff[k]*g_nb[k];
730 coeff(1,1) -= wt1*faceD*secondaryCoeff[k]*g_nb[k];
734 for(
int i=0; i<3; i++)
736 for(
int k=0; k<3; k++)
737 coeff(i,i) -= wt1*secondaryRCoeff[k]*g_nb[k];
745 OffDiag& a0_nb = matrix.
getCoeff(c0,nb);
759 residualSource -= diffRMetric*(xCell[c1]-xCell[c0]);
760 residualSource[0] *= pow(faceT,three)/twelve;
761 residualSource[1] *= pow(faceT,three)/twelve;
762 residualSource[2] *= faceT;
766 residualSource -= gradF*secondaryRCoeff;
769 rCell[c0] += residualSource;
770 rCell[c1] -= residualSource;
772 const T diffRCoeff = -diffRMetric;
775 a01(0,0) +=(pow(faceT,three)/twelve)*diffRCoeff;
776 a10(0,0) +=(pow(faceT,three)/twelve)*diffRCoeff;
779 a00(0,0) -=(pow(faceT,three)/twelve)*diffRCoeff;
780 a11(0,0) -=(pow(faceT,three)/twelve)*diffRCoeff;
782 a01(1,1) +=(pow(faceT,three)/twelve)*diffRCoeff;
783 a10(1,1) +=(pow(faceT,three)/twelve)*diffRCoeff;
786 a00(1,1) -=(pow(faceT,three)/twelve)*diffRCoeff;
787 a11(1,1) -=(pow(faceT,three)/twelve)*diffRCoeff;
790 a01(2,2) +=faceT*diffRCoeff;
791 a10(2,2) +=faceT*diffRCoeff;
794 a00(2,2) -=faceT*diffRCoeff;
795 a11(2,2) -=faceT*diffRCoeff;
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
T harmonicAverage(const T &x0, const T &x1)
CCMatrix::DiagArray DiagArray
const FaceGroupList & getAllFaceGroups() const
Field & _plasticStrainField
CRMatrix< Diag, OffDiag, VectorT3 > CCMatrix
OffDiag & getCoeff(const int i, const int j)
Array< VectorT4 > VectorT4Array
Gradient< VectorT3 > VGradType
OffDiag & getCoeff10(const int np)
Coord & getCoeff(const int i, const int j)
Array< Diag > & getDiag()
void discretizeFaces(const Mesh &mesh, const StorageSite &faces, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField, const bool isBoundary, const bool isSymmetry)
VGradModelType::GradMatrixType VGradMatrix
CCMatrix::PairWiseAssembler CCAssembler
Tangent sqrt(const Tangent &a)
const Field & _thicknessField
Field & _plasticStrainOutField
Array< Gradient< VectorT3 > > VGradArray
const Field & _devStressField
const Field & _varGradientField
pair< const Field *, const StorageSite * > ArrayIndex
const CRConnectivity & getCellCells() const
const StorageSite & getCells() const
void discretize(const Mesh &mesh, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField)
Field & _plasticStrainN1Field
int getCountLevel1() const
OffDiag & getCoeff01(const int np)
const CRConnectivity & getFaceCells(const StorageSite &site) const
static GradMatrixType & getGradientMatrix(const Mesh &mesh, const GeomFields &geomFields)
const Field & _VMStressField
const Field & _forceField
const bool _fullLinearization
const Field & _residualStressField
GradientModel< VectorT3 > VGradModelType
Array< VectorT3 > VectorT3Array
PlateSourceDiscretization(const MeshList &meshes, const GeomFields &geomFields, Field &varField, const Field &ymField, const Field &nuField, const Field &varGradientField, const Field &residualStressField, const Field &thicknessField, const Field &forceField, const T &scf, const Field &devStressField, const Field &VMStressField, Field &plasticStrainField, Field &plasticStrainOutField, Field &plasticStrainN1Field, Field &plasticMomentField, const T &A, const T &B, const T &mm, const T &nn, const T &Sy0, const int &nz, const T &timeStep, const int &creepModel, const bool &creep, bool fullLinearization=true)
PairWiseAssembler & getPairWiseAssembler(const CRConnectivity &pairs)
T dot(const Vector< T, 3 > &a, const Vector< T, 3 > &b)
Field & _plasticMomentField
vector< Mesh * > MeshList
const GeomFields & _geomFields