c23456789012345678901234567890123456789012345678901234567890123456789012


      SUBROUTINE opening 

c     ******************************************************************
c
c     This routine opens output files 
c
c     ******************************************************************

c     -------------
c     Declarations
c     -------------

c     ''''''''''''''''''''''
      implicit none
      include 'commonvar.f'      
c     ''''''''''''''''''''''




c     ---------------------
c     Opening output files
c     ---------------------

c---- Model grid

      open (09,file='grid.'//tag)


c---- Elements of prior xo

      open (40,file='ro.'//tag)
      open (41,file='Uo.'//tag)
      open (42,file='Vo.'//tag)
      open (43,file='Wo.'//tag)
      open (44,file='po.'//tag)


c---- Elements of posterior x

      open (10,file='r.'//tag)
      open (11,file='U.'//tag)
      open (12,file='V.'//tag)
      open (13,file='W.'//tag)
      open (14,file='p.'//tag)


c---- Errors in prior elements 

      open (81,file='e_ro.'//tag)
      open (82,file='e_Uo.'//tag)
      open (83,file='e_Vo.'//tag)
      open (84,file='e_Wo.'//tag)
      open (85,file='e_po.'//tag)


c---- Errors in posterior elements 

      open (60,file='e_r.'//tag)
      open (61,file='e_U.'//tag)
      open (62,file='e_V.'//tag)
      open (63,file='e_W.'//tag)
      open (64,file='e_p.'//tag)


c---- Data misfits 

      open (22,file='mis_r.'//tag)
      open (23,file='mis_U.'//tag)
      open (24,file='mis_V.'//tag)
      open (25,file='mis_W.'//tag)
      open (26,file='mis_p.'//tag)


c---- Model residuals 

      open (27,file='res_mas.'//tag)
      open (28,file='res_twu.'//tag)
      open (29,file='res_twv.'//tag)
      open (30,file='res_vor.'//tag)
      open (31,file='res_den.'//tag)
      open (32,file='res_pos.'//tag)


c---- Objective function

      open (70,file='cost.'//tag)
 

c---- Error covariance matrix for posterior x 

      open (97,file='P.'//tag)


c---- WBC faces

      open (98,file='str_wbc.'//tag)
 

c---- flag_vor

      open (99,file='flag_vor.'//tag)




c     ----------------------
c     End of the subroutine
c     ----------------------

      return

      end

c     ******************************************************************
