User Tools

Site Tools


parallelization-howto

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
parallelization-howto [2010/03/20 17:26] bpparallelization-howto [2010/07/27 17:26] lucasgraim
Line 202: Line 202:
  
 </code> </code>
 +Provided that the suitable sparse matrix representation is used (SMT_PetscMtrx, for example) and solver (ST_Petsc, for example), no modification to the sparse matrix assembly procedure and linear system solution is necessary. We can simply pass sparse matrix, local load vector, and solution vector to the solver and get results!
 +<code cpp>
 +void
 +MyEngngModel :: solveYourselfAt(TimeStep *tStep) {
 +
 +   // create components of characteristic equation
 +   stiffnessMatrix = CreateUsrDefSparseMtrx(sparseMtrxType);
 +   loadVector.resize(this->giveNumberOfEquations(EID_MomentumBalance));
 +   displacementVector.resize(this->giveNumberOfEquations(EID_MomentumBalance));
 +   loadVector.zero(); displacementVector.zero();
 +   
 +   // initialize profile of stiffness matrix
 +   stiffnessMatrix->buildInternalStructure(this, di, EID_MomentumBalance, EModelDefaultEquationNumbering());
 +   
 +   // assemble stiffness and load vector
 +   stiffnessMatrix->zero(); // zero stiffness matrix
 +   this->assemble( stiffnessMatrix, tStep, EID_MomentumBalance, ElasticStiffnessMatrix,
 +                   EModelDefaultEquationNumbering(), this->giveDomain(di) );
 +   this->assembleLoadVector (loadVector,this->giveDomain(di),
 +                             EID_MomentumBalance, tStep);                                 
 +                                    
 +   // get numerical method to solve the problem
 +   this->giveNumericalMethod(tStep);
 +   // solve the problem (yes, this solves linear system in parallel!)
 +   nMethod->solve(stiffnessMatrix, & loadVector, & displacementVector);
 +   // postprocess results update nodes, elements, compute strains, stresses, etc
 +   this->updateYourself( this->giveCurrentStep() );
 +   // and we are done!
 +}
 +</code> 
  
 ====== Further reading ====== ====== Further reading ======
Line 208: Line 238:
   * B. Patzak,D. Rypl, and Z. Bittnar: Parallel explicit finite element dynamics with nonlocal constitutive models, Computers and Structures, 79 (26-28), 2287-2297, 2001.   * B. Patzak,D. Rypl, and Z. Bittnar: Parallel explicit finite element dynamics with nonlocal constitutive models, Computers and Structures, 79 (26-28), 2287-2297, 2001.
  
- +SEE: [[http://www.dissertations.superiorpapers.com | dissertation writing]]
parallelization-howto.txt · Last modified: 2012/12/17 19:39 by mikael.ohman