Skip to content

Commit

Permalink
Merge pull request KratosMultiphysics#757 from KratosMultiphysics/add…
Browse files Browse the repository at this point in the history
…-testcases-beamtruss

Add testcases beamtruss
  • Loading branch information
KlausBSautter authored Oct 19, 2017
2 parents 7b76182 + 3a68b44 commit f78eb3f
Show file tree
Hide file tree
Showing 27 changed files with 5,548 additions and 3,219 deletions.
3,892 changes: 1,911 additions & 1,981 deletions applications/StructuralMechanicsApplication/custom_elements/cr_beam_element_3D2N.cpp

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,191 +1,177 @@
// ==============================================================================
/*
TRUSS_ELEMENT_3D2N
Main author: Klaus B. Sautter
[email protected]
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following condition:
Distribution of this code for any commercial purpose is permissible
ONLY BY DIRECT ARRANGEMENT WITH THE COPYRIGHT OWNERS.
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//==============================================================================

/* ****************************************************************************
* Projectname: $TRUSS_ELEMENT_3D2N
* Last Modified by: $Author: [email protected] $
* Date: $Date: April 2017 $
* Revision: $Revision: 1.0 $
* ***************************************************************************/

#if !defined(KRATOS_TRUSS_ELEMENT_3D2N_H_INCLUDED )
#define KRATOS_TRUSS_ELEMENT_3D2N_H_INCLUDED


#include "includes/element.h"
#include "includes/define.h"
#include "includes/variables.h"

namespace Kratos
{

class TrussElement3D2N : public Element
{
public:
KRATOS_CLASS_POINTER_DEFINITION(TrussElement3D2N);


typedef Element BaseType;
typedef BaseType::GeometryType GeometryType;
typedef BaseType::NodesArrayType NodesArrayType;
typedef BaseType::PropertiesType PropertiesType;
typedef BaseType::IndexType IndexType;
typedef BaseType::SizeType SizeType;
typedef BaseType::MatrixType MatrixType;
typedef BaseType::VectorType VectorType;
typedef BaseType::EquationIdVectorType EquationIdVectorType;
typedef BaseType::DofsVectorType DofsVectorType;


TrussElement3D2N(IndexType NewId,
GeometryType::Pointer pGeometry,
bool rLinear = false);
TrussElement3D2N(IndexType NewId,
GeometryType::Pointer pGeometry,
PropertiesType::Pointer pProperties,
bool rLinear = false);


~TrussElement3D2N() override;


BaseType::Pointer Create(
IndexType NewId,
NodesArrayType const& rThisNodes,
PropertiesType::Pointer pProperties) const override;

void EquationIdVector(
EquationIdVectorType& rResult,
ProcessInfo& rCurrentProcessInfo) override;

void GetDofList(
DofsVectorType& rElementalDofList,
ProcessInfo& rCurrentProcessInfo) override;

void Initialize() override;

MatrixType CreateElementStiffnessMatrix();

void CalculateOnIntegrationPoints(
const Variable<double>& rVariable,
std::vector<double>& rOutput,
const ProcessInfo& rCurrentProcessInfo) override;

void GetValueOnIntegrationPoints(
const Variable<double>& rVariable,
std::vector<double>& rValues,
const ProcessInfo& rCurrentProcessInfo) override;

void UpdateInternalForces(
VectorType& rinternalForces);
void CreateTransformationMatrix(
Matrix& rRotationMatrix);
double CalculateCurrentLength();

void CalculateOnIntegrationPoints(
const Variable<Vector>& rVariable,
std::vector<Vector>& rOutput,
const ProcessInfo& rCurrentProcessInfo) override;

void GetValueOnIntegrationPoints(
const Variable<Vector>& rVariable,
std::vector<Vector>& rValues,
const ProcessInfo& rCurrentProcessInfo) override;

void CalculateLocalSystem(
MatrixType& rLeftHandSideMatrix,
VectorType& rRightHandSideVector,
ProcessInfo& rCurrentProcessInfo) override;


void CalculateRightHandSide(
VectorType& rRightHandSideVector,
ProcessInfo& rCurrentProcessInfo) override;

void CalculateLeftHandSide(
MatrixType& rLeftHandSideMatrix,
ProcessInfo& rCurrentProcessInfo) override;

void CalculateMassMatrix(
MatrixType& rMassMatrix,
ProcessInfo& rCurrentProcessInfo) override;

void CalculateDampingMatrix(
MatrixType& rDampingMatrix,
ProcessInfo& rCurrentProcessInfo) override;


void AddExplicitContribution(const VectorType& rRHSVector,
const Variable<VectorType>& rRHSVariable,
Variable<array_1d<double, 3> >& rDestinationVariable,
const ProcessInfo& rCurrentProcessInfo) override;


void GetValuesVector(
Vector& rValues,
int Step = 0) override;

void GetSecondDerivativesVector(
Vector& rValues,
int Step = 0) override;

void GetFirstDerivativesVector(
Vector& rValues,
int Step = 0) override;

int Check(
const ProcessInfo& rCurrentProcessInfo) override;


double CalculateGreenLagrangeStrain();
double CalculateReferenceLength();

VectorType CalculateBodyForces();

bool ReturnIfIsCable();



private:
bool mIsCompressed;
bool mIsLinearElement = false;

TrussElement3D2N() {};

friend class Serializer;
void save(Serializer& rSerializer) const override;
void load(Serializer& rSerializer) override;
};


}


#endif
// KRATOS ___| | | |
// \___ \ __| __| | | __| __| | | __| _` | |
// | | | | | ( | | | | ( | |
// _____/ \__|_| \__,_|\___|\__|\__,_|_| \__,_|_| MECHANICS
//
// License: BSD License
// license: structural_mechanics_application/license.txt
//
// Main authors: Klaus B. Sautter
//
//
//

#if !defined(KRATOS_TRUSS_ELEMENT_3D2N_H_INCLUDED )
#define KRATOS_TRUSS_ELEMENT_3D2N_H_INCLUDED

// System includes

// External includes

// Project includes
#include "includes/element.h"
#include "includes/define.h"
#include "includes/variables.h"

namespace Kratos
{
class TrussElement3D2N : public Element
{
private:
//const values
static constexpr int msNumberOfNodes = 2;
static constexpr int msDimension = 3;
static constexpr unsigned int msLocalSize = msNumberOfNodes * msDimension;
public:
KRATOS_CLASS_POINTER_DEFINITION(TrussElement3D2N);


typedef Element BaseType;
typedef BaseType::GeometryType GeometryType;
typedef BaseType::NodesArrayType NodesArrayType;
typedef BaseType::PropertiesType PropertiesType;
typedef BaseType::IndexType IndexType;
typedef BaseType::SizeType SizeType;
typedef BaseType::MatrixType MatrixType;
typedef BaseType::VectorType VectorType;
typedef BaseType::EquationIdVectorType EquationIdVectorType;
typedef BaseType::DofsVectorType DofsVectorType;


TrussElement3D2N(IndexType NewId,
GeometryType::Pointer pGeometry,
bool rLinear = false);
TrussElement3D2N(IndexType NewId,
GeometryType::Pointer pGeometry,
PropertiesType::Pointer pProperties,
bool rLinear = false);


~TrussElement3D2N() override;


BaseType::Pointer Create(
IndexType NewId,
NodesArrayType const& rThisNodes,
PropertiesType::Pointer pProperties) const override;

void EquationIdVector(
EquationIdVectorType& rResult,
ProcessInfo& rCurrentProcessInfo) override;

void GetDofList(
DofsVectorType& rElementalDofList,
ProcessInfo& rCurrentProcessInfo) override;

void Initialize() override;

bounded_matrix<double,msLocalSize,msLocalSize> CreateElementStiffnessMatrix(ProcessInfo& rCurrentProcessInfo);

void CalculateOnIntegrationPoints(
const Variable<double>& rVariable,
std::vector<double>& rOutput,
const ProcessInfo& rCurrentProcessInfo) override;

void GetValueOnIntegrationPoints(
const Variable<double>& rVariable,
std::vector<double>& rValues,
const ProcessInfo& rCurrentProcessInfo) override;

void UpdateInternalForces(bounded_vector<double,msLocalSize>& rinternalForces);
void CreateTransformationMatrix(bounded_matrix<double,msLocalSize,msLocalSize>& rRotationMatrix);
double CalculateCurrentLength();

void CalculateOnIntegrationPoints(
const Variable<Vector>& rVariable,
std::vector<Vector>& rOutput,
const ProcessInfo& rCurrentProcessInfo) override;

void GetValueOnIntegrationPoints(
const Variable<Vector>& rVariable,
std::vector<Vector>& rValues,
const ProcessInfo& rCurrentProcessInfo) override;

void CalculateLocalSystem(
MatrixType& rLeftHandSideMatrix,
VectorType& rRightHandSideVector,
ProcessInfo& rCurrentProcessInfo) override;


void CalculateRightHandSide(
VectorType& rRightHandSideVector,
ProcessInfo& rCurrentProcessInfo) override;

void CalculateLeftHandSide(
MatrixType& rLeftHandSideMatrix,
ProcessInfo& rCurrentProcessInfo) override;

void CalculateMassMatrix(
MatrixType& rMassMatrix,
ProcessInfo& rCurrentProcessInfo) override;

void CalculateDampingMatrix(
MatrixType& rDampingMatrix,
ProcessInfo& rCurrentProcessInfo) override;


void AddExplicitContribution(const VectorType& rRHSVector,
const Variable<VectorType>& rRHSVariable,
Variable<array_1d<double, 3> >& rDestinationVariable,
const ProcessInfo& rCurrentProcessInfo) override;


void GetValuesVector(
Vector& rValues,
int Step = 0) override;

void GetSecondDerivativesVector(
Vector& rValues,
int Step = 0) override;

void GetFirstDerivativesVector(
Vector& rValues,
int Step = 0) override;

int Check(
const ProcessInfo& rCurrentProcessInfo) override;


double CalculateGreenLagrangeStrain();
double CalculateReferenceLength();

bounded_vector<double,msLocalSize> CalculateBodyForces();

bool ReturnIfIsCable();

void CalculateGeometricStiffnessMatrix(bounded_matrix<double,msLocalSize,msLocalSize>& rGeometricStiffnessMatrix,
ProcessInfo& rCurrentProcessInfo);

void CalculateElasticStiffnessMatrix(bounded_matrix<double,msLocalSize,msLocalSize>& rElasticStiffnessMatrix,
ProcessInfo& rCurrentProcessInfo);


private:
bool mIsCompressed;
bool mIsLinearElement = false;
TrussElement3D2N() {};

friend class Serializer;
void save(Serializer& rSerializer) const override;
void load(Serializer& rSerializer) override;
};


}


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,18 @@ namespace Kratos
KRATOS_DEFINE_APPLICATION_VARIABLE(STRUCTURAL_MECHANICS_APPLICATION,Vector, ORTHOTROPIC_FIBER_ORIENTATION_1)

// Truss generalized variables
KRATOS_DEFINE_VARIABLE( double, TRUSS_PRESTRESS_PK2 )
KRATOS_DEFINE_VARIABLE( bool, TRUSS_IS_CABLE )
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,double, TRUSS_PRESTRESS_PK2)
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,bool, TRUSS_IS_CABLE)


// Beam generalized variables
KRATOS_DEFINE_VARIABLE(double, AREA_EFFECTIVE_Y)
KRATOS_DEFINE_VARIABLE(double, AREA_EFFECTIVE_Z)
KRATOS_DEFINE_VARIABLE(double, INERTIA_ROT_Y)
KRATOS_DEFINE_VARIABLE(double, INERTIA_ROT_Z)
KRATOS_DEFINE_VARIABLE(Vector, LOCAL_AXES_VECTOR)
KRATOS_DEFINE_VARIABLE(bool, LUMPED_MASS_MATRIX)
KRATOS_DEFINE_VARIABLE(Vector, LOCAL_INERTIA_VECTOR)
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,double, AREA_EFFECTIVE_Y)
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,double, AREA_EFFECTIVE_Z)
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,double, INERTIA_ROT_Y)
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,double, INERTIA_ROT_Z)
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,Vector, LOCAL_AXES_VECTOR)
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,bool, LUMPED_MASS_MATRIX)
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION,Vector, LOCAL_INERTIA_VECTOR)

// Shell generalized variables
KRATOS_DEFINE_APPLICATION_VARIABLE( STRUCTURAL_MECHANICS_APPLICATION, Matrix, SHELL_STRAIN )
Expand Down
Loading

0 comments on commit f78eb3f

Please sign in to comment.