A few months back, i needed a plate model. Searched the net and tried creating it with a CAD software, but then said to myself. What the heck!! All I need is a mesh with quad elements and so wrote this program.
Not a polished code, but if you need a patran neurtal mesh file for a simple plate with custom amount of 4 noded elements, then this is the program for you. Run this and import the generated file any CAD/CAE program.
IMPLICIT NONE INTEGER N_elts_x,D_Node_Number,i,j,N_elts_y REAL*8 coord(121,2),dx,dy,PlateLength,PlateHeight INTEGER conec(100,4),nnodes,nele,ishap,D_Node_Numbery,ielem CHARACTER(len=80) title,datetime DATA title/"Created by fortran code"/ DATA datetime/" Developed by sukhbinder"/ PlateLength = 0.25 PlateHeight = 0.25 ! number of elements in x dir N_elts_x = 3 ! number of elements in y dir N_elts_y = 4 dx = PlateLength / DBLE(N_elts_x) dy = PlateHeight / DBLE(N_elts_y) D_Node_Number = N_elts_x + 1 D_Node_Numbery = N_elts_y + 1 DO i = 1 ,(N_elts_y + 1) DO j =1 , (N_elts_x + 1) COORD((i-1)*D_Node_Number+j , 1 ) = (j-1) * dx COORD((i-1)*D_Node_Number+j , 2 ) = (i-1) * dy END DO END DO ! ielem=0 DO j = 1, N_elts_y DO i = 1, N_elts_x ielem = ielem + 1 conec(ielem,1) = ( j - 1 ) * ( N_elts_x + 1 ) + i conec(ielem,2) = ( j - 1 ) * ( N_elts_x + 1 ) + i + 1 conec(ielem,3) = j * ( N_elts_x + 1 ) + i + 1 conec(ielem,4) = j * ( N_elts_x + 1 ) + i END DO END DO DO i=1,121 WRITE(*,'(i,2f12.8)') i,coord(i,:) END DO DO i=1,100 WRITE(*,'(5i)') i,conec(i,:) END DO ! Writing the file nnodes=(N_elts_x+1)*(N_elts_y+1) nele=N_elts_x*N_elts_y ishap =4 OPEN(13,file="c:\temp\temp.mesh") WRITE(13,9000) 25,0,0,1,0,0,0,0,0 WRITE(13,'(A)') title WRITE(13,9000) 26,0,0,1,nnodes,nele,0,0,0 WRITE(13,'(A)') datetime DO i=1, nnodes WRITE(13,9005) i,0,2,0,0,0,0,0,coord(i,1),coord(i,2),0.0d0 END DO DO i=1,nele WRITE(13,9010) i, ishap, ishap+1,0,0,0,0,0, ishap, 1,1,0,0.d0,0.d0,0.d0,conec(i,1:ishap) END DO WRITE(13,9000) 99, 0, 0, 1, 0, 0, 0, 0, 0 9000 format(i2, 8i8) 9005 format( ' 1', 8i8, /& 1p,3e16.9 / & '1G 6 0 0 000000') 9010 format( ' 2', 8i8, / & 4I8,3e16.9 /& (10i8 )) CLOSE(13) END