60PrescribedGradientBCNeumann :: PrescribedGradientBCNeumann(
int n,
Domain *d) :
66 for (
int i = 0; i < nsd * nsd; i++ ) {
74PrescribedGradientBCNeumann :: ~PrescribedGradientBCNeumann()
79void PrescribedGradientBCNeumann :: initializeFrom(
InputRecord &ir)
81 ActiveBoundaryCondition :: initializeFrom(ir);
82 PrescribedGradientHomogenization :: initializeFrom(ir);
88 ActiveBoundaryCondition :: giveInputRecord(input);
89 PrescribedGradientHomogenization :: giveInputRecord(input);
93DofManager *PrescribedGradientBCNeumann :: giveInternalDofManager(
int i)
98void PrescribedGradientBCNeumann :: scale(
double s)
112 if ( type == ExternalForcesVector ) {
120 stressLoad.
beScaled(-rve_size*loadLevel, gradVoigt);
122 if (lock) omp_set_lock(
static_cast<omp_lock_t*
>(lock));
124 answer.
assemble(stressLoad, sigma_loc);
126 if (lock) omp_unset_lock(
static_cast<omp_lock_t*
>(lock));
128 }
else if ( type == InternalForcesVector ) {
132 IntArray loc, masterDofIDs, sigmaMasterDofIDs;
142 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
144 int boundary = boundaries.
at(pos * 2);
164 if (lock) omp_set_lock(
static_cast<omp_lock_t*
>(lock));
168 if ( eNorm != NULL ) {
173 if (lock) omp_unset_lock(
static_cast<omp_lock_t*
>(lock));
186 if ( type == TangentStiffnessMatrix || type == SecantStiffnessMatrix || type == ElasticStiffnessMatrix ) {
188 IntArray loc_r, loc_c, sigma_loc_r, sigma_loc_c;
190 const IntArray &boundaries =
set->giveBoundaryList();
196 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
198 int boundary = boundaries.
at(pos * 2);
213 if (lock) omp_set_lock(
static_cast<omp_lock_t*
>(lock));
215 answer.
assemble(sigma_loc_r, loc_c, Ke);
216 answer.
assemble(loc_r, sigma_loc_c, KeT);
218 if (lock) omp_unset_lock(
static_cast<omp_lock_t*
>(lock));
222 OOFEM_LOG_DEBUG(
"Skipping assembly in PrescribedGradientBCNeumann::assemble().");
226void PrescribedGradientBCNeumann :: giveLocationArrays(std :: vector< IntArray > &rows, std :: vector< IntArray > &cols,
CharType type,
229 IntArray loc_r, loc_c, sigma_loc_r, sigma_loc_c;
236 const IntArray &boundaries =
set->giveBoundaryList();
238 rows.resize( boundaries.
giveSize() );
239 cols.resize( boundaries.
giveSize() );
241 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
254 cols [ i ] = sigma_loc_c;
257 rows [ i ] = sigma_loc_r;
273 std :: unique_ptr< SparseLinearSystemNM > solver(
286 std :: unique_ptr< SparseMtrx > Kff(
classFactory.createSparseMtrx(stype) );
288 OOFEM_ERROR(
"Couldn't create sparse matrix of type %d\n", stype);
290 Kff->buildInternalStructure(rve, this->
domain->giveNumber(), fnum);
296 int neq = Kff->giveNumberOfRows();
299 for (
int i = 1; i <= neq; ++i ) {
305 std :: unique_ptr< SparseMtrx > Kuu = Kff->giveSubMatrix(loc_u, loc_u);
307 std :: unique_ptr< SparseMtrx > Kus = Kff->giveSubMatrix(loc_u, loc_s);
308 FloatMatrix eye(Kus->giveNumberOfColumns(), Kus->giveNumberOfColumns());
319 solver->solve(*Kuu, KusD, us);
329 tangent.
times(rve_size);
338void PrescribedGradientBCNeumann :: integrateTangent(
FloatMatrix &oTangent,
Element *e,
int iBndIndex)
352 std :: unique_ptr< IntegrationRule > ir;
355 if ( xfemElInt &&
domain->hasXfemManager() ) {
358 OOFEM_ERROR(
"failed to cast to FEInterpolation2d.")
364 std :: vector< Line >segments;
365 std :: vector< FloatArray >intersecPoints;
368 ir = std::make_unique<DiscontinuousSegmentIntegrationRule>(1, e, segments);
369 int numPointsPerSeg = 1;
370 ir->SetUpPointsOnLine(numPointsPerSeg, matMode);
377 for (
auto &gp: *ir ) {
378 const FloatArray &lcoords = gp->giveNaturalCoordinates();
395 if ( xfemElInt != NULL &&
domain->hasXfemManager() ) {
400 interp->
evalN(n, bulkElLocCoords, cellgeo);
408 E_n.
at(1, 1) = normal.
at(1);
409 E_n.
at(2, 2) = normal.
at(2);
410 E_n.
at(3, 3) = normal.
at(3);
411 E_n.
at(4, 1) = normal.
at(2);
412 E_n.
at(5, 1) = normal.
at(3);
413 E_n.
at(6, 2) = normal.
at(3);
414 E_n.
at(7, 2) = normal.
at(1);
415 E_n.
at(8, 3) = normal.
at(1);
416 E_n.
at(9, 3) = normal.
at(2);
417 }
else if ( nsd == 2 ) {
418 E_n.
at(1, 1) = normal.
at(1);
419 E_n.
at(2, 2) = normal.
at(2);
420 E_n.
at(3, 1) = normal.
at(2);
421 E_n.
at(4, 2) = normal.
at(1);
423 E_n.
at(1, 1) = normal.
at(1);
428 oTangent.
add(detJ * gp->giveWeight(), contrib);
#define REGISTER_BoundaryCondition(class)
ActiveBoundaryCondition(int n, Domain *d)
int giveNextFreeDofID(int increment=1)
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
virtual FEInterpolation * giveInterpolation() const
virtual MaterialMode giveMaterialMode()
void giveLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s, IntArray *dofIds=NULL) const
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
virtual bool computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords)
virtual Element_Geometry_Type giveGeometryType() const =0
virtual void assemble(SparseMtrx &answer, TimeStep *tStep, const MatrixAssembler &ma, const UnknownNumberingScheme &s, Domain *domain)
virtual std::unique_ptr< IntegrationRule > giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
int giveInterpolationOrder() const
virtual void boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
Domain * giveDomain() const
Domain * domain
Link to domain object, useful for communicating with other FEM components.
void assemble(const FloatArray &fe, const IntArray &loc)
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
void assembleSquared(const FloatArray &fe, const IntArray &loc)
void beScaled(double s, const FloatArray &b)
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
void add(const FloatMatrix &a)
void resize(Index rows, Index cols)
*Sets size of receiver to be an empty matrix It will have zero rows and zero columns size void clear()
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void beNMatrixOf(const FloatArray &n, int nsd)
void beTranspositionOf(const FloatMatrix &src)
void zero()
Zeroes all coefficient of receiver.
bool beInverseOf(const FloatMatrix &src)
double at(std::size_t i, std::size_t j) const
void beTProductOf(const FloatMatrix &a, const FloatMatrix &b)
int set
Set number for boundary condition to be applied to.
Function * giveTimeFunction()
int giveSetNumber() const
bool contains(int value) const
void integrateTangent(FloatMatrix &oTangent, Element *e, int iBndIndex)
Help function that integrates the tangent contribution from a single element boundary.
std ::unique_ptr< Node > mpSigmaHom
DOF-manager containing the unknown homogenized stress.
void scale(double s) override
FloatMatrix mGradient
Prescribed gradient .
PrescribedGradientHomogenization()
virtual double domainSize(Domain *d, int set)
void giveGradientVoigt(FloatArray &oGradient) const
const IntArray & giveBoundaryList()
virtual int assemble(const IntArray &loc, const FloatMatrix &mat)=0
double giveTargetTime()
Returns target time.
void XfemElementInterface_createEnrNmatrixAt(FloatMatrix &oAnswer, const FloatArray &iLocCoord, Element &iEl, bool iSetDiscontContribToZero)
Creates enriched N-matrix.
void partitionEdgeSegment(int iBndIndex, std ::vector< Line > &oSegments, std ::vector< FloatArray > &oIntersectionPoints, const double &iTangDistPadding=0.0)
#define OOFEM_LOG_DEBUG(...)
ClassFactory & classFactory
FloatMatrixF< N, N > eye()
Constructs an identity matrix.