OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
nonstationarytransportproblem.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 
37 #include "nummet.h"
38 #include "timestep.h"
39 #include "element.h"
40 #include "dofmanager.h"
41 #include "dof.h"
42 #include "maskedprimaryfield.h"
43 #include "verbose.h"
44 #include "transportelement.h"
45 #include "classfactory.h"
46 #include "datastream.h"
47 #include "contextioerr.h"
48 #include "function.h"
49 #include "sparsenonlinsystemnm.h"
50 #include "unknownnumberingscheme.h"
51 
52 #ifdef __CEMHYD_MODULE
53  #include "cemhyd/cemhydmat.h"
54 #endif
55 
56 namespace oofem {
57 REGISTER_EngngModel(NonStationaryTransportProblem);
58 
60 {
61  TransportElement *telem = static_cast< TransportElement* >(&element);
62  telem->computeBCVectorAt(vec, tStep, mode);
63  FloatArray tmp;
64  telem->computeInternalSourceRhsVectorAt(tmp, tStep, mode);
65  vec.add(tmp);
66 }
67 
68 
69 MidpointLhsAssembler :: MidpointLhsAssembler(bool lumped, double alpha) :
70  MatrixAssembler(), lumped(lumped), alpha(alpha)
71 {}
72 
73 
75 {
76  FloatMatrix capacity;
77  el.giveCharacteristicMatrix(answer, TangentStiffnessMatrix, tStep);
78  el.giveCharacteristicMatrix(capacity, this->lumped ? LumpedMassMatrix : MassMatrix, tStep);
79  answer.times(this->alpha);
80  answer.add(1. / tStep->giveTimeIncrement(), capacity);
81 }
82 
83 
85 {
86  static_cast< TransportElement * >( &el )->computeIntSourceLHSMatrix(answer, tStep);
87 }
88 
89 
91 {
92  ndomains = 1;
94  initT = 0.;
95  deltaT = 0.;
96  dtFunction = 0;
98  changingProblemSize = false;
100 }
101 
103 {
104 }
105 
106 
108 // only one has reason for LinearStatic
109 // - SolutionOfLinearEquations
110 
111 {
112  if (!linSolver) {
113  linSolver.reset( classFactory.createSparseLinSolver(solverType, this->giveDomain(1), this) );
114  if ( !linSolver ) {
115  OOFEM_ERROR("linear solver creation failed for lstype %d", solverType);
116  }
117  }
118  return linSolver.get();
119 }
120 
123 {
124  IRResultType result; // Required by IR_GIVE_FIELD macro
125 
126  result = EngngModel :: initializeFrom(ir);
127  if ( result != IRRT_OK ) return result;
128 
131  }
132 
139  } else {
140  OOFEM_WARNING("Time step not defined");
141  return IRRT_BAD_FORMAT;
142  }
143 
145  /* The following done in updateAttributes
146  * if (this->giveNumericalMethod (giveCurrentStep())) nMethod -> instanciateFrom (ir);
147  */
148  // read lumped capacity stabilization flag
150  lumpedCapacityStab = 1;
151  }
152 
153  //secure equation renumbering, otherwise keep efficient algorithms
155  changingProblemSize = true;
156  UnknownsField.reset( new DofDistributedPrimaryField(this, 1, FT_TransportProblemUnknowns, 1) );
157  } else {
158  UnknownsField.reset( new PrimaryField(this, 1, FT_TransportProblemUnknowns, 1) );
159  }
160 
161  //read other input data from StationaryTransportProblem
163 
164  int val = 0;
166  solverType = ( LinSystSolverType ) val;
167 
168 
169  return IRRT_OK;
170 }
171 
172 
174 // returns unknown quantity like displacement, velocity of equation eq
175 // This function translates this request to numerical method language
176 {
177  if ( this->requiresUnknownsDictionaryUpdate() ) {
178  if (mode == VM_TotalIntrinsic) mode = VM_Total;
179  int hash = this->giveUnknownDictHashIndx(mode, tStep);
180  if ( dof->giveUnknowns()->includes(hash) ) {
181  return dof->giveUnknowns()->at(hash);
182  } else {
183  OOFEM_ERROR("Dof unknowns dictionary does not contain unknown of value mode (%s)", __ValueModeTypeToString(mode));
184  }
185  }
186 
187  if ( dof->__giveEquationNumber() == 0 ) {
188  OOFEM_ERROR("invalid equation number on DoF %d", dof->giveDofID());
189  }
190 
191  if (mode == VM_TotalIntrinsic) {
192  /*
193  if (tStep == this->giveCurrentStep()) {
194  double rt = UnknownsField->giveUnknownValue(dof, VM_Total, tStep);
195  double rtm1 = UnknownsField->giveUnknownValue(dof, VM_Total, tStep);
196  return (1.-alpha)*rtm1+alpha*rt;
197  } else {
198  OOFEM_ERROR ("mode only supported for current step");
199  }
200  */
201  mode = VM_Total;
202  }
203  return UnknownsField->giveUnknownValue(dof, mode, tStep);
204 }
205 
206 
207 TimeStep *
209 {
210  if ( master && (!force)) {
212  } else {
213  if ( !stepWhenIcApply ) {
215  //stepWhenIcApply.reset( new TimeStep(giveNumberOfTimeStepWhenIcApply(), this, 0, -deltaT, deltaT, 0) );
216  }
217 
218  return stepWhenIcApply.get();
219  }
220 }
221 
222 
223 Function *
225 // Returns the load-time function of the receiver.
226 {
227  if ( !dtFunction ) {
228  return NULL;
229  }
230 
231  return giveDomain(1)->giveFunction(dtFunction);
232 }
233 
234 double
236 {
237  if ( giveDtFunction() ) {
238  return giveDtFunction()->evaluateAtTime(n);
239  }
240 
241  if ( discreteTimes.giveSize() > 0 ) {
242  return this->giveDiscreteTime(n) - this->giveDiscreteTime(n - 1);
243  }
244 
245  return deltaT;
246 }
247 
248 double
250 {
251  if ( ( iStep > 0 ) && ( iStep <= discreteTimes.giveSize() ) ) {
252  return ( discreteTimes.at(iStep) );
253  }
254 
255  if ( ( iStep == 0 ) && ( iStep <= discreteTimes.giveSize() ) ) {
256  return ( initT );
257  }
258 
259  OOFEM_ERROR("invalid iStep");
260  return 0.0;
261 }
262 
263 
264 TimeStep *
266 {
267  int istep = this->giveNumberOfFirstStep();
268  double totalTime = this->initT;
269  double intrinsicTime;
270  StateCounterType counter = 1;
271 
272  if ( currentStep ) {
273  istep = currentStep->giveNumber() + 1;
274  totalTime = currentStep->giveTargetTime() + giveDeltaT(istep);
275  counter = currentStep->giveSolutionStateCounter() + 1;
276  } else {
277  // first step -> generate initial step
279  }
280 
281  previousStep = std :: move(currentStep);
282  currentStep.reset( new TimeStep(istep, this, 1, totalTime, this->giveDeltaT ( istep ), counter) );
283  //set intrinsic time to time of integration
284  intrinsicTime = currentStep->giveTargetTime();
285 // intrinsicTime = previousStep->giveTargetTime() + this->alpha *this->giveDeltaT(istep);
286  currentStep->setIntrinsicTime(intrinsicTime);
287  return currentStep.get();
288 }
289 
290 
292 {
293  // Creates system of governing eq's and solves them at given tStep
294  // The solution is stored in UnknownsField. If the problem is growing/decreasing, the UnknownsField is projected on DoFs when needed.
295  // If equations are not renumbered, the algorithm is efficient without projecting unknowns to DoFs (nodes).
296 
297  //Right hand side
298  FloatArray rhs;
299  TimeStep *icStep = this->giveSolutionStepWhenIcApply();
300 
302 #ifdef VERBOSE
303  OOFEM_LOG_RELEVANT( "Solving [step number %8d, time %15e]\n", tStep->giveNumber(), tStep->giveTargetTime() );
304 #endif
305 
306  //Solution at the first time step needs history. Therefore, return back one time increment and create it.
307  if ( tStep->isTheFirstStep() ) {
308 
309  bcRhs.resize(neq); //rhs vector from solution step i-1
310  bcRhs.zero();
311 
312  this->applyIC(icStep);
313 
314  //project initial conditions to have temporary temperature in integration points
315 
316  //edge or surface loads on elements
317  //add internal source vector on elements
319  VM_Total, EModelDefaultEquationNumbering(), this->giveDomain(1) );
320  //add prescribed value, such as temperature, on nodes
321  this->assembleDirichletBcRhsVector( bcRhs, icStep, VM_Total,
323  //add nodal load
325  VM_Total, EModelDefaultEquationNumbering(), this->giveDomain(1) );
326  }
327 
328  //Create a new lhs matrix if necessary
329  if ( tStep->isTheFirstStep() || this->changingProblemSize ) {
330 
332  if ( !conductivityMatrix ) {
333  OOFEM_ERROR("sparse matrix creation failed");
334  }
335 
336  conductivityMatrix->buildInternalStructure( this, 1, EModelDefaultEquationNumbering() );
337 
338 #ifdef VERBOSE
339  OOFEM_LOG_INFO("Assembling conductivity and capacity matrices\n");
340 #endif
341 
342  //Add contribution of alpha*K+C/dt (where K has contributions from conductivity and Neumann b.c.s)
345  }
346 
347  //get the previous Rhs vector
348  if ( !tStep->isTheFirstStep() && this->changingProblemSize ) {
349  UnknownsField->initialize( VM_RhsTotal, tStep, bcRhs, EModelDefaultEquationNumbering() );
350  }
351 
352  //prepare position in UnknownsField to store the results
353  FloatArray *solutionVector;
354  UnknownsField->advanceSolution(tStep);
355  solutionVector = UnknownsField->giveSolutionVector(tStep);
356 // solutionVector->resize(neq);
357 // solutionVector->zero();
358 
359  //Initialize and give solutionVector from previous solution
360  //copy previous solution vector so we can use solution-dependent boundary conditions
361  if ( changingProblemSize ) {
362  if ( !tStep->isTheFirstStep() ) {
363  //copy recent solution to previous position, copy from hash=0 to hash=1(previous)
364  copyUnknownsInDictionary( VM_Total, tStep, tStep->givePreviousStep() );
365  }
366  UnknownsField->initialize( VM_Total, tStep->givePreviousStep(), *solutionVector, EModelDefaultEquationNumbering() );
367  } else {
368  //copy previous solution vector to actual
369  *solutionVector = *UnknownsField->giveSolutionVector( tStep->givePreviousStep() );
370  }
371 
373 
374 #ifdef VERBOSE
375  OOFEM_LOG_INFO("Assembling rhs\n");
376 #endif
377  // assembling load from elements
378  rhs = bcRhs;
379  rhs.times(1. - alpha);
380  bcRhs.zero();
381  //boundary conditions evaluated at targetTime
383  VM_Total, EModelDefaultEquationNumbering(), this->giveDomain(1) );
384  this->assembleDirichletBcRhsVector( bcRhs, tStep, VM_Total,
386 
387  // assembling load from nodes
390  for ( int i = 1; i <= neq; i++ ) {
391  rhs.at(i) += bcRhs.at(i) * alpha;
392  }
393 
394  // add the rhs part depending on previous solution
396  // set-up numerical model
397  this->giveNumericalMethod( this->giveCurrentMetaStep() );
398 
399  // call numerical model to solve arised problem
400 #ifdef VERBOSE
401  OOFEM_LOG_INFO("Solving ...\n");
402 #endif
403 // UnknownsField->giveSolutionVector(tStep)->resize(neq);
404  linSolver->solve(*conductivityMatrix, rhs, *UnknownsField->giveSolutionVector(tStep) );
405  // update solution state counter
406  tStep->incrementStateCounter();
407 }
408 
409 void
411 {
412  this->updateInternalState(tStep);
414 
416 #ifdef __CEMHYD_MODULE
417  for ( auto &domain: this->domainList ) {
418  for ( int i = 1; i <= domain->giveNumberOfElements(); ++i ) {
419  TransportElement *elem = static_cast< TransportElement * >( domain->giveElement(i) );
420  //store temperature and associated volume on each GP before performing averaging
421  CemhydMat *cem = dynamic_cast< CemhydMat * >( elem->giveMaterial() );
422  if ( cem ) {
424  cem->storeWeightTemperatureProductVolume(elem, tStep);
425  }
426  }
427  //perform averaging on each material instance
428  for ( int i = 1; i <= domain->giveNumberOfMaterialModels(); i++ ) {
429  CemhydMat *cem = dynamic_cast< CemhydMat * >( domain->giveMaterial(i) );
430  if ( cem ) {
431  cem->averageTemperature();
432  }
433  }
434  }
435  #ifdef VERBOSE
436  VERBOSE_PRINT0("Updated Materials ", 0)
437  #endif
438 #endif
439 }
440 
441 void
443 {
444  Domain *domain = this->giveDomain(1);
445 
446  for ( auto &node : domain->giveDofManagers() ) {
447  for ( Dof *dof: *node ) {
448  double val = dof->giveUnknown(mode, fromTime);
449  dof->updateUnknownsDictionary(toTime, mode, val);
450  }
451  }
452 }
453 
454 
455 void
457 {
458  for ( auto &domain: domainList ) {
460  //update temperature vector
461  UnknownsField->update( VM_Total, tStep, * ( this->UnknownsField->giveSolutionVector(tStep) ), EModelDefaultEquationNumbering() );
462  //update Rhs vector
463  UnknownsField->update(VM_RhsTotal, tStep, bcRhs, EModelDefaultEquationNumbering());
464  }
465 
467  for ( auto &elem : domain->giveElements() ) {
468  elem->updateInternalState(tStep);
469  }
470 
472  }
473  }
474 }
475 
478 {
479  contextIOResultType iores;
480 
481  if ( ( iores = EngngModel :: saveContext(stream, mode) ) != CIO_OK ) {
482  THROW_CIOERR(iores);
483  }
484 
485  if ( ( iores = UnknownsField->saveContext(stream, mode) ) != CIO_OK ) {
486  THROW_CIOERR(iores);
487  }
488 
489  return CIO_OK;
490 }
491 
492 
493 
496 {
497  contextIOResultType iores;
498 
499  if ( ( iores = EngngModel :: restoreContext(stream, mode) ) != CIO_OK ) {
500  THROW_CIOERR(iores);
501  }
502 
503  if ( ( iores = UnknownsField->restoreContext(stream, mode) ) != CIO_OK ) {
504  THROW_CIOERR(iores);
505  }
506 
507  return CIO_OK;
508 }
509 
510 
511 int
513 {
514  // check internal consistency
515  // if success returns nonzero
516  Domain *domain = this->giveDomain(1);
517 
518  // check for proper element type
519  for ( auto &elem : domain->giveElements() ) {
520  if ( !dynamic_cast< TransportElement * >( elem.get() ) ) {
521  OOFEM_WARNING("Element %d has no TransportElement base", elem->giveLabel());
522  return 0;
523  }
524  }
525 
527 
528  return 1;
529 }
530 
531 
532 void
534 {
536  this->giveNumericalMethod( this->giveCurrentMetaStep() )->setDomain( this->giveDomain(1) );
537 }
538 
539 int
541 {
542  if ( mode == VM_Total ) { //Nodal temperature
543  return 0;
544  } else if ( mode == VM_RhsTotal ) { //Nodal Rhs
545  return 1;
546  } else {
547  OOFEM_ERROR("ValueModeType %s undefined", __ValueModeTypeToString(mode));
548  }
549 
550  return 0;
551 }
552 
553 
554 void
556  const UnknownNumberingScheme &s, TimeStep *tStep)
557 {
558  IntArray loc;
559  FloatMatrix charMtrx, charMtrx2;
560  FloatArray unknownVec, contrib, intSource;
561  Element *element;
562 
563  Domain *domain = this->giveDomain(1);
564  int nelem = domain->giveNumberOfElements();
565 
566  for ( int i = 1; i <= nelem; i++ ) {
567  element = domain->giveElement(i);
568  // skip remote elements (these are used as mirrors of remote elements on other domains
569  // when nonlocal constitutive models are used. They introduction is necessary to
570  // allow local averaging on domains without fine grain communication between domains).
571  if ( element->giveParallelMode() == Element_remote ) {
572  continue;
573  }
574 
575  element->giveLocationArray(loc, s);
576  //(alpha-1)*K+C/dt
577  element->giveCharacteristicMatrix(charMtrx, TangentStiffnessMatrix, tStep);
578  element->giveCharacteristicMatrix(charMtrx2, lumpedCapacityStab ? LumpedMassMatrix : MassMatrix, tStep);
579 
580  charMtrx.times(this->alpha - 1.0);
581  charMtrx.add(1. / tStep->giveTimeIncrement(), charMtrx2);
582 
583  if ( charMtrx.isNotEmpty() ) {
584  element->computeVectorOf(VM_Total, tStep, unknownVec);
585  contrib.beProductOf(charMtrx, unknownVec);
586  answer.assemble(contrib, loc);
587  }
588  }
589 }
590 
591 
592 void
594 {
595  Domain *domain = this->giveDomain(1);
597  FloatArray *solutionVector;
598  double val;
599 
600 #ifdef VERBOSE
601  OOFEM_LOG_INFO("Applying initial conditions\n");
602 #endif
603 
604  UnknownsField->advanceSolution(stepWhenIcApply);
605  solutionVector = UnknownsField->giveSolutionVector(stepWhenIcApply);
606  solutionVector->resize(neq);
607  solutionVector->zero();
608 
609  for ( auto &node : domain->giveDofManagers() ) {
610 
611  for ( Dof *dof: *node ) {
612  // ask for initial values obtained from
613  // bc (boundary conditions) and ic (initial conditions)
614  if ( !dof->isPrimaryDof() ) {
615  continue;
616  }
617 
618  int jj = dof->__giveEquationNumber();
619  if ( jj ) {
620  val = dof->giveUnknown(VM_Total, stepWhenIcApply);
621  solutionVector->at(jj) = val;
622  //update in dictionary, if the problem is growing/decreasing
623  if ( this->changingProblemSize ) {
624  dof->updateUnknownsDictionary(stepWhenIcApply, VM_Total, val);
625  }
626  }
627  }
628  }
629 
630 
631  //project initial temperature to integration points
632 
633  // for ( int j = 1; j <= nelem; j++ ) {
634  // domain->giveElement(j)->updateInternalState(stepWhenIcApply);
635  // }
636 
637 #ifdef __CEMHYD_MODULE
638  // Not relevant in linear case, but needed for CemhydMat for temperature averaging before solving balance equations
639  // Update element state according to given ic
640  for ( auto &elem : domain->giveElements() ) {
641  TransportElement *element = static_cast< TransportElement * >( elem.get() );
642  CemhydMat *cem = dynamic_cast< CemhydMat * >( element->giveMaterial() );
643  //assign status to each integration point on each element
644  if ( cem ) {
645  cem->initMaterial(element); //create microstructures and statuses on specific GPs
646  element->updateInternalState(stepWhenIcApply); //store temporary unequilibrated temperature
647  element->updateYourself(stepWhenIcApply); //store equilibrated temperature
649  cem->storeWeightTemperatureProductVolume(element, stepWhenIcApply);
650  }
651  }
652 
653  //perform averaging on each material instance of CemhydMatClass
654  for ( auto &mat : domain->giveMaterials() ) {
655  CemhydMat *cem = dynamic_cast< CemhydMat * >( mat.get() );
656  if ( cem ) {
657  cem->averageTemperature();
658  }
659  }
660 
661 #endif //__CEMHYD_MODULE
662 
663  // update element state according to given ic
664  for ( auto &elem : domain->giveElements() ) {
665  TransportElement *element = static_cast< TransportElement * >( elem.get() );
666  element->updateInternalState(stepWhenIcApply);
667  element->updateYourself(stepWhenIcApply);
668  }
669 }
670 
671 
672 void
674  ValueModeType mode,
675  const UnknownNumberingScheme &ns, Domain *d)
676 {
677  IntArray loc, dofids;
678  FloatArray rp, charVec;
679  FloatMatrix s;
680  FloatMatrix capacity;
681 
682  int nelem = d->giveNumberOfElements();
683 
684  for ( int ielem = 1; ielem <= nelem; ielem++ ) {
685  Element *element = d->giveElement(ielem);
686 
687  element->giveElementDofIDMask(dofids);
688  element->computeVectorOfPrescribed(dofids, mode, tStep, rp);
689  if ( rp.containsOnlyZeroes() ) {
690  continue;
691  } else {
692  element->giveCharacteristicMatrix(s, TangentStiffnessMatrix, tStep);
693  element->giveCharacteristicMatrix(capacity, lumpedCapacityStab ? LumpedMassMatrix : MassMatrix, tStep);
694  s.times(this->alpha);
695  s.add(1. / tStep->giveTimeIncrement(), capacity);
696 
697  charVec.beProductOf(s, rp);
698  charVec.negated();
699 
700  element->giveLocationArray(loc, ns);
701  answer.assemble(charVec, loc);
702  }
703  } // end element loop
704 }
705 
706 #ifdef __CEMHYD_MODULE
707 // needed for CemhydMat
708 void
709 NonStationaryTransportProblem :: averageOverElements(TimeStep *tStep)
710 {
712  Domain *domain = this->giveDomain(1);
713  FloatArray vecTemperature;
714 
715  for ( auto &elem : domain->giveElements() ) {
716  TransportMaterial *mat = dynamic_cast< CemhydMat * >( elem->giveMaterial() );
717  if ( mat ) {
718  for ( GaussPoint *gp: *elem->giveDefaultIntegrationRulePtr() ) {
719  elem->giveIPValue(vecTemperature, gp, IST_Temperature, tStep);
720  //mat->IP_volume += dV;
721  //mat->average_temp += vecState.at(1) * dV;
722  }
723  }
724  }
725 
726  for ( auto &mat : domain->giveMaterials() ) {
727  CemhydMat *cem = dynamic_cast< CemhydMat * >( mat.get() );
728  if ( cem ) {
729  //cem->average_temp /= mat->IP_volume;
730  }
731  }
732 }
733 #endif
734 } // end namespace oofem
virtual void updateDomainLinks()
Updates domain links after the domains of receiver have changed.
LinSystSolverType
The values of this type should be related not to specific solvers, but more to specific packages that...
virtual void assembleAlgorithmicPartOfRhs(FloatArray &rhs, const UnknownNumberingScheme &s, TimeStep *tStep)
The representation of EngngModel default unknown numbering.
std::unique_ptr< SparseLinearSystemNM > linSolver
virtual int checkConsistency()
Allows programmer to test some receiver&#39;s internal data, before computation begins.
std::unique_ptr< TimeStep > currentStep
Current time step.
Definition: engngm.h:231
FloatArray discreteTimes
Specified times where the problem is solved.
#define _IFT_NonStationaryTransportProblem_alpha
Class and object Domain.
Definition: domain.h:115
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Returns local vector of unknowns.
Definition: element.C:86
void assembleVectorFromDofManagers(FloatArray &answer, TimeStep *tStep, const VectorAssembler &va, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms=NULL)
Assembles characteristic vector of required type from dofManagers into given vector.
Definition: engngm.C:1016
Implementation for assembling internal forces vectors in standard monolithic, nonlinear FE-problems...
#define _IFT_NonStationaryTransportProblem_changingproblemsize
virtual int giveNumberOfDomainEquations(int di, const UnknownNumberingScheme &num)
Returns number of equations for given domain in active (current time step) time step.
Definition: engngm.C:391
virtual void computeBCVectorAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Computes the RHS contribution to balance equation(s) due to boundary conditions.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
Definition: engngm.C:262
Class representing meta step.
Definition: metastep.h:62
SparseMtrx * createSparseMtrx(SparseMtrxType type)
Creates new instance of sparse matrix corresponding to given keyword.
Definition: classfactory.C:105
This class represents stationary transport problem.
Abstract class representing field of primary variables (those, which are unknown and are typically as...
Definition: primaryfield.h:104
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
std::vector< std::unique_ptr< Domain > > domainList
List of problem domains.
Definition: engngm.h:207
std::unique_ptr< TimeStep > previousStep
Previous time step.
Definition: engngm.h:233
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
long StateCounterType
StateCounterType type used to indicate solution state.
virtual void copyUnknownsInDictionary(ValueModeType mode, TimeStep *fromTime, TimeStep *toTime)
Copy unknowns in DOF&#39;s from previous to current position.
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
This base class is an abstraction for numerical algorithm.
Definition: nummet.h:80
std::unique_ptr< TimeStep > stepWhenIcApply
Solution step when IC (initial conditions) apply.
Definition: engngm.h:229
virtual void computeInternalSourceRhsVectorAt(FloatArray &answer, TimeStep *tStep, ValueModeType mode)
Computes the contribution to balance equation(s) due to internal sources.
virtual void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: element.C:779
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
void incrementStateCounter()
Updates solution state counter.
Definition: timestep.h:190
Callback class for assembling element external forces:
Abstract base class for all finite elements.
Definition: element.h:145
std::vector< std::unique_ptr< DofManager > > & giveDofManagers()
Definition: domain.h:400
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
virtual int __giveEquationNumber() const =0
Returns equation number of receiver, usually assigned by emodel.
int giveNumberOfElements() const
Returns number of elements in domain.
Definition: domain.h:434
virtual void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep)
Computes characteristic matrix of receiver of requested type in given time step.
Definition: element.C:569
NonStationaryTransportProblem(int i, EngngModel *_master)
Constructor.
REGISTER_EngngModel(ProblemSequence)
Class implementing an array of integers.
Definition: intarray.h:61
#define _IFT_NonStationaryTransportProblem_deltat
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
virtual void giveUnknowns(FloatArray &masterUnknowns, ValueModeType mode, TimeStep *tStep)
The key method of class Dof.
Definition: dof.C:162
double giveDiscreteTime(int n)
Returns time for time step number n (array discreteTimes must be specified)
#define _IFT_NonStationaryTransportProblem_deltatfunction
#define OOFEM_LOG_RELEVANT(...)
Definition: logger.h:126
Function * giveDtFunction()
Returns time function for time step increment.
void computeVectorOfPrescribed(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Returns local vector of prescribed unknowns.
Definition: element.C:181
double giveTimeIncrement()
Returns solution step associated time increment.
Definition: timestep.h:150
bool isTheFirstStep()
Check if receiver is first step.
Definition: timestep.C:134
Class representing field of primary variables, which are typically allocated on nodes.
#define VERBOSE_PRINT0(str, number)
Definition: verbose.h:56
bool isNotEmpty() const
Tests for empty matrix.
Definition: floatmatrix.h:162
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
virtual void updateYourself(TimeStep *tStep)
Updates internal state after finishing time step.
virtual void solveYourselfAt(TimeStep *tStep)
Solves problem for given time step.
MetaStep * giveCurrentMetaStep()
Returns current meta step.
Definition: engngm.C:1684
bool changingProblemSize
Determines if there are change in the problem size (no application/removal of Dirichlet boundary cond...
#define OOFEM_LOG_INFO(...)
Definition: logger.h:127
int giveNumber()
Returns receiver&#39;s number.
Definition: timestep.h:129
std::unique_ptr< SparseMtrx > conductivityMatrix
Element * giveElement(int n)
Service for accessing particular domain fe element.
Definition: domain.C:160
int dtFunction
Associated time function for time step increment.
StateCounterType giveSolutionStateCounter()
Returns current solution state counter.
Definition: timestep.h:188
virtual int giveUnknownDictHashIndx(ValueModeType mode, TimeStep *tStep)
This method is responsible for computing unique dictionary id (ie hash value) from given valueModeTyp...
std::vector< std::unique_ptr< Material > > & giveMaterials()
Definition: domain.h:344
#define OOFEM_ERROR(...)
Definition: error.h:61
#define _IFT_NonStationaryTransportProblem_initt
Callback class for assembling specific types of matrices.
int ndomains
Number of receiver domains.
Definition: engngm.h:205
virtual void averageTemperature()
Perform averaging on a master CemhydMatStatus.
Definition: cemhydmat.C:399
Implementation for assembling external forces vectors in standard monolithic FE-problems.
void giveLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s, IntArray *dofIds=NULL) const
Returns the location array (array of code numbers) of receiver for given numbering scheme...
Definition: element.C:390
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.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
virtual void updateYourself(TimeStep *tStep)
Updates internal state after finishing time step.
Definition: engngm.C:612
DofIDItem giveDofID() const
Returns DofID value of receiver, which determines type of of unknown connected to receiver (e...
Definition: dof.h:276
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
Definition: cemhydmat.C:303
StateCounterType internalVarUpdateStamp
Contains last time stamp of internal variable update.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
EngngModel * master
Master e-model; if defined receiver is in maintained (slave) mode.
Definition: engngm.h:262
virtual int giveNumberOfFirstStep(bool force=false)
Returns number of first time step used by receiver.
Definition: engngm.h:730
FloatArray bcRhs
Right hand side vector from boundary conditions.
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
Definition: element.h:498
int lumpedCapacityStab
If set then stabilization using lumped capacity will be used.
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
Definition: timestep.C:114
Callback class for assembling mid point effective tangents.
Function * giveFunction(int n)
Service for accessing particular domain load time function.
Definition: domain.C:268
virtual double giveUnknownComponent(ValueModeType, TimeStep *, Domain *, Dof *)
Returns requested unknown.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores the state of model to output stream.
Definition: engngm.C:1527
virtual void updateInternalState(TimeStep *tStep)
Updates IP values on elements.
std::unique_ptr< PrimaryField > UnknownsField
This field stores solution vector. For fixed size of problem, the PrimaryField is used...
#define _IFT_NonStationaryTransportProblem_lumpedcapa
#define _IFT_NonStationaryTransportProblem_prescribedtimes
Initializes the variable VERBOSE, in order to get a few intermediate messages on screen: beginning an...
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
elementParallelMode giveParallelMode() const
Return elementParallelMode of receiver.
Definition: element.h:1069
virtual int checkConsistency()
Allows programmer to test some receiver&#39;s internal data, before computation begins.
Definition: engngm.h:995
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
Abstract base class representing a function with vector input and output.
Definition: function.h:88
virtual void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const
#define _IFT_EngngModel_lstype
Definition: engngm.h:81
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
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 int initMaterial(Element *element)
Optional function to call specific procedures when initializing a material.
Definition: cemhydmat.C:354
int giveNumberOfTimeStepWhenIcApply()
Returns the time step number, when initial conditions should apply.
Definition: engngm.h:754
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual int requiresUnknownsDictionaryUpdate()
Allows to change number of equations during solution.
void add(const FloatMatrix &a)
Adds matrix to the receiver.
Definition: floatmatrix.C:1023
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores the state of model to output stream.
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
Abstract base class for all constitutive models for transport problems.
virtual void assembleDirichletBcRhsVector(FloatArray &answer, TimeStep *tStep, ValueModeType mode, const UnknownNumberingScheme &s, Domain *d)
Assembles part of RHS due to Dirichlet boundary conditions.
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
ClassFactory & classFactory
Definition: classfactory.C:59
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
Element in active domain is only mirror of some remote element.
Definition: element.h:102
virtual TimeStep * giveSolutionStepWhenIcApply(bool force=false)
Returns the solution step when Initial Conditions (IC) apply.
Definition: engngm.h:720
virtual void storeWeightTemperatureProductVolume(Element *element, TimeStep *tStep)
Store temperatures multiplied with volume around GPs - need before temperature averaging.
Definition: cemhydmat.C:385
std::vector< std::unique_ptr< Element > > & giveElements()
Definition: domain.h:279
double giveDeltaT(int n)
Returns the time step length for given step number n, initial step is number 0.
void assembleVectorFromElements(FloatArray &answer, TimeStep *tStep, const VectorAssembler &va, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms=NULL)
Assembles characteristic vector of required type from elements into given vector. ...
Definition: engngm.C:1198
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
virtual void setDomain(Domain *d)
Definition: nummet.h:114
MidpointLhsAssembler(bool lumped, double alpha)
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
virtual void clearWeightTemperatureProductVolume(Element *element)
Clear temperatures multiplied with volume around GPs - need before temperature averaging.
Definition: cemhydmat.C:375
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
virtual void updateDomainLinks()
Updates domain links after the domains of receiver have changed.
Definition: engngm.C:1521
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the state of model from output stream.
Definition: engngm.C:1592
bool containsOnlyZeroes() const
Returns nonzero if all coefficients of the receiver are 0, else returns zero.
Definition: floatarray.C:646
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual NumericalMethod * giveNumericalMethod(MetaStep *mStep)
Returns reference to receiver&#39;s numerical method.
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Definition: engngm.C:1720
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the state of model from output stream.
void negated()
Switches the sign of every coefficient of receiver.
Definition: floatarray.C:739
virtual Material * giveMaterial()
virtual TimeStep * giveNextStep()
Returns next time step (next to current step) of receiver.
virtual void updateInternalState(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
virtual double evaluateAtTime(double t)
Returns the value of the function at given time.
Definition: function.C:76
Class representing integration point in finite element program.
Definition: gausspoint.h:93
#define OOFEM_WARNING(...)
Definition: error.h:62
double initT
Initial time from which the computation runs. Default is zero.
Class representing solution step.
Definition: timestep.h:80
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual TimeStep * giveSolutionStepWhenIcApply(bool force=false)
Returns the solution step when Initial Conditions (IC) apply.
const char * __ValueModeTypeToString(ValueModeType _value)
Definition: cltypes.C:322
virtual void applyIC(TimeStep *tStep)
This function is normally called at the first time to project initial conditions to previous (0^th) s...
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011