Page 324 - Computational Fluid Dynamics for Engineers
P. 324

314                                            10.  Inviscid  Compressible  Flow



         a  shock  wave  travelling  at  speed  c  and  leaving  behind  a  contact  discontinuity
         travelling  at  speed  Vc,  as  shown  in  Fig.  10.13:
            The  problem  therefore  contains  three  distinct  regions  (2,  3,  4)  in  addition
         to  the  regions  at  rest  (1  and  5),  of  which  two  represents  discontinuous  regions
         (region  3-4  and  4-5). The  closed  form  solution  of this  problem  is  given  in  [6].


         10.10.1  Initial  Conditions

         The  shock tube  is  of length  1000, and  the  diaphragm  is located  at  x  =  500.  The
         initial  conditions  at  t  =  0  are:
                        u(x,  0)  =  0            for  0  <  x  <  1000
                        Q(X,  0)  =  1,  p(x,  0)  =  1  for  x  <  500
                        Q(x,  0)  =  4,  p{x,  0)  =  4  for  x  >  500


         10.10.2  Boundary   Conditions

         The  shock  tube  is  considered  of  infinite  length,  which  avoids  waves  being  re-
         flected  at  its  end.  Therefore,  extrapolation  from  the  interior  of  the  domain  is
         used  on  both  boundaries:
                   g(i  =  0, t)  =  g{i  =  1, t)  g(i  =  N,t)  =  g(i  =  N  -  1, t)
                   u(i  =  0,t)  =  u(i  =  1,t)  u(i  =  N,t)  =  u(i  =  N  -  l,t)
                   p(i  =  0, t)  = p(i  =  1, t)  p(i  =  N,t)  =p(i  =  N  -  1, t)

         Note  that  we  make  use  of  halo  cells  to  introduce  the  boundary  conditions,  as
         discussed  in  subsection  10.5.2.


         10.10.3  Solution  Procedure  and  Sample  Calculations

         The computer program  is given in Appendix B. First,  a  1-D  grid with  equidistant
         spacing  is  generated  (subroutine  generate_grid).  The  flux  variables  are  then
         initialized  according  to the  specified  boundary  condition  of subection  10.9.2  for
                                  i
         a  diatomic  gas  (subroutine n i t i a l - c o n d i t i o n s ) .  Then  the  algorithm  marches
         in time, with increments  satisfying  the stability  restrictions  of Section  10.8  (sub-
                t
         routine imestep).  The  MacCormack  predictor-corrector  steps  of  Section  10.9
         are  computed  (subroutine  Maccormack)  to  yield  the  updated  flux  values.  The
         program  ends  when  the  time  has  reached  250. Note  that  a  subroutine  has  been
         devised  to  compute  the  Euler  fluxes /  given the  primitive  variables  (subroutine
         flux).  This  way,  the  predictor  and  corrector  steps  are  simply  done  by  calling
         the  flux  subroutine  for  each  of  the  steps  of  Eqs.  (10.6.5)  and  (10.6.6).  The  nu-
         merical  boundary  schemes  are  used  in  both  steps,  but  at  the  opposite  end  of
         the  tube.
   319   320   321   322   323   324   325   326   327   328   329