namespace Electrostatic2Dauxiliaries { //static variables //boost::numeric::ublas::bounded_matrix<double,3,2> Electrostatic2D::msDN_DX; boost::numeric::ublas::bounded_matrix<double,3,2> msDN_DX = ZeroMatrix(3,2); #pragma omp threadprivate(msDN_DX) //boost::numeric::ublas::bounded_matrix<double,2,3> Electrostatic2D::msB; boost::numeric::ublas::bounded_matrix<double,2,3> msB = ZeroMatrix(2,3); #pragma omp threadprivate(msB) //boost::numeric::ublas::bounded_matrix<double,2,2> Electrostatic2D::msD; boost::numeric::ublas::bounded_matrix<double,2,2> msD = ZeroMatrix(2,2); #pragma omp threadprivate(msD) //array_1d<double,3> Electrostatic2D::msN; //dimension = number of nodes array_1d<double,3> msN = ZeroVector(3); //dimension = number of nodes #pragma omp threadprivate(msN) //array_1d<double,3> Electrostatic2D::ms_temp; //dimension = number of nodes array_1d<double,3> ms_temp = ZeroVector(3); //dimension = number of nodes #pragma omp threadprivate(ms_temp) //array_1d<double,3> Electrostatic2D::point_sources; //dimension = number of nodes array_1d<double,3> point_sources = ZeroVector(3); //dimension = number of nodes #pragma omp threadprivate(point_sources) array_1d<double,3> surface_sources = ZeroVector(3); //dimension = number of nodes #pragma omp threadprivate(surface_sources) }
void BeamElement::CalculateLocalNodalStress(Vector& Stress) { Matrix Rotation; Matrix LocalMatrix; array_1d<double, 12 > CurrentDisplacement; array_1d<double, 12 > LocalDisplacement; Vector LocalBody = ZeroVector(12); Vector GlobalBody = ZeroVector(12); Rotation.resize(12,12, false); Stress.resize(12, false); CurrentDisplacement(0) = GetGeometry()[0].GetSolutionStepValue(DISPLACEMENT_X); CurrentDisplacement(1) = GetGeometry()[0].GetSolutionStepValue(DISPLACEMENT_Y); CurrentDisplacement(2) = GetGeometry()[0].GetSolutionStepValue(DISPLACEMENT_Z); CurrentDisplacement(3) = GetGeometry()[0].GetSolutionStepValue(ROTATION_X); CurrentDisplacement(4) = GetGeometry()[0].GetSolutionStepValue(ROTATION_Y); CurrentDisplacement(5) = GetGeometry()[0].GetSolutionStepValue(ROTATION_Z); CurrentDisplacement(6) = GetGeometry()[1].GetSolutionStepValue(DISPLACEMENT_X); CurrentDisplacement(7) = GetGeometry()[1].GetSolutionStepValue(DISPLACEMENT_Y); CurrentDisplacement(8) = GetGeometry()[1].GetSolutionStepValue(DISPLACEMENT_Z); CurrentDisplacement(9) = GetGeometry()[1].GetSolutionStepValue(ROTATION_X); CurrentDisplacement(10) = GetGeometry()[1].GetSolutionStepValue(ROTATION_Y); CurrentDisplacement(11) = GetGeometry()[1].GetSolutionStepValue(ROTATION_Z); CalculateTransformationMatrix(Rotation); CalculateLocalMatrix(LocalMatrix); noalias(LocalDisplacement) = prod(Matrix(trans(Rotation)), CurrentDisplacement); CalculateBodyForce(Rotation, LocalBody, GlobalBody); noalias(Stress) = -LocalBody + prod(LocalMatrix, LocalDisplacement); // noalias(Stress) = -LocalBody + prod(Matrix(prod(Rotation,LocalMatrix)), LocalDisplacement); return; }
MPMBase::MPMBase(int elem,int theMatl,double angin) { int i; inElem=elem; mp=-1.; // calculated in PreliminaryCalcs, unless set in input file matnum=theMatl; SetAnglez0InDegrees(angin); SetAngley0InDegrees(0.0); SetAnglex0InDegrees(0.0); // space to hold velocity fields // these only change if there are cracks vfld = (char *)malloc(maxShapeNodes*sizeof(char)); for(i=1; i<maxShapeNodes; i++) vfld[i]=NO_CRACK; // zero stresses and strains ZeroTensor(&sp); pressure = 0.; ZeroTensor(&ep); ZeroTensor(&eplast); ZeroTensorAntisym(&wrot); ZeroVector(&acc); // zero energies plastEnergy=0.; dispEnergy=0.; workEnergy=0.; resEnergy=0.; heatEnergy=0.; entropy=0; // for J integral if needed (on non-rigid only) velGrad=NULL; // material data is needed matData=NULL; // concentration (c units) and gradient (c units/mm) pConcentration=0.; pDiffusion=NULL; // temperature (degrees) and gradient (degrees/mm) SetTemperature(0.,0.); pTemp=NULL; // CPDI data cpdi = NULL; faceArea = NULL; // PS - when point created, velocity and position and ext force should be set too ZeroVector(&vel); // counts crossing and sign is whether or not left the grid elementCrossings=0; // rotation matrix (when tracked) Rtot = NULL; }
void ScalarDamageInterface2DLaw::InitializeMaterial(const Properties& rMaterialProperties, const GeometryType& rElementGeometry, const Vector& rShapeFunctionsValues) { if(!mInitialized) { mK1 = 0.0; mK1_converged = 0.0; mK2 = 0.0; mK2_converged = 0.0; mD1 = 0.0; mD2 = 0.0; mD2_bar = 0.0; mD2_bar_converged = 0.0; mYieldValue = 0.0; m_initial_strain = ZeroVector(this->GetStrainSize()); mInitialized = true; #ifdef INTERF_DAM_2D_IMPLEX mK1_converged_old = mK1; mK2_converged_old = mK2; m_strain = ZeroVector(this->GetStrainSize()); m_dTime_n = 0.0; m_dTime_n_converged = 0.0; #endif // INTERF_DAM_2D_IMPLEX } }
void ExplicitSolverStrategy::ClearFEMForces() { KRATOS_TRY ModelPart& fem_model_part = GetFemModelPart(); NodesArrayType& pNodes = fem_model_part.Nodes(); vector<unsigned int> node_partition; OpenMPUtils::CreatePartition(mNumberOfThreads, pNodes.size(), node_partition); #pragma omp parallel for for (int k = 0; k < mNumberOfThreads; k++) { typename NodesArrayType::iterator i_begin = pNodes.ptr_begin() + node_partition[k]; typename NodesArrayType::iterator i_end = pNodes.ptr_begin() + node_partition[k + 1]; for (ModelPart::NodeIterator i = i_begin; i != i_end; ++i) { array_1d<double, 3>& node_rhs = i->FastGetSolutionStepValue(CONTACT_FORCES); array_1d<double, 3>& node_rhs_elas = i->FastGetSolutionStepValue(ELASTIC_FORCES); array_1d<double, 3>& node_rhs_tang = i->FastGetSolutionStepValue(TANGENTIAL_ELASTIC_FORCES); double& node_pressure = i->GetSolutionStepValue(DEM_PRESSURE); double& node_area = i->GetSolutionStepValue(DEM_NODAL_AREA); double& shear_stress = i->FastGetSolutionStepValue(SHEAR_STRESS); noalias(node_rhs) = ZeroVector(3); noalias(node_rhs_elas) = ZeroVector(3); noalias(node_rhs_tang) = ZeroVector(3); node_pressure = 0.0; node_area = 0.0; shear_stress = 0.0; } } KRATOS_CATCH("") }
//************************************************************************************ //************************************************************************************ void BeamElement::CalculateRHS(Vector& rRightHandSideVector) { Matrix Rotation; Matrix GlobalMatrix; Vector LocalBody; array_1d<double, 12 > CurrentDisplacement; Rotation.resize(12,12, false); rRightHandSideVector = ZeroVector(12); LocalBody = ZeroVector(12); CalculateTransformationMatrix(Rotation); CalculateBodyForce(Rotation, LocalBody, rRightHandSideVector); CurrentDisplacement(0) = GetGeometry()[0].GetSolutionStepValue(DISPLACEMENT_X); CurrentDisplacement(1) = GetGeometry()[0].GetSolutionStepValue(DISPLACEMENT_Y); CurrentDisplacement(2) = GetGeometry()[0].GetSolutionStepValue(DISPLACEMENT_Z); CurrentDisplacement(3) = GetGeometry()[0].GetSolutionStepValue(ROTATION_X); CurrentDisplacement(4) = GetGeometry()[0].GetSolutionStepValue(ROTATION_Y); CurrentDisplacement(5) = GetGeometry()[0].GetSolutionStepValue(ROTATION_Z); CurrentDisplacement(6) = GetGeometry()[1].GetSolutionStepValue(DISPLACEMENT_X); CurrentDisplacement(7) = GetGeometry()[1].GetSolutionStepValue(DISPLACEMENT_Y); CurrentDisplacement(8) = GetGeometry()[1].GetSolutionStepValue(DISPLACEMENT_Z); CurrentDisplacement(9) = GetGeometry()[1].GetSolutionStepValue(ROTATION_X); CurrentDisplacement(10) = GetGeometry()[1].GetSolutionStepValue(ROTATION_Y); CurrentDisplacement(11) = GetGeometry()[1].GetSolutionStepValue(ROTATION_Z); CalculateLHS(GlobalMatrix); noalias(rRightHandSideVector) -= prod(GlobalMatrix, CurrentDisplacement); return; }
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 Tresca_Yield_Function::CalculateEquivalentUniaxialStressViaPrincipalStress( const Vector& StressVector,double& Result) { double crit = 1E-10; double zero = 1E-10; double max = 0.00; unsigned int dim = 3; Matrix StressTensor = ZeroMatrix(dim,dim); Vector PrincipalStress = ZeroVector(dim); Vector Aux_Vector = ZeroVector(dim); this->State_Tensor(StressVector,StressTensor); this->Comprobate_State_Tensor(StressTensor, StressVector); // funcion definida en clase base; PrincipalStress = SD_MathUtils<double>::EigenValues(StressTensor,crit, zero); Aux_Vector(0) = fabs(PrincipalStress(0)-PrincipalStress(1)); Aux_Vector(1) = fabs(PrincipalStress(0)-PrincipalStress(2)); Aux_Vector(2) = fabs(PrincipalStress(1)-PrincipalStress(2)); max = (*std::max_element(Aux_Vector.begin(),Aux_Vector.end())); Result = 0.50*max; // - msigma_max; //KRATOS_WATCH(Result) }
void Tresca_Yield_Function::CalculateEquivalentUniaxialStress( const Vector& StressVector,double& Result) { array_1d<double,3> Trial_Stress_Vector = ZeroVector(3); CalculatePrincipalStressVector(StressVector, Trial_Stress_Vector); mMultisurface_Platicity_Sigma = ZeroVector(3); mMultisurface_Platicity_Yield = ZeroVector(3); ///* Multisurface Representation mMultisurface_Platicity_Sigma[0] = Trial_Stress_Vector[0] - Trial_Stress_Vector[2]; mMultisurface_Platicity_Yield[0] = mMultisurface_Platicity_Sigma[0] - mcurrent_sigma_y; mMultisurface_Platicity_Sigma[1] = Trial_Stress_Vector[1] - Trial_Stress_Vector[2]; mMultisurface_Platicity_Yield[1] = mMultisurface_Platicity_Sigma[1] - mcurrent_sigma_y; mMultisurface_Platicity_Sigma[2] = Trial_Stress_Vector[0] - Trial_Stress_Vector[1]; mMultisurface_Platicity_Yield[2] = mMultisurface_Platicity_Sigma[2] - mcurrent_sigma_y; Result = (*max_element(mMultisurface_Platicity_Yield.begin(), mMultisurface_Platicity_Yield.end())); }
void Isotropic3D::InitializeMaterial( const Properties& props, const GeometryType& geom, const Vector& ShapeFunctionsValues ) { mCurrentStress = ZeroVector( 6 ); mPrestress = ZeroVector( 6 ); mPrestressFactor = 1.0; mE = props[YOUNG_MODULUS]; mNU = props[POISSON_RATIO]; mDE = props[DENSITY]; }
void ConvDiffAnisotropic2DLaw::InitializeMaterial( const Properties& rMaterialProperties, const GeometryType& rElementGeometry, const Vector& rShapeFunctionsValues) { if(!m_initialized) { m_init_gradT = ZeroVector(this->GetStrainSize()); mStressVector = ZeroVector(this->GetStrainSize()); m_initialized = true; } }
/* initialise and return an instance of SpkrAcc */ SpkrAcc *InitSpkrAcc(void) { SpkrAcc *sa; sa = New(&gstack,sizeof(SpkrAcc)); sa->meanSum = CreateVector(&gstack,vSize); ZeroVector(sa->meanSum); sa->squareSum = CreateVector(&gstack,vSize); ZeroVector(sa->squareSum); sa->NumFrame = 0; return sa; }
void DruckerPrager::InitializeMaterial( const Properties& props, const GeometryType& geom, const Vector& ShapeFunctionsValues ) { mOldStress.resize( 6 ); mOldStress = ZeroVector( 6 ); mCtangent.resize(6, 6); mCtangent = ZeroMatrix( 6, 6 ); mCtangentInv.resize(6, 6); mCtangentInv = ZeroMatrix(6, 6); mOldStrain.resize( 6 ); mOldStrain = ZeroVector( 6 ); mCurrentStrain.resize( 6 ); mCurrentStrain = ZeroVector( 6 ); // mCurrentStrainInc.resize( 6 ); // mCurrentStrainInc = ZeroVector( 6 ); mCurrentStress.resize( 6 ); mCurrentStress = ZeroVector( 6 ); mCurrentPlasticStrains.resize( 6 ); mCurrentPlasticStrains = ZeroVector( 6 ); mOldSElasticStrain.resize( 6 ); mOldSElasticStrain = ZeroVector( 6 ); mCurrentElasticStrain.resize( 6 ); mCurrentElasticStrain = ZeroVector( 6 ); mOldPlasticStrains.resize( 6 ); mOldPlasticStrains = ZeroVector( 6 ); mPrestress.resize( 6 ); mPrestress = ZeroVector( 6 ); mPrestressFactor = 1.0; // mdGamma = 0.0; mAlpha = 0.0; mOldAlpha = 0.0; // mIsYielded = false; // mIsApex = false; mE = props[YOUNG_MODULUS]; mNU = props[POISSON_RATIO]; mCohesion = props[COHESION]; mHardening = props[ISOTROPIC_HARDENING_MODULUS]; double tan_phi = tan(( props[INTERNAL_FRICTION_ANGLE] ) * PI / 180 ); mEta = 3.0 * tan_phi / ( sqrt( 9.0 + 12.0 * tan_phi * tan_phi ) ); mXi = 3.0 / ( sqrt( 9.0 + 12.0 * tan_phi * tan_phi ) ); // ResetMaterial( props, geom, ShapeFunctionsValues ); // mG = mE / ( 2.0 * ( 1.0 + mNU ) ); // mK = mE / ( 3.0 * ( 1.0 - 2.0 * mNU ) ); // CalculateUnit4thSym3D(); // CalculateUnit2nd3D(); ResetMaterial( props, geom, ShapeFunctionsValues ); }
/** * TO BE TESTED!!! */ PlaneStressJ2::PlaneStressJ2() : ConstitutiveLaw() { noalias(mOldPlasticStrain) = ZeroVector(3); noalias(mbeta_old) = ZeroVector(3); malpha_old = 0.0; malpha_current = 0.0; noalias(mCurrentPlasticStrain) = ZeroVector(3); noalias(mbeta_n1) = ZeroVector(3); }
/* CalcWCd: store context dependent weights in wc using all blocks of stream ste except the deleted block dBlk */ void CalcWCd(Vector wc, int dBlk, StreamElem *ste, int M) { WALink wa; float occ; int i; ZeroVector(wc); wa = (WALink)ste->hook; occ = SumWtChain(wa,wc,dBlk,M); if (occ==0.0) ZeroVector(wc); else for (i=1; i<=M; i++) wc[i] /= occ; }
// hold or reverse the direction (should only be done for rigid material particles) // holdFirst == true, store velocity in acc and zero the velocity // holdFirst == false, if holding, reverse using stored velocity otherwise just reverse void MPMBase::ReverseParticle(bool holdFirst,bool holding) { if(holdFirst) { acc = vel; ZeroVector(&vel); } else if(holding) { CopyScaleVector(&vel,&acc,-1.); ZeroVector(&acc); } else { vel.x=-vel.x; vel.y=-vel.y; vel.z=-vel.z; } }
void Tresca_Yield_Function::ReturnMapping(const Vector& StressVector, const Vector& StrainVector, Vector& delta_lamda, array_1d<double,3>& Result) { double p_trial = 0.00; Matrix Sigma_Tensor = ZeroMatrix(3,3); State_Tensor(StressVector, Sigma_Tensor); p_trial = (Sigma_Tensor(0,0) + Sigma_Tensor(1,1) + Sigma_Tensor(2,2))/3.00 ; array_1d<double,3> Trial_Stress_Vector = ZeroVector(3); array_1d<double,3> Aux_Trial_Stress_Vector = ZeroVector(3); CalculatePrincipalStressVector(StressVector, Trial_Stress_Vector); Trial_Stress_Vector[0] = Trial_Stress_Vector[0] - p_trial; Trial_Stress_Vector[1] = Trial_Stress_Vector[1] - p_trial; Trial_Stress_Vector[2] = Trial_Stress_Vector[2] - p_trial; noalias(Aux_Trial_Stress_Vector) = Trial_Stress_Vector; ///* return to main plane One_Vector_Return_Mapping_To_Main_Plane(StressVector, delta_lamda, Trial_Stress_Vector); ///*check validty bool check = false; check = CheckValidity(Trial_Stress_Vector); if( check==false) { ///*return to corner noalias(Trial_Stress_Vector) = Aux_Trial_Stress_Vector; double proof = Trial_Stress_Vector[0] + Trial_Stress_Vector[2] - 2.00 * Trial_Stress_Vector[1]; if(proof > 0.00 ) { mCases = right; } else { mCases = left; } Two_Vector_Return_Mapping_To_Corner(StressVector,delta_lamda, Trial_Stress_Vector); } Result[0] = Trial_Stress_Vector[0] + p_trial; Result[1] = Trial_Stress_Vector[1] + p_trial; Result[2] = Trial_Stress_Vector[2] + p_trial; }
/*! @param[in] A the known system matrix @param[in] r the input vector @param[inout] x On exit contains the result of the multigrid V-cycle with r as the RHS, x is the approximation to Ax = r. @return returns 0 upon success and non-zero otherwise @see ComputeMG_ref */ int ComputeMG(const SparseMatrix & A, const Vector & r, Vector & x) { // This line and the next two lines should be removed and your version of ComputeSYMGS should be used. if(A.optimizationData == 0 || r.optimizationData == 0 || x.optimizationData == 0){ A.isMgOptimized = false; return ComputeMG_ref(A, r, x); } assert(x.localLength==A.localNumberOfColumns); // Make sure x contain space for halo values ZeroVector(x); // initialize x to zero int ierr = 0; if (A.mgData!=0) { // Go to next coarse level if defined int numberOfPresmootherSteps = A.mgData->numberOfPresmootherSteps; for (int i=0; i< numberOfPresmootherSteps; ++i) ierr += ComputeSYMGS(A, r, x); if (ierr!=0) return ierr; ierr = ComputeSPMV(A, x, *A.mgData->Axf); if (ierr!=0) return ierr; // Perform restriction operation using simple injection ierr = ComputeRestriction(A, r); if (ierr!=0) return ierr; ierr = ComputeMG(*A.Ac,*A.mgData->rc, *A.mgData->xc); if (ierr!=0) return ierr; ierr = ComputeProlongation(A, x); if (ierr!=0) return ierr; int numberOfPostsmootherSteps = A.mgData->numberOfPostsmootherSteps; for (int i=0; i< numberOfPostsmootherSteps; ++i) ierr += ComputeSYMGS(A, r, x); if (ierr!=0) return ierr; } else { ierr = ComputeSYMGS(A, r, x); if (ierr!=0) return ierr; } return 0; }
void Isotropic3D::ResetMaterial( const Properties& props, const GeometryType& geom, const Vector& ShapeFunctionsValues ) { mPrestress = ZeroVector( 6 ); mPrestressFactor = 1.0; }
void Fuzzy::computeCentroids(){ // compute the centroid on random assignment above // the centroid of a cluster is the mean of all the points, // weighted by their degree of belonging to the cluster // *p_centroids_ = prod (*p_membership_, rows_); // n_clusters = n_clusters rows.size1() // X [rows.size2()= X [rows.size1()= X [rows.size2= // =size_of_a_point_] =number_points_] size_of_a_point] //std::cout << "Centroids (n_clusters X dim_point)" // <<std::endl << " " << (*p_centroids_) << std::endl; Vector sum_uk = ZeroVector(number_clusters_); for (Index j = 0; j < number_clusters_; j++) for (Index i = 0 ; i < number_points_; i++) sum_uk[j] += (*p_membership_)(j, i); for (Index j = 0; j < number_clusters_; j++) for (Index f = 0 ; f < size_of_a_point_; f++) (*p_centroids_)(j, f) /= sum_uk[j]; //std::cout << "normalizing for " << sum_uk << std::endl; //std::cout << "Centroids (n_clusters X dim_point)" // <<std::endl << " " << (*p_centroids_) << std::endl; }
void Isotropic_Rankine_Yield_Function::ComputeActualStrain(const array_1d<double,3>& Pps) { Vector PPS_bar(3); PPS_bar = ZeroVector(3); ComputePlasticStrainBar(mplastic_strain_old ,m_inv_DeltaF, PPS_bar); noalias(mPrincipalPlasticStrain_current) = PPS_bar + Pps; }
/* CalcWBar: store context independent weights in wb from all blocks across all models excluding deleted block dblk */ void CalcWBar(Vector wb, int dBlk, int M) { int i; WALink wa; float occ = 0.0; ZeroVector(wb); for (i=1; i<=aSize; i++){ wa = (WALink)sSet[i]->hook; occ += SumWtChain(wa,wb,dBlk,M); } if (occ==0.0) ZeroVector(wb); else for (i=1; i<=M; i++) wb[i] /= occ; }
void BeamPointPressureCondition::InitializeSystemMatrices( MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector) { rLeftHandSideMatrix.resize( 6, 6, false ); noalias( rLeftHandSideMatrix ) = ZeroMatrix( 6, 6 ); //resetting LHS rRightHandSideVector.resize( 6, false ); rRightHandSideVector = ZeroVector( 6 ); //resetting RHS }
/* MakeWtAccLists: Copy info from WtAcc to WALink and add WALink to wtStore, Zero WtAcc afterwards */ void MakeWtAccLists() { int ix,n,s,i,nMix; HMMScanState hss; HLink hmm; WALink *w; StateElem *se; StreamElem *ste; WtAcc *wa; NewHMMScan(&hset,&hss); ix=1; do { hmm = hss.hmm; for (i=2,se = hmm->svec+2; i<hmm->numStates;i++,se++) for (s=1,ste = se->info->pdf+1; s<=nStreams; s++,ste++){ w = &(wtStore[ix][i][s]); n = 0; while (*w != NULL){ ++n; w = &((*w)->next); } nMix = (hset.hsKind==TIEDHS) ? hset.tmRecs[s].nMix : ste->nMix; (*w) = CreateChWtAcc(&wtAccStack, nMix); wa = (WtAcc *)ste->hook; CopyVector(wa->c,(*w)->c); (*w)->occ = wa->occ; wa->occ = 0; ZeroVector(wa->c); } ix++; } while (GoNextHMM(&hss)); EndHMMScan(&hss); }
void ConvDiffInterface2DLaw::InitializeMaterial(const Properties& rMaterialProperties, const GeometryType& rElementGeometry, const Vector& rShapeFunctionsValues) { if(!mInitialized) { mK1 = 0.0; mK1_converged = 0.0; mD1 = 0.0; mYieldValue = 0.0; m_init_gradT = ZeroVector(this->GetStrainSize()); mStressVector = ZeroVector(this->GetStrainSize()); m_gap_interface = ZeroVector(this->GetStrainSize()); mInitialized = true; } }
void InfiniteDomainCondition<TDim,TNumNodes>::CalculateRHS( VectorType& rRightHandSideVector, const ProcessInfo& CurrentProcessInfo ) { KRATOS_TRY //const PropertiesType& Prop = this->GetProperties(); const GeometryType& Geom = this->GetGeometry(); const unsigned int element_size = TNumNodes; const GeometryType::IntegrationPointsArrayType& integration_points = Geom.IntegrationPoints( mThisIntegrationMethod ); const unsigned int NumGPoints = integration_points.size(); const unsigned int LocalDim = Geom.LocalSpaceDimension(); //Resetting the RHS if ( rRightHandSideVector.size() != element_size ) rRightHandSideVector.resize( element_size, false ); noalias( rRightHandSideVector ) = ZeroVector( element_size ); boost::numeric::ublas::bounded_matrix<double,TNumNodes,TNumNodes> DampingMatrix; //Defining the shape functions, the jacobian and the shape functions local gradients Containers array_1d<double,TNumNodes> Np; const Matrix& NContainer = Geom.ShapeFunctionsValues( mThisIntegrationMethod ); GeometryType::JacobiansType JContainer(NumGPoints); for(unsigned int i = 0; i<NumGPoints; i++) (JContainer[i]).resize(TDim,LocalDim,false); Geom.Jacobian( JContainer, mThisIntegrationMethod ); double IntegrationCoefficient; // Definition of the speed in the fluid //~ const double BulkModulus = Prop[BULK_MODULUS_FLUID]; //~ const double Water_density = Prop[DENSITY_WATER]; const double BulkModulus = 2.21e9; const double Water_density = 1000.0; const double inv_c_speed = 1.0 /sqrt(BulkModulus/Water_density); //Nodal Variables array_1d<double,TNumNodes> DtPressureVector; for(unsigned int i=0; i<TNumNodes; i++) { DtPressureVector[i] = Geom[i].FastGetSolutionStepValue(Dt_PRESSURE); } for ( unsigned int igauss = 0; igauss < NumGPoints; igauss++ ) { noalias(Np) = row(NContainer,igauss); //calculating weighting coefficient for integration this->CalculateIntegrationCoefficient( IntegrationCoefficient, JContainer[igauss], integration_points[igauss].Weight() ); // Mass matrix contribution noalias(DampingMatrix) = (inv_c_speed)*outer_prod(Np,Np)*IntegrationCoefficient; noalias(rRightHandSideVector) += -1.0*prod(DampingMatrix,DtPressureVector); } KRATOS_CATCH( "" ) }
//----------------------------------------------------------------------------- // Purpose: constructor - initialize the clipper variables //----------------------------------------------------------------------------- Clipper3D::Clipper3D(void) { m_Mode = FRONT; ZeroVector( m_ClipPlane.normal ); m_ClipPlane.dist = 0.0f; ZeroVector( m_ClipPoints[0] ); ZeroVector( m_ClipPoints[1] ); m_ClipPointHit = -1; m_pOrigObjects = NULL; m_bLButtonDown = false; m_bDrawMeasurements = false; SetEmpty(); }
void TrescaExplicitFlowRule::CalculatePlasticPotentialDerivatives(const Vector& rStressVector, Vector& rFirstDerivative, Matrix& rSecondDerivative) { //double YieldStress = mpYieldCriterion->GetHardeningLaw().GetProperties()[YIELD_STRESS]; rFirstDerivative = ZeroVector(1); rSecondDerivative = ZeroMatrix(1,1); return; }
/** * calculates only the RHS vector (certainly to be removed due to contact algorithm) */ void MasterContactPoint2D::CalculateRightHandSide( VectorType& rRightHandSideVector, ProcessInfo& rCurrentProcessInfo) { unsigned int ndof = GetGeometry().size()*2; if( rRightHandSideVector.size() != ndof ) rRightHandSideVector.resize(ndof,false); rRightHandSideVector = ZeroVector(ndof); }
/** * TO BE TESTED!!! */ void PlaneStress::InitializeMaterial( const Properties& props, const GeometryType& geom, const Vector& ShapeFunctionsValues ) { mCurrentStress = ZeroVector( 3 ); mE = props[YOUNG_MODULUS]; mNU = props[POISSON_RATIO]; }