OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
micromaterial.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 "micromaterial.h"
36 #include "../sm/Materials/structuralmaterial.h"
37 #include "../sm/Materials/structuralms.h"
38 #include "domain.h"
39 #include "dofmanager.h"
40 #include "classfactory.h"
41 #include "oofemtxtdatareader.h"
42 #include "util.h"
43 #include "classfactory.h"
44 #include "node.h"
45 #include "engngm.h"
46 
47 namespace oofem {
48 //valgrind --leak-check=full --show-reachable=no -v --log-file=valgr.txt ./oofem -f Macrolspace_1.in
49 
50 // FloatArray A;
51 // FloatMatrix K, B;
52 // stiffnessMatrix->toFloatMatrix(K);
53 // K.symmetrized();
54 // K.printYourself();
55 // displacementVector.printYourself();
56 // A.beProductOf(K, displacementVector);
57 // A.printYourself();
58 //
59 // B.beInverseOf(K);
60 // A.beProductOf(B, displacementVector);
61 // A.printYourself();
62 
63 REGISTER_Material(MicroMaterial);
64 
65 // constructor
66 //strainVector, tempStrainVector, stressVector, tempStressVector are defined on StructuralMaterialStatus
68 
70 
72 {
74 }
75 
77 {
79 }
80 
82 { }
83 
85 {
86  return CIO_OK;
87 }
88 
90 {
91  return CIO_OK;
92 }
93 
94 
96 {
97  this->problemMicro = NULL;
98  this->isDefaultNumbering = true;
100  this->microBoundaryDofs = NULL;
101  this->microInternalDofs = NULL;
102  this->microDefaultDofs = NULL;
103  this->microBoundaryDofsArr.clear();
104  this->microInternalDofsArr.clear();
105  this->microMatIsUsed = false;
106 }
107 
109 {
110  if ( this->problemMicro ) {
111  delete this->problemMicro;
112  }
113 
114  for ( int i = 0; i < this->NumberOfDofManagers; i++ ) {
115  if ( this->microBoundaryDofs ) {
116  delete [] microBoundaryDofs [ i ];
117  }
118 
119  if ( this->microInternalDofs ) {
120  delete [] microInternalDofs [ i ];
121  }
122 
123  if ( this->microDefaultDofs ) {
124  delete [] microDefaultDofs [ i ];
125  }
126  }
127 
128  if ( this->microBoundaryDofs ) {
129  delete [] microBoundaryDofs;
130  }
131 
132  if ( this->microInternalDofs ) {
133  delete [] microInternalDofs;
134  }
135 
136  if ( this->microDefaultDofs ) {
137  delete [] microDefaultDofs;
138  }
139 }
140 
142 {
143  IRResultType result; // Required by IR_GIVE_FIELD macro
144 
145 
147 
148  OOFEM_LOG_INFO( "** Instanciating microproblem with BC from file %s\n", inputFileNameMicro.c_str() );
149  OOFEMTXTDataReader drMicro( inputFileNameMicro.c_str() );
150  this->problemMicro = InstanciateProblem(drMicro, _processor, 0); //0=contextFlag-store/resore
151  drMicro.finish();
152  OOFEM_LOG_INFO("** Microproblem %p instanciated\n\n", problemMicro);
153 
154  return IRRT_OK;
155 }
156 
157 
158 
159 
160 //original pure virtual function has to be declared here
161 //this function should not be used, internal forces are calculated based on reactions not stresses in GPs
163 {
164  //perform average over microproblem
165  // int index;
166  // double dV, VolTot = 0.;
167  // double scale = 1.;
168  // FloatArray VecStrain, VecStress, SumStrain(6), SumStress(6);
169  // GaussPoint *gpL;
170  // Domain *microDomain = problemMicro->giveDomain(1); //from engngm.h
171  // EngngModel *microEngngModel = microDomain->giveEngngModel();
172  // StructuralMaterialStatus *status = static_cast< StructuralMaterialStatus * >( this->giveStatus(gp) );
173 
174  OOFEM_ERROR("Should not be called, use giveInternalForcesVector instead");
175 
176  // int nelem = microDomain->giveNumberOfElements();
177  // //int nnodes = microDomain->giveNumberOfDofManagers();
178  //
179  // //need to update stress so change boundary conditions and recalculate
180  // OOFEM_LOG_INFO( "\n*** giveRealStress microproblem %p on macroElement %d GP %d, step %d, time %f\n", this, this->macroLSpaceElement->giveNumber(), gp->giveNumber(), microEngngModel->giveCurrentStep()->giveNumber(), microEngngModel->giveCurrentStep()->giveTime() );
181  //
182  // this->macroLSpaceElement->changeMicroBoundaryConditions(tStep);
183  // microEngngModel->solveYourselfAt( microEngngModel->giveCurrentStep() );
184  // microEngngModel->terminate( microEngngModel->giveCurrentStep() );
185  // OOFEM_LOG_INFO("\n*** giveRealStress microproblem %p done\n", this);
186  //
187  // for ( int ielem = 1; ielem <= nelem; ielem++ ) { //return stress as average through all elements of the same MicroMaterial
188  // Element *elem = microDomain->giveElement(ielem);
189  // for ( GaussPoint *gpL: *elem->giveDefaultIntegrationRulePtr() ) {
190  // dV = elem->computeVolumeAround(gpL);
191  // VolTot += dV;
192  // //OOFEM_LOG_INFO("Element %d GP %d Vol %f\n", elem->giveNumber(), gp->giveNumber(), dV);
193  // //fprintf(this->stream, "Element %d GP %d stress %f\n", elem->giveNumber(), gp->giveNumber(), 0.0);
194  // //((StructuralCrossSection*) gp->giveCrossSection())->giveFullCharacteristicVector(helpVec, gp, strainVector);
195  // elem->giveIPValue(VecStrain, gpL, IST_StrainTensor, tStep);
196  // elem->giveIPValue(VecStress, gpL, IST_StressTensor, tStep);
197  // elem->giveIntVarCompFullIndx(Mask, IST_StrainTensor);
198  //
199  // VecStrain.times(dV);
200  // VecStress.times(dV);
201  //
202  // for ( int j = 1; j <= 6; j++ ) {
203  // SumStrain.at(j) += VecStrain.at(j);
204  // SumStress.at(j) += VecStress.at(j);
205  // }
206  //
207  // //VecStrain.printYourself();
208  // //SumStrain.printYourself();
209  // }
210  // }
211  //
212  // //average
213  // SumStrain.times(1. / VolTot * scale);
214  // SumStress.times(1. / VolTot * scale);
215  // //SumStrain.printYourself();
216  // //SumStress.printYourself();
217  // answer.resize(6);
218  // answer = SumStress;
219  // //answer.printYourself();
220 
221  // update gp
222  // status->letTempStrainVectorBe(totalStrain);
223  // status->letTempStressVectorBe(answer);
224 }
225 
228 {
230  return status;
231 }
232 
233 
234 //answer must be of size 24x24 (linear brick 3*8=24)
235 void MicroMaterial :: giveMacroStiffnessMatrix(FloatMatrix &answer, TimeStep *tStep, MatResponseMode rMode, const IntArray &microMasterNodes, const IntArray &microBoundaryNodes)
236 {
237  int row, col;
238  double tmpDouble;
239  Domain *microDomain = this->problemMicro->giveDomain(1);
240  EngngModel *microEngngModel = microDomain->giveEngngModel();
241  DofManager *DofMan;
242  Dof *dof;
243 
244  FloatMatrix Kbb; //contains reduced problem with boundary nodes and without interior nodes
245  FloatMatrix *Kbi = NULL; //can be zero size if no internal DOFs
246  FloatMatrix *Kii1KbiT = NULL; //can be zero size if no internal DOFs
247  FloatMatrix *Kbb_1 = NULL; //help matrix
248 
249  FloatMatrix slaveMasterOnBoundary; //transformation matrix representing displacements on boundary tied to master nodes
250 
251  SparseMtrxType sparseMtrxType = ( SparseMtrxType ) 0; //SMT_Skyline symmetric skyline
252  SparseMtrx *stiffnessMatrixMicro = NULL; //full stiffness matrix without any constraint
253  SparseMtrx *Kii = NULL; //submatrix of internal DOFs
254 
256  Kbb.zero();
257 
258  this->isDefaultNumbering = false; //total number of equations can be now set arbitrarily
260 
261  //assemble sparse matrix K_ii of DOFS of internal nodes to be condensed out
262  //K_ii is generally large, inversion of FloatMatrix consumes a lot of time and memory, sparse matrix is used
264  printf( "Internal DOFs %d\n", this->giveRequiredNumberOfDomainEquation() );
266  if ( totalInternalDofs ) {
268  Kbi->zero();
270  Kii1KbiT->zero();
271  Kii = classFactory.createSparseMtrx(sparseMtrxType);
272  Kii->buildInternalStructure(microEngngModel, 1, * this);
273  Kii->zero();
274  microEngngModel->assemble(*Kii, tStep, TangentAssembler(rMode), * this, microDomain);
275  }
276 
277 
278 
279  //build a full stiffness matrix for the extraction of submatrices
282 
283  stiffnessMatrixMicro = classFactory.createSparseMtrx(sparseMtrxType);
284  stiffnessMatrixMicro->zero();
285  stiffnessMatrixMicro->buildInternalStructure(microEngngModel, 1, * this);
286  stiffnessMatrixMicro->zero();
287  microEngngModel->assemble(*stiffnessMatrixMicro, tStep, TangentAssembler(rMode), * this, microDomain);
288 
289 
290  for ( int i = 1; i <= totalBoundaryDofs; i++ ) {
291  for ( int j = 1; j <= totalBoundaryDofs; j++ ) { //Kbb
292  row = microBoundaryDofsArr.at(i);
293  col = microBoundaryDofsArr.at(j);
294  if ( stiffnessMatrixMicro->isAllocatedAt(row, col) ) {
295  //printf("%d %d ", row, col);
296  Kbb.at(i, j) = stiffnessMatrixMicro->at(row, col);
297  }
298  }
299 
300  for ( int j = 1; j <= totalInternalDofs; j++ ) { //Kbi
301  row = microBoundaryDofsArr.at(i);
302  col = microInternalDofsArr.at(j);
303  if ( stiffnessMatrixMicro->isAllocatedAt(row, col) ) {
304  Kbi->at(i, j) = stiffnessMatrixMicro->at(row, col);
305  }
306  }
307  }
308 
309  //Kbi.printYourself();
310 
311  if ( totalInternalDofs ) {
312  FloatArray xVector( Kii->giveNumberOfColumns() );
313  //Kii->printYourself();
314  Kii->factorized();
315 
316  for ( int i = 1; i <= totalInternalDofs; i++ ) {
317  xVector.zero();
318  xVector.at(i) = 1.;
319  Kii->backSubstitutionWith(xVector);
320  //xVector.printYourself();
321  for ( int b = 1; b <= totalBoundaryDofs; b++ ) { //do not store Kii^-1, it is a dense matrix, compute multiplication directly
322  tmpDouble = 0.;
323  for ( int j = 1; j <= totalInternalDofs; j++ ) {
324  tmpDouble += xVector.at(j) * Kbi->at(b, j);
325  }
326 
327  Kii1KbiT->at(i, b) = tmpDouble;
328  }
329 
330  //OOFEM_LOG_INFO("%d ", i);
331  }
332 
333  OOFEM_LOG_INFO("\n");
334 
335  Kbb_1 = new FloatMatrix();
336  Kbb_1->beProductOf( ( FloatMatrix const & ) * Kbi, ( FloatMatrix const & ) * Kii1KbiT );
337  for ( int i = 1; i <= totalBoundaryDofs; i++ ) {
338  for ( int j = 1; j <= totalBoundaryDofs; j++ ) {
339  Kbb.at(i, j) -= Kbb_1->at(i, j);
340  }
341  }
342  }
343 
344  if ( Kbi ) {
345  delete Kbi;
346  }
347 
348  if ( Kii1KbiT ) {
349  delete Kii1KbiT;
350  }
351 
352  if ( Kbb_1 ) {
353  delete Kbb_1;
354  }
355 
356  //Kbb_1->printYourself();
357  //OOFEM_ERROR("Stop");
358  this->isDefaultNumbering = true; //switch back to default numbering
360 
361  if ( Kii ) {
362  delete Kii;
363  }
364 
365  if ( stiffnessMatrixMicro ) {
366  delete stiffnessMatrixMicro;
367  }
368 
369  // IntArray interiorDofNode; //equation numbers to be condensed out, sorted
370  // IntArray boundaryDofNode;//equation numbers in rows (or columns) of stiffness matrix without interior nodes, sorted
371  // interiorDofNode.clear();
372  // boundaryDofNode.clear();
373  // for ( i = 1; i <= microDomain->giveNumberOfDofManagers(); i++){
374  // DofMan = microDomain->giveDofManager(i);
375  // for ( Dof *dof: *DofMan ){
376  // eqNumber = giveDofEquationNumber(dof);
377  // if(microBoundaryNodes.contains( DofMan->giveGlobalNumber())){
378  // boundaryDofNode.followedBy(eqNumber);
379  // }
380  // else {
381  // interiorDofNode.followedBy(eqNumber);
382  // }
383  // }
384  // }
385  // //Tmp.beInverseOf(stiffnessMatrixMicroFloat);
386  // /*Perform static condensation of internal nodes, leave microBoundaryNodes which also contains microMasterNodes
387  // algorithm based on structuralelement.C, Rayleigh-Ritz method
388  // zeroes on particular rows and columns will appear in the FloatMatrix
389  // */
390  // int ii, k;
391  // int size = stiffnessMatrixMicroFloat.giveNumberOfRows();
392  // int ndofs = maxNumberOfDomainEquation;
393  // long double coeff, dii;
394  //
395  // for ( i = 1; i <= interiorDofNode.giveSize(); i++ ) {//how many DOFs will be condensed out
396  // ii = interiorDofNode.at(i);
397  // if ( ( ii > ndofs ) || ( ii <= 0 ) ) {
398  // OOFEM_ERROR("wrong DOF number");
399  // }
400  //
401  // dii = stiffnessMatrixMicroFloat.at(ii, ii);
402  //
403  // for ( j = 1; j <= size; j++ ) {
404  // coeff = -stiffnessMatrixMicroFloat.at(j, ii) / dii;
405  // if ( ii != j ) {
406  // for ( k = 1; k <= size; k++ ) {
407  // stiffnessMatrixMicroFloat.at(j, k) += stiffnessMatrixMicroFloat.at(ii, k) * coeff;
408  // }
409  // }
410  // }
411  //
412  // for ( k = 1; k <= size; k++ ) {
413  // stiffnessMatrixMicroFloat.at(ii, k) = 0.;
414  // stiffnessMatrixMicroFloat.at(k, ii) = 0.;
415  // }
416  // }
417  // //stiffnessMatrixMicroFloat.printYourself();
418  //
419  // //copy non-zeroed rows and columns to reduced stiffness matrix
420  // stiffnessMatrixMicroReducedFloat.resize(boundaryDofNode.giveSize(), boundaryDofNode.giveSize());
421  // stiffnessMatrixMicroReducedFloat.zero();
422  // for ( i = 1; i <= boundaryDofNode.giveSize(); i++ ) {
423  // for ( j = 1; j <= boundaryDofNode.giveSize(); j++ ) {
424  // stiffnessMatrixMicroReducedFloat.at(i,j) = stiffnessMatrixMicroFloat.at( boundaryDofNode.at(i), boundaryDofNode.at(j) );
425  // }
426  // }
427  //stiffnessMatrixMicroReducedFloat.printYourself();
428 
429  //build the transformation matrix of size (x,24) relating slave nodes on the boundary to master nodes on the boundary
430  slaveMasterOnBoundary.resize(Kbb.giveNumberOfColumns(), 24);
431  slaveMasterOnBoundary.zero();
432 
433  FloatArray n(8);
434  int node, nodePos;
435 
436  //master nodes
437  // for ( i = 1; i <= microMasterNodes.giveSize(); i++ ) {//8 nodes
438  // node = microMasterNodes.at(i);
439  // DofMan = microDomain->giveDofManager(node);
440  // dof = DofMan->giveDofWithID(D_u);
441  // j = boundaryDofNode.findFirstIndexOf(giveDofEquationNumber(dof));
442  // if(!j)
443  // OOFEM_ERROR("Not found equation number %d in reduced stiffness matrix of node %d\n", giveDofEquationNumber(dof), DofMan->giveGlobalNumber());
444  // microMasterNodesLoc.followedBy(j);
445  // }
446 
447 
448  //boundary nodes
449  for ( int i = 1; i <= microBoundaryNodes.giveSize(); i++ ) {
450  node = microBoundaryNodes.at(i);
451  DofMan = microDomain->giveDofManager(node);
452  dof = DofMan->giveDofWithID(D_u);
453  nodePos = microBoundaryDofsArr.findFirstIndexOf( giveDofEquationNumber(dof) ); //row(column) of reduced stiffness matrix
454  if ( !nodePos ) {
455  OOFEM_ERROR("Not found equation number %d in reduced stiffness matrix of node %d\n", giveDofEquationNumber(dof), DofMan->giveGlobalNumber() );
456  }
457 
459 
460  //construct transformation matrix relating displacement of slave boundary nodes to macroelement nodes
461  //the answer is returned to macroelement so the columns correspond to x,y,z DOFs of each macroelement node
462 
463  for ( int j = 1; j <= this->macroLSpaceElement->giveNumberOfNodes(); j++ ) { //linhex - 8 nodes
464  for ( int k = 0; k < 3; k++ ) { //the same interpolation for x,y,z
465  row = nodePos + k;
466  col = 3 * j + k - 2;
467  if ( row > slaveMasterOnBoundary.giveNumberOfRows() ) {
468  OOFEM_ERROR("Row is outside the reduced stiffness matrix ");
469  }
470 
471  if ( col > slaveMasterOnBoundary.giveNumberOfColumns() ) {
472  OOFEM_ERROR("Column is outside the reduced stiffness matrix ");
473  }
474 
475  slaveMasterOnBoundary.at(row, col) = n.at(j);
476  }
477  }
478  }
479 
480  //slaveMasterOnBoundary.printYourself();
481 # ifdef DEBUG
482  //check of the transformation matrix - the sum of each third column must be either zero or one
483  double sum;
484  for ( int i = 1; i <= slaveMasterOnBoundary.giveNumberOfRows(); i++ ) {
485  sum = 0;
486  for ( int j = 1; j <= slaveMasterOnBoundary.giveNumberOfColumns(); j++ ) {
487  if ( j % 3 == 0 ) {
488  sum += slaveMasterOnBoundary.at(i, j);
489  }
490  }
491 
492  //OOFEM_LOG_INFO("Sum of %i row of transformation matrix row %f\n", i, sum);
493  }
494 
495 # endif
496 
497  //slaveMasterOnBoundary.printYourself();
498 
499  //perform K(24,24) = T^T * K * T
500  FloatMatrix A;
501  A.beProductOf(Kbb, slaveMasterOnBoundary);
502  //A.printYourself();
503  //slaveMasterOnBoundary.printYourself();
504  //answer.resize(24, 24);
505  //answer.zero();
506  //OOFEM_ERROR("Stop");
507  answer.beTProductOf(slaveMasterOnBoundary, A);
508 }
509 
510 //should be called before the calculation of micromaterial
511 void MicroMaterial :: setMacroProperties(Domain *macroDomain, MacroLSpace *macroLSpaceElement, const IntArray &microMasterNodes, const IntArray &microBoundaryNodes)
512 {
513  Domain *microDomain = this->problemMicro->giveDomain(1);
514  EngngModel *microEngngModel = microDomain->giveEngngModel();
515  MetaStep *mstep;
516  DofManager *DofMan;
517 
518  int numDofs, numDofMan;
519  int counterDefault = 1, counterBoundary = 1, counterInternal = 1;
520 
521  this->macroDomain = macroDomain;
522  this->macroLSpaceElement = macroLSpaceElement;
523 
524  this->microMasterCoords.clear();
525  this->microMasterCoords.reserve(microMasterNodes.giveSize());
526  for ( int nodeNum: microMasterNodes ) { //8 nodes
527  this->microMasterCoords.push_back( * microDomain->giveNode( nodeNum )->giveCoordinates() );
528  }
529 
530  microEngngModel->giveNextStep(); //set the first time step
531  mstep = microEngngModel->giveCurrentMetaStep();
532  mstep->setNumberOfSteps(this->macroDomain->giveEngngModel()->giveMetaStep(1)->giveNumberOfSteps() + 1);
533 
534 
535  //separate DOFs into boundary and internal
536  this->NumberOfDofManagers = microDomain->giveNumberOfDofManagers();
537  microBoundaryDofs = new int * [ this->NumberOfDofManagers ];
538  microInternalDofs = new int * [ this->NumberOfDofManagers ];
539  microDefaultDofs = new int * [ this->NumberOfDofManagers ];
540  for ( int i = 0; i < this->NumberOfDofManagers; i++ ) {
541  microBoundaryDofs [ i ] = new int [ 3 ];
542  microInternalDofs [ i ] = new int [ 3 ];
543  microDefaultDofs [ i ] = new int [ 3 ];
544  microBoundaryDofs [ i ] [ 0 ] = microBoundaryDofs [ i ] [ 1 ] = microBoundaryDofs [ i ] [ 2 ] = 0;
545  microInternalDofs [ i ] [ 0 ] = microInternalDofs [ i ] [ 1 ] = microInternalDofs [ i ] [ 2 ] = 0;
546  microDefaultDofs [ i ] [ 0 ] = microDefaultDofs [ i ] [ 1 ] = microDefaultDofs [ i ] [ 2 ] = 0;
547  }
548 
549  for ( int i = 0; i < this->NumberOfDofManagers; i++ ) {
550  DofMan = microDomain->giveDofManager(i + 1);
551  numDofMan = DofMan->giveGlobalNumber();
552  numDofs = DofMan->giveNumberOfDofs();
553  if ( numDofs != 3 ) {
554  OOFEM_ERROR("Node %d does not have three degrees of freedom", DofMan->giveGlobalNumber() );
555  }
556 
557  for ( int j = 0; j < numDofs; j++ ) {
558  microDefaultDofs [ i ] [ j ] = counterDefault; //equation number
559  if ( microBoundaryNodes.contains(numDofMan) ) { //boundary (and master) nodes
560  microBoundaryDofs [ i ] [ j ] = counterBoundary;
561  microBoundaryDofsArr.followedBy(counterDefault);
562  counterBoundary++;
563  } else { //internal nodes to be condensed out
564  microInternalDofs [ i ] [ j ] = counterInternal;
565  microInternalDofsArr.followedBy(counterDefault);
566  counterInternal++;
567  }
568 
569  counterDefault++;
570  }
571  }
572 
573  this->totalBoundaryDofs = counterBoundary - 1;
574  this->totalInternalDofs = counterInternal - 1;
575 
576  // //the pointer to underlying problem is problemMicro
577  // DofManager *DofMan;
578  // int i, j, counter = 0;
579  // IntArray ut, dofIDArry = {D_u, D_v, D_w};1
580  //
581  // for ( i = 1; i <= problemMicro->giveDomain(1)->giveNumberOfDofManagers(); i++ ) { //for each node
582  // DofMan = problemMicro->giveDomain(1)->giveDofManager(i);
583  // //printf("%d\n",DofMan->giveNumberOfPrimaryMasterDofs(dofIDArry));
584  // //DofMan->giveLocationArray(dofIDArry, *this );
585  // DofMan->giveCompleteLocationArray(* this);
586  // for ( j = 1; j <= DofMan->giveNumberOfDofs(); j++ ) {
587  // counter++;
588  // }
589  // }
590 
591  this->maxNumberOfDomainEquation = counterBoundary - 1 + counterInternal - 1;
592 }
593 
594 
595 
596 //from class UnknownNumberingScheme
598 {
599  if ( this->problemMicro->giveNumberOfDomains() != 1 ) {
600  OOFEM_ERROR("Number of domains on microproblem is greater than 1");
601  }
602 
603  microMatIsUsed = true;
604 }
605 
606 //from class UnknownNumberingScheme
607 //Each node has three dofs (x,y,z direction)
609 {
610  int answer;
611  int numDofMan, numDof;
612 
613  numDofMan = dof->giveDofManNumber();
614  numDof = dof->giveDofID(); // Note: Relieas on D_u, D_v, D_w being 1, 2, 3
615 
616  //depending on the assembly of submatrix, swith to equation numbering
617  switch ( DofEquationNumbering ) {
618  case AllNodes: //the default
619  answer = microDefaultDofs [ numDofMan - 1 ] [ numDof - 1 ];
620  break;
621  case BoundaryNodes:
622  answer = microBoundaryDofs [ numDofMan - 1 ] [ numDof - 1 ];
623  break;
624  case InteriorNodes:
625  answer = microInternalDofs [ numDofMan - 1 ] [ numDof - 1 ];
626  break;
627  default:
628  answer = 0;
629  OOFEM_ERROR("Node numbering undefined");
630  }
631 
632  // answer = 3 * ( dof->giveDofManNumber() - 1 ) + dof->giveNumber();
633  return answer;
634 }
635 
636 //from class UnknownNumberingScheme
638 {
639  return this->reqNumberOfDomainEquation;
640 }
641 } // end namespace oofem
bool contains(int value) const
Definition: intarray.h:283
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
Definition: structuralms.C:96
int giveNumberOfColumns() const
Returns number of columns of receiver.
Definition: floatmatrix.h:158
EngngModel * problemMicro
Pointer to the underlying micro problem.
int giveNumberOfSteps()
Returns number of Steps it represent.
Definition: metastep.h:91
Class and object Domain.
Definition: domain.h:115
int giveDofEquationNumber(Dof *dof) const
Returns the equation number for corresponding DOF.
int giveGlobalNumber() const
Definition: dofmanager.h:501
EquationNumbering DofEquationNumbering
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
Base class for all matrices stored in sparse format.
Definition: sparsemtrx.h:60
Class representing meta step.
Definition: metastep.h:62
virtual FloatArray * backSubstitutionWith(FloatArray &y) const
Computes the solution of linear system where A is receiver.
Definition: sparsemtrx.h:253
SparseMtrx * createSparseMtrx(SparseMtrxType type)
Creates new instance of sparse matrix corresponding to given keyword.
Definition: classfactory.C:105
IntArray microBoundaryDofsArr
Array of equation numbers associated to boundary nodes.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
int totalBoundaryDofs
Number of equations associated with boundary nodes.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
MetaStep * giveMetaStep(int i)
Returns the i-th meta step.
Definition: engngm.C:1765
IntArray microInternalDofsArr
Array of equation numbers associated to internal nodes.
virtual ~MicroMaterialStatus()
Destructor.
Definition: micromaterial.C:69
virtual MaterialStatus * CreateStatus(GaussPoint *gp) const
Creates new copy of associated status and inserts it into given integration point.
This class implements a structural material status information.
Definition: structuralms.h:65
int reqNumberOfDomainEquation
Required number of domain equations.
virtual FloatArray * giveCoordinates()
Definition: dofmanager.h:382
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
Implementation for assembling tangent matrices in standard monolithic FE-problems.
MicroMaterialStatus(int, Domain *d, GaussPoint *gp)
Constructor.
Definition: micromaterial.C:67
virtual TimeStep * giveNextStep()
Returns next time step (next to current step) of receiver.
Definition: engngm.h:701
Base class for dof managers.
Definition: dofmanager.h:113
std::vector< FloatArray > microMasterCoords
Array containing coordinates of 8 master nodes of microproblem.
void setNumberOfSteps(int newNumberOfSteps)
Sets the number of steps within the metastep.
Definition: metastep.C:82
virtual double & at(int i, int j)=0
Returns coefficient at position (i,j).
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
MatResponseMode
Describes the character of characteristic material matrix.
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: micromaterial.C:81
MicroMaterial(int n, Domain *d)
Constructor.
Definition: micromaterial.C:95
int NumberOfDofManagers
Number of DOF Managers.
virtual void giveRealStressVector_3d(FloatArray &answer, GaussPoint *, const FloatArray &, TimeStep *)
Default implementation relies on giveRealStressVector for second Piola-Kirchoff stress.
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: micromaterial.C:71
virtual int giveNumberOfNodes() const
Returns number of nodes of receiver.
Definition: element.h:662
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
Definition: micromaterial.C:76
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
EngngModel * InstanciateProblem(DataReader &dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)
Instanciates the new problem.
Definition: util.C:45
#define _IFT_MicroMaterial_fileName
Definition: micromaterial.h:54
MetaStep * giveCurrentMetaStep()
Returns current meta step.
Definition: engngm.C:1684
int ** microBoundaryDofs
Array containing equation numbers for boundary nodes [DofManagerNumber][DOF].
bool microMatIsUsed
Flag signalizing whether micromaterial is used by other element.
#define OOFEM_LOG_INFO(...)
Definition: logger.h:127
int giveNumberOfDofs() const
Definition: dofmanager.C:279
virtual int buildInternalStructure(EngngModel *eModel, int n, int m, const IntArray &I, const IntArray &J)
Builds internal structure of receiver based on I and J.
Definition: sparsemtrx.h:185
virtual int giveRequiredNumberOfDomainEquation() const
Returns required number of domain equation.
#define OOFEM_ERROR(...)
Definition: error.h:61
void clear()
Clears the array (zero size).
Definition: intarray.h:177
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
DofIDItem giveDofID() const
Returns DofID value of receiver, which determines type of of unknown connected to receiver (e...
Definition: dof.h:276
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: micromaterial.C:84
virtual void zero()=0
Zeroes the receiver.
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: micromaterial.C:89
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
int giveDofManNumber() const
Definition: dof.C:72
std::string inputFileNameMicro
Definition: micromaterial.h:97
Abstract base class representing a material status information.
Definition: matstatus.h:84
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
void setMacroProperties(Domain *macroDomain, MacroLSpace *macroLSpaceElement, const IntArray &microMasterNodes, const IntArray &microBoundaryNodes)
int ** microInternalDofs
Array containing equation numbers for internal nodes to be condensed out [DofManagerNumber][DOF].
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
This class implements a macroelement.
Definition: macrolspace.h:59
virtual SparseMtrx * factorized()
Returns the receiver factorized.
Definition: sparsemtrx.h:245
virtual ~MicroMaterial()
Destructor.
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
Definition: dofmanager.C:119
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
Definition: intarray.C:145
int giveNumberOfDomains()
Returns number of domains in problem.
Definition: engngm.h:342
int ** microDefaultDofs
Array containing default equation numbers for all nodes [DofManagerNumber][DOF].
void beTProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
Definition: floatmatrix.C:367
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
int maxNumberOfDomainEquation
The maximum DOFs corresponding to released all of the boundary conditions.
Abstract base class for all "structural" constitutive models.
virtual FloatArray * giveCoordinates()
Definition: node.h:114
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: structuralms.C:108
virtual void evalInterpolation(FloatArray &answer, const std::vector< FloatArray > &coords, const FloatArray &gcoords)
Evaluates shape function at a given pointnodal representation of real internal forces obtained from m...
Definition: macrolspace.C:279
Domain * giveDomain() const
Definition: femcmpnn.h:100
int giveNumberOfColumns() const
Returns number of columns of receiver.
Definition: sparsemtrx.h:116
MacroLSpace * macroLSpaceElement
Pointer to the macroscale element.
REGISTER_Material(DummyMaterial)
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
Definition: floatmatrix.C:337
virtual bool isAllocatedAt(int i, int j) const
Checks whether memory is allocated at position (i,j).
Definition: sparsemtrx.h:271
int giveSize() const
Definition: intarray.h:203
Class representing the implementation of plain text date reader.
Node * giveNode(int n)
Service for accessing particular domain node.
Definition: domain.h:371
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
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
Definition: domain.C:314
void giveMacroStiffnessMatrix(FloatMatrix &answer, TimeStep *tStep, MatResponseMode rMode, const IntArray &microMasterNodes, const IntArray &microBoundaryNodes)
int giveNumberOfRows() const
Returns number of rows of receiver.
Definition: floatmatrix.h:156
Domain * macroDomain
Pointer to the macroscale domain.
int totalInternalDofs
Number of equations associated with boundary nodes.
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
void init(void)
Related to numbering scheme.
int findFirstIndexOf(int value) const
Finds index of first occurrence of given value in array.
Definition: intarray.C:331

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