read_init.f90

### TABLE OF CONTENTS

- 1. UTI/PRE/read_init

## UTI/PRE/read_init [ Modules ]

[ Top ] [ Modules ]

NOM

     read_init(msh,icode,iarg)

DESCRIPTION

     Lecture du Bloc init du fichier de donnees *.inp
     Read the init block of the *.inp data file

        ENTREES / INPUT
        icode  : 0/ tube a choc / shock tube
                 1/ initialisation par fonction utilisateur / initialization by user function
                 2/ initialisation par zones / initialization by zones
        iarg   : argument de l'initialisation / initialization argument

        SORTIES / OUTPUT
        zonei : tableau de parametres d'initialisation / initialization parameters array
        nzonei: nombre de zones a initialiser / number of zones to initialize

SOURCE

    ! Ce logiciel est regi par la licence [CeCILL-B]
    ! This software is governed by the [CeCILL-B] license
    !=========================== DEBUT DES DECLARATIONS ====================
    !.1-----  Implicit, Use
      use num
      IMPLICIT NONE
    !.2-----  Declaration
      integer, intent(inout)                           :: icode,iarg !! Code, argument
      integer, intent(inout)                           :: nzonei !! parametres /  parameters
      real(kind=kind(0.d0)),allocatable,dimension(:,:) :: zonei !! parametres /  parameters

      real(kind=kind(0.d0))                            :: rl,ul,pl
      real(kind=kind(0.d0))                            :: rr,ur,pr
      integer                                          :: i,j
    !=========================== DEBUT DU CODE EXECUTABLE ==================
      write(*,*)
      write(*,*)achar(27)//'[34m================================================'
      write(*,*)'Reading initial condition: block INIT'
      write(*,*)'================================================'//achar(27)//'[0m'
      write(*,*)

     nzonei=0

    !------------------------------------------------------
      SELECT CASE (icode)
          CASE(0) ! Initialisation dans le cas du tube a choc
              write(*,*)'INIT-Info Initialisation defined for shock tube'
              SELECT CASE (imodel_phy)
                  CASE (2)
                      read(33,*)rl,ul,pl ! si x<0
                      read(33,*)rr,ur,pr ! si x>0
                      write( *,1060)rl,ul,pl ! si x<0
                      write( *,1061)rr,ur,pr ! si x>0
    1060              format(' INIT-Info Initialisation left for Shock tube  :',3e13.5)
    1061              format(' INIT-Info Initialisation right for Shock tube :',3e13.5)
                      phy_state(1)%vprim%v(1)=rL
                      phy_state(1)%vprim%v(2)=uL
                      phy_state(1)%vprim%v(3)=0.d0
                      phy_state(1)%vprim%v(4)=0.d0
                      phy_state(1)%vprim%v(5)=pL
                      phy_state(2)%vprim%v(1)=rR
                      phy_state(2)%vprim%v(2)=uR
                      phy_state(2)%vprim%v(3)=0.d0
                      phy_state(2)%vprim%v(4)=0.d0
                      phy_state(2)%vprim%v(5)=pR
                  !----------------------------------------
                  CASE(1)
                      read(33,*)rl,ul ! si x<0
                      read(33,*)rr,ur ! si x>0
                      phy_state(1)%vprim%v(1)=rL
                      phy_state(1)%vprim%v(2)=uL
                      phy_state(1)%vprim%v(3)=0.d0
                      phy_state(1)%vprim%v(4)=0.d0
                      phy_state(1)%vprim%v(5)=0.d0
                      phy_state(2)%vprim%v(1)=rR
                      phy_state(2)%vprim%v(2)=uR
                      phy_state(2)%vprim%v(3)=0.d0
                      phy_state(2)%vprim%v(4)=0.d0
                      phy_state(2)%vprim%v(5)=0.d0
                      write( *,1010)rL
                      write( *,1011)uL
                      write( *,1012)rR
                      write( *,1013)uR
    1010              format(' INIT-Info Initialisation for shallow water model hL:',e13.5)
    1011              format(' INIT-Info Initialisation for shallow water model uL:',e13.5)
    1012              format(' INIT-Info Initialisation for shallow water model hR:',e13.5)
    1013              format(' INIT-Info Initialisation for shallow water model uR:',e13.5)

                  !----------------------------------------
                  CASE DEFAULT
                      call print_err('READ_INIT','unknown physical model')
             END SELECT

             CALL prim2bal(phy_state(1))
             CALL prim2bal(phy_state(2))

    !----------------------------------------
          CASE (1) ! Initialisation par fonction utilisateur
              write(*,*)'INIT-Info Initialisation defined by user fonction number:',iarg
              allocate(zonei(1,1))
              zonei=0.d0
              nzonei=-iarg

    !------------------------------------------------------
          CASE (2) ! Initialisation par zones
              write(*,*)'INIT-Info  Number of zone to be initialized  :',iarg
              nzonei=iarg
              allocate(zonei(nvar+6,nzonei))
              zonei=0.d0
              DO i=1,nzonei
                  read(33,*)(zonei(j,i),j=1,6)
                  read(33,*)(zonei(j,i),j=7,6+nvar)
              END DO

    !------------------------------------------------------
          CASE DEFAULT
             call print_err('READ_INI','Unforeseen case')

      END SELECT
    !===========================   FIN DE LA ROUTINE    ====================
    END SUBROUTINE read_init