v0.12.1
Classes | Public Member Functions | Public Attributes | List of all members
FePrePostProcess Struct Reference

Not used at this stage. Could be used to do some calculations, before assembly of local elements. More...

#include <users_modules/multifield_plasticity/src/BasicFeTools.hpp>

Inheritance diagram for FePrePostProcess:
[legend]
Collaboration diagram for FePrePostProcess:
[legend]

Classes

struct  BcEntMethod
 

Public Member Functions

 FePrePostProcess (MoFEM::Interface &m_field, boost::ptr_vector< RigidBodyData > &roller_data, boost::ptr_vector< DataFromMove > &bc_data, bool scale_mat)
 
MoFEMErrorCode setNestedContainer (boost::shared_ptr< NestedMatrixContainer > nested_container)
 
MoFEMErrorCode preProcess ()
 
MoFEMErrorCode postProcess ()
 

Public Attributes

MoFEM::InterfacemField
 
boost::ptr_vector< RigidBodyData > & rollerDataVec
 
boost::ptr_vector< DataFromMove > & bcData
 
boost::shared_ptr< DirichletDisplacementBcdirichletBcPtr
 
boost::shared_ptr< MethodForForceScalingmethodsOpForMove
 
boost::shared_ptr< MethodForForceScalingmethodsOpForRollersDisp
 
vector< boost::shared_ptr< MethodForForceScaling > > methodsOpForRollersPosition
 
boost::shared_ptr< NestedMatrixContainer > nestedContainer
 
SmartPetscObj< Mat > SEpEp
 
SmartPetscObj< AO > aoSEpEp
 
bool scaleMat
 
bool runOnceFlag
 

Detailed Description

Not used at this stage. Could be used to do some calculations, before assembly of local elements.

Definition at line 330 of file BasicFeTools.hpp.

Constructor & Destructor Documentation

◆ FePrePostProcess()

FePrePostProcess::FePrePostProcess ( MoFEM::Interface m_field,
boost::ptr_vector< RigidBodyData > &  roller_data,
boost::ptr_vector< DataFromMove > &  bc_data,
bool  scale_mat 
)

Definition at line 378 of file BasicFeTools.hpp.

381  : mField(m_field), rollerDataVec(roller_data), bcData(bc_data),
382  scaleMat(scale_mat) {}
MoFEM::Interface & mField
bool scaleMat
boost::ptr_vector< RigidBodyData > & rollerDataVec
boost::ptr_vector< DataFromMove > & bcData

Member Function Documentation

◆ postProcess()

MoFEMErrorCode FePrePostProcess::postProcess ( )

Definition at line 494 of file BasicFeTools.hpp.

494  {
496  // if (ts_ctx == CTX_TSSETIJACOBIAN)
497  // CHKERR MatView(ts_B, PETSC_VIEWER_STDOUT_SELF);
498  auto assemble = [](Mat a) {
500  if (a) {
501  CHKERR MatAssemblyBegin(a, MAT_FINAL_ASSEMBLY);
502  CHKERR MatAssemblyEnd(a, MAT_FINAL_ASSEMBLY);
503  }
505  };
506 
507  if (ts_ctx == CTX_TSSETIJACOBIAN) {
508 
509  // FIXME: this is probably not necessary
510  // this is only for keeping constant matrices
511  if (nestedContainer) {
512  auto &nested_matrices = nestedContainer->nested_matrices;
513  if (nested_matrices(0, 0)) {
514  CHKERR assemble(nested_matrices(0, 0));
515  CHKERR assemble(nested_matrices(0, 1));
516  CHKERR assemble(nested_matrices(1, 1));
517  }
518 
519  // cout << " nested_matrices(0, 0) " << endl;
520  // CHKERR MatView(nested_matrices(0, 0), PETSC_VIEWER_STDOUT_SELF);
521  // cout << " nested_matrices(0, 1) " << endl;
522  // CHKERR MatView(nested_matrices(0, 1), PETSC_VIEWER_STDOUT_SELF);
523  // cout << " nested_matrices(1, 1) " << endl;
524  // CHKERR MatView(nested_matrices(1, 1), PETSC_VIEWER_STDOUT_SELF);
525  }
526  if (SEpEp)
527  CHKERR assemble(SEpEp);
528  // if (true)
529  // CHKERR MatView(ts_B, PETSC_VIEWER_DRAW_WORLD);
530  // if (SEpEp)
531  // CHKERR MatView(SEpEp, PETSC_VIEWER_DRAW_WORLD);
532 
533  }
534 
536  }
constexpr double a
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
#define CHKERR
Inline error check.
Definition: definitions.h:548
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
boost::shared_ptr< NestedMatrixContainer > nestedContainer
SmartPetscObj< Mat > SEpEp

◆ preProcess()

MoFEMErrorCode FePrePostProcess::preProcess ( )

Definition at line 391 of file BasicFeTools.hpp.

391  {
393  runOnceFlag = true;
394  CHKERR VecSetOption(ts_F, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
395 
396  switch (ts_ctx) {
397  case CTX_TSSETIJACOBIAN: {
398  snes_ctx = CTX_SNESSETJACOBIAN;
399  snes_B = ts_B;
400  // CHKERR MatSetOption(ts_B, MAT_NO_OFF_PROC_ZERO_ROWS, PETSC_TRUE);
401  // CHKERR MatSetOption(ts_B, MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
402  // FIXME: this is probably not necessary
403  // this is only for keeping constant matrices
404  if (nestedContainer) {
405  auto &nested_matrices = nestedContainer->nested_matrices;
406  if (nested_matrices(0, 0)) {
407  CHKERR MatZeroEntries(nested_matrices(0, 0));
408  CHKERR MatZeroEntries(nested_matrices(0, 1));
409  CHKERR MatZeroEntries(nested_matrices(1, 1));
410  }
411  }
412  if (SEpEp)
413  CHKERR MatZeroEntries(SEpEp);
414  break;
415  }
416  case CTX_TSSETIFUNCTION: {
417  snes_ctx = CTX_SNESSETFUNCTION;
418  snes_f = ts_F;
419  break;
420  }
421  default:
422  break;
423  }
424 
425  auto time = ts_t;
426 
427  // forceDataScaled = forceData;
428  // pressureDataScaled = pressureData;
429  if (methodsOpForMove)
430  for (auto &bdata : bcData) {
431  bdata.scaledValues = bdata.values;
433  bdata.scaledValues);
434  }
435 
436  if (time <= (*cache).rollers_stop_time) {
437 
439  for (auto &roller : (*cache).rollerDataVec) {
440  roller.BodyDispScaled = roller.rollerDisp;
442  this, methodsOpForRollersDisp, roller.BodyDispScaled);
443  }
444 
445  if (!methodsOpForRollersPosition.empty())
446 
447  for (int id = 0; id != (*cache).rollerDataVec.size(); ++id) {
448  auto &roller = (*cache).rollerDataVec[id];
449  if (!roller.positionDataParamName.empty())
451  this, methodsOpForRollersPosition[id], roller.BodyDispScaled);
452  }
453  }
454 
455  auto fix_dofs_values = [this]() {
457  auto &methodsOp = dirichletBcPtr->methodsOp;
458 
459  // for fixing dirichlet bcs
460  vector<DataFromBc> bcData;
461  CHKERR dirichletBcPtr->getRotationBcFromBlock(bcData);
462  CHKERR dirichletBcPtr->getBcDataFromSetsAndBlocks(bcData);
463 
464  for (auto &bc_it : bcData) {
465  Range all_bc_ents;
467  bc_it.scaled_values);
468  bc_it.theta = bc_it.scaled_values[0];
469  BcEntMethod method(bc_it, dirichletBcPtr);
470  for (auto &ents : bc_it.bc_ents)
471  all_bc_ents.merge(ents);
472 
473  CHKERR mField.loop_entities("U", method, &all_bc_ents);
474  }
475 
477  };
478 
479  CHKERR fix_dofs_values();
480 
481  // if (snes_ctx == CTX_SNESNONE) {
482  // if (!dofsIndices.empty()) {
483  // CHKERR VecSetValues(snes_x, dofsIndices.size(),
484  // &*dofsIndices.begin(),
485  // &*dofsValues.begin(), INSERT_VALUES);
486  // }
487  // CHKERR VecAssemblyBegin(snes_x);
488  // CHKERR VecAssemblyEnd(snes_x);
489  // }
490 
492  }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
virtual MoFEMErrorCode loop_entities(const std::string field_name, EntityMethod &method, Range const *const ents=nullptr, int verb=DEFAULT_VERBOSITY)=0
Loop over field entities.
boost::shared_ptr< MethodForForceScaling > methodsOpForRollersDisp
boost::shared_ptr< DirichletDisplacementBc > dirichletBcPtr
bool runOnceFlag
boost::shared_ptr< MethodForForceScaling > methodsOpForMove
vector< boost::shared_ptr< MethodForForceScaling > > methodsOpForRollersPosition
static MoFEMErrorCode applyScale(const FEMethod *fe, boost::ptr_vector< MethodForForceScaling > &methods_op, VectorDouble &nf)

◆ setNestedContainer()

MoFEMErrorCode FePrePostProcess::setNestedContainer ( boost::shared_ptr< NestedMatrixContainer >  nested_container)

Definition at line 384 of file BasicFeTools.hpp.

385  {
387  nestedContainer = nested_container;
389  }

Member Data Documentation

◆ aoSEpEp

SmartPetscObj<AO> FePrePostProcess::aoSEpEp

Definition at line 344 of file BasicFeTools.hpp.

◆ bcData

boost::ptr_vector<DataFromMove>& FePrePostProcess::bcData

Definition at line 334 of file BasicFeTools.hpp.

◆ dirichletBcPtr

boost::shared_ptr<DirichletDisplacementBc> FePrePostProcess::dirichletBcPtr

Definition at line 336 of file BasicFeTools.hpp.

◆ methodsOpForMove

boost::shared_ptr<MethodForForceScaling> FePrePostProcess::methodsOpForMove

Definition at line 337 of file BasicFeTools.hpp.

◆ methodsOpForRollersDisp

boost::shared_ptr<MethodForForceScaling> FePrePostProcess::methodsOpForRollersDisp

Definition at line 338 of file BasicFeTools.hpp.

◆ methodsOpForRollersPosition

vector<boost::shared_ptr<MethodForForceScaling> > FePrePostProcess::methodsOpForRollersPosition

Definition at line 339 of file BasicFeTools.hpp.

◆ mField

MoFEM::Interface& FePrePostProcess::mField

Definition at line 332 of file BasicFeTools.hpp.

◆ nestedContainer

boost::shared_ptr<NestedMatrixContainer> FePrePostProcess::nestedContainer

Definition at line 341 of file BasicFeTools.hpp.

◆ rollerDataVec

boost::ptr_vector<RigidBodyData>& FePrePostProcess::rollerDataVec

Definition at line 333 of file BasicFeTools.hpp.

◆ runOnceFlag

bool FePrePostProcess::runOnceFlag

Definition at line 347 of file BasicFeTools.hpp.

◆ scaleMat

bool FePrePostProcess::scaleMat

Definition at line 346 of file BasicFeTools.hpp.

◆ SEpEp

SmartPetscObj<Mat> FePrePostProcess::SEpEp

Definition at line 343 of file BasicFeTools.hpp.


The documentation for this struct was generated from the following file: