Пример #1
0
        /**
        *Checks shape functions and shape function derivatives
        */
        bool CheckShapeFunctions ()
        {
            if(!mpShapeFunctionsValues)
                KRATOS_THROW_ERROR(std::invalid_argument,"ShapeFunctionsValues NOT SET","");

            if(!mpShapeFunctionsDerivatives)
                KRATOS_THROW_ERROR(std::invalid_argument,"ShapeFunctionsDerivatives NOT SET","");

            return 1;
        }
Пример #2
0
        /**
        *Check deformation gradient, strains ans stresses assigned
        */
        bool CheckMechanicalVariables ()
        {
            if(!mpGeneralizedStrainVector)
                KRATOS_THROW_ERROR(std::invalid_argument,"GenralizedStrainVector NOT SET","");

            if(!mpGeneralizedStressVector)
                KRATOS_THROW_ERROR(std::invalid_argument,"GenralizedStressVector NOT SET","");

            if(!mpConstitutiveMatrix)
                KRATOS_THROW_ERROR(std::invalid_argument,"ConstitutiveMatrix NOT SET","");

            return 1;
        }
Пример #3
0
        /**
        *Checks currentprocessinfo, material properties and geometry
        */
        bool CheckInfoMaterialGeometry ()
        {
            if(!mpCurrentProcessInfo)
                KRATOS_THROW_ERROR(std::invalid_argument,"CurrentProcessInfo NOT SET","");

            if(!mpMaterialProperties)
                KRATOS_THROW_ERROR(std::invalid_argument,"MaterialProperties NOT SET","");

            if(!mpElementGeometry)
                KRATOS_THROW_ERROR(std::invalid_argument,"ElementGeometry NOT SET","");

            return 1;
        }
Пример #4
0
int SimoJuNonlocalDamagePlaneStrain2DLaw::Check(const Properties& rMaterialProperties,const GeometryType& rElementGeometry,const ProcessInfo& rCurrentProcessInfo)
{
    int ierr = NonlocalDamage3DLaw::Check(rMaterialProperties,rElementGeometry,rCurrentProcessInfo);
    if(ierr != 0) return ierr;

    if(DAMAGE_THRESHOLD.Key() == 0 || rMaterialProperties.Has( DAMAGE_THRESHOLD ) == false || rMaterialProperties[DAMAGE_THRESHOLD] <= 0.0)
        KRATOS_THROW_ERROR( std::invalid_argument,"DAMAGE_THRESHOLD has Key zero, is not defined or has an invalid value for property", rMaterialProperties.Id() )
    if(STRENGTH_RATIO.Key() == 0 || rMaterialProperties.Has( STRENGTH_RATIO ) == false || rMaterialProperties[STRENGTH_RATIO] <= 0.0)
        KRATOS_THROW_ERROR( std::invalid_argument,"STRENGTH_RATIO has Key zero, is not defined or has an invalid value for property", rMaterialProperties.Id() )
    if(FRACTURE_ENERGY.Key() == 0 || rMaterialProperties.Has( FRACTURE_ENERGY ) == false || rMaterialProperties[FRACTURE_ENERGY] <= 0.0)
        KRATOS_THROW_ERROR( std::invalid_argument,"FRACTURE_ENERGY has Key zero, is not defined or has an invalid value for property", rMaterialProperties.Id() )

    return ierr;
}
Пример #5
0
Vector& Isotropic3D::GetValue( const Variable<Vector>& rThisVariable, Vector& rValue )
{
    if ( rThisVariable == INSITU_STRESS || rThisVariable == PRESTRESS )
    {
        const unsigned int size = mPrestress.size();
        if(rValue.size() != size)
            rValue.resize(size, false );
        noalias(rValue) = mPrestressFactor * mPrestress;
        return rValue;
    }

    if ( rThisVariable == STRESSES )
    {
        const unsigned int size = mCurrentStress.size();
        rValue.resize(size, false );
        rValue  = mCurrentStress;
        return rValue;
    }
    if ( rThisVariable == PLASTIC_STRAIN_VECTOR )
    {
        rValue = ZeroVector( 6 );
        return( rValue );
    }

    if ( rThisVariable == INTERNAL_VARIABLES )
    {
        rValue = ZeroVector( 1 );
        return( rValue );
    }

    KRATOS_THROW_ERROR( std::logic_error, "Vector Variable case not considered", "" );
}
void TwoStepPeriodicCondition<TDim>::GetDofList(DofsVectorType& rElementalDofList, ProcessInfo& rCurrentProcessInfo)
{
    KRATOS_TRY;

    switch ( rCurrentProcessInfo[FRACTIONAL_STEP] )
    {
    case 1:
    {
        this->GetVelocityDofList(rElementalDofList,rCurrentProcessInfo);
        break;
    }
    case 5:
    {
        this->GetPressureDofList(rElementalDofList,rCurrentProcessInfo);
        break;
    }
    case 6:
    {
        this->GetVelocityDofList(rElementalDofList,rCurrentProcessInfo);
        break;
    }
    default:
    {
        KRATOS_THROW_ERROR(std::logic_error,"Unexpected value for FRACTIONAL_STEP index: ",rCurrentProcessInfo[FRACTIONAL_STEP]);
    }
    }

    KRATOS_CATCH("");
}
void Isotropic_Rankine_Yield_Function::GetValue(Matrix& Result)
{
    m_inv_DeltaF.resize(3,3, false);
    noalias(m_inv_DeltaF) = ZeroMatrix(3,3);
    switch(mState)
    {
    case Plane_Stress:
    {
        KRATOS_THROW_ERROR(std::logic_error,  "PLANE STRESS NOT IMPLEMENTED" , "");
        break;
    }
    case Plane_Strain:
    {
        m_inv_DeltaF(0,0)    = Result(0,0);
        m_inv_DeltaF(0,1)    = Result(0,1);
        m_inv_DeltaF(1,0)    = Result(1,0);
        m_inv_DeltaF(1,1)    = Result(1,1);
        m_inv_DeltaF(2,2)    = 1.00;
        break;
    }

    case Tri_D:
    {
        noalias(m_inv_DeltaF) = Result;
        break;
    }

    }
}
Пример #8
0
void RveGeometryDescriptor::FindCornerNodes_2D(ModelPart& modelPart)
{
	m_corner_nodes.resize(4);

	double x_min =  std::numeric_limits<double>::max();
	double x_max = -x_min;
	double y_min =  x_min;
	double y_max = -x_min;

	for(ModelPart::NodeConstantIterator it = modelPart.NodesBegin(); it != modelPart.NodesEnd(); ++it)
	{
		const NodePointerType& inode = *(it.base());
		double ix = inode->X0();
		double iy = inode->Y0();
		x_min = std::min(x_min, ix);
		y_min = std::min(y_min, iy);
		x_max = std::max(x_max, ix);
		y_max = std::max(y_max, iy);
	}

	double lx = x_max - x_min;
	double ly = y_max - y_min;

	double toleranceX = RveUtilities::Precision() * lx;
	double toleranceY = RveUtilities::Precision() * ly;

	for(ModelPart::NodeConstantIterator it = modelPart.NodesBegin(); it != modelPart.NodesEnd(); ++it)
	{
		const NodePointerType& inode = *(it.base());

		double ix = inode->X0();
		double iy = inode->Y0();

		if((ix - x_min) <= toleranceX)
		{
			if((iy - y_min) <= toleranceY)
				m_corner_nodes[0] = inode;
			else if((y_max - iy) <= toleranceY)
				m_corner_nodes[3] = inode;
		}
		else if((x_max - ix) <= toleranceX)
		{
			if((iy - y_min) <= toleranceY)
				m_corner_nodes[1] = inode;
			else if((y_max - iy) <= toleranceY)
				m_corner_nodes[2] = inode;
		}
	}

	for(size_t i = 0; i < m_corner_nodes.size(); i++)
	{
		if(m_corner_nodes[i] == NULL)
		{
			KRATOS_TRY
				std::cout << "Cannot auto-find corner nodes: this mesh is distorted" << std::endl;
				KRATOS_THROW_ERROR(std::logic_error, "Cannot auto-find corner nodes: this mesh is distorted","");
			KRATOS_CATCH("")
		}
	}
Пример #9
0
int LinearElastic3DLaw::Check(const Properties& rMaterialProperties,
                              const GeometryType& rElementGeometry,
                              const ProcessInfo& rCurrentProcessInfo)
{

    if(YOUNG_MODULUS.Key() == 0 || rMaterialProperties[YOUNG_MODULUS]<= 0.00)
        KRATOS_THROW_ERROR( std::invalid_argument,"YOUNG_MODULUS has Key zero or invalid value ", "" )

    const double& nu = rMaterialProperties[POISSON_RATIO];
    const bool check = bool( (nu >0.499 && nu<0.501 ) || (nu < -0.999 && nu > -1.01 ) );

    if(POISSON_RATIO.Key() == 0 || check==true)
        KRATOS_THROW_ERROR( std::invalid_argument,"POISSON_RATIO has Key zero invalid value ", "" )


    if(DENSITY.Key() == 0 || rMaterialProperties[DENSITY]<0.00)
        KRATOS_THROW_ERROR( std::invalid_argument,"DENSITY has Key zero or invalid value ", "" )


    return 0;

}
Пример #10
0
    boost::python::object AuxiliaryUtilities::GetIthSubModelPartIsForceIntegrationGroup(ModelPart& rParentModelPart, const int& required_i){
        KRATOS_TRY;                             
        int current_i = 0;
        for (ModelPart::SubModelPartsContainerType::iterator sub_model_part = rParentModelPart.SubModelPartsBegin(); sub_model_part != rParentModelPart.SubModelPartsEnd(); ++sub_model_part) {

            if(current_i == required_i) {
                const int is_force_integration_group = (*sub_model_part)[FORCE_INTEGRATION_GROUP];
                return boost::python::object( (bool) (is_force_integration_group) );
            }
            current_i++;
        }

        KRATOS_THROW_ERROR(std::runtime_error, "The function GetIthSubModelPartIsForceIntegrationGroup required a position greater than the number of SubModelParts! The number of present submodelparts is ", rParentModelPart.NumberOfSubModelParts());
        
        KRATOS_CATCH("");        
    };
Пример #11
0
    boost::python::object AuxiliaryUtilities::GetIthSubModelPartName(ModelPart& rParentModelPart, const int& required_i){
        KRATOS_TRY;                             
        int current_i = 0;
        for (ModelPart::SubModelPartsContainerType::iterator sub_model_part = rParentModelPart.SubModelPartsBegin(); sub_model_part != rParentModelPart.SubModelPartsEnd(); ++sub_model_part) {

            if(current_i == required_i) {
                const std::string& name = (*sub_model_part).Name();
                return boost::python::object(name);
            }
            current_i++;
        }

        KRATOS_THROW_ERROR(std::runtime_error, "The function GetIthSubModelPartName required a position greater than the number of SubModelParts! The number of present submodelparts is ", rParentModelPart.NumberOfSubModelParts());
        
        KRATOS_CATCH("");  
    };
Пример #12
0
    ModelPart::NodesContainerType::Pointer AuxiliaryUtilities::GetIthSubModelPartNodes(ModelPart& rParentModelPart, const int& required_i){
        KRATOS_TRY; 
        
        int current_i = 0;
        for (ModelPart::SubModelPartsContainerType::iterator sub_model_part = rParentModelPart.SubModelPartsBegin(); sub_model_part != rParentModelPart.SubModelPartsEnd(); ++sub_model_part) {

            if(current_i == required_i) {
                return (*sub_model_part).pNodes();
            }
            
            current_i++;
        }

        KRATOS_THROW_ERROR(std::runtime_error, "The function GetIthSubModelPartNodes required a position greater than the number of SubModelParts! The number of present submodelparts is ", rParentModelPart.NumberOfSubModelParts());
        
        KRATOS_CATCH("");  
        
    }       
Пример #13
0
    void ExplicitSolverStrategy::RepairPointersToNormalProperties(std::vector<SphericParticle*>& rCustomListOfSphericParticles) {
        KRATOS_TRY
        bool found = false;
        const int number_of_particles = (int) rCustomListOfSphericParticles.size();
        #pragma omp parallel for
        for (int i = 0; i < number_of_particles; i++) {

            int own_properties_id = rCustomListOfSphericParticles[i]->GetProperties().Id();

            for (PropertiesIterator props_it = mpDem_model_part->GetMesh(0).PropertiesBegin(); props_it != mpDem_model_part->GetMesh(0).PropertiesEnd(); props_it++) {
                int model_part_id = props_it->GetId();
                if (own_properties_id == model_part_id) {
                    rCustomListOfSphericParticles[i]->SetProperties(*(props_it.base()));
                    found = true;
                    break;
                }
            }

            if (found) continue;

            for (PropertiesIterator props_it = mpInlet_model_part->GetMesh(0).PropertiesBegin(); props_it != mpInlet_model_part->GetMesh(0).PropertiesEnd(); props_it++) {
                int model_part_id = props_it->GetId();
                if (own_properties_id == model_part_id) {
                    rCustomListOfSphericParticles[i]->SetProperties(*(props_it.base()));
                    found = true;
                    break;
                }
            }

            if (found) continue;

            for (PropertiesIterator props_it = mpCluster_model_part->GetMesh(0).PropertiesBegin(); props_it != mpCluster_model_part->GetMesh(0).PropertiesEnd(); props_it++) {
                int model_part_id = props_it->GetId();
                if (own_properties_id == model_part_id) {
                    rCustomListOfSphericParticles[i]->SetProperties(*(props_it.base()));
                    found = true;
                    break;
                }
            }

            if (!found) KRATOS_THROW_ERROR(std::logic_error, "This particle could not find its properties!!", "");
        }
        KRATOS_CATCH("")
    }
void AxisymUpdatedLagrangianElement::CalculateDeformationMatrix(Matrix& rB,
        Matrix& rDN_DX,
        Vector& rN,
        double & rCurrentRadius)
{
    KRATOS_TRY

    const unsigned int number_of_nodes = GetGeometry().PointsNumber();
    const unsigned int dimension       = GetGeometry().WorkingSpaceDimension();

    rB.clear(); //set all components to zero

    if( dimension == 2 )
    {

        for ( unsigned int i = 0; i < number_of_nodes; i++ )
        {
            unsigned int index = 2 * i;

            rB( 0, index + 0 ) = rDN_DX( i, 0 );
            rB( 1, index + 1 ) = rDN_DX( i, 1 );
            rB( 2, index + 0 ) = rN[i]/rCurrentRadius;
            rB( 3, index + 0 ) = rDN_DX( i, 1 );
            rB( 3, index + 1 ) = rDN_DX( i, 0 );

        }

    }
    else if( dimension == 3 )
    {

        std::cout<<" AXISYMMETRIC case and 3D is not possible "<<std::endl;

    }
    else
    {

        KRATOS_THROW_ERROR( std::invalid_argument, "something is wrong with the dimension", "" );

    }

    KRATOS_CATCH( "" )
}
Пример #15
0
	void MonolithicPFEM22D::AddExplicitContribution(ProcessInfo& rCurrentProcessInfo)
	{
		KRATOS_TRY;

		switch ( rCurrentProcessInfo[FRACTIONAL_STEP] )
		{
			case 10: //calculating pressure projection. notthing returned. saving data in PRESS_PROJ, PRESS_PROJ_NO_RO , NODAL_MASS and NODAL_AREA
			{
				this->CalculatePressureProjection(rCurrentProcessInfo);
				break;
			}			
			default:
			{
				KRATOS_THROW_ERROR(std::logic_error,"Unexpected value for FRACTIONAL_STEP index: ",rCurrentProcessInfo[FRACTIONAL_STEP]);
			}
		}

		KRATOS_CATCH("");
	}
void AxisymUpdatedLagrangianElement::CalculateGreenLagrangeStrain(const Matrix& rF,
        Vector& rStrainVector )
{
    KRATOS_TRY

    const unsigned int dimension  = GetGeometry().WorkingSpaceDimension();

    //Right Cauchy-Green Calculation
    Matrix C ( 3, 3 );
    noalias( C ) = prod( trans( rF ), rF );

    if( dimension == 2 )
    {

        //Green Lagrange Strain Calculation
        if ( rStrainVector.size() != 4 ) rStrainVector.resize( 4, false );

        rStrainVector[0] = 0.5 * ( C( 0, 0 ) - 1.00 );

        rStrainVector[1] = 0.5 * ( C( 1, 1 ) - 1.00 );

        rStrainVector[2] = 0.5 * ( C( 2, 2 ) - 1.00 );

        rStrainVector[3] = C( 0, 1 ); // xy

    }
    else if( dimension == 3 )
    {

        std::cout<<" AXISYMMETRIC case and 3D is not possible "<<std::endl;

    }
    else
    {

        KRATOS_THROW_ERROR( std::invalid_argument, "something is wrong with the dimension", "" );

    }

    KRATOS_CATCH( "" )
}
void AxisymUpdatedLagrangianElement::CalculateDeformationGradient(const Matrix& rDN_DX,
        Matrix&  rF,
        Matrix&  rDeltaPosition,
        double & rCurrentRadius,
        double & rReferenceRadius)
{
    KRATOS_TRY

    const unsigned int number_of_nodes = GetGeometry().PointsNumber();
    const unsigned int dimension       = GetGeometry().WorkingSpaceDimension();

    rF = identity_matrix<double> ( 3 );

    if( dimension == 2 )
    {

        for ( unsigned int i = 0; i < number_of_nodes; i++ )
        {
            rF ( 0 , 0 ) += rDeltaPosition(i,0)*rDN_DX ( i , 0 );
            rF ( 0 , 1 ) += rDeltaPosition(i,0)*rDN_DX ( i , 1 );
            rF ( 1 , 0 ) += rDeltaPosition(i,1)*rDN_DX ( i , 0 );
            rF ( 1 , 1 ) += rDeltaPosition(i,1)*rDN_DX ( i , 1 );
        }

        rF ( 2 , 2 ) = rCurrentRadius/rReferenceRadius;
    }
    else if( dimension == 3)
    {

        std::cout<<" AXISYMMETRIC case and 3D is not possible "<<std::endl;
    }
    else
    {

        KRATOS_THROW_ERROR( std::invalid_argument, "something is wrong with the dimension", "" );

    }

    KRATOS_CATCH( "" )
}
int PeriodicConditionLM2D2N::Check(const ProcessInfo& rCurrentProcessInfo)
{
	MyBase::Check(rCurrentProcessInfo);
	KRATOS_TRY

	GeometryType & geom = this->GetGeometry();
	
	if(geom.size() != 2) {
		std::stringstream ss;
		ss << "PeriodicConditionLM2D2N - The Geometry should have 2 nodes. Condition with ID = " << this->GetId();
		KRATOS_THROW_ERROR(std::logic_error, ss.str(), "");
	}
	
	//verify that the variables are correctly initialized
	if(DISPLACEMENT.Key() == 0)
		KRATOS_THROW_ERROR(std::invalid_argument,"DISPLACEMENT has Key zero! (check if the application is correctly registered","");

	if(DISPLACEMENT_LAGRANGE.Key() == 0)
		KRATOS_THROW_ERROR(std::invalid_argument,"DISPLACEMENT_LAGRANGE has Key zero! (check if the application is correctly registered","");

	//verify that the dofs exist
	for(unsigned int i = 0; i < 2; i++)
	{
		NodeType & iNode = geom[i];
		
		if(iNode.SolutionStepsDataHas(DISPLACEMENT) == false)
			KRATOS_THROW_ERROR(std::invalid_argument,"missing variable DISPLACEMENT on node ", iNode.Id());
			
		if(iNode.HasDofFor(DISPLACEMENT_X) == false || iNode.HasDofFor(DISPLACEMENT_Y) == false)
			KRATOS_THROW_ERROR(std::invalid_argument,"missing one of the dofs for the variable DISPLACEMENT on node ", iNode.Id());
			
		if(iNode.SolutionStepsDataHas(DISPLACEMENT_LAGRANGE) == false)
			KRATOS_THROW_ERROR(std::invalid_argument,"missing variable DISPLACEMENT_LAGRANGE on node ", iNode.Id());
			
		if(iNode.HasDofFor(DISPLACEMENT_LAGRANGE_X) == false || iNode.HasDofFor(DISPLACEMENT_LAGRANGE_Y) == false)
			KRATOS_THROW_ERROR(std::invalid_argument,"missing one of the dofs for the variable DISPLACEMENT_LAGRANGE on node ", iNode.Id());
	}

	KRATOS_CATCH("")
	return 0;
}
Element::Pointer AxisymUpdatedLagrangianElement::Clone( IndexType NewId, NodesArrayType const& rThisNodes ) const
{

    AxisymUpdatedLagrangianElement NewElement(NewId, GetGeometry().Create( rThisNodes ), pGetProperties() );

    //-----------//

    NewElement.mThisIntegrationMethod = mThisIntegrationMethod;

    if ( NewElement.mConstitutiveLawVector.size() != mConstitutiveLawVector.size() )
      {
	NewElement.mConstitutiveLawVector.resize(mConstitutiveLawVector.size());
	
	if( NewElement.mConstitutiveLawVector.size() != NewElement.GetGeometry().IntegrationPointsNumber() )
	  KRATOS_THROW_ERROR( std::logic_error, "constitutive law not has the correct size ", NewElement.mConstitutiveLawVector.size() );
      }
    

    for(unsigned int i=0; i<mConstitutiveLawVector.size(); i++)
      {
	NewElement.mConstitutiveLawVector[i] = mConstitutiveLawVector[i]->Clone();
      }

    //-----------//

    if ( NewElement.mDeformationGradientF0.size() != mDeformationGradientF0.size() )
      NewElement.mDeformationGradientF0.resize(mDeformationGradientF0.size());

    for(unsigned int i=0; i<mDeformationGradientF0.size(); i++)
    {
        NewElement.mDeformationGradientF0[i] = mDeformationGradientF0[i];
    }

    NewElement.mDeterminantF0 = mDeterminantF0;

        
    return Element::Pointer( new AxisymUpdatedLagrangianElement(NewElement) );
}
Пример #20
0
//************************************************************************************
//************************************************************************************
void NDFluid2DCrankNicolson::CalculateRightHandSide(VectorType& rRightHandSideVector, ProcessInfo& rCurrentProcessInfo)
{
    KRATOS_THROW_ERROR(std::logic_error,  "method not implemented" , "");
}
    /** functions totally analogous to the precedent but applied to
          the "condition" objects
    */
    void Condition_CalculateSystemContributions(
        Condition::Pointer rCurrentCondition,
        LocalSystemMatrixType& rLHS_Contribution,
        LocalSystemVectorType& rRHS_Contribution,
        Element::EquationIdVectorType& rEquationId,
        ProcessInfo& rCurrentProcessInfo)
    {


        KRATOS_TRY

        int thread = OpenMPUtils::ThisThread();

        //Initializing the non linear iteration for the current element
        //(rCurrentCondition) -> InitializeNonLinearIteration(CurrentProcessInfo);

	bool LHS_Condition_Components_Set = mLocalSystem.Are_LHS_Condition_Components_Set();
	std::vector<LocalSystemMatrixType>& rLHS_Components = mLocalSystem.GetLHS_Condition_Components();
	const std::vector< Variable< LocalSystemMatrixType > >& rLHS_Variables = mLocalSystem.GetLHS_Condition_Variables();

	bool RHS_Condition_Components_Set = mLocalSystem.Are_RHS_Condition_Components_Set();
	std::vector<LocalSystemVectorType>& rRHS_Components = mLocalSystem.GetRHS_Condition_Components();
	const std::vector< Variable< LocalSystemVectorType > >& rRHS_Variables = mLocalSystem.GetRHS_Condition_Variables();

	if( LHS_Condition_Components_Set && RHS_Condition_Components_Set )
	  {

	    //basic operations for the element considered
	    (rCurrentCondition) -> CalculateLocalSystem(rLHS_Components, rLHS_Variables, rRHS_Components, rRHS_Variables, rCurrentProcessInfo);

	    if( rLHS_Contribution.size1() != rLHS_Components[0].size1() )
	      rLHS_Contribution.resize(rLHS_Components[0].size1(), rLHS_Components[0].size2());	

	    rLHS_Contribution.clear();

	    for( unsigned int i=0; i<rLHS_Components.size(); i++ )
	      {	    
		rLHS_Contribution += rLHS_Components[i];
	      }
	
	    if( rRHS_Contribution.size() != rRHS_Components[0].size() )
	      rRHS_Contribution.resize(rRHS_Components[0].size());

	    rRHS_Contribution.clear();
		
	    for( unsigned int i=0; i<rRHS_Components.size(); i++ )
	      {
		rRHS_Contribution += rRHS_Components[i];

		if( rRHS_Variables[i] == CONTACT_FORCES_VECTOR ){
		  //add explicit components to nodes
		  (rCurrentCondition) -> AddExplicitContribution(rRHS_Components[i], rRHS_Variables[i], CONTACT_FORCE, rCurrentProcessInfo);
		}
	      }

	  }
	else
	  {
	    if( !LHS_Condition_Components_Set && RHS_Condition_Components_Set )
	      {
		(rCurrentCondition) -> CalculateRightHandSide(rRHS_Components, rRHS_Variables, rCurrentProcessInfo);

		(rCurrentCondition) -> CalculateLeftHandSide(rLHS_Contribution, rCurrentProcessInfo);
		
		if( rRHS_Contribution.size() != rRHS_Components[0].size() )
		  rRHS_Contribution.resize(rRHS_Components[0].size());

		rRHS_Contribution.clear();

		for( unsigned int i=0; i<rRHS_Components.size(); i++ )
		  {
		    rRHS_Contribution += rRHS_Components[i];

		    if( rRHS_Variables[i] == CONTACT_FORCES_VECTOR ){
		      //add explicit components to nodes
		      (rCurrentCondition) -> AddExplicitContribution(rRHS_Components[i], rRHS_Variables[i], CONTACT_FORCE, rCurrentProcessInfo);
		    }
		    
		    //std::cout<<" Condition ["<<(rCurrentCondition) -> Id()<<"] :"<<rRHS_Contribution<<" and "<<rRHS_Components[i]<<std::endl;
		  }

		

	      }
	    else if ( LHS_Condition_Components_Set && !RHS_Condition_Components_Set )
	      {
		
		KRATOS_THROW_ERROR( std::logic_error, " scheme asks for a unusual Condition LHS components not implemented ", "" )

		(rCurrentCondition) -> CalculateLeftHandSide(rLHS_Components, rLHS_Variables, rCurrentProcessInfo);

		(rCurrentCondition) -> CalculateRightHandSide(rRHS_Contribution, rCurrentProcessInfo);
		
		if( rLHS_Contribution.size1() != rLHS_Components[0].size1() )
		  rLHS_Contribution.resize(rLHS_Components[0].size1(), rLHS_Components[0].size2());	
		
		rLHS_Contribution.clear();
	    
		for( unsigned int i=0; i<rLHS_Components.size(); i++ )
		  {
		    rLHS_Contribution += rLHS_Components[i];
		  }
		
	      }
	    else
	      {

		(rCurrentCondition) -> CalculateLocalSystem(rLHS_Contribution, rRHS_Contribution, rCurrentProcessInfo);

	      }

	  }
	    	    
        if(this->mNewmark.static_dynamic !=0)
        {

            (rCurrentCondition) -> CalculateMassMatrix(this->mMatrix.M[thread], rCurrentProcessInfo);

            (rCurrentCondition) -> CalculateDampingMatrix(this->mMatrix.D[thread], rCurrentProcessInfo);

        }

        (rCurrentCondition) -> EquationIdVector(rEquationId, rCurrentProcessInfo);

        if(this->mNewmark.static_dynamic !=0)
        {

            this->AddDynamicsToLHS  (rLHS_Contribution, this->mMatrix.D[thread], this->mMatrix.M[thread], rCurrentProcessInfo);

            this->AddDynamicsToRHS  (rCurrentCondition, rRHS_Contribution, this->mMatrix.D[thread], this->mMatrix.M[thread], rCurrentProcessInfo);
        }

        //AssembleTimeSpaceLHS_Condition(rCurrentCondition, rLHS_Contribution, DampMatrix, MassMatrix,CurrentProcessInfo);

        KRATOS_CATCH( "" )
    }
void Isotropic_Rankine_Yield_Function::Three_Vector_Return_Mapping_To_Apex(const array_1d<double,3>& PrincipalStress, Vector& delta_lamda ,array_1d<double,3>& Sigma)
{

    unsigned int iter    = 0;
    unsigned int max     = 10;
//    int singular         = 0;
    double norma         = 1.00;
    double delta_lamda_a = 0.00;
    double delta_lamda_b = 0.00;
    double delta_lamda_c = 0.00;
    const  double toler  = 1E-3;
    double E             = (*mprops)[YOUNG_MODULUS];
    double NU            = (*mprops)[POISSON_RATIO];
    double G             = 0.5*E / (1.00 + NU);
    double K             =  E / (3.00 * (1.00-2.00*NU));
    double H             =  mH;
    Matrix d;
    d.resize(3,3,false);
    noalias(d)    = ZeroMatrix(3,3);
    Matrix d_inv;
    d_inv.resize(3,3,false);
    noalias(d_inv)= ZeroMatrix(3,3);
    Vector residual      = ZeroVector(3);
    delta_lamda          = ZeroVector(3);

    Vector Imput_Parameters(4);
    Imput_Parameters    =  ZeroVector(4);
    Imput_Parameters[0] =  mhe;
    Imput_Parameters[1] =  mrankine_accumulated_plastic_strain_current;


    residual[0] = PrincipalStress[0] - mcurrent_Ft;
    residual[1] = PrincipalStress[1] - mcurrent_Ft;
    residual[2] = PrincipalStress[2] - mcurrent_Ft;
    H           = mpSofteningBehaviorFt->FirstDerivateFunctionBehavior(Imput_Parameters);


    double Partial_Ep_gama_a = 0.00;
    double Partial_Ep_gama_b = 0.00;
    double Partial_Ep_gama_c = 0.00;

    double prod_H_a = 0.00;
    double prod_H_b = 0.00;
    double prod_H_c = 0.00;
    double Inc      = 0.00;



    d.resize(3,3);
    d_inv.resize(3,3);
    const double raiz2d3    = 0.8164958092773;
    const double d3         = 0.3333333333333333;
    double Ppvs = 0.00;                            /// principal plastic volumetric strain
    array_1d<double,3> Ppds = ZeroVector(3);       /// principal plastic desviatoric strain
    array_1d<double,3> Pps  = ZeroVector(3);       /// principal plastic  strain
    array_1d<double,3> I;
    I[0] = 1.00;
    I[1] = 1.00;
    I[2] = 1.00;

    while(iter++<=max && norma>= toler)
    {

        prod_H_a = H * Partial_Ep_gama_a;
        prod_H_b = H * Partial_Ep_gama_b;
        prod_H_c = H * Partial_Ep_gama_c;


        d(0,0) = -4.00 * G / 3.00 - K - prod_H_a;
        d(0,1)  =  2.00 * G / 3.00 - K - prod_H_b;
        d(0,2)   =   2.00 * G / 3.00 - K  - prod_H_c;
        d(1,0) =  2.00 * G / 3.00 - K - prod_H_a;
        d(1,1)  = -4.00 * G / 3.00 - K - prod_H_b;
        d(1,2)   =   2.00 * G / 3.00 - K  - prod_H_c;
        d(2,0) =  2.00 * G / 3.00 - K - prod_H_a;
        d(2,1)  =  2.00 * G / 3.00 - K - prod_H_b;
        d(2,2)   =  -4.00 * G / 3.00 - K  - prod_H_c;

//        singular =  SD_MathUtils<double>::InvertMatrix(d, d_inv);
        noalias(delta_lamda) =  delta_lamda - Vector(prod(d_inv, residual));


        delta_lamda_a = delta_lamda[0];
        delta_lamda_b = delta_lamda[1];
        delta_lamda_c = delta_lamda[2];

        /// normal
        ///mrankine_accumulated_plastic_strain_current= mrankine_accumulated_plastic_strain_old+ delta_lamda_a + delta_lamda_b +  delta_lamda_c;

        ///von mises
        Inc = 0.81649658092773 * norm_2(delta_lamda);
        mrankine_accumulated_plastic_strain_current = mrankine_accumulated_plastic_strain_old + Inc;


        /// computing Kp_punto.
        /// volumetric and desviatoric plastic strain
        Pps[0]        = delta_lamda_a;
        Pps[1]        = delta_lamda_b;
        Pps[2]        = delta_lamda_c;
        Ppvs          = Pps[0] + Pps[1] + Pps[2];
        noalias(Ppds) = Pps - d3 * Ppvs * I;
        Inc           = raiz2d3* std::sqrt(inner_prod(Pps,Pps));
        mrankine_accumulated_plastic_strain_current = mrankine_accumulated_plastic_strain_old + Inc;
        ComputeActualStrees(Ppvs, Ppds, PrincipalStress, Sigma);
        ComputeActualStrain(Pps);
        CalculatePlasticDamage(Sigma);


        /// Updatinf mFt
        Partial_Ep_gama_a   = (2.00/3.00) * delta_lamda_a/Inc;
        Partial_Ep_gama_b   = (2.00/3.00) * delta_lamda_b/Inc;
        Partial_Ep_gama_b   = (2.00/3.00) * delta_lamda_c/Inc;

        Imput_Parameters[1] =  mrankine_accumulated_plastic_strain_current;
        Imput_Parameters[2] =  mpastic_damage_old;
        Imput_Parameters[3] =  mpastic_damage_current;
        mcurrent_Ft         =  mpSofteningBehaviorFt->FunctionBehavior(Imput_Parameters);
        H                   =  mpSofteningBehaviorFt->FirstDerivateFunctionBehavior(Imput_Parameters);


        /// ft se anulan
        if(mcurrent_Ft<=toler)
        {
            mcurrent_Ft = 0.00;
            //delta_lamda_a  = delta_lamda[0];
            //delta_lamda_b  = delta_lamda[1];
            //delta_lamda_c  = delta_lamda[2];
            break;
        }
        else
        {


            residual[0] = PrincipalStress[0] - mcurrent_Ft;
            residual[1] = PrincipalStress[1] - mcurrent_Ft;
            residual[2] = PrincipalStress[2] - mcurrent_Ft;

            residual[0] =  residual[0] - delta_lamda_a*( 4.00 * G / 3.00 + K ) - delta_lamda_b*( -2.00 * G / 3.00 + K ) - delta_lamda_c*( -2.00 * G / 3.00 + K );
            residual[1] =  residual[1] - delta_lamda_a*(-2.00 * G / 3.00 + K ) - delta_lamda_b*( 4.00  * G / 3.00 + K ) - delta_lamda_c*( -2.00 * G / 3.00 + K );
            residual[2] =  residual[2] - delta_lamda_a*(-2.00 * G / 3.00 + K ) - delta_lamda_b*( -2.00 * G / 3.00 + K ) - delta_lamda_c*( 4.00  * G / 3.00 + K );
            norma       =  norm_2(residual);

        }
    }

    if(iter>=max || delta_lamda_a<0.0 || delta_lamda_b<0.0 || delta_lamda_c<0)
    {
        KRATOS_WATCH(iter)
        KRATOS_WATCH(norma)
        KRATOS_WATCH(mcurrent_Ft)
        KRATOS_WATCH(Sigma)
        KRATOS_WATCH(PrincipalStress)
        KRATOS_WATCH(delta_lamda)
        std::cout<< "RETURN MAPPING APEX RANKINE  NOT CONVERGED" << std::endl;
        KRATOS_THROW_ERROR(std::logic_error,  "RETURN MAPPING APEX RANKINE  NOT CONVERGED" , "");
    }

    if(mcurrent_Ft <= 0.00)
    {
        Sigma[0] = 0.00;
        Sigma[1] = 0.00;
        Sigma[2] = 0.00;
    }
    else
    {
        /// volumetric and desviatoric plastic strain
        Pps[0]        = delta_lamda_a;
        Pps[1]        = delta_lamda_b;
        Pps[2]        = delta_lamda_c;
        Ppvs          = Pps[0] + Pps[1] + Pps[2];
        noalias(Ppds) = Pps - d3 * Ppvs * I;
        noalias(Sigma) = PrincipalStress - 2.00 * G * Ppds - K * Ppvs * I;


        //Sigma[0] = PrincipalStress[0] - delta_lamda_a*( 4.00  * G / 3.00 + K ) - delta_lamda_b*( -2.00  * G / 3.00 + K ) - delta_lamda_c*( -2.00  * G / 3.00 + K );
        //Sigma[1] = PrincipalStress[1] - delta_lamda_a*(-2.00 * G  / 3.00 + K ) - delta_lamda_b*( 4.00  * G / 3.00 + K )  - delta_lamda_c*( -2.00  * G / 3.00 + K );
        //Sigma[2] = PrincipalStress[2] - delta_lamda_a*(-2.00 * G  / 3.00 + K ) - delta_lamda_b*( -2.00  * G / 3.00 + K )  - delta_lamda_c*( 4.00  * G / 3.00 + K );

    }

    Vector PPS_bar(3);
    Imput_Parameters = ZeroVector(3);
    ComputePlasticStrainBar(mplastic_strain_old ,m_inv_DeltaF, PPS_bar);
    mPrincipalPlasticStrain_current[0] = /*mPrincipalPlasticStrain_old[0]*/ PPS_bar[0] +  delta_lamda_a;
    mPrincipalPlasticStrain_current[1] = /*mPrincipalPlasticStrain_old[0]*/ PPS_bar[1] +  delta_lamda_b;
    mPrincipalPlasticStrain_current[2] = /*mPrincipalPlasticStrain_old[0]*/ PPS_bar[2] +  delta_lamda_c;
}
bool Isotropic_Rankine_Yield_Function::One_Vector_Return_Mapping_To_Main_Plane(const array_1d<double,3>& PrincipalStress, Vector& delta_lamda,  array_1d<double,3>& Sigma)
{
    unsigned int iter       = 0;
    double norma            = 1.00;
    double delta_lamda_a    = 0.00;
    double E                 = (*mprops)[YOUNG_MODULUS];
    double NU                = (*mprops)[POISSON_RATIO];
    double G                 = 0.5*E / (1.00 + NU);
    double K                 =  E / (3.00 * (1.00-2.00*NU));
    double H                 = 0.00;
    double d                 = 0.00;
    double residual          = 0.00;
    const double toler       = 1E-3;
    const double raiz_2_3    = 0.81649658092773;
    unsigned int max         = 1000;
    double Partial_Ep_gama_a = 0.00;


    double Inc             = 0.00;
    const double d3        = 0.3333333333333333;
    const double raiz2d3   = 0.8164958092773;
    double Ppvs = 0.00;           /// principal plastic volumetric strain
    array_1d<double,3> Ppds = ZeroVector(3);      /// principal plastic desviatoric strain
    array_1d<double,3> Pps  = ZeroVector(3);       /// principal plastic  strain
    array_1d<double,3> I;
    I[0] = 1.00;
    I[1] = 1.00;
    I[2] = 1.00;

    delta_lamda         =  ZeroVector(1);
    residual            =  PrincipalStress[0] - mcurrent_Ft;;
    norma               =  residual/mcurrent_Ft;
    Vector Imput_Parameters(4);
    Imput_Parameters    = ZeroVector(4);
    Imput_Parameters[0] =  mhe;
    Imput_Parameters[1] =  mrankine_accumulated_plastic_strain_current;

    while(iter++<=max && norma>= toler)
    {
        Partial_Ep_gama_a   = raiz_2_3; /// Acumulated Vond misses
        H                   = mpSofteningBehaviorFt->FirstDerivateFunctionBehavior(Imput_Parameters);
        d                   = -4.00 * G / 3.00 - K - H * Partial_Ep_gama_a;
        delta_lamda[0]      = delta_lamda[0] - (residual / d);


        ///normal acuulated
        ///mrankine_accumulated_plastic_strain_current= mrankine_accumulated_plastic_strain_old+ delta_lamda[0];

        /// von mises
        mrankine_accumulated_plastic_strain_current = mrankine_accumulated_plastic_strain_old + raiz_2_3 * delta_lamda[0];
        /// computing Kp_punto.
        /// volumetric and desviatoric plastic strain
        Pps[0]        = delta_lamda_a;
        Pps[1]        = 0.00;
        Pps[2]        = 0.00;
        Ppvs          = Pps[0] + Pps[1] + Pps[2];
        noalias(Ppds) = Pps - d3 * Ppvs * I;
        Inc           = raiz2d3* std::sqrt(inner_prod(Pps,Pps));
        mrankine_accumulated_plastic_strain_current = mrankine_accumulated_plastic_strain_old + Inc;
        ComputeActualStrees(Ppvs, Ppds, PrincipalStress, Sigma);
        ComputeActualStrain(Pps);
        CalculatePlasticDamage(Sigma);


        ///* Updatinf mFt
        Imput_Parameters[1] =  mrankine_accumulated_plastic_strain_current;
        Imput_Parameters[2] =  mpastic_damage_old;
        Imput_Parameters[3] =  mpastic_damage_current;
        mcurrent_Ft         =  mpSofteningBehaviorFt->FunctionBehavior(Imput_Parameters);
        delta_lamda_a       =  delta_lamda[0];

        ///* comprobando si mft se cumplio
        if(mcurrent_Ft <= toler)
        {
            mcurrent_Ft = toler;
            break;
        }
        else
        {
            ///* update teh current value
            residual    =  PrincipalStress[0] - mcurrent_Ft - delta_lamda_a * (4.00  * G / 3.00 + K);
            norma       =  fabs(residual/mcurrent_Ft);
        }
    }

    if(iter>=max)  //||  std::delta_lamda_a<0.00){
    {
        //return false;
        KRATOS_WATCH(norma)
        KRATOS_WATCH(PrincipalStress[0])
        KRATOS_WATCH(PrincipalStress[1])
        KRATOS_WATCH(PrincipalStress[2])
        KRATOS_WATCH(delta_lamda_a)
        KRATOS_WATCH(residual)
        KRATOS_WATCH(mcurrent_Ft)

        std::cout<<  "RETURN MAPPING TO MAIN PLANE RANKINE  NOT CONVERGED" << std::endl;
        KRATOS_THROW_ERROR(std::logic_error,  "RETURN MAPPING TO MAIN PLANE RANKINE  NOT CONVERGED" , "");
    }

    ///* Updating Stress
    if(mcurrent_Ft <=toler)
    {
        Sigma[0] = 0.00;
        Sigma[1] = 0.00;
        Sigma[2] = 0.00;
    }
    else
    {
        /// volumetric and desviatoric plastic strain
        Pps[0]        = delta_lamda_a;
        Pps[1]        = 0.00;
        Pps[2]        = 0.00;
        Ppvs          = Pps[0] + Pps[1] + Pps[2];
        noalias(Ppds) = Pps - d3 * Ppvs * I;

        //Sigma[0] = PrincipalStress[0] - delta_lamda_a*(4.00  * G / 3.00 + K );
        //Sigma[1] = PrincipalStress[1] - delta_lamda_a*(-2.00 * G / 3.00 + K );
        //Sigma[2] = PrincipalStress[2] - delta_lamda_a*(-2.00 * G / 3.00 + K );
        noalias(Sigma) = PrincipalStress - 2.00 * G * Ppds - K * Ppvs * I;
    }

    bool check = CheckValidity(Sigma);
    if(check==true)
    {
        Vector PPS_bar(3);
        PPS_bar = ZeroVector(3);
        ComputePlasticStrainBar(mplastic_strain_old ,m_inv_DeltaF, PPS_bar);
        //updating the correct principal pastic strain
        mPrincipalPlasticStrain_current[0] = /*mPrincipalPlasticStrain_old[0]*/  PPS_bar[0] +  delta_lamda_a;
        mPrincipalPlasticStrain_current[1] = /*mPrincipalPlasticStrain_old[1]*/  PPS_bar[1];
        mPrincipalPlasticStrain_current[2] = /*mPrincipalPlasticStrain_old[2]*/  PPS_bar[2];
        return true;
    }
    else
        return false;



}
Пример #24
0
    NonlocalDamageUtilities() {}
    
    ///------------------------------------------------------------------------------------

    /// Destructor
    virtual ~NonlocalDamageUtilities()
    {
        //mNonlocalPointList.clear();
        //mNonlocalPointList.shrink_to_fit();
    }

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    virtual void SearchGaussPointsNeighbours (Parameters* pParameters, ModelPart& rModelPart)
    {
        KRATOS_THROW_ERROR( std::logic_error, "Calling the default SearchGaussPointsNeighbours method", "" )
    }

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    void CalculateNonlocalEquivalentStrain (Parameters* pParameters, const ProcessInfo& CurrentProcessInfo)
    {
        int NGPoints = static_cast<int>(mNonlocalPointList.size());
        double CharacteristicLength = (*pParameters)["characteristic_length"].GetDouble();
        
        // Loop through all Gauss Points
        #pragma omp parallel for
        for(int i = 0; i < NGPoints; i++)
        {
            double LocalEquivalentStrain;
            double NonlocalEquivalentStrain;
Пример #25
0
Matrix& Isotropic3D::GetValue( const Variable<Matrix>& rThisVariable, Matrix& rValue )
{
        KRATOS_THROW_ERROR( std::logic_error, "Matrix Variable case not considered", "" );
}
Пример #26
0
Plasticity2D::Plasticity2D()
    : ConstitutiveLaw()

{
    KRATOS_THROW_ERROR( std::logic_error, "Calling the empty constructor.", "" );
}
    C(1, 2) = 0.0;
    C(2, 0) = 0.0;
    C(2, 1) = 0.0;
    C(2, 2) = c3;
}


//**********************************************************************

void IsotropicRankineDamage2D::CalculateCauchyStresses(
    Vector& rCauchy_StressVector,
    const Matrix& rF,
    const Vector& rPK2_StressVector,
    const Vector& rGreenLagrangeStrainVector)
{
    KRATOS_THROW_ERROR(std::logic_error,"method not yet implemented","")
}

//**********************************************************************
//**********************************************************************

void IsotropicRankineDamage2D::Calculate(const Variable<double>& rVariable,
        double& Output,
        const ProcessInfo& rCurrentProcessInfo)
{
}

void IsotropicRankineDamage2D::CalculateMaterialResponse(const Vector& StrainVector,
        const Matrix& DeformationGradient,
        Vector& StressVector,
        Matrix& AlgorithmicTangent,
Пример #28
0
void BeamElement::CalculateSectionProperties()

{
    KRATOS_TRY

    array_1d<double, 3> x_0;
    array_1d<double, 3> x_1; // Vector que contiene coordenadas de los nodos.
    array_1d<double, 3> length;   // Vector que contiene la direccion de la barra.

//        double minimo, maximo, B;
//        const double b        = GetProperties()[BASE];
//        const double h        = GetProperties()[HEIGHT];

    if( GetProperties().Has(CROSS_AREA) )
        mArea = GetProperties()[CROSS_AREA];
    else
        mArea = GetValue(AREA);
    
    Matrix* inertia;
    if( GetProperties().Has(LOCAL_INERTIA) )
    {
        inertia = &(GetProperties()[LOCAL_INERTIA]);
    }
    else if( GetProperties().Has(INERTIA) )
    {
        inertia = &(GetProperties()[INERTIA]);
    }
    else if( Has(LOCAL_INERTIA) )
    {
        inertia = &(GetValue(LOCAL_INERTIA));
    }
    else if( Has(INERTIA) )
    {
        inertia = &(GetValue(INERTIA));
    }
    else
        KRATOS_THROW_ERROR(std::logic_error, "The Inertia is not fully defined for the element", "")
    mInertia_x = (*inertia)(0,0);
    mInertia_y = (*inertia)(1,1);
    mInertia_Polar = (*inertia)(0,1);

//        mInertia_x     = b * h * h * h / 12.0;
//        mInertia_y     = b * b * b * h / 12.0;
//        minimo         = std::min( b, h );
//        maximo        = std::max( b, h );
//        B        = ( 1.00 - 0.63 * ( minimo / maximo ) * ( 1 - ( pow( minimo, 4 ) / ( 12 * pow( maximo, 4 ) ) ) ) ) / 3; // constante torsional. Solo para secciones rectangulares.
//        mInertia_Polar = B * minimo * minimo * minimo * maximo;
//        mArea        = b * h;


    x_0( 0 ) = GetGeometry()[0].X0();
    x_0( 1 ) = GetGeometry()[0].Y0();
    x_0( 2 ) = GetGeometry()[0].Z0();
    x_1( 0 ) = GetGeometry()[1].X0();
    x_1( 1 ) = GetGeometry()[1].Y0();
    x_1( 2 ) = GetGeometry()[1].Z0();

    noalias( length ) = x_1 - x_0;
    mlength = std::sqrt( inner_prod( length, length ) );

    if (mlength == 0.00)
        KRATOS_THROW_ERROR(std::invalid_argument, "Zero length found in elemnet #", this->Id());


    KRATOS_CATCH( "" )

}