void AxisymPointRigidContactPenalty2DCondition::CalculateContactFactors(GeneralVariables &rVariables) { KRATOS_TRY WeakPointerVector<Node<3> >& rN = GetGeometry()[0].GetValue(NEIGHBOUR_NODES); array_1d<double,3> Contact_Point = GetGeometry()[0].Coordinates(); array_1d<double,3> Neighb_Point; double distance = 0; double counter = 0; // double radius = 0; // double meanradius = 0; for(unsigned int i = 0; i < rN.size(); i++) { if(rN[i].Is(BOUNDARY)){ Neighb_Point[0] = rN[i].X(); Neighb_Point[1] = rN[i].Y(); Neighb_Point[2] = rN[i].Z(); // radius = fabs(Contact_Point[0] + rN[i].X()) * 0.5; // meanradius += radius; // distance += norm_2(Contact_Point-Neighb_Point) * radius; distance += norm_2(Contact_Point-Neighb_Point); counter ++; } } // if( Contact_Point[0] > 0) // distance /= ( counter * Contact_Point[0] ); // else // distance /= ( counter * (meanradius/counter) ); if( counter != 0 ) distance /= counter; if( distance == 0 ) distance = 1; //get contact properties and parameters double PenaltyParameter = 1; if( GetProperties().Has(PENALTY_PARAMETER) ) PenaltyParameter = GetProperties()[PENALTY_PARAMETER]; double ElasticModulus = GetProperties()[YOUNG_MODULUS]; double factor = 4; if( distance < 1.0 ){ //take a number bigger than 1.0 (length units) int order = (int)((-1) * std::log10(distance) + 1) ; distance *= factor * pow(10,order); } rVariables.Penalty.Normal = distance * PenaltyParameter * ElasticModulus; double PenaltyRatio = 1; if( GetProperties().Has(TANGENTIAL_PENALTY_RATIO) ) PenaltyRatio = GetProperties()[TANGENTIAL_PENALTY_RATIO]; rVariables.Penalty.Tangent = rVariables.Penalty.Normal * PenaltyRatio; //std::cout<<" Node "<<GetGeometry()[0].Id()<<" Contact Factors "<<rVariables.Penalty.Normal<<" Gap Normal "<<rVariables.Gap.Normal<<" Gap Tangent "<<rVariables.Gap.Tangent<<" Surface.Normal "<<rVariables.Surface.Normal<<" Surface.Tangent "<<rVariables.Surface.Tangent<<" distance "<<distance<<" ElasticModulus "<<ElasticModulus<<" PenaltyParameter "<<PenaltyParameter<<std::endl; KRATOS_CATCH( "" ) }
inline double computeWeightedNorm2(const vectord &x1, const vectord &x2) { assert(n_inputs == x1.size()); assert(x1.size() == x2.size()); return norm_2(x1-x2)/params(0); };
double operator() (const vectord &x) { const vectord x2 = mProc->getData()->getLastSampleX(); return mW*norm_2(x-x2); };