39 #ifndef _ELASTICSTRUCTUREHANDLER_H_ 40 #define _ELASTICSTRUCTUREHANDLER_H_ 46 #include <life/lifesolver/dataElasticStructure.hpp> 47 #include <lifev/core/fem/ReferenceFE.hpp> 48 #include <lifev/core/fem/DOF.hpp> 49 #include <lifev/core/LifeV.hpp> 50 #include <life/lifefilters/medit_wrtrs.hpp> 51 #include <lifev/core/fem/BCHandler.hpp> 59 template <
typename Mesh>
131 void initialize (
const Function& d0,
const Function& w0 );
140 const std::string& velName,
280 template <
typename Mesh>
299 template <
typename Mesh>
323 template <
typename Mesh>
330 VenantKirchhoffElasticData<Mesh> = data;
332 M_dof (
this->mesh(), M_refFE ),
333 M_dim = M_dof.numTotalDof();
336 M_fe ( M_refFE, getGeometricMap (
this->mesh() ), M_Qr );
337 M_feBd ( M_refFE.boundaryFE(), getGeometricMap (
this->mesh() ).boundaryMap(), M_bdQr );
348 template <
typename Mesh>
349 PhysVectUnknown<Vector>&
357 template <
typename Mesh>
358 PhysVectUnknown<Vector>&
365 template <
typename Mesh>
369 std::ostringstream index;
370 std::string name, namedef;
374 if ( fmod (
float (
M_count ),
float (
this->_verbose ) ) == 0.0 )
376 std::cout <<
" S- Post-processing \n";
377 index << (
M_count /
this->_verbose );
379 switch ( index.str().size() )
382 name =
"00" + index.str();
385 name =
"0" + index.str();
392 namedef =
"defor." + name +
".mesh";
393 wr_medit_ascii_scalar (
"dep_x." + name +
".bb", M_d.giveVec(),
this->mesh().numVertices() );
394 wr_medit_ascii_scalar (
"dep_y." + name +
".bb", M_d.giveVec() + M_dim,
this->mesh().numVertices() );
395 wr_medit_ascii_scalar (
"dep_z." + name +
".bb", M_d.giveVec() + 2 * M_dim,
this->mesh().numVertices() );
396 wr_medit_ascii2 ( namedef,
this->mesh(), M_d,
this->_factor );
400 system ( (
"ln -sf " + namedef +
" dep_x." + name +
".mesh" ).data() );
401 system ( (
"ln -sf " + namedef +
" dep_y." + name +
".mesh" ).data() );
402 system ( (
"ln -sf " + namedef +
" dep_z." + name +
".mesh" ).data() );
406 wr_medit_ascii_scalar (
"veld_x." + name +
".bb", M_w.giveVec(),
this->mesh().numVertices() );
407 wr_medit_ascii_scalar (
"veld_y." + name +
".bb", M_w.giveVec() + M_dim,
this->mesh().numVertices() );
408 wr_medit_ascii_scalar (
"veld_z." + name +
".bb", M_w.giveVec() + 2 * M_dim,
this->mesh().numVertices() );
412 system ( (
"ln -sf " + namedef +
" veld_x." + name +
".mesh" ).data() );
413 system ( (
"ln -sf " + namedef +
" veld_y." + name +
".mesh" ).data() );
414 system ( (
"ln -sf " + namedef +
" veld_z." + name +
".mesh" ).data() );
421 template <
typename Mesh>
428 typedef typename Mesh::VolumeShape GeoShape;
430 UInt nDofpV = M_refFE.nbDofPerVertex;
431 UInt nDofpE = M_refFE.nbDofPerEdge;
432 UInt nDofpF = M_refFE.nbDofPerFace;
433 UInt nDofpEl = M_refFE.nbDofPerVolume;
435 UInt nElemV = GeoShape::S_numVertices;
436 UInt nElemE = GeoShape::S_numEdges;
437 UInt nElemF = GeoShape::S_numFaces;
439 UInt nDofElemV = nElemV * nDofpV;
440 UInt nDofElemE = nElemE * nDofpE;
441 UInt nDofElemF = nElemF * nDofpF;
443 ID nbComp = M_d.nbcomp();
450 for (
ID iElem = 0; iElem <
this->mesh().numVolumes(); ++iElem )
453 M_fe.updateJac (
this->mesh().volume ( iElem ) );
460 for (
ID iVe = 0; iVe < nElemV; ++iVe )
464 for ( ID l = 0; l < nDofpV; ++l )
466 lDof = iVe * nDofpV + l;
469 M_fe.coorMap ( x, y, z, M_fe.refFE.xi ( lDof ), M_fe.refFE.eta ( lDof ), M_fe.refFE.zeta ( lDof ) );
472 for ( UInt icmp = 0; icmp < nbComp; ++icmp )
474 M_d ( icmp * M_dim + M_dof.localToGlobalMap ( iElem, lDof ) ) = d0 ( 0.0, x, y, z, icmp + 1 );
475 M_w ( icmp * M_dim + M_dof.localToGlobalMap ( iElem, lDof ) ) = w0 ( 0.0, x, y, z, icmp + 1 );
486 for (
ID iEd = 0; iEd < nElemE; ++iEd )
490 for ( ID l = 0; l < nDofpE; ++l )
492 lDof = nDofElemV + iEd * nDofpE + l;
495 M_fe.coorMap ( x, y, z, M_fe.refFE.xi ( lDof ), M_fe.refFE.eta ( lDof ), M_fe.refFE.zeta ( lDof ) );
498 for ( UInt icmp = 0; icmp < nbComp; ++icmp )
500 M_d ( icmp * M_dim + M_dof.localToGlobalMap ( iElem, lDof ) ) = d0 ( 0.0, x, y, z, icmp + 1 );
501 M_w ( icmp * M_dim + M_dof.localToGlobalMap ( iElem, lDof ) ) = w0 ( 0.0, x, y, z, icmp + 1 );
512 for (
ID iFa = 0; iFa < nElemF; ++iFa )
516 for ( ID l = 0; l < nDofpF; ++l )
519 lDof = nDofElemE + nDofElemV + iFa * nDofpF + l;
522 M_fe.coorMap ( x, y, z, M_fe.refFE.xi ( lDof ), M_fe.refFE.eta ( lDof ), M_fe.refFE.zeta ( lDof ) );
525 for ( UInt icmp = 0; icmp < nbComp; ++icmp )
527 M_d ( icmp * M_dim + M_dof.localToGlobalMap ( iElem, lDof ) ) = d0 ( 0.0, x, y, z, icmp + 1 );
528 M_w ( icmp * M_dim + M_dof.localToGlobalMap ( iElem, lDof ) ) = w0 ( 0.0, x, y, z, icmp + 1 );
535 for ( ID l = 0; l < nDofpEl; ++l )
537 lDof = nDofElemF + nDofElemE + nDofElemV + l;
540 M_fe.coorMap ( x, y, z, M_fe.refFE.xi ( lDof ), M_fe.refFE.eta ( lDof ), M_fe.refFE.zeta ( lDof ) );
543 for ( UInt icmp = 0; icmp < nbComp; ++icmp )
545 M_d ( icmp * M_dim + M_dof.localToGlobalMap ( iElem, lDof ) ) = d0 ( 0.0, x, y, z, icmp + 1 );
546 M_w ( icmp * M_dim + M_dof.localToGlobalMap ( iElem, lDof ) ) = w0 ( 0.0, x, y, z, icmp + 1 );
554 template <
typename Mesh>
557 const std::string& velName,
560 std::cout <<
" S- restarting at time = " << startT << std::endl;
562 M_count = (
Int) (startT /
this->timestep() - 0.5);
565 for (
ID iElem = 0; iElem <
this->mesh().numVolumes(); ++iElem )
567 M_fe.updateJac (
this->mesh().volume ( iElem ) );
569 readUnknown (depName, M_d);
570 readUnknown (velName, M_w);
574 template <
typename Mesh>
577 PhysVectUnknown<Vector>& unknown)
586 std::string filenamex = name;
588 filenamex.insert (filenamex.end(), ext.begin(), ext.end() );
590 std::ifstream filex (filenamex.c_str(), std::ios::in);
594 std::cout <<
"Reading file " << filenamex
595 <<
" impossible" << std::endl;
605 std::cout <<
"restart: nonmatching dimension in file " << filenamex << std::endl;
611 for (
UInt ix = 0; ix < nsx; ++ix)
613 filex >> unknown[ix + 0 * nDof];
619 std::string filenamey = name;
621 filenamey.insert (filenamey.end(), ext.begin(), ext.end() );
623 std::ifstream filey (filenamey.c_str(), std::ios::in);
627 std::cout <<
"Reading file " << filenamey
628 <<
" impossible" << std::endl;
638 std::cout <<
"restart: nonmatching dimension in file " << filenamex << std::endl;
644 for (
UInt iy = 0; iy < nsy; ++iy)
646 filey >> unknown[iy + 1 * nDof];
652 std::string filenamez = name;
654 filenamez.insert (filenamez.end(), ext.begin(), ext.end() );
659 std::ifstream filez (filenamez.c_str(), std::ios::in);
663 std::cout <<
"Reading mesh file " << filenamez
664 <<
" impossible" << std::endl;
674 std::cout <<
"restart: nonmatching dimension in file " << filenamex << std::endl;
680 for (
UInt iz = 0; iz < nsz; ++iz)
682 filez >> unknown[iz + 2 * nDof];
VenantKirchhoffElasticHandler(VenantKirchhoffElasticHandler &T)
virtual void iterate()=0
Solve the non-linear problem.
CurrentFEManifold M_feBd
Current boundary FE.
PhysVectUnknown< Vector > M_dRhs
const UInt getDimension() const
Returns the number of unknowns.
void initialize(const std::string &depName, const std::string &velName, Real startT=0.)
BCHandler bchandlerRaw_Type
A class for a finite element on a manifold.
BCHandler - class for handling boundary conditions.
PhysVectUnknown< Vector > M_w
The velocity.
int32_type Int
Generic integer data.
PhysVectUnknown< Vector > & getVelocity()
Returns the velocity vector.
void updateInverseJacobian(const UInt &iQuadPt)
virtual ~VenantKirchhoffElasticHandler()
Destructor.
const QuadratureRule & M_bdQr
Quadrature rule for elementary computations.
const QuadratureRule & M_Qr
Quadrature rule for volumic elementary computations.
virtual void timeAdvance(source_Type const &, const Real &time)=0
Update the right hand side for time advancing.
BCHandler * M_BCh_solid
The BC handler.
PhysVectUnknown< Vector > M_d
The displacement.
BCHandler & getBCh_solid()
Returns the BCHandler object.
VenantKirchhoffElasticHandler()
setUp(const VenantKirchhoffElasticData< Mesh > &data, const ReferenceFE &refFE, const QuadratureRule &Qr, const QuadratureRule &bdQr)
void initialize(const Function &d0, const Function &w0)
Sets initial condition for the displacment en velocity.
const bool setSolidBC() const
checking if BC are set
double Real
Generic real data.
CurrentFE - A primordial class for the assembly of the local matrices/vectors retaining the values on...
The class for a reference Lagrangian finite element.
setUp(const VenantKirchhoffElasticData< Mesh > &data, const RefernceFE &refFE, const QuadratureRule &Qr, const QuadratureRule &bdQr, BCHandler &BCh)
const CurrentFE & getFe() const
Returns the current FE object.
void postProcess()
Postprocessing.
const ReferenceFE & getRefFE() const
Returns the reference FE object.
UInt M_count
Aux. var. for PostProc.
std::function< Real(Real const &, Real const &, Real const &, Real const &, ID const &) > source_Type
UInt M_dim
The number of total displacement dofs.
QuadratureRule - The basis class for storing and accessing quadrature rules.
CurrentFEManifold & getFeBd()
Returns the current boundary FE object.
void setSolidBC(BCHandler &BCh_solid)
set the fluid BCs
std::shared_ptr< bchandlerRaw_type > bchandler_Type
PhysVectUnknown< Vector > & getDisplacement()
Returns the displacement vector.
CurrentFE M_fe
Current FE.
const ReferenceFE & M_refFE
Reference FE.
Real M_time
The current time.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
CurrentFE & getFe()
Returns the current FE object.
const DOF & getdDof() const
Returns the DOF object.