forked from altMITgcm/MITgcm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cost_final_restore.F
73 lines (58 loc) · 1.76 KB
/
cost_final_restore.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_final_restore.F,v 1.7 2015/05/29 02:54:22 heimbach Exp $
C $Name: $
#include "COST_OPTIONS.h"
#ifdef ALLOW_AUTODIFF
# include "AUTODIFF_OPTIONS.h"
#endif
subroutine cost_final_restore ( mythid, lastdiva )
c ==================================================================
c SUBROUTINE cost_final_restore
c ==================================================================
c
c Restore cost function value
c This is required in conjunction with DIVA
c heimbach@mit.edu 5-Mar-2003
c
c ==================================================================
c SUBROUTINE cost_final_restore
c ==================================================================
implicit none
c == global variables ==
#include "EEPARAMS.h"
#include "SIZE.h"
#include "cost.h"
c == routine arguments ==
integer mythid
logical lastdiva
# ifdef ALLOW_DIVIDED_ADJOINT
c == local variables ==
logical exst
integer idivbeg, idivend
c == end of interface ==
c-- Each process has calculated the global part for itself.
cph IF (myProcId .eq. 0) THEN
_BEGIN_MASTER( mythid )
c
inquire(file='divided.ctrl',exist=exst)
if (exst) then
open(unit=76,file='divided.ctrl',form='formatted')
read(unit=76,fmt=*) idivbeg,idivend
close(unit=76)
else
idivbeg = -2
endif
c
if ( idivbeg .EQ. 0 ) then
lastdiva = .TRUE.
open(unit=76,file='costfinal')
read(76,*) fc
close(76)
else
lastdiva = .FALSE.
endif
c
_END_MASTER( mythid )
cph ENDIF
_BARRIER
#endif
end