Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:38:32 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
5ed655852f Jean*0001 #include "COST_OPTIONS.h"
47dd97aab7 Patr*0002 #ifdef ALLOW_AUTODIFF
                0003 # include "AUTODIFF_OPTIONS.h"
                0004 #endif
39154404ca Patr*0005 
                0006       subroutine cost_final_restore ( mythid, lastdiva )
                0007 
                0008 c     ==================================================================
                0009 c     SUBROUTINE cost_final_restore
                0010 c     ==================================================================
                0011 c
                0012 c     Restore cost function value
                0013 c     This is required in conjunction with DIVA
                0014 c     heimbach@mit.edu 5-Mar-2003
                0015 c
                0016 c     ==================================================================
                0017 c     SUBROUTINE cost_final_restore
                0018 c     ==================================================================
                0019 
                0020       implicit none
                0021 
                0022 c     == global variables ==
                0023 
                0024 #include "EEPARAMS.h"
                0025 #include "SIZE.h"
                0026 
                0027 #include "cost.h"
                0028 
                0029 c     == routine arguments ==
                0030 
                0031       integer mythid
                0032       logical lastdiva
                0033 
                0034 # ifdef ALLOW_DIVIDED_ADJOINT
                0035 
                0036 c     == local variables ==
                0037       logical exst
                0038 
                0039       integer idivbeg, idivend
                0040 c     == end of interface ==
                0041 
                0042 c--   Each process has calculated the global part for itself.
cd97a12749 Patr*0043 cph      IF (myProcId .eq. 0) THEN
39154404ca Patr*0044          _BEGIN_MASTER( mythid )
                0045 c
                0046            inquire(file='divided.ctrl',exist=exst)
                0047            if (exst) then
                0048               open(unit=76,file='divided.ctrl',form='formatted')
                0049               read(unit=76,fmt=*) idivbeg,idivend
                0050               close(unit=76)
                0051            else
                0052               idivbeg = -2
                0053            endif
                0054 c
                0055            if ( idivbeg .EQ. 0 ) then
                0056               lastdiva = .TRUE.
                0057               open(unit=76,file='costfinal')
951926fb9b Jean*0058               read(76,*) fc
39154404ca Patr*0059               close(76)
fa169b9c64 Patr*0060            else
                0061               lastdiva = .FALSE.
39154404ca Patr*0062            endif
                0063 c
                0064          _END_MASTER( mythid )
cd97a12749 Patr*0065 cph      ENDIF
39154404ca Patr*0066       _BARRIER
                0067 
                0068 #endif
                0069 
                0070       end