Advertisement
rgedies

mesh_fine02

May 26th, 2023
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Fortran 32.40 KB | Source Code | 0 0
  1.  
  2.       subroutine MESH02_FINE(d_branch,thickness_p,thickness_b,& gap,gap2,area_w,angle_wrtb,vl_runpipe,& vl_branch,size_w,nnode,nelem,INODE,coord,&larray_ele,key_point,r_cc,iabaqus)
  3.       parameter (nnmax=2000,nemax=1000)
  4.       IMPLICIT REAL*8 (A-H, O-Z)
  5.  
  6.       DIMENSION :: KEY_POINT(*),LARRAY_ELE(8,*)
  7.       DIMENSION INODE(*),COORD(2,*)
  8.  
  9.       DIMENSION :: x(1000),y(1000),n_repeat(10,2)
  10.       DIMENSION :: co_f(2),co_l(2),dist(4),larray2D(1000,5)
  11.  
  12.     DIMENSION :: INODE_TEMP1(10000), IELEM_TEMP1(4,10000)&  , INELEM_TEMP1(4,10000)
  13.     DIMENSION :: INODE_TEMP2(10000), IELEM_TEMP2(4,10000)&  , INELEM_TEMP2(4,10000)
  14.     REAL*8 COORD_TEMP1(2,10000),COORD_TEMP2(2,10000)
  15.     INTEGER NDEN1, NDEN2,NDEN3,NDEN4,NDEN5,NDEN6,NDEN7,NDEN8,NDEN9& ,NDEN10
  16.     INTEGER NDEN11, NDEN12,NDEN13,NDEN14,NDEN15,NDEN16,NDEN17,NDEN18&,NDEN19,NDEN20
  17.       common /coord/x,y
  18.     COMMON /MESHING/DLENGTH1, DHAZ, DLENGTH2, DBAND, DMESHSIZE
  19.     INTEGER NNUM_HAZ, NNUM_WELD, NNUM_PIPE, NNUM_SLEEVE
  20.     REAL*8 ELEMSIZE, ELLP_X1, ELLP_X2, ELLP_Y1, ELLP_Y2
  21.     REAL*8 POINTS(2,50),CORNERS(2,4)
  22.     INTEGER ITOTALNODES, ITOTALELEMS, ITOTALNODES2, ITOTALELEMS2&, NRESIDUAL&, NCOARSESIDE
  23.     REAL*8 DTEMP1, DTEMP2
  24.     LOGICAL BTRAN
  25.     INTEGER NNUM_HAZ_H, NNUM_HAZ_V, NNUM_BAND, NNUM_PIPE_TRAN&  , NNUM_PIPE_END
  26.  
  27.     BTRAN = .TRUE.
  28.       zero=0.0d0
  29.     DPI = DASIN(1.0D0)*2.0D0
  30.       electro_ang = angle_wrtb*DPI/180.0D0
  31.       wprep_ang = 0.5 * electro_ang
  32.       write(*,3) "Estimated cross-sectional area ", &   "of the weld deposit =", weldarea,"mm^2."
  33.  3    format(1x,A,A,ES9.2,1x,A,A)
  34.  
  35.       angle1=electro_ang
  36.       angle2=wprep_ang
  37.     ROOTGAP = GAP
  38.     VLAND = GAP2
  39.       if (rootgap .lt. 0.5*vland) rootgap=0.5*vland    
  40.       vxmin=0.3*vland  
  41.       vymin=vxmin*tan(angle2)
  42.       weldmin=rootgap*(vland+vxmin) &   +0.5d0*vxmin*vymin&   +0.5d0*(vymin+rootgap)**2/tan(angle1)
  43.  
  44.       if (area_W.le. weldmin) then
  45.          vx=zero
  46.          vy=zero
  47.          rootgap=sqrt(AREA_W)
  48.          vland=rootgap
  49.          size_w=zero
  50.          r_cc=0.5*rootgap        
  51.       else
  52.          a=0.5*tan(angle2)*(1.+tan(angle2)/tan(angle1))
  53.          b=rootgap*(1.+tan(angle2)/tan(angle1))
  54.          c=rootgap*vland+0.5*rootgap*rootgap/tan(angle1)-AREA_W
  55.          vx=0.5*(-b+sqrt(b*b-4.*a*c))/a
  56.          if (vland+vx .gt. THICKNESS_B-0.1D0) then
  57.             vx=THICKNESS_B-vland
  58.             vy=vx*tan(angle2)
  59.             area3=AREA_W-rootgap*vland-0.5*vx*(2.*rootgap+vy)
  60.             weldsize=vx+2.*area3/(vy+rootgap)
  61.             electro_ang=atan((vy+rootgap)/(weldsize-vx))  
  62.          else
  63.             vy=vx*tan(angle2)
  64.             weldsize=vx+(vy+rootgap)/tan(angle1)
  65.          endif
  66.          size_w=(vy+rootgap)/sin(electro_ang)
  67.          r_cc=0.5*size_w
  68.       endif
  69.  
  70.     CALL INITMESH(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1, COORD_TEMP1 & , 10000,10000)
  71.  
  72.     CALL KEYPOINTS_BRANCH(D_BRANCH-2*THICKNESS_B,THICKNESS_P&   ,THICKNESS_B, ROOTGAP,VLAND,
  73.      1     VX,WELDSIZE,ANGLE1,VL_RUNPIPE,VL_BRANCH,POINTS,50)
  74.  
  75.     ELLP_X1 = DLENGTH1
  76.     ELLP_Y1 = DHAZ
  77.     NNUM_HAZ = ELLP_X1/DMESHSIZE
  78.     NNUM_HAZ_T = DHAZ/DMESHSIZE
  79.     NNUM_WELD_PIPE = 0.75D0*NNUM_HAZ ! REDUCE THE NUMBER BY HALF
  80.     NRESIDUAL = NNUM_HAZ-NNUM_WELD_PIPE
  81.     IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  82.         NNUM_WELD_PIPE = NNUM_WELD_PIPE + 1
  83.     END IF
  84.     IF ( NNUM_WELD_PIPE .EQ. NNUM_HAZ ) NNUM_WELD_PIPE = NNUM_HAZ-2
  85.     IF ( NNUM_WELD_PIPE .LT.2 ) THEN
  86.         NNUM_WELD_PIPE = 2
  87.         NNUM_HAZ = 4
  88.     END IF
  89.    
  90.     IFINESIDE = NNUM_HAZ+1 !THESE ARE THE DEFINING NUMBERS FOR THE MESH
  91.     ISIDE = NNUM_HAZ_T+1
  92.     ICOARSESIDE = NNUM_WELD_PIPE +1
  93.  
  94.     NDEN1 = NNUM_HAZ
  95.     NDEN2 = NNUM_HAZ_T
  96.     NDEN12 = NNUM_WELD_PIPE
  97.  
  98.     ITOTALNODES = 0
  99.     ITOTALELEMS = 0    
  100.       CALL INITMESH(INODE_TEMP1,IELEM_TEMP1,INELEM_TEMP1, COORD_TEMP1&  , 10000,10000)
  101.    
  102.     CALL MESHRECTANGLE_TRANSITION2(IFINESIDE,ICOARSESIDE, ISIDE&    , INODE_TEMP1, & IELEM_TEMP1,INELEM_TEMP1, COORD_TEMP1)
  103.    
  104.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  105.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  106.  
  107.     CORNERS(1,1) = POINTS(1,3)
  108.     CORNERS(2,1) = POINTS(2,3)
  109.     CORNERS(1,2) = POINTS(1,4)
  110.     CORNERS(2,2) = POINTS(2,4)
  111.     CORNERS(1,3) = POINTS(1,2)
  112.     CORNERS(2,3) = POINTS(2,2)
  113.     CORNERS(1,4) = POINTS(1,1)
  114.     CORNERS(2,4) = POINTS(2,1)
  115.     CALL TRANSFORMNODES(COORD_TEMP1,CORNERS,ITOTALNODES,1.0D0,1.0D0)           
  116.     ISIDE = DHAZ*ISIDE*0.75D0/DBAND
  117.     NCOARSESIDE = 0.4D0*(IFINESIDE-1)
  118.     NRESIDUAL = NNUM_HAZ-NCOARSESIDE
  119.     IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  120.         NCOARSESIDE = NCOARSESIDE +1
  121.     END IF
  122.     ICOARSESIDE = NCOARSESIDE +1
  123.     NDEN4 = NCOARSESIDE
  124.     NDEN3 = ISIDE-1
  125.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&  , 10000,10000)
  126.     CALL MESHRECTANGLE_TRANSITION2(IFINESIDE,ICOARSESIDE, ISIDE &   , INODE_TEMP2,& IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  127.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  128.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  129.     CORNERS(1,1) = POINTS(1,4)
  130.     CORNERS(2,1) = POINTS(2,4)
  131.     CORNERS(1,2) = POINTS(1,3)
  132.     CORNERS(2,2) = POINTS(2,3)
  133.     CORNERS(1,3) = POINTS(1,5)
  134.     CORNERS(2,3) = POINTS(2,5)
  135.     CORNERS(1,4) = POINTS(1,6)
  136.     CORNERS(2,4) = POINTS(2,6) 
  137.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.2D0)
  138.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1, & ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  139.  
  140.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  141.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)             
  142.     IFINESIDE = ICOARSESIDE
  143.     NCOARSESIDE = 0.33D0*(IFINESIDE-1)
  144.     IF ( NCOARSESIDE .LT. 5 ) NCOARSESIDE = 5
  145.     NRESIDUAL = (IFINESIDE-1)-NCOARSESIDE
  146.     IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  147.         NCOARSESIDE = NCOARSESIDE +1
  148.     END IF
  149.     ICOARSESIDE = NCOARSESIDE +1
  150.  
  151.     IF ( (IFINESIDE - ICOARSESIDE).LT. 2 ) BTRAN = .FALSE.
  152.      
  153.     DTEMP1 = DSQRT((POINTS(1,6)-POINTS(1,5))*(POINTS(1,6)-POINTS(1,5)) & + (POINTS(2,6)-POINTS(2,5))*(POINTS(2,6)-POINTS(2,5)))
  154.     DTEMP2 = DSQRT((POINTS(1,7)-POINTS(1,5))*(POINTS(1,7)-POINTS(1,5))& + (POINTS(2,7)-POINTS(2,5))*(POINTS(2,7)-POINTS(2,5)))
  155.     ISIDE = 0.5D0*IFINESIDE*DTEMP2/DTEMP1
  156.     IF ( ISIDE .LT. 3 ) ISIDE = 3
  157.     NDEN5 = NCOARSESIDE
  158.     NDEN6 = ISIDE -1
  159.  
  160.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&  , 10000,10000)
  161.     IF ( BTRAN ) THEN
  162.         CALL MESHRECTANGLE_TRANSITION2(IFINESIDE,ICOARSESIDE, ISIDE&    , INODE_TEMP2,& IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  163.     ELSE
  164.         CALL MESHRECTANGLE(IFINESIDE, ISIDE, INODE_TEMP2,&      IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  165.     END IF
  166.  
  167.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  168.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  169.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2,& ITOTALELEMS2,3,2)!!THIS SAYS: SET FACE 3 TO FORCED 2
  170.  
  171.     CORNERS(1,1) = POINTS(1,6)
  172.     CORNERS(2,1) = POINTS(2,6)
  173.     CORNERS(1,2) = POINTS(1,5)
  174.     CORNERS(2,2) = POINTS(2,5)
  175.     CORNERS(1,3) = POINTS(1,7)
  176.     CORNERS(2,3) = POINTS(2,7)
  177.     CORNERS(1,4) = POINTS(1,8)
  178.     CORNERS(2,4) = POINTS(2,8) 
  179.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.5D0)
  180.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,& ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  181.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  182.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  183.     BTRAN = .TRUE.
  184.  
  185.     IFINESIDE = NDEN2+1
  186.     ISIDE = NDEN3+1
  187.     NCOARSESIDE = 0.75D0*(IFINESIDE-1)
  188.  
  189.     NRESIDUAL = (IFINESIDE-1)-NCOARSESIDE
  190.     IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  191.         NCOARSESIDE = NCOARSESIDE +1
  192.     END IF
  193.     ICOARSESIDE = NCOARSESIDE +1
  194.     IF ( (IFINESIDE - ICOARSESIDE).LT. 2 ) BTRAN = .FALSE.
  195.     IF ( BTRAN ) THEN
  196.         NDEN7 = NCOARSESIDE
  197.     ELSE
  198.         NDEN7 = IFINESIDE - 1
  199.     END IF
  200.  
  201.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&  , 10000,10000)
  202.     IF ( BTRAN ) THEN
  203.         CALL MESHRECTANGLE_TRANSITION2(IFINESIDE,ICOARSESIDE, ISIDE &   , INODE_TEMP2,& IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  204.     ELSE
  205.         CALL MESHRECTANGLE(IFINESIDE, ISIDE, INODE_TEMP2,&      IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  206.     END IF
  207.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  208.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  209.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2,& ITOTALELEMS2,2,1)!!THIS SAYS: SET FACE 2  TO 1,FREE
  210.  
  211.  
  212.     CORNERS(1,1) = POINTS(1,3)
  213.     CORNERS(2,1) = POINTS(2,3)
  214.     CORNERS(1,2) = POINTS(1,1)
  215.     CORNERS(2,2) = POINTS(2,1)
  216.     CORNERS(1,3) = POINTS(1,10)
  217.     CORNERS(2,3) = POINTS(2,10)
  218.     CORNERS(1,4) = POINTS(1,5)
  219.     CORNERS(2,4) = POINTS(2,5) 
  220.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.2D0)
  221.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,& ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  222.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  223.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  224.  
  225.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&  , 10000,10000)
  226.     IF ( BTRAN ) THEN
  227.         CALL MESHRECTANGLE_TRANSITION2(IFINESIDE,ICOARSESIDE, ISIDE &   , INODE_TEMP2,& IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  228.     ELSE
  229.         CALL MESHRECTANGLE(IFINESIDE, ISIDE, INODE_TEMP2,&  IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  230.     END IF
  231.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  232.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  233.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2, &    ITOTALELEMS2,4,1)!!THIS SAYS: SET FACE 4 TO 1, FREE CONVECTION
  234.        
  235.     CORNERS(1,1) = POINTS(1,2)
  236.     CORNERS(2,1) = POINTS(2,2)
  237.     CORNERS(1,2) = POINTS(1,4)
  238.     CORNERS(2,2) = POINTS(2,4)
  239.     CORNERS(1,3) = POINTS(1,6)
  240.     CORNERS(2,3) = POINTS(2,6)
  241.     CORNERS(1,4) = POINTS(1,12)
  242.     CORNERS(2,4) = POINTS(2,12)
  243.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.2D0)
  244.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,& ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2,  & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  245.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  246.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  247.     BTRAN = .TRUE.
  248.  
  249.     IFINESIDE = NDEN7+1
  250.     ISIDE = NDEN6+1
  251.     NCOARSESIDE = 0.2D0*(IFINESIDE-1)
  252.     IF ( NCOARSESIDE .LT. 5 ) NCOARSESIDE = 5
  253.     NRESIDUAL = (IFINESIDE-1)-NCOARSESIDE
  254.     IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  255.         NCOARSESIDE = NCOARSESIDE +1
  256.     END IF
  257.     ICOARSESIDE = NCOARSESIDE +1
  258.     IF ( (IFINESIDE - ICOARSESIDE).LT. 2 ) BTRAN = .FALSE.
  259.     IF ( BTRAN ) THEN
  260.         NDEN8 = NCOARSESIDE
  261.     ELSE
  262.         NDEN8 = IFINESIDE - 1
  263.     END IF
  264.  
  265.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&  , 10000,10000)
  266.     IF ( BTRAN ) THEN
  267.         CALL MESHRECTANGLE_TRANSITION2(IFINESIDE,ICOARSESIDE, ISIDE&    , INODE_TEMP2, &    IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  268.     ELSE
  269.         CALL MESHRECTANGLE(IFINESIDE, ISIDE, INODE_TEMP2, &     IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  270.     END IF
  271.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  272.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  273.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2,& ITOTALELEMS2,2,1)!!THIS SAYS: SET 2 TO 1, FREE CONVECTION
  274.  
  275.     CORNERS(1,1) = POINTS(1,5)
  276.     CORNERS(2,1) = POINTS(2,5)
  277.     CORNERS(1,2) = POINTS(1,10)
  278.     CORNERS(2,2) = POINTS(2,10)
  279.     CORNERS(1,3) = POINTS(1,11)
  280.     CORNERS(2,3) = POINTS(2,11)
  281.     CORNERS(1,4) = POINTS(1,7)
  282.     CORNERS(2,4) = POINTS(2,7) 
  283.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.5D0)
  284.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,& ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  285.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  286.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  287.  
  288.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&  , 10000,10000)
  289.     IF ( BTRAN ) THEN
  290.         CALL MESHRECTANGLE_TRANSITION2(IFINESIDE,ICOARSESIDE, ISIDE &, INODE_TEMP2, &   IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  291.     ELSE
  292.         CALL MESHRECTANGLE(IFINESIDE, ISIDE, INODE_TEMP2, &     IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  293.     END IF
  294.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  295.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  296.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2,& ITOTALELEMS2,4,1)!!THIS SAYS: SET FACE 1 TO 1, FREE CONVECTION
  297.  
  298.     CORNERS(1,1) = POINTS(1,12)
  299.     CORNERS(2,1) = POINTS(2,12)
  300.     CORNERS(1,2) = POINTS(1,6)
  301.     CORNERS(2,2) = POINTS(2,6)
  302.     CORNERS(1,3) = POINTS(1,8)
  303.     CORNERS(2,3) = POINTS(2,8)
  304.     CORNERS(1,4) = POINTS(1,13)
  305.     CORNERS(2,4) = POINTS(2,13)
  306.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.5D0)
  307.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,& ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  308.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  309.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  310.     DTEMP1 = DSQRT((POINTS(1,11)-POINTS(1,10))*(POINTS(1,11)&   -POINTS(1,10))& + (POINTS(2,11)-POINTS(2,10))*(POINTS(2,11)-POINTS(2,10)))
  311.     DTEMP2 = DSQRT((POINTS(1,11)-POINTS(1,14))*(POINTS(1,11)&-POINTS(1,14))& + (POINTS(2,11)-POINTS(2,14))*(POINTS(2,11)-POINTS(2,14)))
  312.     NDEN9 = 0.6D0*NDEN6*DTEMP2/DTEMP1
  313.     DGRADE = 1.0D0
  314.     IF ( NDEN9 .LT.3 ) THEN
  315.         NDEN9 =3
  316.     ELSE IF ( NDEN9/NDEN6 .GT. 10 ) THEN
  317.         NDEN9 = NDEN9/2
  318.         DGRADE = 1.5d0
  319.     END IF
  320.     NDEN10 = NDEN8-2
  321.  
  322.     BTRAN = .TRUE.
  323.  
  324.     IFINESIDE = NDEN8+1
  325.  
  326.     IF ( IFINESIDE .LE. 3 ) BTRAN = .FALSE.
  327.     ISIDE = NDEN9+1
  328.  
  329.     IF ( BTRAN ) THEN
  330.     ELSE
  331.         NDEN10 = IFINESIDE -1
  332.     END IF
  333.  
  334.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&  , 10000,10000)
  335.  
  336.     IF ( BTRAN ) THEN
  337.         CALL MESHRECTANGLE_TRANSITION(IFINESIDE, ISIDE, INODE_TEMP2,&   IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  338.     ELSE
  339.         CALL MESHRECTANGLE(IFINESIDE, ISIDE, INODE_TEMP2,&  IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  340.     END IF
  341.  
  342.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  343.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  344.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2,& ITOTALELEMS2,4,2)!!THIS SAYS: SET FACE 4 TO 2, FORCED
  345.  
  346.     CORNERS(1,1) = POINTS(1,7)
  347.     CORNERS(2,1) = POINTS(2,7)
  348.     CORNERS(1,2) = POINTS(1,11)
  349.     CORNERS(2,2) = POINTS(2,11)
  350.     CORNERS(1,3) = POINTS(1,14)
  351.     CORNERS(2,3) = POINTS(2,14)
  352.     CORNERS(1,4) = POINTS(1,15)
  353.     CORNERS(2,4) = POINTS(2,15)
  354.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,DGRADE)
  355.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1, & ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  356.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  357.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  358.  
  359.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2 & , 10000,10000)
  360.  
  361.     IF ( BTRAN ) THEN
  362.         CALL MESHRECTANGLE_TRANSITION(IFINESIDE, ISIDE, INODE_TEMP2, &  IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  363.     ELSE
  364.         CALL MESHRECTANGLE(IFINESIDE, ISIDE, INODE_TEMP2,&  IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  365.     END IF
  366.  
  367.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  368.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  369.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2, &ITOTALELEMS2,2,2)!!THIS SAYS: SET FACE 2 TO 2, FORCED
  370.  
  371.     CORNERS(1,1) = POINTS(1,13)
  372.     CORNERS(2,1) = POINTS(2,13)
  373.     CORNERS(1,2) = POINTS(1,8)
  374.     CORNERS(2,2) = POINTS(2,8)
  375.     CORNERS(1,3) = POINTS(1,17)
  376.     CORNERS(2,3) = POINTS(2,17)
  377.     CORNERS(1,4) = POINTS(1,16)
  378.     CORNERS(2,4) = POINTS(2,16)
  379.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,DGRADE)
  380.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,& ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  381.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  382.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  383.     CALL MARKELEMENTS(IELEM_TEMP1, ITOTALELEMS, 2,1)
  384.     DIST1 = DSQRT((POINTS(1,21)-POINTS(1,22))*(POINTS(1,21)&-POINTS(1,22)) & + (POINTS(2,21)-POINTS(2,22))*(POINTS(2,21)-POINTS(2,22)))
  385.     DIST1 = ( DIST1 + WELDSIZE)*0.5D0
  386.     DIST2 = VLAND
  387.  
  388.     NDEN11 = NDEN12*(DIST1)/(DIST1+VLAND)
  389.     IF ( NDEN11 .LT. 3 .AND. DIST1 .GT. 1.0D-2) THEN
  390.         NDEN11 = 3
  391.     ELSE IF ( DIST1 .LE. 1.0D-2 ) THEN
  392.         NDEN11 = 0
  393.     END IF
  394.  
  395.     NDEN13 = NDEN12-NDEN11
  396.     IF ( NDEN13 .EQ. 0 ) THEN
  397.       NDEN13 = 1
  398.       NDEN11 = NDEN12 - NDEN13
  399.     END IF
  400.  
  401.     NDEN14 = NDEN13*ROOTGAP/VLAND
  402.  
  403.     IFINESIDE = NDEN13+1
  404.     ISIDE = NDEN14+1
  405.       CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&  , 10000,10000)    
  406.     CALL MESHRECTANGLE(IFINESIDE, ISIDE, INODE_TEMP2, & IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  407.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  408.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  409.     CALL MARKELEMENTS(IELEM_TEMP2,ITOTALELEMS2,2,3)
  410.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2,& ITOTALELEMS2,4,1)!!THIS SAYS: SET FACE 4 TO 1, FREE
  411.  
  412.     CORNERS(1,1) = POINTS(1,1)
  413.     CORNERS(2,1) = POINTS(2,1)
  414.     CORNERS(1,2) = POINTS(1,9)
  415.     CORNERS(2,2) = POINTS(2,9)
  416.     IF ( NDEN11 .GT. 0 ) THEN
  417.         CORNERS(1,2) = POINTS(1,1) + NDEN13*(VLAND+WELDSIZE)/NDEN12
  418.     END IF
  419.     CORNERS(1,3) = POINTS(1,21)
  420.     CORNERS(2,3) = POINTS(2,21)
  421.     CORNERS(1,4) = POINTS(1,20)
  422.     CORNERS(2,4) = POINTS(2,20)
  423.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.0D0)
  424.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,& ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  425.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  426.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  427.  
  428.     IF ( NDEN11 .GT. 0 ) THEN
  429.         ICOARSESIDE = NDEN14+1
  430.         DIST1 = DSQRT((POINTS(1,2)-POINTS(1,22))*(POINTS(1,2)&  -POINTS(1,22))& + (POINTS(2,2)-POINTS(2,22))*(POINTS(2,2)-POINTS(2,22)))
  431.         NFINESIDE = NDEN14*DIST1/ROOTGAP
  432.  
  433.         NRESIDUAL = NFINESIDE-NDEN14
  434.         IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  435.             NFINESIDE = NFINESIDE +1
  436.         END IF
  437.         IF ( (NFINESIDE - NDEN14) .LT. 2 ) NFINESIDE = NDEN14+2
  438.  
  439.         CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2& , COORD_TEMP2,&  10000,10000)
  440.         CALL MESHRECTANGLE_TRANSITION2(NFINESIDE+1,NDEN14+1, NDEN11+1, & INODE_TEMP2,&  IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  441.         CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  442.         CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  443.         CALL MARKELEMENTS(IELEM_TEMP2,ITOTALELEMS2,2,3)
  444.         CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2&   ,INELEM_TEMP2,& ITOTALELEMS2,2,1)!!THIS SAYS: SET FACE  TO 1, FREE
  445.  
  446.         CORNERS(1,4) = POINTS(1,1) + NDEN13*(WELDSIZE+VLAND)/NDEN12
  447.         CORNERS(2,4) = POINTS(2,9)
  448.         CORNERS(1,1) = POINTS(1,2)
  449.         CORNERS(2,1) = POINTS(2,2)
  450.         CORNERS(1,2) = POINTS(1,22)
  451.         CORNERS(2,2) = POINTS(2,22)
  452.         CORNERS(1,3) = POINTS(1,21)
  453.         CORNERS(2,3) = POINTS(2,21)
  454.         CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0&     ,1.0D0)
  455.  
  456.         CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,&  ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2,  &   INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  457.         CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  458.         CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  459.     END IF
  460.  
  461.  
  462.     IF ( NDEN11 > 0 ) THEN
  463.         DIST1 = DSQRT((POINTS(1,23)-POINTS(1,22))*(POINTS(1,23) &   -POINTS(1,22))& + (POINTS(2,23)-POINTS(2,22))*(POINTS(2,23)-POINTS(2,22)))
  464.  
  465.         IF ( DIST1 .LT. 1.0D-6 ) THEN
  466.             DSIZE = ROOTGAP/NDEN13
  467.             NDEN17 = THICKNESS_B/DSIZE
  468.             NRESIDUAL = NDEN17-NDEN13
  469.             IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  470.                 NDEN17 = NDEN17 +1
  471.             END IF
  472.             CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2& , COORD_TEMP2&  , 10000,10000)
  473.             CALL MESHRECTANGLE_TRANSITION2(NDEN17+1, NDEN13+1&  , NDEN11+1&     ,INODE_TEMP2,&  IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  474.             CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  475.             CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  476.             CALL MARKELEMENTS(IELEM_TEMP2,ITOTALELEMS2,2,2)
  477.             CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2 &  ,INELEM_TEMP2,& ITOTALELEMS2,2,1)!!THIS SAYS: SET FACE 3 TO 1,FREE
  478.  
  479.             CORNERS(1,1) = POINTS(1,23)
  480.             CORNERS(2,1) = POINTS(2,23)
  481.             CORNERS(1,2) = POINTS(1,25)
  482.             CORNERS(2,2) = POINTS(2,25)
  483.             CORNERS(1,3) = POINTS(1,20)
  484.             CORNERS(2,3) = POINTS(2,20)
  485.             CORNERS(1,4) = POINTS(1,21)
  486.             CORNERS(2,4) = POINTS(2,21)
  487.             CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0& ,1.0D0)
  488.             CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1& , INELEM_TEMP1,&    ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2&  , IELEM_TEMP2, &     INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  489.             CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  490.             CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  491.         ELSE
  492.  
  493.             DIST1 = DSQRT((POINTS(1,24)-POINTS(1,22))*(POINTS(1,24)-&POINTS(1,22)) &+ (POINTS(2,24)-POINTS(2,22))*(POINTS(2,24)&   -POINTS(2,22)))     
  494.             NDEN15 = NDEN13*DIST1/VLAND
  495.             NRESIDUAL = NDEN15-NDEN13
  496.             IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  497.                 NDEN15 = NDEN15 +1
  498.             END IF
  499.  
  500.             CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2& , COORD_TEMP2&      , 10000,10000)
  501.             CALL MESHRECTANGLE_TRANSITION2(NDEN15+1, NDEN13+1&  , NDEN11+1&     ,INODE_TEMP2,&  IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  502.             CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  503.             CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  504.             CALL MARKELEMENTS(IELEM_TEMP2,ITOTALELEMS2,2,2)
  505.             CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2&   ,INELEM_TEMP2,& ITOTALELEMS2,4,1)!!THIS SAYS: SET FACE 4 TO 1,FREE
  506.  
  507.             CORNERS(1,1) = POINTS(1,22)
  508.             CORNERS(2,1) = POINTS(2,22)
  509.             CORNERS(1,2) = POINTS(1,24)
  510.             CORNERS(2,2) = POINTS(2,24)
  511.             CORNERS(1,3) = POINTS(1,20)
  512.             CORNERS(2,3) = POINTS(2,20)
  513.             CORNERS(1,4) = POINTS(1,21)
  514.             CORNERS(2,4) = POINTS(2,21)
  515.             CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0&,1.0D0)
  516.  
  517.             CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1& , INELEM_TEMP1,&        ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2&  , IELEM_TEMP2, &     INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  518.             CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  519.             CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  520.  
  521.             NDEN17 = 0.5D0*NDEN15
  522.             NRESIDUAL = NDEN15-NDEN17
  523.             IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  524.                 NDEN17 = NDEN17 + 1
  525.             END IF
  526.  
  527.             NDEN16 = NDEN11*(POINTS(2,25)-POINTS(2,24))/(POINTS(2,24)-& POINTS(2,20))
  528.             IF ( NDEN16 .EQ. 0 ) NDEN16 = 1
  529.  
  530.             CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2& , COORD_TEMP2&  , 10000,10000)
  531.             CALL MESHRECTANGLE_TRANSITION2(NDEN15+1, NDEN17+1 & , NDEN16+1& ,INODE_TEMP2,&  IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  532.             CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  533.             CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  534.             CALL MARKELEMENTS(IELEM_TEMP2,ITOTALELEMS2,2,2)
  535.             CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2 &  ,INELEM_TEMP2,& ITOTALELEMS2,2,1)!!THIS SAYS: SET FACE 4 TO 1,FREE
  536.  
  537.             CORNERS(1,1) = POINTS(1,24)
  538.             CORNERS(2,1) = POINTS(2,24)
  539.             CORNERS(1,2) = POINTS(1,22)
  540.             CORNERS(2,2) = POINTS(2,22)
  541.             CORNERS(1,3) = POINTS(1,23)
  542.             CORNERS(2,3) = POINTS(2,23)
  543.             CORNERS(1,4) = POINTS(1,25)
  544.             CORNERS(2,4) = POINTS(2,25)
  545.             CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0 &            ,1.0D0)
  546.  
  547.             CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1& , INELEM_TEMP1,&        ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2& , IELEM_TEMP2,  & INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  548.  
  549.             CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  550.             CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  551.         END IF
  552.  
  553.     ELSE
  554.         DIST1 = POINTS(1,23)-POINTS(1,25)
  555.         DIST2 = POINTS(1,21)-POINTS(1,20)
  556.         DIST3 = POINTS(2,20)-POINTS(2,1)          
  557.         DIST4 = POINTS(2,25)-POINTS(2,20)
  558.         NDEN17 = 0.75D0*DIST1*NDEN13/DIST2
  559.         ISIDE = 0.75D0*NDEN14*DIST4/DIST3+1
  560.         NRESIDUAL = NDEN17-NDEN13
  561.         IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  562.             NDEN17 = NDEN17 +1
  563.         END IF
  564.         CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2 &        , COORD_TEMP2&      , 10000,10000)      
  565.         CALL MESHRECTANGLE_TRANSITION2(NDEN17+1, NDEN13+1, ISIDE&       ,INODE_TEMP2, & IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  566.         CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  567.         CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  568.  
  569.         CALL MARKELEMENTS(IELEM_TEMP2,ITOTALELEMS2,2,2)
  570.  
  571.         CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2&       ,INELEM_TEMP2,&     ITOTALELEMS2,2,1)!!THIS SAYS: SET FACE 3 TO 1,FREE
  572.  
  573.         CORNERS(1,1) = POINTS(1,20)
  574.         CORNERS(2,1) = POINTS(2,20)
  575.         CORNERS(1,2) = POINTS(1,21)
  576.         CORNERS(2,2) = POINTS(2,21)
  577.         CORNERS(1,3) = POINTS(1,23)
  578.         CORNERS(2,3) = POINTS(2,23)
  579.         CORNERS(1,4) = POINTS(1,25)
  580.         CORNERS(2,4) = POINTS(2,25)
  581.         CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0&     ,1.0D0)
  582.  
  583.         CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,&  ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, &    INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  584.         CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  585.         CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  586.     END IF
  587.  
  588.     NDEN18 = 0.5D0*NDEN17
  589.     NRESIDUAL = NDEN17-NDEN18
  590.     IF ( MOD(NRESIDUAL,2) .NE.0 ) THEN
  591.         NDEN18 = NDEN18 +1
  592.     END IF
  593.     DSIZE = 5.0D0*DSIZE
  594.     ISIDE = 0.25D0*(POINTS(2,26)-POINTS(2,25))/DSIZE
  595.     IF ( ISIDE .LT. 3 ) ISIDE = 3
  596.     CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&    , 10000 &   ,10000)
  597.     IF ( NDEN17 .GE. 3 ) THEN
  598.         CALL MESHRECTANGLE_TRANSITION2(NDEN17+1, NDEN18+1, ISIDE &      ,INODE_TEMP2,&      IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  599.     ELSE
  600.         NDEN18 = NDEN17
  601.         CALL MESHRECTANGLE(NDEN17+1, ISIDE, INODE_TEMP2, &      IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  602.       END IF
  603.                
  604.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  605.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  606.  
  607.     CALL MARKELEMENTS(IELEM_TEMP2,ITOTALELEMS2,2,2)
  608.  
  609.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2, &    ITOTALELEMS2,2,1)!!THIS SAYS: SET FACE 3 TO 1,FREE
  610.  
  611.     CORNERS(1,1) = POINTS(1,25)
  612.     CORNERS(2,1) = POINTS(2,25)
  613.     CORNERS(1,2) = POINTS(1,23)
  614.     CORNERS(2,2) = POINTS(2,23)
  615.     CORNERS(1,3) = POINTS(1,23)
  616.     CORNERS(2,3) = POINTS(2,23)+0.25D0*(POINTS(2,27)-POINTS(2,23))
  617.     CORNERS(1,4) = POINTS(1,25)
  618.     CORNERS(2,4) = POINTS(2,25)+0.25D0*(POINTS(2,26)-POINTS(2,25)) 
  619.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.5D0)
  620.  
  621.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,&  ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2, &    INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  622.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  623.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  624.  
  625.     CALL INITMESH(INODE_TEMP2,IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2&    , 10000,10000)
  626.     CALL MESHRECTANGLE(NDEN18+1, 5,INODE_TEMP2,&    IELEM_TEMP2,INELEM_TEMP2, COORD_TEMP2)
  627.     CALL GETNODENUMBER(INODE_TEMP2, 10000,ITOTALNODES2)
  628.     CALL GETELEMNUMBER(IELEM_TEMP2, 10000,ITOTALELEMS2)
  629.  
  630.     CALL MARKELEMENTS(IELEM_TEMP2,ITOTALELEMS2,2,2)
  631.  
  632.     CALL MARKBCFACE(INODE_TEMP2, COORD_TEMP2,IELEM_TEMP2,INELEM_TEMP2,& ITOTALELEMS2,2,1)!!THIS SAYS: SET FACE 3 TO 1,FREE
  633.  
  634.     CORNERS(1,1) = POINTS(1,25)
  635.     CORNERS(2,1) = POINTS(2,25)+0.25D0*(POINTS(2,26)-POINTS(2,25))
  636.     CORNERS(1,2) = POINTS(1,23)
  637.     CORNERS(2,2) = POINTS(2,23)+0.25D0*(POINTS(2,27)-POINTS(2,23))
  638.     CORNERS(1,3) = POINTS(1,27)
  639.     CORNERS(2,3) = POINTS(2,27)
  640.     CORNERS(1,4) = POINTS(1,26)
  641.     CORNERS(2,4) = POINTS(2,26)
  642.     CALL TRANSFORMNODES(COORD_TEMP2,CORNERS,ITOTALNODES2,1.0D0,1.5D0)
  643.  
  644.     CALL MERGEBLOCKMESHES(INODE_TEMP1, IELEM_TEMP1, INELEM_TEMP1,&  ITOTALNODES,ITOTALELEMS,COORD_TEMP1, INODE_TEMP2, IELEM_TEMP2,  &   INELEM_TEMP2, ITOTALNODES2, ITOTALELEMS2, COORD_TEMP2)
  645.  
  646.     CALL GETNODENUMBER(INODE_TEMP1, 10000,ITOTALNODES)
  647.     CALL GETELEMNUMBER(IELEM_TEMP1, 10000,ITOTALELEMS)
  648.  
  649.     X = POINTS(1,2)
  650.     Y = POINTS(2,2)
  651.     CALL FINDNODE(INODE_TEMP1,ITOTALNODES,COORD_TEMP1,X,Y&  ,KEY_POINT(1))
  652.     X = POINTS(1,22)
  653.     Y = POINTS(2,22)
  654.     CALL FINDNODE(INODE_TEMP1,ITOTALNODES,COORD_TEMP1,X,Y & ,KEY_POINT(2))
  655.     X = (POINTS(1,2)+ POINTS(1,22))*0.5D0
  656.     Y = (POINTS(2,2)+ POINTS(2,22))*0.5D0
  657.     CALL FINDCLOSESTNODE(INODE_TEMP1,ITOTALNODES,COORD_TEMP1,X,Y &  ,KEY_POINT(3))
  658.     X = POINTS(1,1)
  659.     Y = POINTS(2,1)
  660.     CALL FINDNODE(INODE_TEMP1,ITOTALNODES,COORD_TEMP1,X,Y&  ,KEY_POINT(4))
  661.     X = POINTS(1,20)
  662.     Y = POINTS(2,20)
  663.     CALL FINDNODE(INODE_TEMP1,ITOTALNODES,COORD_TEMP1,X,Y&  ,KEY_POINT(5))
  664.     X = POINTS(1,7)
  665.     Y = POINTS(2,7)
  666.     CALL FINDNODE(INODE_TEMP1,ITOTALNODES,COORD_TEMP1,X,Y&  ,KEY_POINT(9))
  667.     X = POINTS(1,8)
  668.     Y = POINTS(2,8)
  669.     CALL FINDNODE(INODE_TEMP1,ITOTALNODES,COORD_TEMP1,X,Y & ,KEY_POINT(10))
  670.     X = (POINTS(1,7)+ POINTS(1,8))*0.5D0
  671.     Y = (POINTS(2,7)+ POINTS(2,8))*0.5D0
  672.     CALL FINDCLOSESTNODE(INODE_TEMP1,ITOTALNODES,COORD_TEMP1,X,Y &  ,KEY_POINT(11))
  673.  
  674.     KEY_POINT(6) = KEY_POINT(3)
  675.     KEY_POINT(7) = KEY_POINT(3)
  676.     KEY_POINT(8) = KEY_POINT(3)
  677.  
  678.     NNODE = ITOTALNODES
  679.     NELEM = ITOTALELEMS
  680.  
  681.     DO I = 1, NNODE
  682.         INODE(I) = INODE_TEMP1(I)
  683.         COORD(1,I) = COORD_TEMP1(1,I)
  684.         COORD(2,I) = COORD_TEMP1(2,I)
  685.     END DO
  686.     DO I =1, ITOTALELEMS
  687.         LARRAY_ELE(1,I) = IELEM_TEMP1(1,I)
  688.         LARRAY_ELE(2,I) = INELEM_TEMP1(1,I)
  689.         LARRAY_ELE(3,I) = INELEM_TEMP1(2,I)
  690.         LARRAY_ELE(4,I) = INELEM_TEMP1(3,I)
  691.         LARRAY_ELE(5,I) = INELEM_TEMP1(4,I)
  692.         LARRAY_ELE(6,I) = IELEM_TEMP1(2,I)
  693.         LARRAY_ELE(7,I) = IELEM_TEMP1(3,I)
  694.         LARRAY_ELE(8,I) = IELEM_TEMP1(4,I)
  695.     END DO
  696.  
  697.     if ( iabaqus .eq. 1 ) then
  698.     OPEN (81, FILE="NODE_TEST.INP")
  699.     OPEN (82, FILE="ELEM_TEST.INP")
  700.     WRITE(81,*) "*NODE, NSET=GLOBAL"
  701.     WRITE(82,*) "*ELEMENT, TYPE=DCAX4, ELSET=EALL"
  702.     DO I = 1, 10000
  703.         IF ( INODE_TEMP1(I) .GT. 0 ) THEN
  704.             WRITE(81,900) INODE_TEMP1(I), COORD_TEMP1(1,I)
  705.  
  706.         END IF
  707.     END DO
  708.  
  709.     DO I = 1, 10000
  710.         IF ( IELEM_TEMP1(1,I) .GT. 0 ) THEN
  711.             WRITE(82,901) IELEM_TEMP1(1,I),INELEM_TEMP1(1,I) &  , INELEM_TEMP1(2,I), INELEM_TEMP1(3,I), &       INELEM_TEMP1(4,I)
  712.         END IF
  713.     END DO
  714.     end if
  715.  
  716.   900 FORMAT(1X, I8, ", ", F12.4, ", ", F12.4, ", ", F12.4)
  717.   901 FORMAT(1X, I8, ", ", I8, ", ", I8, ", ", I8, ", ", I8)
  718.     CLOSE (81)
  719.     CLOSE (82)
  720.     RETURN             
  721.     END
  722.     SUBROUTINE KEYPOINTS_BRANCH(D_BRANCH,T_PIPE,T_BRANCH, ROOTGAP&  ,VLAND,
  723.      1     VX,WELDSIZE, ANGLE, VL_RUNPIPE,VL_BRANCH,POINTS,NPTS)
  724.     IMPLICIT REAL*8 (A-H,O-Z)
  725.     REAL*8 T_PIPE,D_BRANCH,T_BRANCH, ROOTGAP,VLAND,
  726.      1     VX,WELDSIZE, VL_RUNPIPE,VL_BRANCH,& POINTS(2,*)
  727.     INTEGER NPTS
  728.  
  729.     REAL*8 FEATURE_ANGLE, FTV, FCV
  730.     LOGICAL P5ANDP30, NOFILLWELD
  731.     REAL*8 WELDWIDTH, DBAND, DBOTTOM
  732.  
  733.     COMMON /MESHING/DLENGTH1, DHAZ, DLENGTH2, DBAND, DMESHSIZE
  734.  
  735.     IF ( VX .LT. 1.0D-8 ) THEN
  736.         NOFILLWELD = .TRUE.
  737.     ELSE
  738.         NOFILLWEL = .FALSE.
  739.     END IF
  740.  
  741.  
  742.     WELDWIDTH = VLAND + WELDSIZE
  743.     DPI = DASIN(1.0D0)*2.0D0
  744.     FEATURE_ANGLE = 30.0D0*DPI/180.0D0
  745.     FTV = DTAN(FEATURE_ANGLE) !! FEATURE-ANGLE'S TAN VALUE
  746.     FCV = DCOS(FEATURE_ANGLE)
  747.     DLENGTH1 = WELDWIDTH
  748.     DLENGTH2 = DLENGTH1
  749.     DHAZ = 0.3D0* WELDWIDTH ! 0.3 IS A HARD-CODED NUMBER FOR HAZ THICKNESS
  750.     DBAND = 0.75D0*DHAZ ! 0.75 IS ANOTHER HARD-CODED NUMBER FOR BANDWITH
  751.     DBOTTOM = DHAZ + DBAND
  752.     IF ( DBOTTOM .GT. 0.75D0*T_PIPE ) THEN
  753.  
  754.         DHAZ = 0.75D0*T_PIPE/1.75D0
  755.         DBAND = 0.75D0*DHAZ
  756.     END IF
  757.  
  758.     POINTS(1,1) = 0.5D0*D_BRANCH
  759.     POINTS(2,1) = 0.0D0
  760.  
  761.     POINTS(1,2) = POINTS(1,1) + WELDWIDTH
  762.     POINTS(2,2) = POINTS(2,1)
  763.  
  764.     POINTS(1,3) = POINTS(1,1) + FTV*DHAZ;
  765.     POINTS(2,3) = POINTS(2,1) - DHAZ
  766.  
  767.     POINTS(1,4) = POINTS(1,2) - FTV*DHAZ;
  768.     POINTS(2,4) = POINTS(2,3)
  769.  
  770.     POINTS(1,5) = POINTS(1,3) - DBAND*FTV
  771.     POINTS(2,5) = POINTS(2,3) - DBAND
  772.  
  773.     POINTS(1,6) = POINTS(1,4) + DBAND*FTV
  774.     POINTS(2,6) = POINTS(2,5)
  775.     POINTS(2,7) = POINTS(2,1) - T_PIPE
  776.     POINTS(1,7) = POINTS(1,5) - (POINTS(2,5)-POINTS(2,7))*FTV
  777.  
  778.     POINTS(2,8) = POINTS(2,7)
  779.     POINTS(1,8) = POINTS(1,6) + FTV*(POINTS(2,6)-POINTS(2,8))
  780.  
  781.     POINTS(1,9) = POINTS(1,1) + VLAND
  782.     POINTS(2,9) = POINTS(2,1)
  783.  
  784.     POINTS(1,10) = POINTS(1,1) - DBAND/FCV/FCV
  785.     POINTS(2,10) = POINTS(2,1)
  786.  
  787.     POINTS(1,11) = POINTS(1,10) - (T_PIPE-DBOTTOM)/FCV/FCV
  788.     POINTS(2,11) = POINTS(2,10)
  789.  
  790.     POINTS(1,12) = POINTS(1,2) + DBAND/FCV/FCV
  791.     POINTS(2,12) = POINTS(2,2)
  792.  
  793.     POINTS(1,13) = POINTS(1,12) + (T_PIPE-DBOTTOM)/FCV/FCV
  794.     POINTS(2,13) = POINTS(2,12)
  795.  
  796.     POINTS(1,14) = 0.0D0
  797.     POINTS(2,14) = POINTS(2,1)
  798.  
  799.     POINTS(1,15) = 0.0D0
  800.     POINTS(2,15) = POINTS(2,7)
  801.  
  802.     IF ( D_BRANCH + T_BRANCH .GT. 10.0D0*T_PIPE ) THEN
  803.         DLENGTH = 2*(D_BRANCH + T_BRANCH)
  804.     ELSE
  805.         DLENGTH =  D_BRANCH + T_BRANCH + 10.0D0*T_BRANCH
  806.     END IF
  807.  
  808.     POINTS(1,16) = 0.5D0*DLENGTH
  809.     POINTS(2,16) = POINTS(2,2)
  810.  
  811.     POINTS(1,17) = POINTS(1,16)
  812.     POINTS(2,17) = POINTS(2,8)
  813.  
  814.     POINTS(1,18) = -1.0D0 ! NEGACTIVE X MEANS INVALID POINT
  815.     POINTS(2,18) = 0.0D0
  816.  
  817.     POINTS(1,19) = -1.0D0
  818.     POINTS(2,19) = 0.0D0
  819.  
  820.     POINTS(1,20) = POINTS(1,1)
  821.     POINTS(2,20) = POINTS(2,1) + ROOTGAP
  822.  
  823.     POINTS(1,21) = POINTS(1,9)
  824.     POINTS(2,21) = POINTS(2,20)
  825.  
  826.     POINTS(1,22) = POINTS(1,21) + VX
  827.     POINTS(2,22) = POINTS(2,21) + VX*DTAN(ANGLE*0.5D0)
  828.  
  829.     POINTS(1,23) = POINTS(1,1) + T_BRANCH
  830.     POINTS(2,23) = POINTS(2,21) + (T_BRANCH-VLAND)*DTAN(ANGLE*0.5D0)
  831.  
  832.     POINTS(1,24) = POINTS(1,20)
  833.     POINTS(2,24) = POINTS(2,22)
  834.  
  835.     POINTS(1,25) = POINTS(1,24)
  836.     POINTS(2,25) = POINTS(2,23)
  837.  
  838.     POINTS(1,26) = POINTS(1,25)
  839.     POINTS(2,26) = 0.5D0*VL_BRANCH
  840.      
  841.     POINTS(1,27) = POINTS(1,23)
  842.     POINTS(2,27) = POINTS(2,26)
  843.  
  844.     OPEN (31, FILE="POINTS_BRANCH.TXT")
  845.     DO I = 1,27
  846.     WRITE(31,800) I, POINTS(1,I), POINTS(2,I)
  847.     END DO
  848.  800  FORMAT(1X,I8, 2F15.5)
  849.     CLOSE(31)
  850.     RETURN
  851.     END
  852.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement