normal contact stress code with quad 4 node element
TRANSCRIPT
-
8/14/2019 normal contact stress code with quad 4 node element
1/30
#include
#include
#include
#define ABS(x) (x < 0 ? -(x) : (x))
#define EPS 0.00001
/* Begin-Function definitions */
integ(float xni[][2]);
dmat(int,float*,int*,int,float*,float*,int,float d[][3]);
dbmat(int,float*,int*,float*,float*,float d[][3],float b[][8],float db[][8],float*,float,float);
elemstif(int,int,float se[][8],float tl[8],float xni[][2],float d[][3],float*,float*,float*,float,float,int*);
dbmat2(int,float*,int*,float*,float*,float d[][3],float b[][8],float db[][8],float*,float,float);
elemstif2(int,int,float se[][8],float tl[8],float xni[][2],float d[][3],float*,float*,float*,float,float,int*);
GSolve(float **,int ,float *);
/* End-Function definitions */
/* Begin-Main Code */main()
{// Begin-Declaring variables in main code
FILE *fptr; //pointer to a file
int n,i,j,k,ii,jj; //dummy integers for storing values temporarily and for using in loops
int nmin,nmax,nrt1,nct1,nrt,nct,it,jt;
int ip,nr1,nc1,nr,nc,in;
char dummy[81], title[81], file1[81], file3[81],file4[81],file5[81];
int ne,nn,nq,nm,nd,nl,nen,ndn,ndim,npr,nbw,opt,nbw2,nq1,nq2,nbw3,nbw4;// Numbers of---> ne: elements; nn: nodes; nq: total d.o.f; nm: material
s// nd: disp. BCs; nl: load BCs; nen:el. nodal conn.=4; ndn: dof per node
=2// ndim: 2-dim; npr: mat. properties=3 (E,nu,alpha); nbw, nbw3: band wid
th of specimen// nbw2, nbw4: band width for punch; opt: option for plane stress/strain// nq1,nq2: dof for specimen and punch
int ne1=857,ne2=510,nn1=896,nn2=544;// ne1: no. of el. in spec.; ne2: no. of el. in punch
-
8/14/2019 normal contact stress code with quad 4 node element
2/30
-
8/14/2019 normal contact stress code with quad 4 node element
3/30
printf("output file name:");gets(file5);printf("\n");
printf(" 1 plane stress analysis\n");
printf(" 2 plane strain analysis\n");
printf(" enter 1 or 2 ");
scanf("%d", &opt);
if (opt < 1 opt > 2)
opt = 2;
// Begin-reading data from input filefptr = fopen(file1, "r");
fgets(dummy,80,fptr); // stores first line in a dummy variable
fgets(title,80,fptr); // stores second line in a dummy variable
fgets(dummy,80,fptr); // stores third line in a dummy variable
fscanf(fptr,"%d %d %d %d %d %d\n", &nn, &ne, &nm, &ndim, &nen, &ndn);// scanning values from fourth line
fgets(dummy, 80, fptr); // stores fifth line in a dummy variable
fscanf(fptr,"%d %d\n", &nd, &nl); // scanning values from 6th line
npr = 3; /* Material properties E, Nu, Alpha */
/* ----- begin-memory allocation ----- */
x = (float *) calloc(nn*ndim, sizeof(float));
g =(float *)calloc(nn*ndim, sizeof(float));xx1 = (float *)calloc(nn1*ndim, sizeof(float));
xx2 = (float *)calloc(nn2*ndim, sizeof(float));
noc = (int *) calloc(ne*nen, sizeof(int));
noc1 = (int *) calloc(ne1*nen, sizeof(int));
noc2 = (int *) calloc(ne2*nen, sizeof(int));
u = (float *) calloc(nd, sizeof(float));
nu = (int *) calloc(nd, sizeof(int));
mat = (int *) calloc(ne,sizeof(int));
thick = (float *) calloc(ne, sizeof(float));
f = (float *) calloc(nn*ndn, sizeof(float));
-
8/14/2019 normal contact stress code with quad 4 node element
4/30
tempr = (float *) calloc(ne, sizeof(float));
pm = (float *) calloc(nm*npr, sizeof(float));
mat1=(int *) calloc(ne, sizeof(int));thick1=(float *) calloc(ne, sizeof(float));tempr1=(float *) calloc(ne, sizeof(float));
/* ----- total dof is nq ----- */
nq = ndn * nn;
nq1 = ndn*nn1;
nq2 = ndn*nn2;
x1 = (float *) calloc(nq, sizeof(float));
/* ----- end-memory allocation ----- */
/* =============== read data again ==================== */
/* ----- connectivity, material, thickness, temp-change ----- */
fgets(dummy,80,fptr); // stores eighth line in dummy variableprintf("%s I am at beginning of nodes \n",dummy);
/* begin-loop to read element connectivity data line by line */
for (i = 0; i < ne; i++){
fscanf(fptr,"%d", &n); // Element number stored in n
for (j = 0; j < nen; j++){
fscanf(fptr,"%d", &k); // nen=4 Nodes corresponding to nth element
noc[(n-1)*nen+j]=k; // list of nodes attached to all elements ingroups of 4
}
fscanf(fptr,"%d", &k);mat[n-1] = k; // storing material number
fscanf(fptr,"%f",&c);
thick[n-1] = c; // storing thickness
fscanf(fptr,"%f\n",&c);
tempr[n-1] = c; // storing temperature
-
8/14/2019 normal contact stress code with quad 4 node element
5/30
}
/* end-loop to read element connectivity data line by line */
for (i=0; i
-
8/14/2019 normal contact stress code with quad 4 node element
6/30
fscanf(fptr, "%d %f\n", &k, &c);
f[k-1] = c; // value of force, c, for the corresponding dof, k, replacingthe initialized zero value
}
/* ----- material properties ----- */
fgets(dummy,80,fptr);
for (i = 0; i < nm; i++){
fscanf(fptr, "%d", &k);
for (j = 0; j < npr; j++){
fscanf(fptr, "%f\n", &c);
pm[(k-1)*npr+j] = c;
}
}
fclose (fptr);
// End-reading data from input file
/* ----- coordinates ----- */
printf("\nenter the step number or increment number\n");scanf("%d",&inc);
//begin-reading node coordinatesif(inc==1){// Reads from old co-ordinates file
fptr=fopen(file3,"r");fgets(dummy,80,fptr); // Header saying node no, x-coord and y-coord
for (i = 0; i < nn; i++)
{
fscanf(fptr, "%d", &n); // Node number
for (j = 0; j < ndim; j++){
fscanf(fptr, "%f\n", &c);
x[ndim*(n-1)+j] = c; // coordinates stored alternately
}
-
8/14/2019 normal contact stress code with quad 4 node element
7/30
}
for (i=0;i
-
8/14/2019 normal contact stress code with quad 4 node element
8/30
-
8/14/2019 normal contact stress code with quad 4 node element
9/30
}
printf ("the bandwidth for punch is %d\n", nbw3);
/* ----- allocate memory for banded stiffness array----- */
s1 = (float *) calloc(nq1*nbw, sizeof(float));
s2 = (float *) calloc(nq2*nbw3, sizeof(float));
for (i=0; i< nq1*nbw; i++){
s1[i]=0;}
for (i=0; i< nq2*nbw3; i++)
{ s2[i]=0;}
/* ----- global stiffness matrix, corner nodes and integrationpoints ----- */
integ(xni);
for (n = 0; n < ne1; n++){//begin- n loop going element by element in spec
printf("forming stiffness matrix of specimen %d\n", n+1);
dmat(n,pm,mat,npr,&pnu,&al,opt,d); // Constitutive matrix
/* --- element stiffness --- */
elemstif(n,opt,se,tl,xni,d,thick,tempr,xx1,al,pnu,noc1);printf (".... placing in global locations\n");
for (ii = 0; ii < nen; ii++){//begin - ii loop to go through four nodes corresonding to each element
nrt1 = ndn * (noc1[nen*n + ii] - 1);
for (it = 0; it < ndn; it++){//begin - it loop to go through dimensions
nr1 = nrt1 + it; // gives position of Ux and Uy (row number in banded matrix)
i = ndn * ii + it; // goes from 0 to 7, corresponding to local stiffness matrix
for (jj = 0; jj < nen; jj++){// begin - jj loop similar to ii
-
8/14/2019 normal contact stress code with quad 4 node element
10/30
nct1 = ndn * (noc1[nen*n+jj] - 1);
for (jt = 0; jt < ndn; jt++){//begin - jt loop similar to it
nc1 = nct1 + jt - nr1; // corresponds to column number in ba
nded matrix
j = ndn * jj + jt; // goes from 0 to 7, corresponding to local stiffness matrix
if (nc1 >= 0)
s1[nbw*nr1+nc1] = s1[nbw*nr1+nc1] + se[i][j];}//end - jt loop
}//end - jj loop}//end - it loop
}//end - ii loop
}//end- n loop going element by element in spec
for (n = 0;n < ne2;n++){
printf("forming stiffness matrix of punch %d\n", n+1);
dmat(n,pm,mat1,npr,&pnu,&al,opt,d);
/* --- element stiffness --- */
elemstif2(n,opt,se,tl,xni,d,thick1,tempr1,xx2,al,pnu,noc2);printf (".... placing in global locations\n");
for (ii = 0; ii < nen; ii++){
nrt = ndn*(noc2[nen*n + ii] - nn1-1);
for (it = 0; it < ndn; it++){
nr = nrt + it;
i = ndn * ii + it;
for (jj = 0; jj < nen; jj++){
nct = ndn * (noc2[nen*n+jj] - nn1-1);
for (jt = 0; jt < ndn; jt++)
{
j = ndn * jj + jt;
-
8/14/2019 normal contact stress code with quad 4 node element
11/30
nc = nct + jt - nr;if (nc >= 0)
s2[nbw3*nr+nc] = s2[nbw3*nr+nc] + se[i][j];
}
}
}
}}
printf("\nNOW ASSEMBLING,CACULATING AND THEN DISPLAYING THE RESULTS,PLEASE BE PATIENT\n");
/*allocating memory for SPECIMEN stiffness matrix */
k1 = (float **)malloc((nq1)*sizeof(float *));
for (i=0;i
-
8/14/2019 normal contact stress code with quad 4 node element
12/30
{
nbw2--; // Last few rows have decreasing band width !!
}
for(j=i;j
-
8/14/2019 normal contact stress code with quad 4 node element
13/30
nbw4=nbw3;
for(i=0;i=nq2-nbw3+1)
{
nbw4--;
}
for(j=i;j
-
8/14/2019 normal contact stress code with quad 4 node element
14/30
kk[i] = (float *)malloc(nq*sizeof(float));
for(i=0;i
-
8/14/2019 normal contact stress code with quad 4 node element
15/30
kk[i][j]=kk[i][j]+k2[i-1792][j-1792];
}
}
/* ----- decide penalty parameter cnst ----- */
cnst = 0.;
for (i = 0; i < nq; i++) {
if (cnst < kk[i][i])
cnst = kk[i][i];
}
cnst = cnst * 10000.;
/* ----- modify for displacement boundary conditions ----- */
for (i = 0; i < nd; i++) {
k = nu[i];kk[k-1][k-1] = kk[k-1][k-1]+ cnst;
f[k-1] = f[k-1] + cnst * u[i];
}
/*---------------------------------------------------------------------------------------*/
a = (float **)malloc((nq+1)*sizeof(float *));
for (i=0;i
-
8/14/2019 normal contact stress code with quad 4 node element
16/30
{
a[nq][i]=f[i];
}
GSolve(a,nq,x1);
/* ----- solution of equations using gauss solver ----- ----------------------------------------------------------------*/
/* bandsolv(s,f,nq,nbw); */
/* ----- printing displacements ----- */
fptr = fopen(file5, "w");//opening of a file in which disp will be printed
printf("\n%s\n", title);
fprintf(fptr, "\n%s\n", title);
fprintf(fptr,"bandwidth for spcimen is %d\n",nbw);fprintf(fptr,"bandwidth for punch is %d\n",nbw3);
if (opt == 1)
fprintf(fptr, "plane stress analysis\n");
if (opt == 2)
fprintf(fptr, "plane strain analysis\n");
fprintf(fptr, "nodulal x-displ y-displ\n");
printf ("node x-displ y-displ\n");
for (i = 0; i < nn; i++) {
printf(" %4d %11.4e %11.4e\n",i+1,x1[2*i],x1[2*i+1]);
fprintf(fptr," %4d %11.4e %11.4e\n",i+1,x1[2*i],x1[2*i+1]);
}
fclose(fptr);//closing of this file/*NOW FINDING OVERALL DISP OF EACH NODE*//*allocating memory for new displacements*/np=(float *) calloc(nn*ndn, sizeof(float));if(inc==1){
printf("\n now writing final coordinates for increment1 in user choice file 4
");for(i=0;i
-
8/14/2019 normal contact stress code with quad 4 node element
17/30
g[2*i]=x[2*i]+x1[2*i]; //the final x-coordinate after deformation with increment1
g[2*i+1]=x[2*i+1]+x1[2*i+1];//the final y-coordinat after deformation with increment1
}fptr=fopen(file4,"w");
for(i=0;i
-
8/14/2019 normal contact stress code with quad 4 node element
18/30
fprintf(fptr,"%.15f\n",reldisp[i]);}fclose(fptr);}
printf("\nthanks for ur patience..for complete results,check the output filesin this folder");return(0);
}
integ(xni)
float xni[][2];
{
float c;
/* ----- integration points xni() ----- */
c = 0.57735026919;
xni[0][0] = -c;
xni[0][1] = -c;
xni[1][0] = c;
xni[1][1] = -c;
xni[2][0] = c;
xni[2][1] = c;
xni[3][0] = -c;
xni[3][1] = c;
return(0);
}
dmat(n,pm,mat,npr,pnu1,al1,opt,d)
int opt,n,npr,*mat;
float *pm,*pnu1,*al1,d[][3];
{
int m;
float e,c,c1,c2,c3,pnu,al;
/* ----- d() matrix ----- */
/* --- material properties --- */
-
8/14/2019 normal contact stress code with quad 4 node element
19/30
m = mat[n]-1;
e = pm[npr*m];
pnu= pm[npr*m+1];
al = pm[npr*m+2];
*pnu1 = pnu;
*al1 = al;
/* --- d() matrix --- */
if (opt == 1) {
/* --- plane stress --- */
c1 = e / (1 - pnu * pnu);
c2 = c1 * pnu;
}
else {
/* --- plane strain --- */
c = e / ((1 + pnu) * (1 - 2 * pnu));
c1 = c * (1 - pnu);
c2 = c * pnu;
}
c3 = .5 * e / (1 + pnu);
d[0][0] = c1;
d[0][1] = c2;
d[0][2] = 0;
d[1][0] = c2;
d[1][1] = c1;
d[1][2] = 0;
d[2][0] = 0;
d[2][1] = 0;
d[2][2] = c3;
return(0);
}
-
8/14/2019 normal contact stress code with quad 4 node element
20/30
elemstif(n,opt,se,tl,xni,d,thick,tempr,x,al,pnu,noc)
int n,opt,*noc;
float al,pnu;
float *x,*tempr,*thick,d[][3],tl[8],se[][8],xni[][2];
{
int i,j,k,ip;
float dte,c,xi,eta,th,dj,b[3][8],db[3][8];
/* ----- element stiffness and temperature load ----- */
for (i = 0; i < 8;i++) {
for (j = 0; j < 8; j++) {
se[i][j] = 0.;
}
tl[i] = 0.;
}
dte = tempr[n];
/* --- weight factor is one --- */
/* --- loop on integration points --- */
for (ip = 0; ip < 4; ip++) {
/* --- get db matrix at integration point ip --- */
xi = xni[ip][0];
eta = xni[ip][1];
dbmat(n,x,noc,thick,&th,d,b,db,&dj,xi,eta);
/* --- element stiffness matrix se --- */
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++) {
c = 0;
for (k = 0; k < 3; k++) {
c = c + b[k][i] * db[k][j] * dj * th;
}
-
8/14/2019 normal contact stress code with quad 4 node element
21/30
se[i][j] = se[i][j] + c;
}
}
/* --- determine temperature load tl --- */
c = al * dte;
if (opt == 2)
c = (1 + pnu) * c;
for (i = 0; i < 8; i++) {
tl[i] = tl[i] + th * dj * c * (db[0][i] + db[1][i]);
}
}
return(0);
}
dbmat(n,x,noc,thick,th1,d,b,db,dj1,xi,eta)
float *x,*dj1,*thick,*th1,xi,eta;
float d[][3],b[][8],db[][8];
int n,*noc;
{
int n1,n2,n3,n4,i,j,k;
float x1,y1,x2,y2,x3,y3,x4,y4,tj11,tj12,tj21,tj22,dj,c;
float th,a[3][4],g[4][8];
/* ----- db() matrix ----- */
/* --- nodal coordinates --- */
th = thick[n];
*th1 = th;
n1 = noc[4*n];
n2 = noc[4*n+1];
n3 = noc[4*n+2];
n4 = noc[4*n+3];
x1 = x[2*(n1-1)];
-
8/14/2019 normal contact stress code with quad 4 node element
22/30
y1 = x[2*(n1-1)+1];
x2 = x[2*(n2-1)];
y2 = x[2*(n2-1)+1];
x3 = x[2*(n3-1)];
y3 = x[2*(n3-1)+1];
x4 = x[2*(n4-1)];
y4 = x[2*(n4-1)+1];
/* --- formation of jacobian tj --- */
tj11 = ((1 - eta) * (x2 - x1) + (1 + eta) * (x3 - x4)) / 4;
tj12 = ((1 - eta) * (y2 - y1) + (1 + eta) * (y3 - y4)) / 4;
tj21 = ((1 - xi) * (x4 - x1) + (1 + xi) * (x3 - x2)) / 4;
tj22 = ((1 - xi) * (y4 - y1) + (1 + xi) * (y3 - y2)) / 4;
/* --- determinant of the jacobian --- */
dj = tj11 * tj22 - tj12 * tj21;
*dj1 = dj;
/* --- a[3,4] matrix relates strains to --- */
/* --- local derivatives of u --- */
a[0][0] = tj22 / dj;
a[1][0] = 0;
a[2][0] = -tj21 / dj;
a[0][1] = -tj12 / dj;
a[1][1] = 0;
a[2][1] = tj11 / dj;
a[0][2] = 0;
a[1][2] = -tj21 / dj;
a[2][2] = tj22 / dj;
a[0][3] = 0;
a[1][3] = tj11 / dj;
a[2][3] = -tj12 / dj;
/* --- g[4,8] matrix relates local derivatives of u --- */
-
8/14/2019 normal contact stress code with quad 4 node element
23/30
/* --- to local nodal displacements q[8] --- */
for (i = 0; i < 4; i++) {
for (j = 0; j < 8; j++) {
g[i][j] = 0;
}
}
g[0][0] = -(1 - eta) / 4;
g[1][0] = -(1 - xi) / 4;
g[2][1] = -(1 - eta) / 4;
g[3][1] = -(1 - xi) / 4;
g[0][2] = (1 - eta) / 4;
g[1][2] = -(1 + xi) / 4;
g[2][3] = (1 - eta) / 4;
g[3][3] = -(1 + xi) / 4;
g[0][4] = (1 + eta) / 4;
g[1][4] = (1 + xi) / 4;
g[2][5] = (1 + eta) / 4;
g[3][5] = (1 + xi) / 4;
g[0][6] = -(1 + eta) / 4;
g[1][6] = (1 - xi) / 4;
g[2][7] = -(1 + eta) / 4;
g[3][7] = (1 - xi) / 4;
/* --- b[3,8] matrix relates strains to q --- */
for (i = 0; i < 3; i++) {
for (j = 0; j < 8; j++) {
c = 0;
for (k = 0; k < 4; k++) {
c = c + a[i][k] * g[k][j];
}
b[i][j] = c;
-
8/14/2019 normal contact stress code with quad 4 node element
24/30
}
}
/* --- db[3,8] matrix relates stresses to q[8] --- */
for (i = 0; i < 3; i++) {
for (j = 0; j < 8; j++) {
c = 0;
for (k = 0; k < 3; k++) {
c = c + d[i][k] * b[k][j];
}
db[i][j] = c;
}
}
return(0);
}
/*repeating functions for punch*/elemstif2(n,opt,se,tl,xni,d,thick,tempr,x,al,pnu,noc)
int n,opt,*noc;
float al,pnu;
float *x,*tempr,*thick,d[][3],tl[8],se[][8],xni[][2];
{
int i,j,k,ip;
float dte,c,xi,eta,th,dj,b[3][8],db[3][8];
/* ----- element stiffness and temperature load ----- */
for (i = 0; i < 8;i++) {
for (j = 0; j < 8; j++) {
se[i][j] = 0.;
}
tl[i] = 0.;
}
dte = tempr[n];
-
8/14/2019 normal contact stress code with quad 4 node element
25/30
/* --- weight factor is one --- */
/* --- loop on integration points --- */
for (ip = 0; ip < 4; ip++) {
/* --- get db matrix at integration point ip --- */
xi = xni[ip][0];
eta = xni[ip][1];
dbmat2(n,x,noc,thick,&th,d,b,db,&dj,xi,eta);
/* --- element stiffness matrix se --- */
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++) {
c = 0;
for (k = 0; k < 3; k++) {
c = c + b[k][i] * db[k][j] * dj * th;
}
se[i][j] = se[i][j] + c;
}
}
/* --- determine temperature load tl --- */
c = al * dte;
if (opt == 2)
c = (1 + pnu) * c;
for (i = 0; i < 8; i++) {
tl[i] = tl[i] + th * dj * c * (db[0][i] + db[1][i]);
}
}
return(0);
}
dbmat2(n,x,noc,thick,th1,d,b,db,dj1,xi,eta)
float *x,*dj1,*thick,*th1,xi,eta;
float d[][3],b[][8],db[][8];
-
8/14/2019 normal contact stress code with quad 4 node element
26/30
int n,*noc;
{
int n1,n2,n3,n4,i,j,k;
float x1,y1,x2,y2,x3,y3,x4,y4,tj11,tj12,tj21,tj22,dj,c;
float th,a[3][4],g[4][8];
/* ----- db() matrix ----- */
/* --- nodal coordinates --- */
th = thick[n];
*th1 = th;
n1 = noc[4*n];
n2 = noc[4*n+1];
n3 = noc[4*n+2];
n4 = noc[4*n+3];
x1 = x[2*(n1-1)-1792];
y1 = x[2*(n1-1)+1-1792];
x2 = x[2*(n2-1)-1792];
y2 = x[2*(n2-1)+1-1792];
x3 = x[2*(n3-1)-1792];
y3 = x[2*(n3-1)+1-1792];
x4 = x[2*(n4-1)-1792];
y4 = x[2*(n4-1)+1-1792];
/* --- formation of jacobian tj --- */
tj11 = ((1 - eta) * (x2 - x1) + (1 + eta) * (x3 - x4)) / 4;
tj12 = ((1 - eta) * (y2 - y1) + (1 + eta) * (y3 - y4)) / 4;
tj21 = ((1 - xi) * (x4 - x1) + (1 + xi) * (x3 - x2)) / 4;
tj22 = ((1 - xi) * (y4 - y1) + (1 + xi) * (y3 - y2)) / 4;
/* --- determinant of the jacobian --- */
dj = tj11 * tj22 - tj12 * tj21;
*dj1 = dj;
/* --- a[3,4] matrix relates strains to --- */
-
8/14/2019 normal contact stress code with quad 4 node element
27/30
/* --- local derivatives of u --- */
a[0][0] = tj22 / dj;
a[1][0] = 0;
a[2][0] = -tj21 / dj;
a[0][1] = -tj12 / dj;
a[1][1] = 0;
a[2][1] = tj11 / dj;
a[0][2] = 0;
a[1][2] = -tj21 / dj;
a[2][2] = tj22 / dj;
a[0][3] = 0;
a[1][3] = tj11 / dj;
a[2][3] = -tj12 / dj;
/* --- g[4,8] matrix relates local derivatives of u --- */
/* --- to local nodal displacements q[8] --- */
for (i = 0; i < 4; i++) {
for (j = 0; j < 8; j++) {
g[i][j] = 0;
}
}
g[0][0] = -(1 - eta) / 4;
g[1][0] = -(1 - xi) / 4;
g[2][1] = -(1 - eta) / 4;
g[3][1] = -(1 - xi) / 4;
g[0][2] = (1 - eta) / 4;
g[1][2] = -(1 + xi) / 4;
g[2][3] = (1 - eta) / 4;
g[3][3] = -(1 + xi) / 4;
g[0][4] = (1 + eta) / 4;
g[1][4] = (1 + xi) / 4;
-
8/14/2019 normal contact stress code with quad 4 node element
28/30
g[2][5] = (1 + eta) / 4;
g[3][5] = (1 + xi) / 4;
g[0][6] = -(1 + eta) / 4;
g[1][6] = (1 - xi) / 4;
g[2][7] = -(1 + eta) / 4;
g[3][7] = (1 - xi) / 4;
/* --- b[3,8] matrix relates strains to q --- */
for (i = 0; i < 3; i++) {
for (j = 0; j < 8; j++) {
c = 0;
for (k = 0; k < 4; k++) {
c = c + a[i][k] * g[k][j];
}
b[i][j] = c;
}
}
/* --- db[3,8] matrix relates stresses to q[8] --- */
for (i = 0; i < 3; i++) {
for (j = 0; j < 8; j++) {
c = 0;
for (k = 0; k < 3; k++) {
c = c + d[i][k] * b[k][j];
}
db[i][j] = c;
}
}
return(0);
}/* ----- band solver ----- */
/* -----gauss solver ----- */
GSolve(float **a,int nq,float *x1)
-
8/14/2019 normal contact stress code with quad 4 node element
29/30
{
int i,j,k,maxrow;
float tmp;
for (i=0;i
-
8/14/2019 normal contact stress code with quad 4 node element
30/30