67 int components = nsd * nsd - 1;
68 for (
int i = 0; i < components; i++ ) {
97 cartesian.
at(1) = deviatoric.
at(1) / sqrt(2.0);
98 cartesian.
at(2) = -deviatoric.
at(1) / sqrt(2.0);
99 cartesian.
at(3) = ( deviatoric.
at(2) + deviatoric.
at(3) ) * 0.5;
105 double s6 = sqrt(6.);
106 double s2 = sqrt(2.);
108 cartesian.
at(1) = 2.0 * deviatoric.
at(1) / s6;
109 cartesian.
at(2) = -deviatoric.
at(1) / s6 + deviatoric.
at(2) / s2;
110 cartesian.
at(3) = -deviatoric.
at(1) / s6 - deviatoric.
at(2) / s2;
112 cartesian.
at(4) = ( deviatoric.
at(3) + deviatoric.
at(6) ) * 0.5;
113 cartesian.
at(5) = ( deviatoric.
at(4) + deviatoric.
at(7) ) * 0.5;
114 cartesian.
at(6) = ( deviatoric.
at(5) + deviatoric.
at(8) ) * 0.5;
124 cartesian.
at(1, 1) = deviatoric.
at(1, 1) * 0.5;
125 cartesian.
at(2, 2) = deviatoric.
at(1, 1) * 0.5;
126 cartesian.
at(1, 2) = -deviatoric.
at(1, 1) * 0.5;
127 cartesian.
at(2, 1) = -deviatoric.
at(1, 1) * 0.5;
129 cartesian.
at(1, 3) = ( deviatoric.
at(1, 2) + deviatoric.
at(1, 3) ) / sqrt(8.0);
130 cartesian.
at(2, 3) = -( deviatoric.
at(1, 2) + deviatoric.
at(1, 3) ) / sqrt(8.0);
131 cartesian.
at(3, 1) = ( deviatoric.
at(2, 1) + deviatoric.
at(3, 1) ) / sqrt(8.0);
132 cartesian.
at(3, 2) = -( deviatoric.
at(2, 1) + deviatoric.
at(3, 1) ) / sqrt(8.0);
134 cartesian.
at(3, 3) = ( deviatoric.
at(2, 2) + deviatoric.
at(2, 3) +
135 deviatoric.
at(3, 2) + deviatoric.
at(3, 3) ) * 0.25;
163 cartesian.
at(1, 1) = deviatoric.
at(1, 1) * 2.0 / 3.0;
164 cartesian.
at(1, 2) = -deviatoric.
at(1, 1) / 3.0 + deviatoric.
at(1, 2) * sqrt(3.0);
165 cartesian.
at(2, 1) = -deviatoric.
at(1, 1) / 3.0 + deviatoric.
at(1, 2) * sqrt(3.0);
166 cartesian.
at(1, 3) = -deviatoric.
at(1, 1) / 3.0 - deviatoric.
at(1, 2) * sqrt(3.0);
167 cartesian.
at(3, 1) = -deviatoric.
at(1, 1) / 3.0 - deviatoric.
at(1, 2) * sqrt(3.0);
169 cartesian.
at(2, 2) = deviatoric.
at(1, 1) / 6.0 + deviatoric.
at(2, 2) / 2.0 - deviatoric.
at(1, 2) / sqrt(12.0) - deviatoric.
at(2, 1) / sqrt(12.0);
170 cartesian.
at(2, 3) = deviatoric.
at(1, 1) / 6.0 - deviatoric.
at(2, 2) / 2.0 + deviatoric.
at(1, 2) / sqrt(12.0) - deviatoric.
at(2, 1) / sqrt(12.0);
171 cartesian.
at(3, 3) = deviatoric.
at(1, 1) / 6.0 + deviatoric.
at(2, 2) / 2.0 - deviatoric.
at(1, 2) / sqrt(12.0) + deviatoric.
at(2, 1) / sqrt(12.0);
172 cartesian.
at(3, 2) = deviatoric.
at(1, 1) / 6.0 - deviatoric.
at(2, 2) / 2.0 + deviatoric.
at(1, 2) / sqrt(12.0) + deviatoric.
at(2, 1) / sqrt(12.0);
174 cartesian.
at(1, 4) = ( deviatoric.
at(1, 3) + deviatoric.
at(1, 6) ) / sqrt(6.0);
175 cartesian.
at(1, 5) = ( deviatoric.
at(1, 4) + deviatoric.
at(1, 7) ) / sqrt(6.0);
176 cartesian.
at(1, 6) = ( deviatoric.
at(1, 5) + deviatoric.
at(1, 8) ) / sqrt(6.0);
177 cartesian.
at(2, 4) = deviatoric.
at(2, 3) / sqrt(8.0) + deviatoric.
at(2, 6) / sqrt(8.0) - deviatoric.
at(1, 3) / sqrt(24.0) - deviatoric.
at(1, 6) / sqrt(24.0);
178 cartesian.
at(2, 5) = deviatoric.
at(2, 4) / sqrt(8.0) + deviatoric.
at(2, 7) / sqrt(8.0) - deviatoric.
at(1, 4) / sqrt(24.0) - deviatoric.
at(1, 7) / sqrt(24.0);
179 cartesian.
at(2, 6) = deviatoric.
at(2, 5) / sqrt(8.0) + deviatoric.
at(2, 8) / sqrt(8.0) - deviatoric.
at(1, 5) / sqrt(24.0) - deviatoric.
at(1, 8) / sqrt(24.0);
180 cartesian.
at(3, 4) = -deviatoric.
at(2, 3) / sqrt(8.0) - deviatoric.
at(2, 6) / sqrt(8.0) - deviatoric.
at(1, 3) / sqrt(24.0) - deviatoric.
at(1, 6) / sqrt(24.0);
181 cartesian.
at(3, 5) = -deviatoric.
at(2, 4) / sqrt(8.0) - deviatoric.
at(2, 7) / sqrt(8.0) - deviatoric.
at(1, 4) / sqrt(24.0) - deviatoric.
at(1, 7) / sqrt(24.0);
182 cartesian.
at(3, 6) = -deviatoric.
at(2, 5) / sqrt(8.0) - deviatoric.
at(2, 8) / sqrt(8.0) - deviatoric.
at(1, 5) / sqrt(24.0) - deviatoric.
at(1, 8) / sqrt(24.0);
184 cartesian.
at(1, 4) = ( deviatoric.
at(3, 1) + deviatoric.
at(6, 1) ) / sqrt(6.0);
185 cartesian.
at(1, 5) = ( deviatoric.
at(4, 1) + deviatoric.
at(7, 1) ) / sqrt(6.0);
186 cartesian.
at(1, 6) = ( deviatoric.
at(5, 1) + deviatoric.
at(8, 1) ) / sqrt(6.0);
187 cartesian.
at(2, 4) = deviatoric.
at(3, 2) / sqrt(8.0) + deviatoric.
at(6, 2) / sqrt(8.0) - deviatoric.
at(3, 1) / sqrt(24.0) - deviatoric.
at(6, 1) / sqrt(24.0);
188 cartesian.
at(2, 5) = deviatoric.
at(4, 2) / sqrt(8.0) + deviatoric.
at(7, 2) / sqrt(8.0) - deviatoric.
at(4, 1) / sqrt(24.0) - deviatoric.
at(7, 1) / sqrt(24.0);
189 cartesian.
at(2, 6) = deviatoric.
at(5, 2) / sqrt(8.0) + deviatoric.
at(8, 2) / sqrt(8.0) - deviatoric.
at(5, 1) / sqrt(24.0) - deviatoric.
at(8, 1) / sqrt(24.0);
190 cartesian.
at(3, 4) = -deviatoric.
at(3, 2) / sqrt(8.0) - deviatoric.
at(6, 2) / sqrt(8.0) - deviatoric.
at(3, 1) / sqrt(24.0) - deviatoric.
at(6, 1) / sqrt(24.0);
191 cartesian.
at(3, 5) = -deviatoric.
at(4, 2) / sqrt(8.0) - deviatoric.
at(7, 2) / sqrt(8.0) - deviatoric.
at(4, 1) / sqrt(24.0) - deviatoric.
at(7, 1) / sqrt(24.0);
192 cartesian.
at(3, 6) = -deviatoric.
at(5, 2) / sqrt(8.0) - deviatoric.
at(8, 2) / sqrt(8.0) - deviatoric.
at(5, 1) / sqrt(24.0) - deviatoric.
at(8, 1) / sqrt(24.0);
194 cartesian.
at(4, 4) = ( deviatoric.
at(3, 3) + deviatoric.
at(3, 6) + deviatoric.
at(6, 3) + deviatoric.
at(6, 6) ) * 0.25;
195 cartesian.
at(4, 5) = ( deviatoric.
at(3, 4) + deviatoric.
at(3, 7) + deviatoric.
at(6, 4) + deviatoric.
at(6, 7) ) * 0.25;
196 cartesian.
at(4, 6) = ( deviatoric.
at(3, 5) + deviatoric.
at(3, 8) + deviatoric.
at(6, 5) + deviatoric.
at(6, 8) ) * 0.25;
197 cartesian.
at(5, 4) = ( deviatoric.
at(4, 3) + deviatoric.
at(4, 6) + deviatoric.
at(7, 3) + deviatoric.
at(7, 6) ) * 0.25;
198 cartesian.
at(5, 5) = ( deviatoric.
at(4, 4) + deviatoric.
at(4, 7) + deviatoric.
at(7, 4) + deviatoric.
at(7, 7) ) * 0.25;
199 cartesian.
at(5, 6) = ( deviatoric.
at(4, 5) + deviatoric.
at(4, 8) + deviatoric.
at(7, 5) + deviatoric.
at(7, 8) ) * 0.25;
200 cartesian.
at(6, 4) = ( deviatoric.
at(5, 3) + deviatoric.
at(5, 6) + deviatoric.
at(8, 3) + deviatoric.
at(8, 6) ) * 0.25;
201 cartesian.
at(6, 5) = ( deviatoric.
at(5, 4) + deviatoric.
at(5, 7) + deviatoric.
at(8, 4) + deviatoric.
at(8, 7) ) * 0.25;
202 cartesian.
at(6, 6) = ( deviatoric.
at(5, 5) + deviatoric.
at(5, 8) + deviatoric.
at(8, 5) + deviatoric.
at(8, 8) ) * 0.25;
224 }
else if ( nsd == 2 ) {
241 if ( type != TangentStiffnessMatrix ) {
246 IntArray loc_r, loc_c, sigma_loc_r, sigma_loc_c;
253 const IntArray &boundaries =
set->giveBoundaryList();
256 cols.resize( boundaries.
giveSize() );
258 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
260 int boundary = boundaries.
at(pos * 2);
267 cols [ i ] = sigma_loc_c;
270 rows [ i ] = sigma_loc_r;
286 if ( interpUnknown ) {
297 const FloatArray &lcoords = gp->giveNaturalCoordinates();
306 answer.
plusProduct( nMatrix, normal, detJ * gp->giveWeight() );
321 if ( interpUnknown ) {
331 for (
auto &gp: *ir ) {
332 const FloatArray &lcoords = gp->giveNaturalCoordinates();
345 E_n.
at(1, 1) = 2.0 * normal.
at(1) / sqrt(6.0);
346 E_n.
at(1, 2) = -normal.
at(2) / sqrt(6.0);
347 E_n.
at(1, 3) = -normal.
at(3) / sqrt(6.0);
350 E_n.
at(2, 2) = normal.
at(2) / sqrt(2.0);
351 E_n.
at(2, 3) = -normal.
at(3) / sqrt(2.0);
353 E_n.
at(3, 1) = normal.
at(2);
357 E_n.
at(4, 1) = normal.
at(3);
362 E_n.
at(5, 2) = normal.
at(3);
366 E_n.
at(6, 2) = normal.
at(1);
371 E_n.
at(7, 3) = normal.
at(1);
375 E_n.
at(8, 3) = normal.
at(2);
376 }
else if ( nsd == 2 ) {
378 E_n.
at(1, 1) = normal.
at(1) / sqrt(2.0);
379 E_n.
at(1, 2) = -normal.
at(2) / sqrt(2.0);
381 E_n.
at(2, 1) = normal.
at(2);
385 E_n.
at(3, 2) = normal.
at(1);
392 answer.
add(detJ * gp->giveWeight(), contrib);
401 const IntArray &boundaries =
set->giveBoundaryList();
408 if ( type == ExternalForcesVector ) {
413 answer.
assemble(devLoad, sigma_loc);
417 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
419 int boundary = boundaries.
at(pos * 2);
430 }
else if ( type == InternalForcesVector ) {
440 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
442 int boundary = boundaries.
at(pos * 2);
471 if ( type == TangentStiffnessMatrix || type == SecantStiffnessMatrix || type == ElasticStiffnessMatrix ) {
473 IntArray loc_r, loc_c, sigma_loc_r, sigma_loc_c;
476 const IntArray &boundaries =
set->giveBoundaryList();
482 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
484 int boundary = boundaries.
at(pos * 2);
494 answer.
assemble(sigma_loc_r, loc_c, Ke);
495 answer.
assemble(loc_r, sigma_loc_c, KeT);
506 const IntArray &boundaries =
set->giveBoundaryList();
509 sigmaDevBase.
resize( this->sigmaDev->giveNumberOfDofs() );
510 for (
int i = 1; i <= this->sigmaDev->giveNumberOfDofs(); i++ ) {
516 }
else if ( nsd == 2 ) {
526 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
528 int boundary = boundaries.
at(pos * 2);
546 std :: unique_ptr< SparseLinearSystemNM > solver(
552 const IntArray &boundaries =
set->giveBoundaryList();
558 OOFEM_ERROR(
"Couldn't create sparse matrix of type %d\n", stype);
564 int neq = Kff->giveNumberOfRows();
567 int ndev = this->
sigmaDev->giveNumberOfDofs();
578 for (
int i = 1; i <= ndev; ++i ) {
579 int eqn = this->
sigmaDev->giveDofWithID(
dev_id.
at(i))->giveEquationNumber(fnum);
580 ddev_pert.
at(eqn, i) = -1.0 * rve_size;
587 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
589 int boundary = boundaries.
at(pos * 2);
599 solver->solve(*Kff, ddev_pert, s_d);
600 solver->solve(*Kff, p_pert, s_p);
605 for (
int i = 1; i <= ndev; ++i ) {
606 int eqn = this->
sigmaDev->giveDofWithID(
dev_id.
at(i))->giveEquationNumber(fnum);
607 sigma_p.
at(i) = s_p.
at(eqn);
608 for (
int j = 1; j <= ndev; ++j ) {
609 sigma_d.
at(i, j) = s_d.
at(eqn, j);
617 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
619 int boundary = boundaries.
at(pos * 2);
629 for (
int i = 1; i <= fe.
giveSize(); ++i ) {
630 if ( loc.
at(i) > 0 ) {
631 e_p += fe.
at(i) * s_p.
at( loc.
at(i) );
632 for (
int j = 1; j <= ndev; ++j ) {
633 e_d.
at(j) += fe.
at(i) * s_d.
at(loc.
at(i), j);
639 e_d.
times(1. / rve_size);
648 }
else if ( nsd == 2 ) {
MixedGradientPressureNeumann(int n, Domain *d)
Creates boundary condition with given number, belonging to given domain.
The representation of EngngModel default unknown numbering.
REGISTER_BoundaryCondition(BoundaryCondition)
void fromDeviatoricBase2D(FloatArray &cartesian, FloatArray &deviatoric)
Converts from deviatoric to (normal) cartesian base (arrays are second order 2D tensors in Voigt nota...
virtual void scale(double s)
Scales the receiver according to given value.
virtual int assemble(const IntArray &loc, const FloatMatrix &mat)=0
Assembles sparse matrix from contribution of local elements.
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Base class for all matrices stored in sparse format.
SparseMtrx * createSparseMtrx(SparseMtrxType type)
Creates new instance of sparse matrix corresponding to given keyword.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
virtual double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the normal on the requested boundary.
double & at(int i)
Coefficient access function.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
double domainSize()
Computes the size (including pores) by surface integral over the domain.
void clear()
Clears receiver (zero size).
int giveInterpolationOrder()
Returns the interpolation order.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Implementation for assembling tangent matrices in standard monolithic FE-problems.
Abstract base class for all finite elements.
Base class for dof managers.
void negated()
Changes sign of receiver values.
int giveNumber()
Returns domain number.
virtual double giveUnknown(PrimaryField &field, ValueModeType mode, TimeStep *tStep, ActiveDof *dof)
Computes the value of the dof.
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual DofManager * giveInternalDofManager(int i)
Returns the volumetric DOF manager for i == 1, and the deviatoric manager for i == 2...
virtual void assembleVector(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s, FloatArray *eNorm=NULL)
Assembles B.C.
virtual FEInterpolation * giveInterpolation() const
virtual void computeTangents(FloatMatrix &Ed, FloatArray &Ep, FloatArray &Cd, double &Cp, TimeStep *tStep)
Computes the macroscopic tangents through sensitivity analysis.
Class representing a general abstraction for finite element interpolation class.
virtual void assemble(SparseMtrx &answer, TimeStep *tStep, const MatrixAssembler &ma, const UnknownNumberingScheme &s, Domain *domain)
Assembles characteristic matrix of required type into given sparse matrix.
Class representing "master" degree of freedom.
void beScaled(double s, const FloatArray &b)
Sets receiver to be .
virtual void computeFields(FloatArray &sigmaDev, double &vol, TimeStep *tStep)
Computes the homogenized fields through sensitivity analysis.
void integrateVolTangent(FloatArray &answer, Element *e, int boundary)
Helper function that integrates the volumetric tangent contribution from a single element boundary...
Element * giveElement(int n)
Service for accessing particular domain fe element.
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
double volGradient
The volumetric part of what was sent in (needed to return the difference).
DofIDItem
Type representing particular dof type.
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
#define _IFT_MixedGradientPressure_pressure
void times(double f)
Multiplies receiver by factor f.
Set of elements, boundaries, edges and/or nodes.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
double pressure
Prescribed pressure.
FloatArray devGradient
Prescribed gradient in Voigt form.
Wrapper around element definition to provide FEICellGeometry interface.
Set * giveSet(int n)
Service for accessing particular domain set.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
IntArray dofs
Dofs that b.c. is applied to (relevant for Dirichlet type b.c.s).
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix^T and anArray.
double at(int i, int j) const
Coefficient access function.
void resize(int n)
Checks size of receiver towards requested bounds.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
std::unique_ptr< Node > sigmaDev
DOF-manager containing the unknown deviatoric stress.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
void fromDeviatoricBase3D(FloatArray &cartesian, FloatArray &deviatoric)
Converts from deviatoric to (normal) cartesian base (arrays are second order 3D tensors in Voigt nota...
void beNMatrixOf(const FloatArray &n, int nsd)
Assigns the receiver to be a repeated diagonal matrix.
virtual ~MixedGradientPressureNeumann()
Destructor.
virtual void boundaryGiveNodes(IntArray &answer, int boundary)=0
Gives the boundary nodes for requested boundary number.
int giveNextFreeDofID(int increment=1)
Gives the next free dof ID.
Class representing vector of real numbers.
SparseLinearSystemNM * createSparseLinSolver(LinSystSolverType st, Domain *d, EngngModel *m)
Creates new instance of SparseLinearSystemNM corresponding to given type.
Implementation of matrix containing floating point numbers.
virtual void giveLocationArrays(std::vector< IntArray > &rows, std::vector< IntArray > &cols, CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s)
Gives a list of location arrays that will be assembled.
IRResultType
Type defining the return values of InputRecord reading operations.
void assemble(const FloatArray &fe, const IntArray &loc)
Assembles the array fe (typically, the load vector of a finite element) into the receiver, using loc as location array.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
virtual int giveNumberOfInternalDofManagers()
Returns the number of internal DOF managers (=2).
virtual IntegrationRule * giveBoundaryIntegrationRule(int order, int boundary)
Sets up a suitable integration rule for integrating over the requested boundary.
void add(const FloatMatrix &a)
Adds matrix to the receiver.
virtual void assemble(SparseMtrx &answer, TimeStep *tStep, CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s, double scale=1.0)
Assembles B.C.
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
void zero()
Zeroes all coefficients of receiver.
void assembleSquared(const FloatArray &fe, const IntArray &loc)
Assembles the array fe with each component squared.
virtual void giveBoundaryLocationArray(IntArray &locationArray, const IntArray &bNodes, const UnknownNumberingScheme &s, IntArray *dofIds=NULL)
Returns the location array for the boundary of the element.
IntArray dev_id
Dof IDs for the lagrange multipliers in sigmaDev.
void times(double s)
Multiplies receiver with scalar.
void beTranspositionOf(const FloatMatrix &src)
Assigns to the receiver the transposition of parameter.
ClassFactory & classFactory
void zero()
Zeroes all coefficient of receiver.
Domain * giveDomain() const
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Abstract base class representing the "problem" under consideration.
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
int giveSize() const
Returns the size of receiver.
void integrateDevTangent(FloatMatrix &answer, Element *e, int boundary)
Helper function that integrates the deviatoric tangent contribution from a single element boundary...
the oofem namespace is to define a context or scope in which all oofem names are defined.
void clear()
Sets size of receiver to be an empty matrix. It will have zero rows and zero columns size...
Class implementing node in finite element mesh.
void negated()
Switches the sign of every coefficient of receiver.
General class for boundary condition that prolongates macroscopic fields to incompressible flow...
void computeBoundaryVectorOf(const IntArray &bNodes, const IntArray &dofIDMask, ValueModeType u, TimeStep *tStep, FloatArray &answer, bool padding=false)
Boundary version of computeVectorOf.
virtual void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the basis functions on the requested boundary.
Class representing integration point in finite element program.
Class representing solution step.
virtual void setPrescribedDeviatoricGradientFromVoigt(const FloatArray &ddev)
Sets the prescribed tensor from the matrix from given Voigt notation.
void resize(int s)
Resizes receiver towards requested size.
void plusProduct(const FloatMatrix &b, const FloatArray &s, double dV)
Adds the product .