OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
transportgradientneumann.C
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
36 #include "classfactory.h"
37 #include "node.h"
38 #include "masterdof.h"
39 #include "element.h"
40 #include "feinterpol.h"
41 #include "feinterpol2d.h"
42 #include "gausspoint.h"
43 #include "sparsemtrx.h"
46 #include "timestep.h"
47 #include "function.h"
48 #include "sparselinsystemnm.h"
49 #include "unknownnumberingscheme.h"
50 #include "engngm.h"
51 #include "mathfem.h"
52 #include "dynamicinputrecord.h"
53 #include "transportelement.h"
54 
55 namespace oofem {
56 REGISTER_BoundaryCondition(TransportGradientNeumann);
57 
60  //PrescribedGradientHomogenization(),
61  mpFluxHom( new Node(0, d) )
62 {
63  int nsd = d->giveNumberOfSpatialDimensions();
64  for ( int i = 0; i < nsd; i++ ) {
65  // Just putting in X_i id-items since they don't matter.
66  int dofId = d->giveNextFreeDofID();
67  mFluxIds.followedBy(dofId);
68  mpFluxHom->appendDof( new MasterDof( mpFluxHom.get(), ( DofIDItem ) ( dofId ) ) );
69  }
70 }
71 
73 {
74 }
75 
76 
78 {
79  IRResultType result; // Required by IR_GIVE_FIELD macro
80 
82 
84  this->mCenterCoord.clear();
86 
88 
90 }
91 
92 
94 {
95  //ActiveBoundaryCondition :: giveInputRecord(input);
96  //PrescribedGradientHomogenization :: giveInputRecord(input);
98 }
99 
100 
102 {
104 
105  if ( this->dispControl ) this->computeEta();
106 }
107 
108 
110 {
111  return mpFluxHom.get();
112 }
113 
115 {
116  this->mGradient.times(s);
117 }
118 
120 {
121  Domain *domain = this->giveDomain();
122  int nsd = domain->giveNumberOfSpatialDimensions();
123  double domain_size = 0.0;
124  // This requires the boundary to be consistent and ordered correctly.
125  for ( auto &setNum : this->surfSets ) {
126  Set *set = domain->giveSet(setNum);
127  const IntArray &boundaries = set->giveBoundaryList();
128 
129  for ( int pos = 0; pos < boundaries.giveSize() / 2; ++pos ) {
130  Element *e = domain->giveElement( boundaries[pos * 2] );
131  int boundary = boundaries[pos * 2 + 1];
133  domain_size += fei->evalNXIntegral( boundary, FEIElementGeometryWrapper(e) );
134  }
135  }
136  return fabs(domain_size / nsd);
137 }
138 
140  CharType type, ValueModeType mode,
141  const UnknownNumberingScheme &s, FloatArray *eNorm)
142 {
143  IntArray flux_loc; // For the displacements and flux respectively
144  mpFluxHom->giveLocationArray(mFluxIds, flux_loc, s);
145 
146  if ( type == ExternalForcesVector ) {
147  // The external forces have two contributions. On the additional equations for flux, the load is simply the prescribed gradient.
148  double rve_size = this->domainSize();
149  FloatArray fluxLoad;
150 
151  double loadLevel = this->giveTimeFunction()->evaluateAtTime(tStep->giveTargetTime());
152  fluxLoad.beScaled(-rve_size*loadLevel, mGradient);
153 
154  answer.assemble(fluxLoad, flux_loc);
155  } else if ( type == InternalForcesVector ) {
156  FloatMatrix Ke;
157  FloatArray fe_v, fe_s;
158  FloatArray fluxHom, e_u;
159  IntArray loc, masterDofIDs, fluxMasterDofIDs, bNodes;
160 
161  // Fetch the current values of the flux;
162  mpFluxHom->giveUnknownVector(fluxHom, mFluxIds, mode, tStep);
163  // and the master dof ids for flux used for the internal norms
164  mpFluxHom->giveMasterDofIDArray(mFluxIds, fluxMasterDofIDs);
165 
166  // Assemble
167  for ( int i = 0; i < this->surfSets.giveSize(); ++i ) {
168  int surfSet = this->surfSets[i];
169  Set *setPointer = this->giveDomain()->giveSet(surfSet);
170  const IntArray &boundaries = setPointer->giveBoundaryList();
171  for ( int pos = 0; pos < boundaries.giveSize() / 2; ++pos ) {
172  Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] );
173  int boundary = boundaries[pos * 2 + 1];
174 
175  // Fetch the element information;
176  e->giveInterpolation()->boundaryGiveNodes(bNodes, boundary);
177  e->giveBoundaryLocationArray(loc, bNodes, this->dofs, s, & masterDofIDs);
178  e->computeBoundaryVectorOf(bNodes, this->dofs, mode, tStep, e_u);
179  this->integrateTangent(Ke, e, boundary, i, pos);
180 
181  // We just use the tangent, less duplicated code (the addition of flux is linear).
182  fe_v.beProductOf(Ke, e_u);
183  fe_s.beTProductOf(Ke, fluxHom);
184 
185  // Note: The terms appear negative in the equations:
186  fe_v.negated();
187  fe_s.negated();
188 
189  answer.assemble(fe_s, loc); // Contributions to delta_v equations
190  answer.assemble(fe_v, flux_loc); // Contribution to delta_s_i equations
191  if ( eNorm != NULL ) {
192  eNorm->assembleSquared(fe_s, masterDofIDs);
193  eNorm->assembleSquared(fe_v, fluxMasterDofIDs);
194  }
195  }
196  }
197  }
198 }
199 
201  CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s, double scale)
202 {
203  if ( type == TangentStiffnessMatrix || type == SecantStiffnessMatrix || type == ElasticStiffnessMatrix ) {
204  FloatMatrix Ke, KeT;
205  IntArray loc_r, loc_c, flux_loc_r, flux_loc_c, bNodes;
206 
207  // Fetch the columns/rows for the flux contributions;
208  mpFluxHom->giveLocationArray(mFluxIds, flux_loc_r, r_s);
209  mpFluxHom->giveLocationArray(mFluxIds, flux_loc_c, c_s);
210 
211  for ( int i = 0; i < this->surfSets.giveSize(); ++i ) {
212  int surfSet = this->surfSets[i];
213  Set *set = this->giveDomain()->giveSet(surfSet);
214  const IntArray &boundaries = set->giveBoundaryList();
215  for ( int pos = 0; pos < boundaries.giveSize() / 2; ++pos ) {
216  Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] );
217  int boundary = boundaries[pos * 2 + 1];
218 
219  e->giveInterpolation()->boundaryGiveNodes(bNodes, boundary);
220  e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, r_s);
221  e->giveBoundaryLocationArray(loc_c, bNodes, this->dofs, c_s);
222 
223  this->integrateTangent(Ke, e, boundary, i, pos);
224  Ke.times(-scale);
225  KeT.beTranspositionOf(Ke);
226 
227  answer.assemble(flux_loc_r, loc_c, Ke); // Contribution to delta_s_i equations
228  answer.assemble(loc_r, flux_loc_c, KeT); // Contributions to delta_v equations
229  }
230  }
231  } else {
232  printf("Skipping assembly in TransportGradientNeumann::assemble().\n");
233  }
234 }
235 
236 void TransportGradientNeumann :: giveLocationArrays(std :: vector< IntArray > &rows, std :: vector< IntArray > &cols, CharType type,
237  const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s)
238 {
239  IntArray loc_r, loc_c, flux_loc_r, flux_loc_c, bNodes;
240 
241  // Fetch the columns/rows for the flux contributions;
242  mpFluxHom->giveLocationArray(mFluxIds, flux_loc_r, r_s);
243  mpFluxHom->giveLocationArray(mFluxIds, flux_loc_c, c_s);
244 
245  rows.clear();
246  cols.clear();
247 
248  int i = 0;
249  for ( auto &surfSet : this->surfSets ) {
250  Set *set = this->giveDomain()->giveSet(surfSet);
251  const IntArray &boundaries = set->giveBoundaryList();
252 
253  rows.resize( rows.size() + boundaries.giveSize() );
254  cols.resize( cols.size() + boundaries.giveSize() );
255  for ( int pos = 0; pos < boundaries.giveSize() / 2; ++pos ) {
256  Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] );
257  int boundary = boundaries[pos * 2 + 1];
258 
259  e->giveInterpolation()->boundaryGiveNodes(bNodes, boundary);
260  e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, r_s);
261  e->giveBoundaryLocationArray(loc_c, bNodes, this->dofs, c_s);
262 
263  // For most uses, loc_r == loc_c, and flux_loc_r == flux_loc_c.
264  rows [ i ] = loc_r;
265  cols [ i ] = flux_loc_c;
266  i++;
267  // and the symmetric part (usually the transpose of above)
268  rows [ i ] = flux_loc_r;
269  cols [ i ] = loc_c;
270  i++;
271  }
272  }
273 }
274 
276 {
277  mpFluxHom->giveUnknownVector(flux, mFluxIds, VM_Total, tStep);
278 }
279 
280 
282 {
283  EngngModel *rve = this->giveDomain()->giveEngngModel();
285  std :: unique_ptr< SparseLinearSystemNM > solver(
286  classFactory.createSparseLinSolver( ST_Petsc, this->domain, this->domain->giveEngngModel() ) ); // = rve->giveLinearSolver();
287  SparseMtrxType stype = solver->giveRecommendedMatrix(true);
288  double rve_size = this->domainSize();
289 
290  // Solving the system:
291  // [Kuu Kus] [u] = [0] => Kuu*u + Kus*s = 0
292  // [Ksu 0 ] [s] = [I] => Ksu*u = I
293  // 1. u = -Kuu^(-1)*Kus*s. Denote us = -Kuu^(-1)*Kus
294  // 2. -[Ksu*us]*s = I. Denote Ks = Ksu*us
295  // 3. s = Ks^(-1)*I
296  // Here, s = tangent as rhs is identity.
297 
298  // 1.
299  // This is not very good. We have to keep Kuu and Kff in memory at the same time. Not optimal
300  // Consider changing this approach.
302  std :: unique_ptr< SparseMtrx > Kff( classFactory.createSparseMtrx(stype) );
303  if ( !Kff ) {
304  OOFEM_ERROR("Couldn't create sparse matrix of type %d\n", stype);
305  }
306  Kff->buildInternalStructure(rve, this->domain->giveNumber(), fnum);
307 
308  rve->assemble(*Kff, tStep, TangentAssembler(TangentStiffness), fnum, this->domain);
309 
310  IntArray loc_u, loc_s;
311  this->mpFluxHom->giveLocationArray(this->mFluxIds, loc_s, fnum);
312  int neq = Kff->giveNumberOfRows();
313  loc_u.resize(neq - loc_s.giveSize());
314  int k = 0;
315  for ( int i = 1; i <= neq; ++i ) {
316  if ( !loc_s.contains(i) ) {
317  loc_u.at(++k) = i;
318  }
319  }
320 
321  std :: unique_ptr< SparseMtrx > Kuu(Kff->giveSubMatrix(loc_u, loc_u));
322  FloatMatrix KusD;
323 #if 0
324  // NOTE: Kus is actually a dense matrix, but we have to make it a dense matrix first
325  std :: unique_ptr< SparseMtrx > Kus(Kff->giveSubMatrix(loc_u, loc_s));
326  Kus->toFloatMatrix(KusD);
327  Kus.reset();
328 #else
329  // Ugly code-duplication, but worth it for performance.
330  // PETSc doesn't allow you to take non-symmetric submatrices from a SBAIJ-matrix.
331  // Which means extracting "Kus" puts limitations on Kuu.
332  FloatMatrix Ke, KeT;
333  IntArray loc_r, bNodes;
334 
335  KusD.resize(neq - loc_s.giveSize(), loc_s.giveSize());
336  for ( int i = 0; i < this->surfSets.giveSize(); ++i ) {
337  int surfSet = this->surfSets[i];
338  Set *set = this->giveDomain()->giveSet(surfSet);
339  const IntArray &boundaries = set->giveBoundaryList();
340  for ( int pos = 0; pos < boundaries.giveSize() / 2; ++pos ) {
341  Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] );
342  int boundary = boundaries[pos * 2 + 1];
343 
344  e->giveInterpolation()->boundaryGiveNodes(bNodes, boundary);
345  e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, fnum);
346 
347  this->integrateTangent(Ke, e, boundary, i, pos);
348  Ke.negated();
349  KeT.beTranspositionOf(Ke);
350 
351  KusD.assemble(KeT, loc_r, {1, 2, 3}); // Contributions to delta_v equations
352  }
353  }
354 #endif
355  // Release a large chunk of redundant memory early.
356  Kff.reset();
357 
358  // 1.
359  FloatMatrix us;
360 #if 1
361  // Initial guess can help significantly for KSP solver,
362  // However, it is difficult to construct a cheap, reliable estimate for Neumann b.c.
363  // We need the tangent to relate q-bar to g-bar. Since this would be meaningless
364  // we shall instead assume isotropic response, and
366 #if 0
367  FloatMatrix Di(nsd, nsd), tmpD, tmpDi;
368  double vol = 0;
369  for ( auto &e : domain->giveElements() ) {
370  static_cast< TransportElement* >(e.get())->computeConstitutiveMatrixAt(tmpD, Capacity,
371  e->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), tStep);
372  double tmpVol = e->computeVolumeAreaOrLength();
373  vol += tmpVol;
374  tmpDi.beInverseOf(tmpD);
375  Di.add(tmpVol, tmpDi);
376  }
377  Di.times(1/vol);
378 #endif
379  us.resize(KusD.giveNumberOfRows(), KusD.giveNumberOfColumns());
380  for ( auto &n : domain->giveDofManagers() ) {
381  int k1 = n->giveDofWithID( this->dofs(0) )->__giveEquationNumber();
382  if ( k1 ) {
383  FloatArray *coords = n->giveCoordinates();
384  for ( int i = 1; i <= nsd; ++i ) {
385  us.at(k1, i) += -(coords->at(i) - mCenterCoord.at(i));
386  }
387  }
388  }
389  // Now "us" will have roughly the correct shape, but the wrong magnitude, so we rescale it:
390  FloatMatrix KusD0;
391  Kuu->times(us, KusD0);
392  us.times( KusD.computeFrobeniusNorm() / KusD0.computeFrobeniusNorm() );
393 #endif
394 
395  if ( solver->solve(*Kuu, KusD, us) & NM_NoSuccess ) {
396  OOFEM_ERROR("Failed to solve Kuu");
397  }
398  us.negated();
399 
400  // 2.
401  FloatMatrix Ks;
402  Ks.beTProductOf(KusD, us);
403 
404  // 3.
405  tangent.beInverseOf(Ks);
406  tangent.times(rve_size);
407  tangent.negated();
408 }
409 
410 
412 {
413  mpFluxHom->giveLocationArray(mFluxIds, oCols, r_s);
414 }
415 
416 
418 {
419  OOFEM_LOG_INFO("Computing eta for Neumann b.c.\n");
421  eta.resize(this->surfSets.giveSize());
422  for ( int i = 0; i < this->surfSets.giveSize(); ++i ) {
423  // Compute the coordinate indices based on what surface we're on.
424  int i_r;
425  int i_t;
426  if ( i % 3 == 0 ) { // Plane facing +- x
427  i_r = 1;
428  i_t = 2;
429  } else if ( i % 3 == 1 ) { // Plane facing +- y
430  i_r = 0;
431  i_t = 2;
432  } else { // Plane facing +- z
433  i_r = 0;
434  i_t = 1;
435  }
436  FloatArray coords, normal, tmp;
437  FloatMatrix d;
438  Set *setPointer = this->giveDomain()->giveSet(surfSets[i]);
439  const IntArray &boundaries = setPointer->giveBoundaryList();
440 
441  eta[i].resize(boundaries.giveSize() / 2);
442 
443  // Set up and solve: c * eta_c = f
444  // which represents the equations:
445  // int (eta - 1) dA = 0
446  // int (eta - 1) r dA = 0
447  // int (eta - 1) t dA = 0
448  //
449  // int eta_0 + eta_r * r + eta_t * t dA = A
450  // int (eta_0 + eta_r * r + eta_t * t) r dA = int r dA
451  // int (eta_0 + eta_r * r + eta_t * t) t dA = int t dA
452  FloatArray f(3), eta_c;
453  FloatMatrix c(3, 3);
454  for ( int pos = 0; pos < boundaries.giveSize() / 2; ++pos ) {
455  Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] );
456  int boundary = boundaries[pos * 2 + 1];
457 
458  FEInterpolation *interp = e->giveInterpolation(); // Geometry interpolation
459  int order = interp->giveInterpolationOrder();
460  std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary) );
461  static_cast< TransportElement* >(e)->computeConstitutiveMatrixAt(d, Capacity, e->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), tStep);
462 
463  for ( auto &gp: *ir ) {
464  const FloatArray &lcoords = gp->giveNaturalCoordinates();
465  FEIElementGeometryWrapper cellgeo(e);
466 
467  double detJ = interp->boundaryEvalNormal(normal, boundary, lcoords, cellgeo);
468  double dA = detJ * gp->giveWeight();
469  interp->boundaryLocal2Global(coords, boundary, lcoords, cellgeo);
470  coords.subtract(this->mCenterCoord);
471  double r = coords[i_r], t = coords[i_t];
472 
473  // Compute material property
475  //static_cast< TransportElement* >(e)->computeConstitutiveMatrixAt(d, Capacity, gp, tStep);
476  tmp.beProductOf(d, normal);
477  double k = tmp.dotProduct(normal);
478 
479  f[0] += dA;
480  f[1] += dA * r;
481  f[2] += dA * t;
482 
483  c(0, 0) += dA * k;
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;
492  }
493  }
494  c.solveForRhs(f, eta_c);
495 
496  for ( int pos = 0; pos < boundaries.giveSize() / 2; ++pos ) {
497  Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] );
498  int boundary = boundaries[pos * 2 + 1];
499 
500  FEInterpolation *interp = e->giveInterpolation(); // Geometry interpolation
501  int order = interp->giveInterpolationOrder();
502  std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary) );
503  static_cast< TransportElement* >(e)->computeConstitutiveMatrixAt(d, Capacity, e->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), tStep);
504 
505  eta[i][pos].resize(ir->giveNumberOfIntegrationPoints());
506  for ( auto &gp: *ir ) {
507  const FloatArray &lcoords = gp->giveNaturalCoordinates();
508  FEIElementGeometryWrapper cellgeo(e);
509 
510  interp->boundaryEvalNormal(normal, boundary, lcoords, cellgeo);
511  interp->boundaryLocal2Global(coords, boundary, lcoords, cellgeo);
512  coords.subtract(this->mCenterCoord);
513  double r = coords[i_r], t = coords[i_t];
514 
515  // Compute material property
516  //static_cast< TransportElement* >(e)->computeConstitutiveMatrixAt(d, Capacity, gp, tStep);
517  tmp.beProductOf(d, normal);
518  double k = tmp.dotProduct(normal);
519 
520  eta[i][pos].at(gp->giveNumber()) = (eta_c[0] + eta_c[1] * r + eta_c[2] * t) * k;
521  }
522  }
523  }
524 }
525 
526 
527 void TransportGradientNeumann :: integrateTangent(FloatMatrix &oTangent, Element *e, int boundary, int surfSet, int pos)
528 {
529  FloatArray normal, n;
530 
531  FEInterpolation *interp = e->giveInterpolation(); // Geometry interpolation
532  //FEInterpolation *interpUnknown = e->giveInterpolation(this->dofs(0));
533 
534  int order = interp->giveInterpolationOrder();
535  std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary) );
536 
537  oTangent.clear();
538 
539  for ( auto &gp: *ir ) {
540  const FloatArray &lcoords = gp->giveNaturalCoordinates();
541  FEIElementGeometryWrapper cellgeo(e);
542  // If eta isn't set, assume that classical Neumann b.c. is used (eta = 1)
543  double scale = 1.0;
544  if ( !eta.empty() ) {
545  //printf(" surfset %d / %d, pos %d, number %d\n", surfSet, pos, gp->giveNumber(), eta.size());
546  scale = eta[surfSet][pos].at(gp->giveNumber());
547  }
548 
549  double detJ = interp->boundaryEvalNormal(normal, boundary, lcoords, cellgeo);
550  interp->boundaryEvalN(n, boundary, lcoords, cellgeo);
551  oTangent.plusDyadUnsym(normal, n, scale * detJ * gp->giveWeight());
552  }
553 }
554 } /* namespace oofem */
std::unique_ptr< Node > mpFluxHom
DOF-manager containing the unknown homogenized stress.
bool contains(int value) const
Definition: intarray.h:283
void setField(int item, InputFieldType id)
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.
Definition: floatarray.C:258
REGISTER_BoundaryCondition(BoundaryCondition)
Class and object Domain.
Definition: domain.h:115
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.
Definition: element.h:822
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
bool solveForRhs(const FloatArray &b, FloatArray &answer, bool transpose=false)
Solves the system of linear equations .
Definition: floatmatrix.C:1112
Base class for all matrices stored in sparse format.
Definition: sparsemtrx.h:60
IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: activebc.h:75
SparseMtrx * createSparseMtrx(SparseMtrxType type)
Creates new instance of sparse matrix corresponding to given keyword.
Definition: classfactory.C:105
const IntArray & giveBoundaryList()
Returns list of element boundaries within set.
Definition: set.C:140
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.
Definition: floatarray.h:131
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
void clear()
Clears receiver (zero size).
Definition: floatarray.h:206
int giveInterpolationOrder()
Returns the interpolation order.
Definition: feinterpol.h:159
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
Implementation for assembling tangent matrices in standard monolithic FE-problems.
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
double giveTargetTime()
Returns target time.
Definition: timestep.h:146
Abstract base class for all finite elements.
Definition: element.h:145
Base class for dof managers.
Definition: dofmanager.h:113
std::vector< std::unique_ptr< DofManager > > & giveDofManagers()
Definition: domain.h:400
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.
Definition: floatmatrix.C:1605
int giveNumber()
Returns domain number.
Definition: domain.h:266
virtual double evalNXIntegral(int boundary, const FEICellGeometry &cellgeo)
Computes the integral .
Definition: feinterpol.h:420
void plusDyadUnsym(const FloatArray &a, const FloatArray &b, double dV)
Adds to the receiver the product .
Definition: floatmatrix.C:811
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Definition: domain.C:1067
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
virtual void scale(double s)
Scales the receiver according to given value.
virtual FEInterpolation * giveInterpolation() const
Definition: element.h:629
virtual double computeVolumeAreaOrLength()
Computes the volume, area or length of the element depending on its spatial dimension.
Definition: element.C:1059
virtual DofManager * giveInternalDofManager(int i)
Gives an internal dof manager from receiver.
#define NM_NoSuccess
Numerical method failed to solve problem.
Definition: nmstatus.h:48
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
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.
Definition: engngm.C:803
Class representing "master" degree of freedom.
Definition: masterdof.h:92
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 .
Definition: floatarray.C:146
#define OOFEM_LOG_INFO(...)
Definition: logger.h:127
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
virtual void computeTangent(FloatMatrix &tangent, TimeStep *tStep)
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
#define OOFEM_ERROR(...)
Definition: error.h:61
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
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.
Definition: floatmatrix.C:1594
This abstract class represent a general base element class for transport problems.
Set of elements, boundaries, edges and/or nodes.
Definition: set.h:66
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
Wrapper around element definition to provide FEICellGeometry interface.
Definition: feinterpol.h:95
Set * giveSet(int n)
Service for accessing particular domain set.
Definition: domain.C:363
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
IntArray dofs
Dofs that b.c. is applied to (relevant for Dirichlet type b.c.s).
Abstract base class for all active boundary conditions.
Definition: activebc.h:63
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix^T and anArray.
Definition: floatarray.C:708
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
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.
Definition: domain.C:1411
Class representing vector of real numbers.
Definition: floatarray.h:82
SparseLinearSystemNM * createSparseLinSolver(LinSystSolverType st, Domain *d, EngngModel *m)
Creates new instance of SparseLinearSystemNM corresponding to given type.
Definition: classfactory.C:120
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
double computeFrobeniusNorm() const
Computes the Frobenius norm of the receiver.
Definition: floatmatrix.C:1613
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
#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.
Definition: floatarray.C:551
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
CharType
Definition: chartype.h:87
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual IntegrationRule * giveBoundaryIntegrationRule(int order, int boundary)
Sets up a suitable integration rule for integrating over the requested boundary.
Definition: feinterpol.C:63
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
Definition: intarray.C:145
void beTProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
Definition: floatmatrix.C:367
void assembleSquared(const FloatArray &fe, const IntArray &loc)
Assembles the array fe with each component squared.
Definition: floatarray.C:572
virtual void giveBoundaryLocationArray(IntArray &locationArray, const IntArray &bNodes, const UnknownNumberingScheme &s, IntArray *dofIds=NULL)
Returns the location array for the boundary of the element.
Definition: element.C:446
Class representing the a dynamic Input Record.
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
void beTranspositionOf(const FloatMatrix &src)
Assigns to the receiver the transposition of parameter.
Definition: floatmatrix.C:323
ClassFactory & classFactory
Definition: classfactory.C:59
#define new
Domain * giveDomain() const
Definition: femcmpnn.h:100
#define _IFT_TransportGradientNeumann_gradient
std::vector< std::unique_ptr< Element > > & giveElements()
Definition: domain.h:279
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
virtual TimeStep * giveCurrentStep(bool force=false)
Returns current time step.
Definition: engngm.h:683
int giveSize() const
Definition: intarray.h:203
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...
Definition: floatmatrix.h:516
Class implementing node in finite element mesh.
Definition: node.h:87
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
void beInverseOf(const FloatMatrix &src)
Modifies receiver to become inverse of given parameter.
Definition: floatmatrix.C:835
void negated()
Switches the sign of every coefficient of receiver.
Definition: floatarray.C:739
void computeBoundaryVectorOf(const IntArray &bNodes, const IntArray &dofIDMask, ValueModeType u, TimeStep *tStep, FloatArray &answer, bool padding=false)
Boundary version of computeVectorOf.
Definition: element.C:139
virtual double evaluateAtTime(double t)
Returns the value of the function at given time.
Definition: function.C:76
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.
Definition: timestep.h:80

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:32 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011