OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
cbs.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 
35 #include "cbs.h"
36 #include "nummet.h"
37 #include "timestep.h"
38 #include "element.h"
39 #include "dofmanager.h"
40 #include "dof.h"
41 #include "initialcondition.h"
42 #include "maskedprimaryfield.h"
43 #include "verbose.h"
44 #include "cbselement.h"
45 #include "classfactory.h"
46 #include "mathfem.h"
47 #include "datastream.h"
48 //<RESTRICTED_SECTION>
49 #include "leplic.h"
50 //</RESTRICTED_SECTION>
51 #ifdef TIME_REPORT
52  #include "timer.h"
53 #endif
54 #include "contextioerr.h"
55 
56 namespace oofem {
58 
59 
61 {
62  static_cast< CBSElement & >( element ).computeNumberOfNodalPrescribedTractionPressureContributions(vec, tStep);
63 }
64 
66 {
67  FloatArray vec_p;
68  static_cast< CBSElement & >( element ).computeConvectionTermsI(vec, tStep);
69  static_cast< CBSElement & >( element ).computeDiffusionTermsI(vec_p, tStep);
70  vec.add(vec_p);
71 }
72 
74 {
75  static_cast< CBSElement & >( element ).computePrescribedTermsI(vec, tStep);
76 
77 }
78 
80 {
81  static_cast< CBSElement & >( element ).computePrescribedTractionPressure(vec, tStep);
82 }
83 
85 {
86  FloatArray vec_p;
87  static_cast< CBSElement & >( element ).computeDensityRhsVelocityTerms(vec, tStep);
88  static_cast< CBSElement & >( element ).computeDensityRhsPressureTerms(vec_p, tStep);
89  vec.add(vec_p);
90 }
91 
93 {
94  static_cast< CBSElement & >( element ).computeCorrectionRhs(vec, tStep);
95 
96 }
97 
99 {
100  static_cast< CBSElement & >( element ).computePressureLhs(answer, tStep);
101 }
102 
104 {
105  element.giveLocationArray(loc, {P_f}, s, dofIds);
106 }
107 
108 
109 
110 CBS :: CBS(int i, EngngModel* _master) : FluidModel ( i, _master ),
111  PressureField ( this, 1, FT_Pressure, 1 ),
112  VelocityField ( this, 1, FT_Velocity, 1 ),
113  vnum ( false ), vnumPrescribed ( true ), pnum ( false ), pnumPrescribed ( true )
114 {
115  initFlag = 1;
116  ndomains = 1;
117  consistentMassFlag = 0;
118  equationScalingFlag = false;
119  lscale = uscale = dscale = 1.0;
120 }
121 
123 {
124 }
125 
127 {
128  if ( !nMethod ) {
129  nMethod.reset( classFactory.createSparseLinSolver(solverType, this->giveDomain(1), this) );
130  if ( !nMethod ) {
131  OOFEM_ERROR("linear solver creation failed for lstype %d", solverType);
132  }
133  }
134  return nMethod.get();
135 }
136 
139 {
140  IRResultType result; // Required by IR_GIVE_FIELD macro
141 
142  int val = 0;
144  solverType = ( LinSystSolverType ) val;
145 
146  val = 0;
148  sparseMtrxType = ( SparseMtrxType ) val;
149 
151  minDeltaT = 0.;
153 
155 
156  theta1 = theta2 = 1.0;
159 
160  val = 0;
162  equationScalingFlag = val > 0;
163  if ( equationScalingFlag ) {
167  double vref = 1.0; // reference viscosity
168  Re = dscale * uscale * lscale / vref;
169  } else {
170  lscale = uscale = dscale = 1.0;
171  Re = 1.0;
172  }
173 
174  //<RESTRICTED_SECTION>
175  val = 0;
177  if ( val ) {
178  this->materialInterface.reset( new LEPlic( 1, this->giveDomain(1) ) );
179  // export velocity field
180  FieldManager *fm = this->giveContext()->giveFieldManager();
181  IntArray mask = {V_u, V_v, V_w};
182 
183  //std::shared_ptr<Field> _velocityField = make_shared<MaskedPrimaryField>(FT_Velocity, &this->VelocityField, mask);
184  std :: shared_ptr< Field > _velocityField( new MaskedPrimaryField ( FT_Velocity, &this->VelocityField, mask ) );
185  fm->registerField(_velocityField, FT_Velocity);
186  }
187  //</RESTRICTED_SECTION>
188 
189  return EngngModel :: initializeFrom(ir);
190 }
191 
192 
193 double
195 // returns unknown quantity like displacement, velocity of dof
196 {
197 #ifdef DEBUG
198  if ( dof->__giveEquationNumber() == 0 ) {
199  OOFEM_ERROR("invalid equation number");
200  }
201 
202 #endif
203 
204  if ( dof->giveDofID() == P_f ) { // pressures
205  return PressureField.giveUnknownValue(dof, mode, tStep);
206  } else { // velocities
207  return VelocityField.giveUnknownValue(dof, mode, tStep);
208  }
209 }
210 
211 
212 double
214 {
215  return equationScalingFlag ? this->Re : 1.0;
216 }
217 
218 
219 double CBS :: giveTheta1() { return this->theta1; }
220 
221 double CBS :: giveTheta2() { return this->theta2; }
222 
223 double
225 {
227  int eq = dof->__givePrescribedEquationNumber();
228  if ( eq ) {
229  return prescribedTractionPressure.at(eq);
230  } else {
231  OOFEM_ERROR("prescribed traction pressure requested for dof with no BC");
232  }
233 
234  return 0;
235 }
236 
237 
238 TimeStep *
240 {
241  if ( master && (!force)) {
243  } else {
244  if ( !stepWhenIcApply ) {
246  0.0, deltaT, 0) );
247  }
248 
249  return stepWhenIcApply.get();
250  }
251 }
252 
253 TimeStep *
255 {
256  double dt = deltaT;
257  if ( !currentStep ) {
258  // first step -> generate initial step
260  }
261 
262  previousStep = std :: move(currentStep);
263 
264  Domain *domain = this->giveDomain(1);
265  // check for critical time step
266  for ( auto &elem : domain->giveElements() ) {
267  dt = min( dt, static_cast< CBSElement & >( *elem ).computeCriticalTimeStep(previousStep.get()) );
268  }
269 
270  dt *= 0.6;
271  dt = max(dt, minDeltaT);
272  dt /= this->giveVariableScale(VST_Time);
273 
274  currentStep.reset( new TimeStep(*previousStep, dt) );
275 
276  OOFEM_LOG_INFO( "SolutionStep %d : t = %e, dt = %e\n", currentStep->giveNumber(),
277  currentStep->giveTargetTime() * this->giveVariableScale(VST_Time), dt * this->giveVariableScale(VST_Time) );
278 
279  return currentStep.get();
280 }
281 
282 void
284 {
285  int momneq = this->giveNumberOfDomainEquations(1, vnum);
286  int presneq = this->giveNumberOfDomainEquations(1, pnum);
287  int presneq_prescribed = this->giveNumberOfDomainEquations(1, pnumPrescribed);
288  double deltaT = tStep->giveTimeIncrement();
289 
290  FloatArray rhs(momneq);
291 
292  if ( initFlag ) {
293  deltaAuxVelocity.resize(momneq);
294 
299  pnumPrescribed, this->giveDomain(1) );
300 
301 
303  if ( !lhs ) {
304  OOFEM_ERROR("sparse matrix creation failed");
305  }
306 
307  lhs->buildInternalStructure(this, 1, pnum);
308 
310  pnum, this->giveDomain(1) );
311  lhs->times(deltaT * theta1 * theta2);
312 
313  if ( consistentMassFlag ) {
315  if ( !mss ) {
316  OOFEM_ERROR("sparse matrix creation failed");
317  }
318 
319  mss->buildInternalStructure(this, 1, vnum);
321  vnum, this->giveDomain(1) );
322  } else {
323  mm.resize(momneq);
324  mm.zero();
325  this->assembleVectorFromElements( mm, tStep, LumpedMassVectorAssembler(), VM_Total,
326  vnum, this->giveDomain(1) );
327  }
328 
329  //<RESTRICTED_SECTION>
330  // init material interface
331  if ( materialInterface ) {
332  materialInterface->initialize();
333  }
334 
335  //</RESTRICTED_SECTION>
336  initFlag = 0;
337  }
338  //<RESTRICTED_SECTION>
339  else if ( materialInterface ) {
340  lhs->zero();
342  pnum, this->giveDomain(1) );
343  lhs->times(deltaT * theta1 * theta2);
344 
345  if ( consistentMassFlag ) {
346  mss->zero();
348  vnum, this->giveDomain(1) );
349  } else {
350  mm.zero();
351  this->assembleVectorFromElements( mm, tStep, LumpedMassVectorAssembler(), VM_Total,
352  vnum, this->giveDomain(1) );
353  }
354  }
355 
356  //</RESTRICTED_SECTION>
357 
358  if ( tStep->isTheFirstStep() ) {
360  this->applyIC(stepWhenIcApply);
361  }
362 
365  FloatArray *velocityVector = VelocityField.giveSolutionVector(tStep);
366  FloatArray *prevVelocityVector = VelocityField.giveSolutionVector( tStep->givePreviousStep() );
367  FloatArray *pressureVector = PressureField.giveSolutionVector(tStep);
368  FloatArray *prevPressureVector = PressureField.giveSolutionVector( tStep->givePreviousStep() );
369 
370  velocityVector->resize(momneq);
371  pressureVector->resize(presneq);
372 
373  /* STEP 1 - calculates auxiliary velocities*/
374  rhs.zero();
375  // Depends on old v:
376  this->assembleVectorFromElements( rhs, tStep, IntermediateConvectionDiffusionAssembler(), VM_Total, vnum, this->giveDomain(1) );
377  //this->assembleVectorFromElements(mm, tStep, LumpedMassVectorAssembler(), VM_Total, this->giveDomain(1));
378 
379  if ( consistentMassFlag ) {
380  rhs.times(deltaT);
381  // Depends on prescribed v
382  this->assembleVectorFromElements( rhs, tStep, PrescribedVelocityRhsAssembler(), VM_Total, vnum, this->giveDomain(1) );
383  nMethod->solve(*mss, rhs, deltaAuxVelocity);
384  } else {
385  for ( int i = 1; i <= momneq; i++ ) {
386  deltaAuxVelocity.at(i) = deltaT * rhs.at(i) / mm.at(i);
387  }
388  }
389 
390  /* STEP 2 - calculates pressure (implicit solver) */
391  this->prescribedTractionPressure.resize(presneq_prescribed);
395  pnumPrescribed, this->giveDomain(1) );
396  for ( int i = 1; i <= presneq_prescribed; i++ ) {
398  }
399 
400  // DensityRhsVelocityTerms needs this: Current velocity without correction;
401  * velocityVector = * prevVelocityVector;
402  velocityVector->add(this->theta1, deltaAuxVelocity);
403 
404  // Depends on old V + deltaAuxV * theta1 and p:
405  rhs.resize(presneq);
406  rhs.zero();
407  this->assembleVectorFromElements( rhs, tStep, DensityRhsAssembler(), VM_Total,
408  pnum, this->giveDomain(1) );
409  this->giveNumericalMethod( this->giveCurrentMetaStep() );
410  nMethod->solve(*lhs, rhs, *pressureVector);
411  pressureVector->times(this->theta2);
412  pressureVector->add(* prevPressureVector);
413 
414  /* STEP 3 - velocity correction step */
415  rhs.resize(momneq);
416  rhs.zero();
417  // Depends on p:
418  this->assembleVectorFromElements( rhs, tStep, CorrectionRhsAssembler(), VM_Total,
419  vnum, this->giveDomain(1) );
420  if ( consistentMassFlag ) {
421  rhs.times(deltaT);
422  //this->assembleVectorFromElements(rhs, tStep, PrescribedRhsAssembler(), VM_Incremental, vnum, this->giveDomain(1));
423  nMethod->solve(*mss, rhs, *velocityVector);
424  velocityVector->add(deltaAuxVelocity);
425  velocityVector->add(* prevVelocityVector);
426  } else {
427  for ( int i = 1; i <= momneq; i++ ) {
428  velocityVector->at(i) = prevVelocityVector->at(i) + deltaAuxVelocity.at(i) + deltaT *rhs.at(i) / mm.at(i);
429  }
430  }
431 
432  // update solution state counter
433  tStep->incrementStateCounter();
434 
435  //<RESTRICTED_SECTION>
436  if ( materialInterface ) {
437 #ifdef TIME_REPORT
438  Timer timer;
439  timer.startTimer();
440 #endif
441  materialInterface->updatePosition( this->giveCurrentStep() );
442 #ifdef TIME_REPORT
443  timer.stopTimer();
444  OOFEM_LOG_INFO( "CBS info: user time consumed by updating interfaces: %.2fs\n", timer.getUtime() );
445 #endif
446  }
447 
448  //</RESTRICTED_SECTION>
449 }
450 
451 
452 void
454 {
455  this->updateInternalState(tStep);
457  //<RESTRICTED_SECTION>
458  if ( materialInterface ) {
459  materialInterface->updateYourself(tStep);
460  }
461 
462  //</RESTRICTED_SECTION>
463  //previousSolutionVector = solutionVector;
464 }
465 
466 
467 void
469 {
470  for ( auto &domain: domainList ) {
472  for ( auto &dman : domain->giveDofManagers() ) {
473  this->updateDofUnknownsDictionary(dman.get(), tStep);
474  }
475  }
476 
477  for ( auto &elem : domain->giveElements() ) {
478  elem->updateInternalState(tStep);
479  }
480  }
481 }
482 
483 
486 {
487  contextIOResultType iores;
488 
489  if ( ( iores = EngngModel :: saveContext(stream, mode) ) != CIO_OK ) {
490  THROW_CIOERR(iores);
491  }
492 
493  if ( ( iores = PressureField.saveContext(stream, mode) ) != CIO_OK ) {
494  THROW_CIOERR(iores);
495  }
496 
497  if ( ( iores = VelocityField.saveContext(stream, mode) ) != CIO_OK ) {
498  THROW_CIOERR(iores);
499  }
500 
501  if ( ( iores = prescribedTractionPressure.storeYourself(stream) ) != CIO_OK ) {
502  THROW_CIOERR(iores);
503  }
504 
505  return CIO_OK;
506 }
507 
508 
511 {
512  contextIOResultType iores;
513 
514  if ( ( iores = EngngModel :: restoreContext(stream, mode) ) != CIO_OK ) {
515  THROW_CIOERR(iores);
516  }
517 
518  if ( ( iores = PressureField.restoreContext(stream, mode) ) != CIO_OK ) {
519  THROW_CIOERR(iores);
520  }
521 
522  if ( ( iores = VelocityField.restoreContext(stream, mode) ) != CIO_OK ) {
523  THROW_CIOERR(iores);
524  }
525 
526  if ( ( iores = prescribedTractionPressure.restoreYourself(stream) ) != CIO_OK ) {
527  THROW_CIOERR(iores);
528  }
529 
530  return CIO_OK;
531 }
532 
533 
534 int
536 {
537  // check internal consistency
538  // if success returns nonzero
539  Domain *domain = this->giveDomain(1);
540 
541  // check for proper element type
542  for ( auto &elem : domain->giveElements() ) {
543  if ( !dynamic_cast< CBSElement * >( elem.get() ) ) {
544  OOFEM_WARNING("Element %d has no CBS base", elem->giveLabel());
545  return 0;
546  }
547  }
548 
550 
551 
552  // scale boundary and initial conditions
553  if ( equationScalingFlag ) {
554  for ( auto &bc: domain->giveBcs() ) {
555  if ( bc->giveBCValType() == VelocityBVT ) {
556  bc->scale(1. / uscale);
557  } else if ( bc->giveBCValType() == PressureBVT ) {
558  bc->scale( 1. / this->giveVariableScale(VST_Pressure) );
559  } else if ( bc->giveBCValType() == ForceLoadBVT ) {
560  bc->scale( 1. / this->giveVariableScale(VST_Force) );
561  } else {
562  OOFEM_WARNING("unknown bc/ic type");
563  return 0;
564  }
565  }
566 
567  for ( auto &ic : domain->giveIcs() ) {
568  if ( ic->giveICValType() == VelocityBVT ) {
569  ic->scale(VM_Total, 1. / uscale);
570  } else if ( ic->giveICValType() == PressureBVT ) {
571  ic->scale( VM_Total, 1. / this->giveVariableScale(VST_Pressure) );
572  } else {
573  OOFEM_WARNING("unknown bc/ic type");
574  return 0;
575  }
576  }
577  }
578 
579  return 1;
580 }
581 
582 
583 void
585 {
587  this->giveNumericalMethod( this->giveCurrentMetaStep() )->setDomain( this->giveDomain(1) );
588 }
589 
590 
591 void
592 CBS :: printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *tStep)
593 {
594  double pscale = ( dscale * uscale * uscale );
595 
596  DofIDItem type = iDof->giveDofID();
597  if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) {
598  iDof->printSingleOutputAt(stream, tStep, 'd', VM_Total, uscale);
599  } else if ( type == P_f ) {
600  iDof->printSingleOutputAt(stream, tStep, 'd', VM_Total, pscale);
601  } else {
602  OOFEM_ERROR("unsupported dof type");
603  }
604 }
605 
606 
607 void
609 {
610  Domain *domain = this->giveDomain(1);
611  int mbneq = this->giveNumberOfDomainEquations(1, vnum);
612  int pdneq = this->giveNumberOfDomainEquations(1, pnum);
613  FloatArray *velocityVector, *pressureVector;
614 
615 #ifdef VERBOSE
616  OOFEM_LOG_INFO("Applying initial conditions\n");
617 #endif
618 
619  VelocityField.advanceSolution(stepWhenIcApply);
620  velocityVector = VelocityField.giveSolutionVector(stepWhenIcApply);
621  velocityVector->resize(mbneq);
622  velocityVector->zero();
623 
624  PressureField.advanceSolution(stepWhenIcApply);
625  pressureVector = PressureField.giveSolutionVector(stepWhenIcApply);
626  pressureVector->resize(pdneq);
627  pressureVector->zero();
628 
629  for ( auto &node : domain->giveDofManagers() ) {
630  for ( Dof *iDof: *node ) {
631  // ask for initial values obtained from
632  // bc (boundary conditions) and ic (initial conditions)
633  if ( !iDof->isPrimaryDof() ) {
634  continue;
635  }
636 
637  int jj = iDof->__giveEquationNumber();
638  if ( jj ) {
639  DofIDItem type = iDof->giveDofID();
640  if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) {
641  velocityVector->at(jj) = iDof->giveUnknown(VM_Total, stepWhenIcApply);
642  } else {
643  pressureVector->at(jj) = iDof->giveUnknown(VM_Total, stepWhenIcApply);
644  }
645  }
646  }
647  }
648 
649  // update element state according to given ic
650  for ( auto &elem : domain->giveElements() ) {
651  CBSElement *element = static_cast< CBSElement * >( elem.get() );
652  element->updateInternalState(stepWhenIcApply);
653  element->updateYourself(stepWhenIcApply);
654  }
655 }
656 
657 
658 int
660 {
661  if ( ( id == V_u ) || ( id == V_v ) || ( id == V_w ) ) {
662  return this->vnum.askNewEquationNumber();
663  } else if ( id == P_f ) {
664  return this->pnum.askNewEquationNumber();
665  } else {
666  OOFEM_ERROR("Unknown DofIDItem");
667  }
668 
669  return 0;
670 }
671 
672 
673 int
675 {
676  if ( ( id == V_u ) || ( id == V_v ) || ( id == V_w ) ) {
677  return this->vnumPrescribed.askNewEquationNumber();
678  } else if ( id == P_f ) {
679  return this->pnumPrescribed.askNewEquationNumber();
680  } else {
681  OOFEM_ERROR("Unknown DofIDItem");
682  }
683 
684  return 0;
685 }
686 
687 
689 {
691  this->forceEquationNumbering();
692  }
693 
695 }
696 
697 
699 {
700  if ( varID == VST_Length ) {
701  return this->lscale;
702  } else if ( varID == VST_Velocity ) {
703  return this->uscale;
704  } else if ( varID == VST_Density ) {
705  return this->dscale;
706  } else if ( varID == VST_Time ) {
707  return ( lscale / uscale );
708  } else if ( varID == VST_Pressure ) {
709  return ( dscale * uscale * uscale );
710  } else if ( varID == VST_Force ) {
711  return ( uscale * uscale / lscale );
712  } else if ( varID == VST_Viscosity ) {
713  return 1.0;
714  } else {
715  OOFEM_ERROR("unknown variable type");
716  }
717 
718  return 0.0;
719 }
720 
721 #if 0
722 void CBS :: printOutputAt(FILE *file, TimeStep *tStep)
723 {
724  int domCount = 0;
725  // fprintf (File,"\nOutput for time step number %d \n\n",tStep->giveNumber());
726  for ( auto &domain: this->domainList ) {
727  domCount += domain->giveOutputManager()->testTimeStepOutput(tStep);
728  }
729 
730  if ( domCount == 0 ) {
731  return; // do not print even Solution step header
732  }
733 
734  fprintf( File, "\nOutput for time % .8e \n\n", tStep->giveTime() / this->giveVariableScale(VST_Time) );
735  for ( auto &domain: this->domainList ) {
736  fprintf(file, "\nOutput for domain %3d\n", domain->giveNumber() );
737  domain->giveOutputManager()->doDofManOutput(file, tStep);
738  domain->giveOutputManager()->doElementOutput(file, tStep);
739  }
740 }
741 #endif
742 } // end namespace oofem
EngngModelTimer timer
E-model timer.
Definition: engngm.h:267
virtual FloatArray * giveSolutionVector(TimeStep *tStep)
Definition: primaryfield.C:443
LinSystSolverType
The values of this type should be related not to specific solvers, but more to specific packages that...
FloatArray prescribedTractionPressure
Definition: cbs.h:186
#define _IFT_CBS_scaleflag
Definition: cbs.h:56
virtual int giveNumberOfDomainEquations(int, const UnknownNumberingScheme &num)
Returns number of equations for given domain in active (current time step) time step.
Definition: cbs.C:688
#define _IFT_CBS_deltat
Definition: cbs.h:51
std::unique_ptr< TimeStep > currentStep
Current time step.
Definition: engngm.h:231
VelocityEquationNumbering vnum
Definition: cbs.h:203
virtual void advanceSolution(TimeStep *tStep)
Brings up a new solution vector for given time step.
Definition: primaryfield.C:483
Class and object Domain.
Definition: domain.h:115
virtual int giveNewPrescribedEquationNumber(int domain, DofIDItem)
Increases number of prescribed equations of receiver&#39;s domain and returns newly created equation numb...
Definition: cbs.C:674
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:87
Abstract class representing subset of DOFs (identified by DofId mask) of primary field.
void applyIC(TimeStep *tStep)
Definition: cbs.C:608
double theta2
Definition: cbs.h:197
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
Definition: engngm.C:262
std::unique_ptr< MaterialInterface > materialInterface
Definition: cbs.h:220
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
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:80
virtual void printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *tStep)
DOF printing routine.
Definition: cbs.C:592
VelocityEquationNumbering vnumPrescribed
Definition: cbs.h:204
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
contextIOResultType storeYourself(DataStream &stream) const
Definition: floatarray.C:872
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
int max(int i, int j)
Returns bigger value form two given decimals.
Definition: mathfem.h:71
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
virtual int requiresUnknownsDictionaryUpdate()
Indicates if EngngModel requires Dofs dictionaries to be updated.
Definition: engngm.h:845
PrimaryField VelocityField
Velocity field.
Definition: cbs.h:184
VarScaleType
Type determining the scale corresponding to particular variable.
Definition: varscaletype.h:40
Base class for fluid problems.
Definition: fluidmodel.h:46
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
#define _IFT_CBS_theta2
Definition: cbs.h:55
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: element.C:779
PressureEquationNumbering pnumPrescribed
Definition: cbs.h:206
double dscale
Density scale.
Definition: cbs.h:214
void incrementStateCounter()
Updates solution state counter.
Definition: timestep.h:190
Abstract base class for all finite elements.
Definition: element.h:145
virtual int checkConsistency()
Allows programmer to test some receiver&#39;s internal data, before computation begins.
Definition: cbs.C:535
std::vector< std::unique_ptr< DofManager > > & giveDofManagers()
Definition: domain.h:400
Implementation for assembling the consistent mass matrix.
virtual int __giveEquationNumber() const =0
Returns equation number of receiver, usually assigned by emodel.
virtual int giveNewEquationNumber(int domain, DofIDItem)
Increases number of equations of receiver&#39;s domain and returns newly created equation number...
Definition: cbs.C:659
double Re
Reynolds number.
Definition: cbs.h:216
FieldManager * giveFieldManager()
Definition: engngm.h:131
REGISTER_EngngModel(ProblemSequence)
Class implementing an array of integers.
Definition: intarray.h:61
#define _IFT_CBS_lscale
Definition: cbs.h:57
virtual int __givePrescribedEquationNumber()=0
Returns prescribed equation number of receiver.
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
#define _IFT_CBS_theta1
Definition: cbs.h:54
virtual TimeStep * giveSolutionStepWhenIcApply(bool force=false)
Returns the solution step when Initial Conditions (IC) apply.
Definition: cbs.C:239
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: cbs.C:65
std::unique_ptr< SparseMtrx > lhs
Definition: cbs.h:180
double uscale
Velocity scale.
Definition: cbs.h:212
double giveTimeIncrement()
Returns solution step associated time increment.
Definition: timestep.h:150
bool isTheFirstStep()
Check if receiver is first step.
Definition: timestep.C:134
#define _IFT_CBS_miflag
Definition: cbs.h:60
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:94
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
MetaStep * giveCurrentMetaStep()
Returns current meta step.
Definition: engngm.C:1684
std::vector< std::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
Definition: domain.h:322
FloatArray deltaAuxVelocity
Definition: cbs.h:185
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores receiver state to output stream.
Definition: primaryfield.C:507
virtual double giveVariableScale(VarScaleType varId)
Returns the scale factor for given variable type.
Definition: cbs.C:698
#define OOFEM_LOG_INFO(...)
Definition: logger.h:127
virtual double giveUnknownComponent(ValueModeType type, TimeStep *tStep, Domain *d, Dof *dof)
Returns requested unknown.
Definition: cbs.C:194
FloatArray nodalPrescribedTractionPressureConnectivity
Definition: cbs.h:187
#define _IFT_EngngModel_smtype
Definition: engngm.h:82
#define _IFT_CBS_dscale
Definition: cbs.h:59
double deltaT
Time step and its minimal value.
Definition: cbs.h:195
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the receiver state previously written in stream.
Definition: primaryfield.C:541
#define OOFEM_ERROR(...)
Definition: error.h:61
EngngModelContext * giveContext()
Context requesting service.
Definition: engngm.h:1078
int ndomains
Number of receiver domains.
Definition: engngm.h:205
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
virtual void solveYourselfAt(TimeStep *tStep)
Solves problem for given time step.
Definition: cbs.C:283
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: cbs.C:84
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
CBS(int i, EngngModel *_master=NULL)
Definition: cbs.C:110
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
virtual TimeStep * giveNextStep()
Returns next time step (next to current step) of receiver.
Definition: cbs.C:254
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: cbs.C:79
contextIOResultType restoreYourself(DataStream &stream)
Definition: floatarray.C:895
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
std::vector< std::unique_ptr< InitialCondition > > & giveIcs()
Definition: domain.h:329
EngngModel * master
Master e-model; if defined receiver is in maintained (slave) mode.
Definition: engngm.h:262
virtual int forceEquationNumbering()
Forces equation renumbering on all domains associated to engng model.
Definition: fluidmodel.h:52
virtual void locationFromElement(IntArray &loc, Element &element, const UnknownNumberingScheme &s, IntArray *dofIds=nullptr) const
Definition: cbs.C:103
std::unique_ptr< SparseMtrx > mss
Sparse consistent mass.
Definition: cbs.h:192
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
Definition: timestep.C:114
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
Definition: cbs.C:138
double giveTheta1()
Definition: cbs.C:219
double giveTractionPressure(Dof *dof)
Definition: cbs.C:224
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores the state of model to output stream.
Definition: engngm.C:1527
bool equationScalingFlag
Definition: cbs.h:208
Abstract base class representing Lagrangian-Eulerian (moving) material interfaces.
Definition: leplic.h:153
Initializes the variable VERBOSE, in order to get a few intermediate messages on screen: beginning an...
void registerField(FieldPtr eField, FieldType key)
Registers the given field (the receiver is not assumed to own given field).
Definition: fieldmanager.C:42
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
Callback class for assembling CBS pressure matrices.
Definition: cbs.h:108
#define _IFT_CBS_mindeltat
Definition: cbs.h:52
virtual int checkConsistency()
Allows programmer to test some receiver&#39;s internal data, before computation begins.
Definition: engngm.h:995
PressureEquationNumbering pnum
Definition: cbs.h:205
void updateInternalState(TimeStep *tStep)
Updates nodal values (calls also this->updateDofUnknownsDictionary for updating dofs unknowns diction...
Definition: cbs.C:468
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:73
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
virtual NumericalMethod * giveNumericalMethod(MetaStep *mStep)
Returns reference to receiver&#39;s numerical method.
Definition: cbs.C:126
#define _IFT_EngngModel_lstype
Definition: engngm.h:81
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual void updateInternalState(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: cbselement.C:153
virtual int giveRequiredNumberOfDomainEquation() const
Returns required number of domain equation.
std::unique_ptr< SparseLinearSystemNM > nMethod
Numerical method used to solve the problem.
Definition: cbs.h:175
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the state of model from output stream.
Definition: cbs.C:510
double lscale
Length scale.
Definition: cbs.h:210
Implementation for assembling lumped mass matrix (diagonal components) in vector form.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode)
Stores the state of model to output stream.
Definition: cbs.C:485
virtual void updateDofUnknownsDictionary(DofManager *, TimeStep *)
Updates necessary values in Dofs unknown dictionaries.
Definition: engngm.h:859
double theta1
Integration constants.
Definition: cbs.h:197
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 void updateYourself(TimeStep *tStep)
Updates internal state after finishing time step.
Definition: cbs.C:453
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: cbs.C:92
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: cbs.C:60
LinSystSolverType solverType
Definition: cbs.h:177
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
Class implementing single timer, providing wall clock and user time capabilities. ...
Definition: timer.h:46
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Prints output of receiver to output domain stream, for given time step.
Definition: engngm.C:695
This abstract class represent a general base element class for fluid dynamic problems solved using CB...
Definition: cbselement.h:56
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:101
ClassFactory & classFactory
Definition: classfactory.C:59
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Definition: cbs.h:66
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
virtual void updateDomainLinks()
Updates domain links after the domains of receiver have changed.
Definition: cbs.C:584
virtual TimeStep * giveSolutionStepWhenIcApply(bool force=false)
Returns the solution step when Initial Conditions (IC) apply.
Definition: engngm.h:720
int min(int i, int j)
Returns smaller value from two given decimals.
Definition: mathfem.h:59
std::vector< std::unique_ptr< Element > > & giveElements()
Definition: domain.h:279
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
virtual void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const
Definition: cbs.C:73
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
virtual TimeStep * giveCurrentStep(bool force=false)
Returns current time step.
Definition: engngm.h:683
FloatArray mm
Lumped mass matrix.
Definition: cbs.h:190
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
the oofem namespace is to define a context or scope in which all oofem names are defined.
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 ~CBS()
Definition: cbs.C:122
double minDeltaT
Definition: cbs.h:195
void startTimer()
Definition: timer.C:69
double getUtime()
Returns total user time elapsed in seconds.
Definition: timer.C:105
#define _IFT_CBS_uscale
Definition: cbs.h:58
#define OOFEM_WARNING(...)
Definition: error.h:62
int consistentMassFlag
Consistent mass flag.
Definition: cbs.h:201
PrimaryField PressureField
Pressure field.
Definition: cbs.h:182
Class representing solution step.
Definition: timestep.h:80
virtual double giveUnknownValue(Dof *dof, ValueModeType mode, TimeStep *tStep)
Definition: primaryfield.C:319
int initFlag
Definition: cbs.h:199
void stopTimer()
Definition: timer.C:77
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual void printSingleOutputAt(FILE *file, TimeStep *tStep, char ch, ValueModeType mode, double scale=1.0)
Prints Dof output (it prints value of unknown related to dof at given timeStep).
Definition: dof.C:76
virtual double giveReynoldsNumber()
Definition: cbs.C:213
#define _IFT_CBS_cmflag
Definition: cbs.h:53
virtual void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const
Definition: cbs.C:98
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
int equationNumberingCompleted
Equation numbering completed flag.
Definition: engngm.h:223
double giveTheta2()
Definition: cbs.C:221
SparseMtrxType sparseMtrxType
Definition: cbs.h:178

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