58 #include "../sm/Elements/nlstructuralelement.h" 97 OOFEM_WARNING(
"ngp isn't being used anymore! see how the interpolator constructs the integration rule automatically.");
120 for (
int i = 0; i < temp.
giveSize() / 2; i++ ) {
121 side [ 0 ].push_back( temp.
at(2 * i + 1) );
122 element [ 0 ].push_back( temp.
at(2 * i + 2) );
128 for (
int i = 0; i < temp.
giveSize() / 2; i++ ) {
129 side [ 1 ].push_back( temp.
at(2 * i + 1) );
130 element [ 1 ].push_back( temp.
at(2 * i + 2) );
149 for (
int i = 0; i <
ndof; i++ ) {
165 for (
int i = 2; i <=
ndof; i++ ) {
169 for (
int j = 1; j < i; j++ ) {
178 uTemp.
times(-thisValue);
193 double value = 0.0, nom = 0.0, denom = 0.0;
199 thisOrder = thisOrder + A + B;
202 for (
size_t ielement = 0; ielement <
element [ thisSide ].size(); ielement++ ) {
212 const FloatArray &lcoords = gp->giveNaturalCoordinates();
223 for (
int k = 1; k <
ndof; k++ ) {
229 nom = nom + vVal *uValue *detJ *gp->giveWeight();
230 denom = denom + uValue *uValue *detJ *gp->giveWeight();
275 if ( fabs( normal.
at(1) ) > 0.99999 ) {
283 }
else if ( fabs( normal.
at(2) ) > 0.99999 ) {
291 }
else if ( fabs( normal.
at(3) ) > 0.99 ) {
294 OOFEM_ERROR(
"3 dimensioal normal in a 2 dimensional problem.");
302 OOFEM_ERROR(
"Only surfaces with normal in x, y or z direction supported. (el=%d, side=%d) \n", thisElement->
giveLabel(),
side [ 0 ].at(0) );
314 for (
int i = 0; i < posBoundary.
giveSize() / 2; i++ ) {
315 side [ 0 ].push_back( posBoundary.
at(2 * i + 2) );
316 element [ 0 ].push_back( posBoundary.
at(2 * i + 1) );
320 for (
int i = 0; i < negBoundary.
giveSize() / 2; i++ ) {
321 side [ 1 ].push_back( negBoundary.
at(2 * i + 2) );
322 element [ 1 ].push_back( negBoundary.
at(2 * i + 1) );
330 double normalSum = -1;
333 if ( normalSum > -0.000001 ) {
367 if (
element [ 0 ].size() > 0 ) {
371 double d = sqrt( pow(normalNew.
at(1) - normal0.
at(1), 2) + pow(normalNew.
at(2) - normal0.
at(2), 2) );
372 if ( fabs(d) < 0.001 ) {
380 if ( fabs(fabs( normalNew.
at(1) ) - 1.) < 0.0001 ) {
387 element [ addToList ].push_back(newElement);
388 side [ addToList ].push_back(newSide);
410 BH.
at(1, 3 * i - 2) = dNdx.
at(i, 1);
411 BH.
at(2, 3 * i - 1) = dNdx.
at(i, 2);
412 BH.
at(3, 3 * i - 0) = dNdx.
at(i, 3);
413 BH.
at(4, 3 * i - 1) = dNdx.
at(i, 3);
414 BH.
at(7, 3 * i - 0) = dNdx.
at(i, 2);
415 BH.
at(5, 3 * i - 2) = dNdx.
at(i, 3);
416 BH.
at(8, 3 * i - 0) = dNdx.
at(i, 1);
417 BH.
at(6, 3 * i - 2) = dNdx.
at(i, 2);
418 BH.
at(9, 3 * i - 1) = dNdx.
at(i, 1);
454 const FloatArray &lcoords = gp->giveNaturalCoordinates();
467 if ( dynamic_cast <NLStructuralElement *> (e) != NULL ) {
485 B(k, j) +=
N(k) * fVal * detJ * gp->giveWeight();
493 if ( type != TangentStiffnessMatrix && type != StiffnessMatrix ) {
507 for (
int thisSide = 0; thisSide <= 1; thisSide++ ) {
510 for (
size_t ielement = 0; ielement <
element [ thisSide ].size(); ielement++ ) {
512 int boundary =
side [ thisSide ].at(ielement);
534 FloatArray lcoords = gp->giveNaturalCoordinates();
545 for (
int i=0; i<
tcount; i++) {
546 for (
int j=0; j<
ndofids; j++) {
551 for (
int i=0; i<N.
giveSize(); i++) {
552 for (
int j=0; j<
ndofids; j++) {
553 Mv.at(j+1, ndofids*i+j+1) = N.
at(i+1);
573 NvTNbeta.times(J * detJ * gp->giveWeight());
587 B.
times(normalSign * scale);
590 answer.
assemble(r_sideLoc, c_loc, B);
591 answer.
assemble(r_loc, c_sideLoc, BT);
614 fVal = pow(coordinate.
at(1), a) * pow(coordinate.
at(2), b);
616 for (
int i = 1; i <=
ndof; i++ ) {
619 fVal = fVal +
gsMatrix.
at(baseID+1, i) * pow(coordinate.
at(1), a) * pow(coordinate.
at(2), b);
638 fVal = pow(coordinate, baseID);
640 if ( baseID % 2 == 0 ) {
641 fVal = cos( ( (
double ) baseID ) / 2. * ( coordinate * 2. *
M_PI / sideLength.
at(1) ) );
643 fVal = sin( ( (
double ) baseID + 1 ) / 2. * ( coordinate * 2. *
M_PI / sideLength.
at(1) ) );
646 double n = ( double ) baseID;
647 coordinate = 2.0 * coordinate - 1.0;
648 for (
int k = 0; k <= baseID; k++ ) {
649 fVal = fVal +
binomial(n, k) *
binomial(-n - 1.0, k) * pow( ( 1.0 - coordinate ) / 2.0, (
double ) k );
660 if ( type == InternalForcesVector ) {
662 }
else if ( type == ExternalForcesVector ) {
682 IntArray sideLocation, masterDofIDs;
691 for (
int thisSide = 0; thisSide <= 1; thisSide++ ) {
694 for (
size_t ielement = 0; ielement <
element [ thisSide ].size(); ielement++ ) {
696 int boundary =
side [ thisSide ].at(ielement);
728 FloatArray lcoords = gp->giveNaturalCoordinates();
738 for (
int i=0; i<
tcount; i++) {
740 for (
int j=0; j<
ndofids; j++) {
741 Nbeta.
at(j+1, i*ndofids+j+1) = val;
747 for (
int i=0; i<
ndofids; i++) {
748 for (
int j=0; j<N.
giveSize(); j++) {
749 Nv.
at(i+1, ndofids*j+i+1) =
N(j);
771 gammaProd.
plusProduct(D, a, J*detJ*gp->giveWeight()*normalSign);
772 vProd.
plusProduct(C, gamma, J*detJ*gp->giveWeight()*normalSign);
795 answer.
assemble(gammaProd, gammaLoc);
796 answer.
assemble(vProd, sideLocation);
820 for (
int thisSide = 0; thisSide <= 1; thisSide++ ) {
822 for (
size_t ielement = 0; ielement <
element [ thisSide ].size(); ielement++ ) {
830 for (
auto gp: *iRule ) {
833 FloatArray lcoords = gp->giveNaturalCoordinates();
840 for (
int j = 0; j <
ndof; j++ ) {
845 temp.
at(j+1) += normalSign*this->
g.
dotProduct(gcoords)*fVal*gp->giveWeight()*detJ;
855 answer.
times(factor);
875 for (
int i = 1; i <= n; i++ ) {
884 for (
int i = 1; i <= k; i++ ) {
885 f = f * ( n - ( k - i ) ) / i;
892 bool doContinue =
true;
900 while ( doContinue ) {
901 for (
int t = 0; t <= n; t++ ) {
#define _IFT_WeakPeriodicBoundaryCondition_descritizationType
int giveNumberOfColumns() const
Returns number of columns of receiver.
void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s, FloatArray *eNorm=NULL)
virtual DofManager * giveInternalDofManager(int i)
Gives an internal dof manager from receiver.
REGISTER_BoundaryCondition(BoundaryCondition)
virtual int assemble(const IntArray &loc, const FloatMatrix &mat)=0
Assembles sparse matrix from contribution of local elements.
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Returns local vector of unknowns.
#define _IFT_WeakPeriodicBoundaryCondition_dofids
Domain * domain
Link to domain object, useful for communicating with other FEM components.
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Base class for all matrices stored in sparse format.
IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
#define _IFT_WeakPeriodicBoundaryCondition_ngp
const IntArray & giveBoundaryList()
Returns list of element boundaries within set.
virtual double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the normal on the requested boundary.
void giveEdgeNormal(FloatArray &answer, int element, int side)
double & at(int i)
Coefficient access function.
signed int sideSign[2]
sideSign is the sign of the normal for each side
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Function * giveTimeFunction()
WeakPeriodicBoundaryCondition(int n, Domain *d)
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
int tcount
Number of terms in polynomial.
#define _IFT_WeakPeriodicBoundaryCondition_elementSidesNegative
std::vector< int > side[2]
side[] keeps track of which side of the triangle is located along the boundary.
Abstract base class for all finite elements.
Base class for dof managers.
double evaluate(TimeStep *tStep, ValueModeType mode)
Returns the value of load time function at given time.
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
std::unique_ptr< Node > gammaDman
int posSet
Set containing positive side.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual FEInterpolation * giveInterpolation() const
IntArray dofids
ID of dofs on which weak periodicity is imposed.
#define _IFT_WeakPeriodicBoundaryCondition_order
int ndof
Number of degrees of freedom (number of terms)
int direction
Direction of normal.
#define _IFT_WeakPeriodicBoundaryCondition_nlgeo
void beMatrixForm(const FloatArray &aArray)
Class representing a general abstraction for finite element interpolation class.
Class representing "master" degree of freedom.
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 computeDeformationGradient(FloatMatrix &answer, Element *e, FloatArray *lcoord, TimeStep *tStep)
#define _IFT_WeakPeriodicBoundaryCondition_elementSidesPositive
FloatMatrix gsMatrix
gsMatrix contains coefficients for the Gram-Schmidt polynomials
IntArray surfaceIndexes
Keeps info on which coordinates varies over the surface.
int giveNumber()
Returns receiver's number.
void computeOrthogonalBasis()
Compute orthogonal polynomial basis using Gram-Smidth process.
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.
void clear()
Clears the array (zero size).
DofIDItem
Type representing particular dof type.
#define _IFT_WeakPeriodicBoundaryCondition_elementSidesPositiveSet
virtual void boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Maps the local boundary coordinates to global.
void times(double f)
Multiplies receiver by factor f.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
void getExponents(int n, int &i, int &j)
Compute exponent for term n.
std::vector< int > element[2]
Wrapper around element definition to provide FEICellGeometry interface.
Set * giveSet(int n)
Service for accessing particular domain set.
virtual int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo)=0
Evaluates local coordinates from given global ones.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
virtual double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the determinant of the transformation Jacobian on the requested boundary.
Abstract base class for all active boundary conditions.
double at(int i, int j) const
Coefficient access function.
void resize(int n)
Checks size of receiver towards requested bounds.
double computeProjectionCoefficient(int vIndex, int uIndex)
virtual void scale(double s)
Scales the receiver according to given value.
#define _IFT_WeakPeriodicBoundaryCondition_gradient
bool nlgeo
Use finite strains?
double binomial(double n, int k)
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.
int ngp
Number of Gausspoints used when integrating along the element edges.
Class representing vector of real numbers.
Implementation of matrix containing floating point numbers.
IRResultType
Type defining the return values of InputRecord reading operations.
void computeElementTangent(FloatMatrix &answer, Element *e, int boundary, TimeStep *tStep)
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.
int ndofids
Number of dofIDs.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
virtual void assembleVector(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s, FloatArray *eNorm=NULL)
Assembles B.C.
virtual void printYourself() const
Print receiver on stdout.
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.
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
void zero()
Zeroes all coefficients of receiver.
void beTProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
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.
void times(double s)
Multiplies receiver with scalar.
void beTranspositionOf(const FloatMatrix &src)
Assigns to the receiver the transposition of parameter.
double computeBaseFunctionValue(int baseID, FloatArray coordinate)
void printYourself() const
Prints matrix to stdout. Useful for debugging.
virtual int giveNumberOfInternalDofManagers()
Gives the number of internal dof managers.
void zero()
Zeroes all coefficient of receiver.
Domain * giveDomain() const
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
int giveSize() const
Returns the size of receiver.
virtual double giveCoordinate(int i)
FloatArray g
Contains prescribed gradient.
int negSet
Set containing negative side.
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual void addElementSide(int elem, int side)
Adds element for active boundary condition.
Class implementing node in finite element mesh.
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
void beInverseOf(const FloatMatrix &src)
Modifies receiver to become inverse of given parameter.
#define _IFT_WeakPeriodicBoundaryCondition_elementSidesNegativeSet
double computeBaseFunctionValue2D(int baseID, FloatArray coordinate)
double computeBaseFunctionValue1D(int baseID, double coordinate)
virtual ~WeakPeriodicBoundaryCondition()
int giveNumberOfRows() const
Returns number of rows of receiver.
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.
#define OOFEM_WARNING(...)
Class representing solution step.
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the matrix of derivatives of interpolation functions (shape functions) at given point...
void resize(int s)
Resizes receiver towards requested size.
void plusProduct(const FloatMatrix &b, const FloatArray &s, double dV)
Adds the product .
void giveExternalForcesVector(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s)