TABLE OF CONTENTS


UTI/PRE/read_cond [ Modules ]

[ Top ] [ Modules ]

NOM

 read_cond(calc,icode,iarg,nb_bloc)

DESCRIPTION

 Lecture du Bloc COND du fichier de donnees .inp
 Reading the COND block of the .inp data file
 
    ENTREES / INPUT
    lst_bloc    : liste des blocs / list of blocks
    icode  : 0/ tube a choc / shock tube
             1/ Cas 2D / 2D case
             2/ Cas 3D / 3D case
             3/ condition par zones (gmsh) / condition by zones (gmsh)
    iarg    : nombre de zones pour le cas 3 / number of zones for case 3
    nb_bloc : nombre de blocs / number of blocks
    SORTIES / OUTPUT
    msh    : maillage / mesh

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
  type(bloc), pointer, dimension(:), intent(inout) :: lst_bloc !! Liste des blocs / Block list
  integer, intent(inout)                           :: icode, iarg !! Code, argument
  integer, intent(inout)                           :: nb_bloc !! nombre de blocs / number of blocks
  
  integer                                   :: i,nzon,nbf,fctnum,icl,kkk,k
  integer                                   :: ityp,iz,izone
  real(kind=kind(0.d0)), dimension(nvarmax) :: val
!=========================== DEBUT DU CODE EXECUTABLE ==================
!-------  Initialisations
  nzon=0
  write(*,*)
  write(*,*)achar(27)//'[34m================================================'
  write(*,*)'Reading boundary condition: block COND'
  write(*,*)'================================================'//achar(27)//'[0m'
  write(*,*)
         
  SELECT CASE (icode)
!=====================================================================
! Conditions pour le tube a choc
!=====================================================================
      CASE (0)
          write(*,*)'COND-Info Boundary condition for shock tube already defined'
          DO i=1,nb_bloc
              if(lst_bloc(i)%cl(1).eq.-111) lst_bloc(i)%cl(1)=-101
              if(lst_bloc(i)%cl(2).eq.-222) lst_bloc(i)%cl(2)=-102
          END DO

!=====================================================================
! Conditions communes pour la marche et le cube
!=====================================================================
      CASE (1,2)
          IF (icode.eq.1) then
             write(*,*)'COND-Info 2D Conditions definition'
             kkk=4
           endif
          IF (icode.eq.2) then
              write(*,*)'COND-Info 3D Conditions definition'
              kkk=6
          endif

          ! condition en xmin, xmax, ymin, ymax (zmin, zmax)
          do k=1,kkk
              phy_state(k)%vprim%v=0.d0
              phy_state(k)%vbal%v =0.d0
              phy_state(k)%gprim(1)%v =0.d0
              phy_state(k)%gprim(2)%v =0.d0
              phy_state(k)%gprim(3)%v =0.d0
              val =0.d0
              read(33,*)ityp
              SELECT CASE (ityp)
                  CASE (0)
                      icl= 0
                  CASE (1)
                      icl=-1
                  CASE (2)
                      icl=-100-k
                      read(33,*)(val(i),i=1,nvar)
                      phy_state(k)%vprim%v=val
                      CALL prim2bal(phy_state(k))
                  CASE (3)
                      read(33,*)fctnum
                      icl=-(10000+fctnum)
                  !~CASE (6)
                  !~    icl=-2001 !condition de type periodique
                  CASE (4)
                      icl=-200-k
                      read(33,*)(val(i),i=1,nvar)
                      phy_state(k)%vbal%v=val
                      CALL Bal2Prim(phy_state(k))
                  CASE (999)
                      icl=-999
                  CASE DEFAULT
                  call print_err('READ_COND','unknown kind of boundary condition')
              END SELECT
            
              nbf=0
              DO i=1,nb_bloc
                  if(lst_bloc(i)%cl(k).eq.-111*k) then
                      lst_bloc(i)%cl(k)=icl
                      nbf=nbf+1
                  endif
              END DO
              if(k.eq.1)write( *,1011)icl,nbf
              if(k.eq.2)write( *,1012)icl,nbf
              if(k.eq.3)write( *,1013)icl,nbf
              if(k.eq.4)write( *,1014)icl,nbf
              if(k.eq.5)write( *,1015)icl,nbf
              if(k.eq.6)write( *,1016)icl,nbf
          enddo
1011 format(' COND-Info Condition',i8,' is affected to ',I8,' faces at Xmin')
1012 format(' COND-Info Condition',i8,' is affected to ',I8,' faces at Xmax')
1013 format(' COND-Info Condition',i8,' is affected to ',I8,' faces at Ymin')
1014 format(' COND-Info Condition',i8,' is affected to ',I8,' faces at Ymax')
1015 format(' COND-Info Condition',i8,' is affected to ',I8,' faces at Zmin')
1016 format(' COND-Info Condition',i8,' is affected to ',I8,' faces at Zmax')
         
         
!=====================================================================
! Conditions definis par zone au format GMSH
!=====================================================================
      CASE (3)
          write(*,*)'COND-Info Conditions defined using GMSH'
          DO iz=1,iarg
              nbf=0
              read(33,*)izone,ityp  !numero de zone, type de condition aux limites
              SELECT CASE (ityp)
                  CASE (0)
                      icl= 0
                  CASE (1)
                      icl=-1
                  CASE (2)
                      nzon=nzon+1
                      icl=-100-nzon
                      read(33,*)(val(i),i=1,nvar)
                      phy_state(nzon)%vprim%v=val
                      CALL prim2bal(phy_state(nzon))
                  CASE (3)
                      read(33,*)fctnum
                      icl=-(10000+fctnum)
                  CASE (4)
                      nzon=nzon+1
                      icl=-200-nzon
                      read(33,*)(val(i),i=1,nvar)
                      phy_state(nzon)%vbal%v=val
                      CALL Bal2Prim(phy_state(nzon))
                  CASE (999)
                      icl=-999
                  CASE DEFAULT
                     call print_err('READ_COND','unknown kind of boundary condition')
                     STOP
              END SELECT
              
              nbf=0
              DO i=1,nb_bloc
                do k=1,6
                  if(lst_bloc(i)%cl(k).eq.-izone) then
                      lst_bloc(i)%cl(k)=icl
                      nbf=nbf+1
                  endif
                enddo
              END DO

              write( *,1021)izone,icl,nbf
1021 format(' COND-Info Zone',i2,' affectation of the condition',i8,' to ',I8,' faces')
          END DO
      CASE DEFAULT
         call print_err('READ_COND','unknown code')

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