FEM-Course-Matlab/17.接触问题matlab有限元编程/fem-contact/Contact_Geometry.m

45 lines
1.9 KiB
Mathematica
Raw Normal View History

2024-01-28 16:46:36 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Function: specify contact geometry entities
%
%input: Problem=0:test problem of two blocks
% 1:Hertz problem
% Slave_or_Master= 0:slave segment
% 1:master segment
%
%output: p,n,Xi,P,W=NURBS parameters for the output segment(in 2D, it's a curve)
% n_q=number of integral points within one element segment
% patch=the patch number that the segement attached to
% Global_ID=global ids of the control points on the curve
% normal_type= 1:normal is 90 anti-clockise to tangent of the curve
% 2:normal is 90 clockwise to tangent of the curve
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ P, patch, Global_DOF_ID] = Contact_Geometry(Slave_or_Master, dis_1, dis_2)
global Nx Ny
switch Slave_or_Master
%in problem 0, slave segment is the upper smaller block
% which patch=2
case 0
patch=2;
[P2,E2,~,~] = Geometry(patch, dis_1, dis_2);
P=P2(1:Nx+1, 1:2);%<EFBFBD>Ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Global_Node_ID=[1:(Nx+1)]+(Nx+1)*(Ny+1);
Global_DOF_ID=[2*(Global_Node_ID(1)-1)+1:2*(Global_Node_ID(end)-1)+2];%<EFBFBD>Ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
case 1
patch=1;
[P1,E1,~,~] = Geometry(patch, dis_1, dis_2);
P=P1((Nx+1)*Ny+1:(Nx+1)*(Ny+1), 1:2);%<EFBFBD>Ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Global_Node_ID=[(Nx+1)*Ny+1:(Nx+1)*(Ny+1)];
Global_DOF_ID=[2*(Global_Node_ID(1)-1)+1:2*(Global_Node_ID(end)-1)+2];;%<EFBFBD>Ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧȫ<EFBFBD>ָնȾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
otherwise
error('Contact_Geometry:slave_or_master can only be chose between 0 or 1');
end
end