Google

C*******************************************************************
C**
C**    v e m g e n 1 d :
C**
C**   generation of a subdivision of a 1D domain of length L.
C**   The created mesh can be read by vemu02.
C**
C**   by L. Grosz                          Karlsruhe, Jan. 1995
C**
C*******************************************************************
C**
C**  This FORTRAN program generates an order 2 subdivision of a
C**  one-dimensional domain into line elements. The left and right
C**  boundary points get Dirichlet conditions.
C**
      PROGRAM VEMEXM
C**
C**-----------------------------------------------------------------
C**
      IMPLICIT NONE
C**
C**-----------------------------------------------------------------
C**
C**    some parameters which may be chanced:
C**
C**    ELEM1 = number of elements in x1 direction
C**    NK    = number of solution components
C**    MESH  = name of the mesh file
C**
      INTEGER        ELEM1,NK,IND
      CHARACTER*80   MESH
      PARAMETER (NK=1)
C***
      INTEGER          Z1,N1,S,D
      DOUBLE PRECISION L,X1,X2,X3
      IND=1
C**
C**-----------------------------------------------------------------
C**
      PRINT*,'Enter length :'
      READ(5,*) L
      PRINT*,'Enter number of elements in x1-direction :'
      READ(5,*) ELEM1
      PRINT*,'Name of the mesh file :'
      READ(5,'(80A)') MESH
C**
C**-----------------------------------------------------------------
C**
C**   open output file :
C**
      OPEN (99,FILE=MESH,STATUS= 'UNKNOWN',FORM='FORMATTED')
      PRINT*,'opened file : ',MESH
C**
C**-----------------------------------------------------------------
C**
C**** the generation of the geometrical nodes :
C**   ---------------------------------------
C**
      N1=2*ELEM1+1
      WRITE(99,*) N1
C**
      DO 10 Z1=1,N1
        X1=DBLE(Z1-1)/DBLE(N1-1)*L
        X2=0
        X3=0
        WRITE(99,*) Z1,X1,X2,X3
 10   CONTINUE
C**
      PRINT*,'written nodes : ',N1
C**
C**-----------------------------------------------------------------
C**
C**** the generation of the elements :
C**   -------------------------------
C**
C**   The domain is covered by line elements of order 2.
C**   The following picture illustrates the construction of the
C**   line elements with left node S
C**
C**             1-----3-----2
C**            S     S+1     S+2
C**
C**   There is only one element type:
C**
      WRITE(99,*) 1
C**
C**   These are the line elements:
C**
      WRITE(99,*) ELEM1,1,2,3

      DO 20 Z1=1,ELEM1
        S=2*(Z1-1)+1
        WRITE(99,*) Z1,IND,S,S+2,S+1
 20   CONTINUE
C**
      PRINT*,'written line elements : ',ELEM1
C**
C**-----------------------------------------------------------------
C**
C**   generation of the nodes with Dirichlet conditions :
C**   -------------------------------------------------
C**
      WRITE(99,*) NK
C**
      DO 40 D=1,NK
C**
        WRITE(99,*) 2
C**
        WRITE(99,*) 1,DBLE(1)
        WRITE(99,*) N1,DBLE(2)
C**
        PRINT*,2,' Dirichlet conditions for component ',d
40    CONTINUE
C**
C**-----------------------------------------------------------------
C**
C**** end of calculation
C**   ------------------
C**