35 #include "../sm/EngineeringModels/qclinearstatic.h" 36 #include "../sm/Quasicontinuum/fullsolveddomain.h" 37 #include "../sm/Elements/structuralelement.h" 38 #include "../sm/Elements/structuralelementevaluator.h" 54 #include "../sm/Quasicontinuum/quasicontinuum.h" 55 #include "../sm/Quasicontinuum/fullsolveddomain.h" 56 #include "../sm/Quasicontinuum/geometrygenerator.h" 59 #include "../sm/Quasicontinuum/quasicontinuumnumberingscheme.h" 66 #ifdef __PARALLEL_MODE 167 OOFEM_ERROR(
"Links cannot be set manualy if particles are generated automaticaly");
170 OOFEM_ERROR(
"Interpolation elements cannot be set manually if particles are generated automaticaly");
181 #ifdef __PARALLEL_MODE 248 for (
auto &el : this->
giveDomain(1)->giveElements() ) {
249 el->postInitialize();
255 for (
auto &el : this->
giveDomain(1)->giveElements() ) {
256 el->postInitialize();
265 for (
auto &el : this->
giveDomain(1)->giveElements() ) {
266 el->postInitialize();
314 OOFEM_ERROR(
"invalid format of FullSolvedDomainRadius");
317 OOFEM_ERROR(
"invalid format of FullSolvedDomainBox");
340 OOFEM_ERROR(
"Definition of Full Solved Domain by list of interpolation element has not been implemented yet");
375 if ( ( A.at(1) <= coordinates->
at(1) ) && ( coordinates->
at(1) <= B.
at(1) ) && \
376 ( A.at(2) <= coordinates->
at(2) ) && ( coordinates->
at(2) <= B.
at(2) ) && \
377 ( A.at(3) <= coordinates->
at(3) ) && ( coordinates->
at(3) <= B.
at(3) ) ) {
393 for (
int i = 1; i <= noe; i++ ) {
396 for (
int j = 1; j <= noen; j++ ) {
404 }
else if ( noen == 2 ) {
424 OOFEM_WARNING(
"Node %d is not \"qcNode\", quasicontinuum is not applied in this node", i);
444 OOFEM_WARNING(
"Node %d is not \"qcNode\", quasicontinuum is not applied in this node", i);
463 std :: vector< IntArray >
466 std :: vector< IntArray >newMeshNodes;
470 std :: vector< FloatArray >nodeCoords;
471 std :: vector< IntArray >meshNodes;
474 char options_string [ 128 ] =
"";
475 const char *t3dInFile;
476 const char *t3dOutFile;
480 temp.append(
".oofem.t3d.out");
481 t3dOutFile = temp.c_str();
483 sprintf(options_string,
"-i %s -o %s -S -u %f -Q -W", t3dInFile, t3dOutFile,
defaultT3DMeshSize);
489 t3d_main(NULL, options_string);
490 }
catch(
int exit_code) {
491 fprintf(stderr,
"T3d was prematuraly terminated with error code %d\n\n", exit_code);
495 OOFEM_ERROR(
"OOFEM is NOT compiled with T3D option but T3D in needed");
513 std :: vector< IntArray >
516 std :: vector< IntArray >newMeshNodes;
520 std :: vector< FloatArray >nodeCoords;
521 std :: vector< IntArray >meshNodes;
524 const char *t3dOutFile;
542 std :: vector< IntArray >
552 int nomn = nodeCoords.size();
554 int nome = meshNodes.size();
557 std :: vector< IntArray >newMeshNodes;
558 newMeshNodes.clear();
561 newNodeNumbers.
resize(nomn);
564 for (
int i = 1; i <= nomn; i++ ) {
568 if ( nearestParticle ) {
573 OOFEM_ERROR(
"Vertex of interpolation mesh is shifted to node which is not \"qcNode\"");
580 newNodeNumbers [ i - 1 ] = nearestParticle->
giveNumber();
589 if ( meshNodes [ 0 ].giveSize() == 3 ) {
593 for (
int i = 1; i <= nome; i++ ) {
594 int n1 = meshNodes [ i - 1 ].at(1);
595 int n2 = meshNodes [ i - 1 ].at(2);
596 int n3 = meshNodes [ i - 1 ].at(3);
597 if ( newNodeNumbers.
at(n1) == newNodeNumbers.
at(n2) || \
598 newNodeNumbers.at(n1) == newNodeNumbers.
at(n3) || \
599 newNodeNumbers.at(n2) == newNodeNumbers.
at(n3) ) {
606 OOFEM_WARNING(
"%d-th interpolation element degenerates to negative volume", i);
609 OkmeshNodes.
at(1) = newNodeNumbers.
at(n1);
610 OkmeshNodes.
at(2) = newNodeNumbers.
at(n2);
611 OkmeshNodes.
at(3) = newNodeNumbers.
at(n3);
612 newMeshNodes.push_back(OkmeshNodes);
619 for (
int i = 1; i <= nome; i++ ) {
624 int n1 = meshNodes [ i - 1 ].at(1);
625 int n2 = meshNodes [ i - 1 ].at(2);
626 int n3 = meshNodes [ i - 1 ].at(3);
627 int n4 = meshNodes [ i - 1 ].at(4);
628 if ( newNodeNumbers.
at(n1) == newNodeNumbers.
at(n2) || \
629 newNodeNumbers.at(n1) == newNodeNumbers.
at(n3) || \
630 newNodeNumbers.at(n1) == newNodeNumbers.
at(n4) || \
631 newNodeNumbers.at(n2) == newNodeNumbers.
at(n3) || \
632 newNodeNumbers.at(n2) == newNodeNumbers.
at(n4) || \
633 newNodeNumbers.at(n3) == newNodeNumbers.
at(n4) ) {
636 double x1 = d->
giveDofManager( newNodeNumbers.
at(n1) )->giveCoordinates()->at(1);
637 double y1 = d->
giveDofManager( newNodeNumbers.
at(n1) )->giveCoordinates()->at(2);
638 double z1 = d->
giveDofManager( newNodeNumbers.
at(n1) )->giveCoordinates()->at(3);
639 double x2 = d->
giveDofManager( newNodeNumbers.
at(n2) )->giveCoordinates()->at(1);
640 double y2 = d->
giveDofManager( newNodeNumbers.
at(n2) )->giveCoordinates()->at(2);
641 double z2 = d->
giveDofManager( newNodeNumbers.
at(n2) )->giveCoordinates()->at(3);
642 double x3 = d->
giveDofManager( newNodeNumbers.
at(n3) )->giveCoordinates()->at(1);
643 double y3 = d->
giveDofManager( newNodeNumbers.
at(n3) )->giveCoordinates()->at(2);
644 double z3 = d->
giveDofManager( newNodeNumbers.
at(n3) )->giveCoordinates()->at(3);
645 double x4 = d->
giveDofManager( newNodeNumbers.
at(n4) )->giveCoordinates()->at(1);
646 double y4 = d->
giveDofManager( newNodeNumbers.
at(n4) )->giveCoordinates()->at(2);
647 double z4 = d->
giveDofManager( newNodeNumbers.
at(n4) )->giveCoordinates()->at(3);
648 double detJ = ( x4 - x1 ) * ( y2 - y1 ) * ( z3 - z1 ) - ( x4 - x1 ) * ( y3 - y1 ) * ( z2 - z1 ) + ( x3 - x1 ) * ( y4 - y1 ) * ( z2 - z1 ) - ( x2 - x1 ) * ( y4 - y1 ) * ( z3 - z1 ) + ( x2 - x1 ) * ( y3 - y1 ) * ( z4 - z1 ) - ( x3 - x1 ) * ( y2 - y1 ) * ( z4 - z1 );
650 OOFEM_WARNING(
"%d-th interpolation element degenerates to negative volume", i);
654 OkmeshNodes.
at(1) = newNodeNumbers.
at(n1);
655 OkmeshNodes.
at(2) = newNodeNumbers.
at(n2);
656 OkmeshNodes.
at(3) = newNodeNumbers.
at(n3);
657 OkmeshNodes.
at(4) = newNodeNumbers.
at(n4);
658 newMeshNodes.push_back(OkmeshNodes);
674 double totalVolume = 0.;
685 totalVolume += volume / th;
688 }
else if ( dim == 3 ) {
694 totalVolume += volume;
698 OOFEM_ERROR(
"Invalid number of dimensions. Only 2d and 3d domains are supported in QC simulation. \n");
709 double minDistance = 1.0e100;
715 if ( distance < minDistance ) {
716 minDistance = distance;
723 OOFEM_ERROR(
"Neares particle for point [%d, %d] not found", coords.
at(1), coords.
at(2) );
742 for (
int i = 1; i <= nodeList.
giveSize(); i++ ) {
755 for (
int i = 1; i <= elemList.
giveSize(); i++ ) {
757 if ( elemList.
at(i) == 1 ) {
CrossSection * giveCrossSection()
void applyApproach3(Domain *d, int homMtrxType)
virtual bool nodeInFullSolvedDomainTest(Node *n)
#define _IFT_QuasiContinuum_generate_Links
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
QCFullsolveddomain Fullsolveddomain
#define _IFT_QuasiContinuum_t3d_File_Name
virtual int giveQcNodeType()
int interpolationElementsMaterialNumber
virtual void setRepNodesInVerticesOfInterpolationMesh(Domain *d)
General simplification for Quasicontinuum simulation.
void applyApproach1(Domain *d)
Information about fullsolved domain in CQ simulation.
int giveGlobalNumber() const
virtual IRResultType initializeFrom(InputRecord *ir)
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
virtual void solveYourself()
Starts solution process.
double & at(int i)
Coefficient access function.
bool giveIsInitializedFlag()
int giveGlobalNumber() const
void setActivatedNodeList(IntArray nodeList, Domain *d)
#define _IFT_QuasiContinuum_mtrx_type
virtual void solveYourselfAt(TimeStep *tStep)
Solves problem for given time step.
FloatArray FullSolvedDomainBox
virtual FloatArray * giveCoordinates()
bool isParallel() const
Returns true if receiver in parallel mode.
#define _IFT_QuasiContinuum_T3D_Interpolation_Mesh_size
Base class for dof managers.
int giveNumberOfProcesses() const
Returns the number of collaborating processes.
void createInterpolationElements(Domain *d)
int giveNumberOfElements() const
Returns number of elements in domain.
virtual void setAsRepnode()
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
virtual ~QClinearStatic()
#define _IFT_QuasiContinuum_generate_Interpolation_Elements
REGISTER_EngngModel(ProblemSequence)
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual int giveNumberOfDofManagers() const
void setupInterpolationMesh(Domain *d, int generateInterpolationElements, int interpolationElementsMaterialNumber, std::vector< IntArray > *newMeshNodes)
QClinearStatic(int i, EngngModel *_master=NULL)
virtual void createInterpolationMeshNodes(Domain *d)
int generateInterpolationElements
virtual double computeVolumeAreaOrLength()
Computes the volume, area or length of the element depending on its spatial dimension.
virtual void postInitialize()
Performs post-initialization for all the problem contents (which is called after initializeFrom).
double distance(const FloatArray &x) const
Computes the distance between position represented by receiver and position given as parameter...
QuasicontinuumNumberingscheme * qcEquationNumbering
int numberOfIntepolationElements
#define _IFT_FullSolvedDomain_radius
IRResultType initializeLinkGenerator(InputRecord *ir)
virtual DofManager * findNearestParticle(Domain *d, FloatArray coords)
virtual void setAsHanging()
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description in input reader.
#define _IFT_QuasiContinuum_approach
Element * giveElement(int n)
Service for accessing particular domain fe element.
void setActivatedElementList(IntArray elemList)
#define _IFT_QuasiContinuum_interp_Mat_Number
virtual void init(Domain *domain, std::vector< bool > activatedNodeList, TimeStep *tStep)
Initializes the receiver.
Class implementing hanging node connected to other nodes (masters) using interpolation.
ProblemCommunicator * communicator
Communicator.
virtual void solveYourself()
Starts solution process.
CommunicatorBuff * commBuff
Common Communicator buffer.
double defaultT3DMeshSize
void setNoDimensions(Domain *d)
virtual void postInitialize()
Performs post-initialization for all the problem contents (which is called after initializeFrom).
std::vector< bool > activatedElementList
virtual std::vector< IntArray > transformMeshToParticles(Domain *d, std::vector< FloatArray > &nodeCoords, std::vector< IntArray > &meshNodes)
void resize(int n)
Checks size of receiver towards requested bounds.
#define _IFT_FullSolvedDomain_elements
FloatArray FullSolvedDomainNodes
virtual DofManager * giveInternalDofManager(int i) const
Returns i-th internal element dof manager of the receiver.
void applyApproach2(Domain *d, int homMtrxType, double volumeOfInterpolationMesh)
Initializes the variable VERBOSE, in order to get a few intermediate messages on screen: beginning an...
virtual std::vector< IntArray > generateInterpolationMesh(Domain *d)
Class representing vector of real numbers.
int homogenizationMtrxType
virtual void updateNodeTypes(Domain *d)
virtual void solveYourselfAt(TimeStep *tStep)
Solves problem for given time step.
IRResultType
Type defining the return values of InputRecord reading operations.
virtual double give(CrossSectionProperty a, GaussPoint *gp)
Returns the value of cross section property at given point.
#define _IFT_FullSolvedDomain_nodes
virtual QCFullsolveddomain * giveFullSolvedDomain()
Returns Fullsolved domain to which receiver is associated.
double computeNorm() const
Computes the norm (or length) of the vector.
void addCrosssectionToInterpolationElements(Domain *d)
std::vector< IntArray > interpolationMeshNodes
This class implements linear static engineering problem.
IRResultType initializeParticleGenerator(InputRecord *ir)
#define _IFT_QuasiContinuum_generate_Particles
virtual int giveQcNodeType()
int giveRank() const
Returns domain rank in a group of collaborating processes (0..groupSize-1)
virtual double computeTotalVolumeOfInterpolationMesh(Domain *d)
virtual void setQCNodeType(Domain *d)
#define _IFT_FullSolvedDomain_box
Numbering scheme that takes into account only list of selected nodes.
FloatArray FullSolvedDomainElements
virtual FloatArray * giveCoordinates()
The Communicator and corresponding buffers (represented by this class) are separated in order to allo...
Abstract base class representing the "problem" under consideration.
FloatArray FullSolvedDomainRadius
int giveSize() const
Returns the size of receiver.
Node * giveNode(int n)
Service for accessing particular domain node.
the oofem namespace is to define a context or scope in which all oofem names are defined.
DofManager * giveDofManager(int i) const
Domain * giveDomain(int n)
Service for accessing particular problem domain.
std::vector< bool > activatedNodeList
Class implementing node in finite element mesh.
virtual std::vector< IntArray > loadInterpolationMesh(Domain *d)
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
virtual IRResultType initializeFullSolvedDomain(InputRecord *ir)
#define OOFEM_WARNING(...)
Class representing solution step.
This class represents the interface to t3d mesh generation package.
int createQCInterpolationMesh(const char *t3dOutFile, std::vector< FloatArray > &nodeCoords, std::vector< IntArray > &cellNodes, IntArray &cellTypes)
Generate random geometry of particles and links for CQ simulation.
void resize(int s)
Resizes receiver towards requested size.