63#define FIXEDpressure 0
68#define VELOCITYCOEFF 1.0
79 1, 2, 3, 8, 9, 10, 15, 16, 17, 22, 23, 24, 28, 29, 30, 34, 35, 36
82 4, 5, 6, 11, 12, 13, 18, 19, 20, 25, 26, 27, 31, 32, 33, 37, 38, 39
91 double nu = .25,
E = 1;
101 Dghost.times(
E / ( 1 + nu ) / ( 1 - 2 * nu ) );
107 for (
int i = 0, j = 1; i < 10; ++i ) {
117 for (
int i = 0, j = 1; i < 10; ++i ) {
170 aPert.
at(i) = aPert.
at(i) + eps;
174 DintF.operator=(intF - intFPert);
175 DintF.
times(-1 / eps);
195 aPert.
at(i) = aPert.
at(i) + eps;
199 DintF.operator=(intF - intFPert);
200 DintF.
times(-1 / eps);
237 FloatMatrix afDu, afDw, bfuDu, bfuDp, bfpDu, bfpDw, cfwDu;
240 FloatArray aVelocity, aPressure, aGhostDisplacement, aIncGhostDisplacement;
262 a_inc.operator=(a - a_prev);
270 aTotal.operator=(aVelocity + aIncGhostDisplacement *
VELOCITYCOEFF);
274 const FloatArray &lcoords = gp->giveNaturalCoordinates();
276 double weight = gp->giveWeight();
284 dNv.
at(k * 3 + 1) = dNx.
at(k + 1, 1);
285 dNv.
at(k * 3 + 2) = dNx.
at(k + 1, 2);
286 dNv.
at(k * 3 + 3) = dNx.
at(k + 1, 3);
289 gp->setMaterialMode(_3dFlow);
291 gp->setMaterialMode(_3dMat);
308 int Voigt6[ 3 ] [ 3 ] = { { 1, 6, 5 }, { 6, 2, 4 }, { 5, 4, 3 } };
309 int Voigt9[ 3 ] [ 3 ] = { { 1, 6, 5 }, { 9, 2, 4 }, { 8, 7, 3 } };
344 #if FIXEDpressure == 1
348 gp->setMaterialMode(_3dFlow);
350 fluidCauchyArray = stress_eps.first;
351 gp->setMaterialMode(_3dMat);
359 fluidTwoPointStressMatrix.
beProductOf(fluidCauchyMatrix, FinvT);
360 fluidTwoPointStressArray.
beVectorForm(fluidTwoPointStressMatrix);
365 afuT1.
times(J * weight * detJ);
378 for (
int i = 1; i <= 3; i++ ) {
379 for (
int j = 1; j <= 3; j++ ) {
380 for (
int k = 1; k <= 3; k++ ) {
381 for (
int l = 1; l <= 3; l++ ) {
382 for (
int m = 1; m <= 3; m++ ) {
383 G.
at(Voigt9 [ i - 1 ] [ j - 1 ], Voigt9 [ k - 1 ] [ l - 1 ]) +=
384 Ed.
at(Voigt6 [ i - 1 ] [ m - 1 ], Voigt6 [ k - 1 ] [ l - 1 ]) * FinvT.
at(m, j);
393 afuT2.
times(J * weight * detJ);
404 for (
int i = 1; i <= 3; i++ ) {
405 for (
int j = 1; j <= 3; j++ ) {
406 for (
int k = 1; k <= 3; k++ ) {
407 for (
int l = 1; l <= 3; l++ ) {
408 for (
int m = 1; m <= 3; m++ ) {
409 K.
at(Voigt9 [ i - 1 ] [ j - 1 ], Voigt9 [ m - 1 ] [ l - 1 ]) +=
410 fluidCauchyArray.
at(Voigt6 [ i - 1 ] [ k - 1 ]) * FinvT.
at(k, l) * FinvT.
at(m, j);
419 afuT3.
times(-J * weight * detJ);
432 bfuT1.
times(-J * pressure * weight * detJ);
441 for (
int i = 1; i <= 3; i++ ) {
442 for (
int j = 1; j <= 3; j++ ) {
443 for (
int k = 1; k <= 3; k++ ) {
444 for (
int l = 1; l <= 3; l++ ) {
445 C.
at(Voigt9 [ i - 1 ] [ j - 1 ], Voigt9 [ k - 1 ] [ l - 1 ]) +=
446 FinvT.
at(i, l) * FinvT.
at(k, j);
454 bfuT2.
times(pressure * J * weight * detJ);
461 bfuT3.
times(-J * detJ * weight);
477 for (
int k = 1; k <= 3; k++ ) {
478 for (
int l = 1; l <= 3; l++ ) {
479 for (
int i = 1; i <= 3; i++ ) {
480 for (
int j = 1; j <= 3; j++ ) {
481 A_IVm.
at(k, l) += Bvm.
at(i, j) * FinvT.
at(i, l) * FinvT.
at(k, j);
490 bfpT1.
times(-J * detJ * weight * FinvTaBv);
503 bfpT2.
times(J * detJ * weight);
513 bfpT3.
times(-J * detJ * weight);
525 cfwT1.
times(detJ * weight);
576 double difference = numtan.
at(i, j) - temp.
at(i, j);
577 if ( fabs(difference) > fabs(MaxErr) ) {
582 if ( fabs(numtan.
at(i, j) < 1e-15) ) {
583 numtan.
at(i, j) = 0.0;
585 if ( fabs(temp.
at(i, j) < 1e-15) ) {
591 printf(
"globalNumber: %u, i:%u, j:%u, MaxErr: %e, Numtan=%f, Analytic=%f\n", this->
globalNumber, imax, jmax, MaxErr, numtan.
at(imax, jmax), temp.
at(imax, jmax) );
595 if ( fabs(MaxErr) > 1e-5 ) {
596 printf(
"The error is actually quite large..\n");
617 if ( type != ExternalForcesVector ) {
625 FloatArray N, gVector, temparray(30), dNv, inc, a, a_prev, u, u_prev, vload;
639 const FloatArray &lcoords = gp->giveNaturalCoordinates();
642 double dA = detJ * gp->giveWeight();
647 double rho = mat->
give(
'd', gp);
669 for (
int j = 0; j <
N.giveSize(); j++ ) {
670 temparray(3 * j + 0) +=
N(j) * rho * gVector(0) * dA;
671 temparray(3 * j + 1) +=
N(j) * rho * gVector(1) * dA;
672 temparray(3 * j + 2) +=
N(j) * rho * gVector(2) * dA;
682 dNv.
at(k * 3 + 1) = dNx.
at(k + 1, 1);
683 dNv.
at(k * 3 + 2) = dNx.
at(k + 1, 2);
684 dNv.
at(k * 3 + 3) = dNx.
at(k + 1, 3);
725 FloatArray Strain, Stress, Nlin, dNv, a_inc, a_prev, aVelocity, aPressure, aGhostDisplacement, aIncGhostDisplacement, fluidStress, epsf, dpdivv;
726 FloatArray momentum, conservation, auxstress, divv;
735 a_inc.operator=(a - a_prev);
743 aTotal.operator=(aVelocity + aIncGhostDisplacement *
VELOCITYCOEFF);
746 const FloatArray &lcoords = gp->giveNaturalCoordinates();
748 double weight = gp->giveWeight();
755 dNv.
at(k * 3 + 1) = dNx.
at(k + 1, 1);
756 dNv.
at(k * 3 + 2) = dNx.
at(k + 1, 2);
757 dNv.
at(k * 3 + 3) = dNx.
at(k + 1, 3);
768 gp->setMaterialMode(_3dFlow);
771 fluidStress = val.first;
775 gp->setMaterialMode(_3dMat);
777 momentum.
plusProduct(B, fluidStress, detJ * weight);
778 momentum.
add(-pressure * detJ * weight, dNv);
782 divv.
times(-detJ * weight);
784 conservation.
add(divv.
at(1), Nlin);
816 gp->setMaterialMode(_3dFlow);
819 fluidCauchyArray = val.first;
823 gp->setMaterialMode(_3dMat);
827 fluidStressMatrix.
beProductOf(fluidCauchyMatrix, FinvT);
831 momentum.
plusProduct(BH, fluidStress, detJ * J * weight);
837 momentum.
add(-pressure * detJ * weight * J, ptemp);
841 double FinvTaBvaTotal;
845 conservation.
add(-J * detJ * weight * FinvTaBvaTotal, Nlin);
880 FloatArray Strain, Stress, Nlin, dNv, a_inc, a_prev, aVelocity, aPressure, aGhostDisplacement, aIncGhostDisplacement, fluidStress, epsf, dpdivv;
881 FloatArray momentum, conservation, auxstress, divv;
890 a_inc.operator=(a - a_prev);
898 aTotal.operator=(aVelocity + aIncGhostDisplacement *
VELOCITYCOEFF);
902 const FloatArray &lcoords = gp->giveNaturalCoordinates();
904 double weight = gp->giveWeight();
911 dNv.
at(k * 3 + 1) = dNx.
at(k + 1, 1);
912 dNv.
at(k * 3 + 2) = dNx.
at(k + 1, 2);
913 dNv.
at(k * 3 + 3) = dNx.
at(k + 1, 3);
917#if FIXEDpressure == 1
927 gp->setMaterialMode(_3dFlow);
930 fluidStress = val.first;
934 gp->setMaterialMode(_3dMat);
936 momentum.
plusProduct(B, fluidStress, detJ * weight);
937 momentum.
add(-pressure * detJ * weight, dNv);
941 divv.
times(-detJ * weight);
943 conservation.
add(divv.
at(1), Nlin);
986 gp->setMaterialMode(_3dFlow);
989 fluidCauchy = val.first;
993 gp->setMaterialMode(_3dMat);
997 fluidStressMatrix.
beProductOf(fluidCauchyMatrix, FinvT);
1008 momentum.
plusProduct(BH, fluidStress, detJ * J * weight);
1013 momentum.
add(-pressure * detJ * weight * J, ptemp);
1017 double FinvTaBvaTotal;
1020 FinvTaBvaTotal = FinvTa.
dotProduct(BvaTotal);
1021 conservation.
add(-J * detJ * weight * FinvTaBvaTotal, Nlin);
1055 V_u, V_v, V_w, D_u, D_v, D_w, P_f
1059 V_u, V_v, V_w, D_u, D_v, D_w
1077 for (
int i = 1; i <= 10; i++ ) {
1078 answer.
at(1, 3 * i - 2) = dnx.
at(i, 1);
1079 answer.
at(2, 3 * i - 1) = dnx.
at(i, 2);
1080 answer.
at(3, 3 * i - 0) = dnx.
at(i, 3);
1082 answer.
at(4, 3 * i - 1) = dnx.
at(i, 3);
1083 answer.
at(4, 3 * i - 0) = dnx.
at(i, 2);
1085 answer.
at(5, 3 * i - 2) = dnx.
at(i, 3);
1086 answer.
at(5, 3 * i - 0) = dnx.
at(i, 1);
1088 answer.
at(6, 3 * i - 2) = dnx.
at(i, 2);
1089 answer.
at(6, 3 * i - 1) = dnx.
at(i, 1);
1111 BH.
at(1, 3 * i - 2) = dNdx.
at(i, 1);
1112 BH.
at(2, 3 * i - 1) = dNdx.
at(i, 2);
1113 BH.
at(3, 3 * i - 0) = dNdx.
at(i, 3);
1114 BH.
at(4, 3 * i - 1) = dNdx.
at(i, 3);
1115 BH.
at(7, 3 * i - 0) = dNdx.
at(i, 2);
1116 BH.
at(5, 3 * i - 2) = dNdx.
at(i, 3);
1117 BH.
at(8, 3 * i - 0) = dNdx.
at(i, 1);
1118 BH.
at(6, 3 * i - 2) = dNdx.
at(i, 2);
1119 BH.
at(9, 3 * i - 1) = dNdx.
at(i, 1);
1142 answer.
at(1, 3 * i - 2) = dnx.
at(i, 1);
1143 answer.
at(2, 3 * i - 1) = dnx.
at(i, 2);
1144 answer.
at(3, 3 * i - 0) = dnx.
at(i, 3);
1145 answer.
at(4, 3 * i - 1) = dnx.
at(i, 3);
1146 answer.
at(7, 3 * i - 0) = dnx.
at(i, 2);
1147 answer.
at(5, 3 * i - 2) = dnx.
at(i, 3);
1148 answer.
at(8, 3 * i - 0) = dnx.
at(i, 1);
1149 answer.
at(6, 3 * i - 2) = dnx.
at(i, 2);
1150 answer.
at(9, 3 * i - 1) = dnx.
at(i, 1);
1165 u_prev.operator=(inc);
1188 if ( matMode == _3dMat || matMode == _PlaneStrain ) {
1189 answer.
at(1) += 1.0;
1190 answer.
at(2) += 1.0;
1191 answer.
at(3) += 1.0;
1192 }
else if ( matMode == _PlaneStress ) {
1193 answer.
at(1) += 1.0;
1194 answer.
at(2) += 1.0;
1195 }
else if ( matMode == _1dMat ) {
1196 answer.
at(1) += 1.0;
1198 OOFEM_ERROR(
"MaterialMode is not supported yet (%s)", __MaterialModeToString(matMode) );
1225 if ( type == IST_Velocity ) {
1232 Nmat.
resize(3,
N.giveSize() * 3);
1233 for (
int i = 1; i <=
N.giveSize(); i++ ) {
1234 Nmat.
at(1, 3 * i - 2) =
N.at(i);
1235 Nmat.
at(2, 3 * i - 1) =
N.at(i);
1236 Nmat.
at(3, 3 * i - 0) =
N.at(i);
1241 }
else if ( type == IST_Pressure ) {
1248 answer.
at(1) =
N.dotProduct(a);
1267#if USEUNCOUPLED == 0
1284 for (
int j = 1; j <= DofIDs.
giveSize(); j++ ) {
1288 if ( DofIDs.
at(j) == V_u || DofIDs.
at(j) == V_v || DofIDs.
at(j) == V_w ) {
1294 for (
int n = 1; n <= DofIDs.
giveSize(); n++ ) {
1295 if ( ( DofIDs.
at(j) == V_u && DofIDs.
at(n) == D_u ) ||
1296 ( DofIDs.
at(j) == V_v && DofIDs.
at(n) == D_v ) ||
1297 ( DofIDs.
at(j) == V_w && DofIDs.
at(n) == D_w ) ) {
1298 row2 = firstIndex + n - 1;
1315 for (
int i = 1; i <= row1List.
giveSize(); i++ ) {
1356 for (
int i = 1; i <= n.
giveSize(); i++ ) {
1362 for (
int i = 1; i <= n_lin.
giveSize(); i++ ) {
1370 if ( type == IST_Pressure ) {
1375 const auto &eNodes = this->
interpolation.computeLocalEdgeMapping(node - 4);
1376 answer.
at(1) = 0.5 * (
1389 if ( type != ExternalForcesVector ) {
1406 for (
auto &gp : * iRule ) {
1407 FloatArray lcoords = gp->giveNaturalCoordinates();
1415 if ( thisLoad != NULL ) {
1455 double thickness = 1.0;
#define REGISTER_Element(class)
void computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode) override
int giveApproxOrder() override=0
CoordSystType giveCoordSystMode() override
virtual int setupIntegrationPoints(IntegrationRule &irule, int npoints, Element *element)
Dof * giveDofWithID(int dofID) const
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
virtual bool hasBc(TimeStep *tStep)=0
EIPrimaryUnknownMapperInterface()
Node * giveNode(int i) const
int numberOfDofMans
Number of dofmanagers.
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
std::vector< std ::unique_ptr< IntegrationRule > > integrationRulesArray
virtual int giveNumberOfDofManagers() const
DofManager * giveDofManager(int i) const
CrossSection * giveCrossSection()
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
virtual double computeVolume()
virtual std::unique_ptr< IntegrationRule > giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const
virtual double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual int giveNsd(const Element_Geometry_Type) const =0
virtual void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual Interface * giveInterface(InterfaceType t)
void assemble(const FloatArray &fe, const IntArray &loc)
void plusProduct(const FloatMatrix &b, const FloatArray &s, double dV)
double dotProduct(const FloatArray &x) const
Index giveSize() const
Returns the size of receiver.
void zero()
Zeroes all coefficients of receiver.
void rotatedWith(FloatMatrix &r, char mode)
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
void beVectorForm(const FloatMatrix &aMatrix)
void add(const FloatArray &src)
void subtract(const FloatArray &src)
void beSubArrayOf(const FloatArray &src, const IntArray &indx)
void printYourselfToFile(const std::string filename, const bool showDimensions=true) const
void plusProductSymmUpper(const FloatMatrix &a, const FloatMatrix &b, double dV)
static FloatMatrix fromArray(const FloatArray &vector, bool transpose=false)
void add(const FloatMatrix &a)
void resize(Index rows, Index cols)
int giveNumberOfColumns() const
Returns number of columns of receiver.
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void beNMatrixOf(const FloatArray &n, int nsd)
void plusDyadUnsym(const FloatArray &a, const FloatArray &b, double dV)
void setColumn(const FloatArray &src, int c)
void beTranspositionOf(const FloatMatrix &src)
void zero()
Zeroes all coefficient of receiver.
void beMatrixFormOfStress(const FloatArray &aArray)
bool beInverseOf(const FloatMatrix &src)
void beDyadicProductOf(const FloatArray &vec1, const FloatArray &vec2)
double giveDeterminant() const
void beMatrixForm(const FloatArray &aArray)
int giveNumberOfRows() const
Returns number of rows of receiver.
void assemble(const FloatMatrix &src, const IntArray &loc)
double at(std::size_t i, std::size_t j) const
void beTProductOf(const FloatMatrix &a, const FloatMatrix &b)
virtual FloatMatrixF< 6, 6 > computeTangent3D(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const =0
virtual std::pair< FloatArrayF< 6 >, double > computeDeviatoricStress3D(const FloatArrayF< 6 > &eps, double pressure, GaussPoint *gp, TimeStep *tStep) const
void setMaterialMode(MaterialMode newMode)
Sets material mode of receiver.
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
void resizeWithValues(int n, int allocChunk=0)
virtual void computeComponentArrayAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
@ CST_Global
Load is specified in global c.s.
virtual FormulationType giveFormulationType()
virtual double give(int aProperty, GaussPoint *gp) const
NLStructuralElement(int n, Domain *d)
int nlGeometry
Flag indicating if geometrical nonlinearities apply.
void computeValueAtBoundary(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode, Element *e, int boundary)
NodalAveragingRecoveryModelInterface()
Constructor.
SpatialLocalizerInterface(Element *element)
virtual FloatMatrixF< 9, 9 > giveStiffnessMatrix_dPdF_3d(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const =0
virtual FloatArrayF< 6 > giveRealStress_3d(const FloatArrayF< 6 > &reducedStrain, GaussPoint *gp, TimeStep *tStep) const =0
virtual FloatMatrixF< 6, 6 > giveStiffnessMatrix_3d(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const =0
StructuralCrossSection * giveStructuralCrossSection()
Helper function which returns the structural cross-section for the element.
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
std::unique_ptr< FloatArray > initialDisplacements
Initial displacement vector, describes the initial nodal displacements when element has been casted.
virtual int computeLoadGToLRotationMtrx(FloatMatrix &answer)
int giveNumber()
Returns receiver's number.
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
static FEI3dTetQuad interpolation
static IntArray displacementdofsonside
FEInterpolation * giveInterpolation() const override
bool giveRowTransformationMatrix(TimeStep *tStep)
void computeDeformationGradientVectorFromDispl(FloatArray &answer, GaussPoint *gp, TimeStep *tStep, FloatArray &u)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
void EIPrimaryUnknownMI_computePrimaryUnknownVectorAtLocal(ValueModeType u, TimeStep *tStep, const FloatArray &coords, FloatArray &answer) override
void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override
void computeNumericStiffnessMatrixDebug(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
static IntArray velocitydofsonside
static IntArray conservation_ordering
Ordering of conservation equations in element. Used to assemble the element stiffness.
void computeDeformationGradientVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) override
void giveInternalForcesVectorGivenSolutionDebug(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord, FloatArray &SolutionVector, bool ExtraLogging)
void computeConstitutiveMatrix_dPdF_At(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override
static IntArray ghostdisplacement_ordering
Ordering of ghost displacements equations.
void computeDeformationGradientVectorAt(FloatArray &answer, FloatArray lcoord, TimeStep *tStep)
void giveInternalForcesVectorGivenSolution(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord, FloatArray &SolutionVector)
double computeVolumeAround(GaussPoint *gp) override
void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord=0) override
static FEI3dTetLin interpolation_lin
Interface * giveInterface(InterfaceType it) override
void giveUnknownData(FloatArray &u_prev, FloatArray &u, FloatArray &inc, TimeStep *tStep)
Element_Geometry_Type giveGeometryType() const override
void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep) override
void computeBmatrixAt(GaussPoint *, FloatMatrix &, int=1, int=ALL_STRAINS) override
void computeGaussPoints() override
tet21ghostsolid(int n, Domain *d)
void computeBoundarySurfaceLoadVector(FloatArray &answer, BoundaryLoad *load, int boundary, CharType type, ValueModeType mode, TimeStep *tStep, bool global=true) override
static IntArray momentum_ordering
Ordering of momentum balance equations in element. Used to assemble the element stiffness.
virtual void computeNumericStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
void computeLoadVector(FloatArray &answer, BodyLoad *load, CharType type, ValueModeType mode, TimeStep *tStep) override
void giveDofManDofIDMask(int inode, IntArray &answer) const override
void computeBHmatrixAt(GaussPoint *, FloatMatrix &) override
void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override
void computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) override
@ SpatialLocalizerInterfaceType
@ NodalAveragingRecoveryModelInterfaceType
@ EIPrimaryUnknownMapperInterfaceType