64 for (
int i = 0; i < nsd; i++ ) {
123 double domain_size = 0.0;
125 for (
auto &setNum : this->
surfSets ) {
127 const IntArray &boundaries =
set->giveBoundaryList();
129 for (
int pos = 0; pos < boundaries.
giveSize() / 2; ++pos ) {
131 int boundary = boundaries[pos * 2 + 1];
136 return fabs(domain_size / nsd);
146 if ( type == ExternalForcesVector ) {
154 answer.
assemble(fluxLoad, flux_loc);
155 }
else if ( type == InternalForcesVector ) {
159 IntArray loc, masterDofIDs, fluxMasterDofIDs, bNodes;
171 for (
int pos = 0; pos < boundaries.
giveSize() / 2; ++pos ) {
173 int boundary = boundaries[pos * 2 + 1];
191 if ( eNorm != NULL ) {
203 if ( type == TangentStiffnessMatrix || type == SecantStiffnessMatrix || type == ElasticStiffnessMatrix ) {
205 IntArray loc_r, loc_c, flux_loc_r, flux_loc_c, bNodes;
214 const IntArray &boundaries =
set->giveBoundaryList();
215 for (
int pos = 0; pos < boundaries.
giveSize() / 2; ++pos ) {
217 int boundary = boundaries[pos * 2 + 1];
227 answer.
assemble(flux_loc_r, loc_c, Ke);
228 answer.
assemble(loc_r, flux_loc_c, KeT);
232 printf(
"Skipping assembly in TransportGradientNeumann::assemble().\n");
239 IntArray loc_r, loc_c, flux_loc_r, flux_loc_c, bNodes;
249 for (
auto &surfSet : this->
surfSets ) {
251 const IntArray &boundaries =
set->giveBoundaryList();
254 cols.resize( cols.size() + boundaries.
giveSize() );
255 for (
int pos = 0; pos < boundaries.
giveSize() / 2; ++pos ) {
257 int boundary = boundaries[pos * 2 + 1];
265 cols [ i ] = flux_loc_c;
268 rows [ i ] = flux_loc_r;
285 std :: unique_ptr< SparseLinearSystemNM > solver(
304 OOFEM_ERROR(
"Couldn't create sparse matrix of type %d\n", stype);
312 int neq = Kff->giveNumberOfRows();
315 for (
int i = 1; i <= neq; ++i ) {
321 std :: unique_ptr< SparseMtrx > Kuu(Kff->giveSubMatrix(loc_u, loc_u));
325 std :: unique_ptr< SparseMtrx > Kus(Kff->giveSubMatrix(loc_u, loc_s));
326 Kus->toFloatMatrix(KusD);
339 const IntArray &boundaries =
set->giveBoundaryList();
340 for (
int pos = 0; pos < boundaries.
giveSize() / 2; ++pos ) {
342 int boundary = boundaries[pos * 2 + 1];
351 KusD.assemble(KeT, loc_r, {1, 2, 3});
370 static_cast< TransportElement*
>(e.get())->computeConstitutiveMatrixAt(tmpD, Capacity,
371 e->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), tStep);
375 Di.add(tmpVol, tmpDi);
379 us.
resize(KusD.giveNumberOfRows(), KusD.giveNumberOfColumns());
381 int k1 = n->giveDofWithID( this->
dofs(0) )->__giveEquationNumber();
384 for (
int i = 1; i <= nsd; ++i ) {
391 Kuu->
times(us, KusD0);
406 tangent.
times(rve_size);
429 }
else if ( i % 3 == 1 ) {
454 for (
int pos = 0; pos < boundaries.
giveSize() / 2; ++pos ) {
456 int boundary = boundaries[pos * 2 + 1];
463 for (
auto &gp: *ir ) {
464 const FloatArray &lcoords = gp->giveNaturalCoordinates();
468 double dA = detJ * gp->giveWeight();
471 double r = coords[i_r], t = coords[i_t];
484 c(0, 1) += dA * k * r;
485 c(0, 2) += dA * k * t;
486 c(1, 0) += dA * k * r;
487 c(1, 1) += dA * k * r * r;
488 c(1, 2) += dA * k * t * r;
489 c(2, 0) += dA * k * t;
490 c(2, 1) += dA * k * r * t;
491 c(2, 2) += dA * k * t * t;
496 for (
int pos = 0; pos < boundaries.
giveSize() / 2; ++pos ) {
498 int boundary = boundaries[pos * 2 + 1];
505 eta[i][pos].resize(ir->giveNumberOfIntegrationPoints());
506 for (
auto &gp: *ir ) {
507 const FloatArray &lcoords = gp->giveNaturalCoordinates();
513 double r = coords[i_r], t = coords[i_t];
520 eta[i][pos].at(gp->giveNumber()) = (eta_c[0] + eta_c[1] * r + eta_c[2] * t) * k;
539 for (
auto &gp: *ir ) {
540 const FloatArray &lcoords = gp->giveNaturalCoordinates();
544 if ( !
eta.empty() ) {
546 scale =
eta[surfSet][pos].at(gp->giveNumber());
551 oTangent.
plusDyadUnsym(normal, n, scale * detJ * gp->giveWeight());
std::unique_ptr< Node > mpFluxHom
DOF-manager containing the unknown homogenized stress.
bool contains(int value) const
void integrateTangent(FloatMatrix &oTangent, Element *e, int iBndIndex, int surfSet, int pos)
Help function that integrates the tangent contribution from a single element boundary.
The representation of EngngModel default unknown numbering.
void subtract(const FloatArray &src)
Subtracts array src to receiver.
REGISTER_BoundaryCondition(BoundaryCondition)
virtual int assemble(const IntArray &loc, const FloatMatrix &mat)=0
Assembles sparse matrix from contribution of local elements.
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
TransportGradientNeumann(int n, Domain *d)
Domain * domain
Link to domain object, useful for communicating with other FEM components.
bool solveForRhs(const FloatArray &b, FloatArray &answer, bool transpose=false)
Solves the system of linear equations .
Base class for all matrices stored in sparse format.
IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
SparseMtrx * createSparseMtrx(SparseMtrxType type)
Creates new instance of sparse matrix corresponding to given keyword.
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.
double & at(int i)
Coefficient access function.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Function * giveTimeFunction()
virtual ~TransportGradientNeumann()
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.
double giveTargetTime()
Returns target time.
Abstract base class for all finite elements.
Base class for dof managers.
std::vector< std::unique_ptr< DofManager > > & giveDofManagers()
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.
void negated()
Changes sign of receiver values.
int giveNumber()
Returns domain number.
virtual double evalNXIntegral(int boundary, const FEICellGeometry &cellgeo)
Computes the integral .
void plusDyadUnsym(const FloatArray &a, const FloatArray &b, double dV)
Adds to the receiver the product .
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual void scale(double s)
Scales the receiver according to given value.
virtual FEInterpolation * giveInterpolation() const
virtual double computeVolumeAreaOrLength()
Computes the volume, area or length of the element depending on its spatial dimension.
virtual DofManager * giveInternalDofManager(int i)
Gives an internal dof manager from receiver.
#define NM_NoSuccess
Numerical method failed to solve problem.
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.
virtual void assembleVector(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s, FloatArray *eNorm=NULL)
Assembles B.C.
void beScaled(double s, const FloatArray &b)
Sets receiver to be .
#define OOFEM_LOG_INFO(...)
Element * giveElement(int n)
Service for accessing particular domain fe element.
virtual void computeTangent(FloatMatrix &tangent, TimeStep *tStep)
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
DofIDItem
Type representing particular dof type.
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
virtual void boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Maps the local boundary coordinates to global.
void computeEta()
Help function computes phi by solving a diffusion problem on the RVE-surface.
void times(double f)
Multiplies receiver by factor f.
This abstract class represent a general base element class for transport problems.
Set of elements, boundaries, edges and/or nodes.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
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).
Abstract base class for all active boundary conditions.
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 void assemble(SparseMtrx &answer, TimeStep *tStep, CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s, double scale=1.0)
Assembles B.C.
#define _IFT_TransportGradientNeumann_surfSets
virtual void postInitialize()
Performs post initialization steps.
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.
double computeFrobeniusNorm() const
Computes the Frobenius norm of the receiver.
IRResultType
Type defining the return values of InputRecord reading operations.
#define _IFT_TransportGradientNeumann_dispControl
GaussPoint * getIntegrationPoint(int n)
Access particular integration point of receiver.
std::vector< std::vector< FloatArray > > eta
Scaling factor (one array per edge with one scaling factor per GP)
void giveFluxLocationArray(IntArray &oCols, const UnknownNumberingScheme &r_s)
#define _IFT_TransportGradientNeumann_centerCoords
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.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
virtual IntegrationRule * giveBoundaryIntegrationRule(int order, int boundary)
Sets up a suitable integration rule for integrating over the requested boundary.
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end 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.
ClassFactory & classFactory
Domain * giveDomain() const
#define _IFT_TransportGradientNeumann_gradient
std::vector< std::unique_ptr< Element > > & giveElements()
Abstract base class representing the "problem" under consideration.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
virtual TimeStep * giveCurrentStep(bool force=false)
Returns current time step.
virtual void postInitialize()
Performs post initialization steps.
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 beInverseOf(const FloatMatrix &src)
Modifies receiver to become inverse of given parameter.
void negated()
Switches the sign of every coefficient of receiver.
void computeBoundaryVectorOf(const IntArray &bNodes, const IntArray &dofIDMask, ValueModeType u, TimeStep *tStep, FloatArray &answer, bool padding=false)
Boundary version of computeVectorOf.
virtual double evaluateAtTime(double t)
Returns the value of the function at given time.
virtual void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the basis functions on the requested boundary.
virtual void computeField(FloatArray &flux, TimeStep *tStep)
Class representing solution step.