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