/[MITgcm]/MITgcm_contrib/ksnow/press_release/code_expt/shelfice_fields_load.F
ViewVC logotype

Annotation of /MITgcm_contrib/ksnow/press_release/code_expt/shelfice_fields_load.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Fri Dec 16 15:25:29 2016 UTC (9 years, 8 months ago) by ksnow
Branch: MAIN
Adding shelfice_remeshing files for experiment

1 ksnow 1.1 C $Header: /u/gcmpack/MITgcm/pkg/streamice/streamice_fields_load.F,v 1.5 2015/09/02 12:07:29 dgoldberg Exp $
2     C $Name: $
3    
4     #include "SHELFICE_OPTIONS.h"
5    
6     CStartOfInterface
7     SUBROUTINE SHELFICE_FIELDS_LOAD(
8     I myTime, myIter, myThid )
9     C *==========================================================*
10     C | SUBROUTINE SHELFICE_LOAD
11     C | o Control reading of SHELFICE fields from external source.
12     C *==========================================================*
13     IMPLICIT NONE
14    
15     C === Global variables ===
16     #include "SIZE.h"
17     #include "EEPARAMS.h"
18     #include "PARAMS.h"
19     #include "GRID.h"
20     #include "SHELFICE.h"
21    
22    
23    
24     C === Routine arguments ===
25     C myTime :: Simulation time
26     C myIter :: Simulation timestep number
27     C myThid :: Thread no. that called this routine.
28     _RL myTime
29     INTEGER myIter
30     INTEGER myThid
31     CEndOfInterface
32    
33     C === Functions ===
34    
35     #ifdef ALLOW_SHELFICE
36     C === Local variables ===
37     C bi,bj, i,j :: Loop counters
38     C tYear :: Fraction within year of myTime
39     C mnthIndex :: Current time in whole months
40     C prevMnthIndex
41     C fNam :: Strings used in constructing file names
42     C mnthNam
43     C loadNewData :: true when need to load new data from file
44     INTEGER bi,bj,i,j
45     c _RL pfact
46     LOGICAL first, changed
47     C-- for use with useMMsurfFc:
48     CHARACTER*(MAX_LEN_FNAM) fNam
49    
50     INTEGER nm0, nm1, nmP
51     _RL myRelTime, fac, tmpFac
52    
53     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
54    
55     C-- find which month to use for surface BC
56     C aim_surfForc_TimePeriod :: Length of forcing time period (e.g. 1 month)
57     C aim_surfForc_NppCycle :: Number of time period per Cycle (e.g. 12)
58    
59     myRelTime = myTime - startTime
60     first = (myRelTime .lt. 0.5*deltaTClock)
61     if ( shelfice_forcing_period .eq. 0.D0 ) THEN
62     ! & .or. externForcingCycle .eq. 0.D0 ) then
63     C control parameter is constant in time and only needs to be updated
64     C once in the beginning
65     changed = .false.
66     nm0 = 1
67     nm1 = 1
68     fac = 1.D0
69     else
70    
71     C-- Now calculate whether it is time to update the forcing arrays
72     if (externForcingCycle .eq. 0.0 ) THEN
73     CALL GET_PERIODIC_INTERVAL(
74     O nmP, nm0, nm1, tmpFac, fac,
75     I externForcingCycle, shelfice_forcing_period,
76     I deltaTclock,
77     I myTime+0.5*shelfice_forcing_period,
78     I myThid )
79     fac = 1.D0 - fac
80     else
81     CALL GET_PERIODIC_INTERVAL(
82     O nmP, nm0, nm1, tmpFac, fac,
83     I externForcingCycle, shelfice_forcing_period,
84     I deltaTclock, myTime,
85     I myThid )
86     endif
87    
88     IF ( nm0.NE.nmP ) THEN
89     changed = .true.
90     ELSE
91     changed = .false.
92     ENDIF
93     IF ( first ) changed = .false.
94     endif
95    
96    
97    
98     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
99    
100     C- Load new data:
101    
102    
103     C- Only one thread updates parameter in common block
104     C- Wait for everyone to set loadNewData before Master updates prevMnthIndex
105     _BARRIER
106    
107     IF ( first ) THEN
108    
109    
110     IF ( SHELFICEmassforcingfile .NE. ' ' ) THEN
111     CALL READ_REC_XY_RL(SHELFICEmassforcingfile,
112     & SHELFICEmass1,
113     & nm0,myIter,myThid)
114     ENDIF
115     ! PRINT *, "GOT HERE FIELDS LOAD 2"
116    
117    
118     C- endif 1rst iter.
119     ENDIF
120    
121     IF ( first .OR. changed) THEN
122    
123    
124     DO bj=myByLo(myThid),myByHi(myThid)
125     DO bi=myBxLo(myThid),myBxHi(myThid)
126     DO j=1,sNy
127     DO i=1,sNx
128    
129     SHELFICEmass0(i,j,bi,bj) =
130     & SHELFICEmass1(i,j,bi,bj)
131     ENDDO
132     ENDDO
133     ENDDO
134     ENDDO
135     ! PRINT *, "GOT HERE FIELDS LOAD 4"
136    
137     IF ( SHELFICEmassforcingfile .NE. ' ' ) THEN
138     CALL READ_REC_XY_RL(SHELFICEmassforcingfile,
139     & SHELFICEmass1,
140     & nm0,myIter,myThid)
141     ENDIF
142    
143     C- endif 1rst iter.
144     ENDIF
145    
146     DO bj=myByLo(myThid),myByHi(myThid)
147     DO bi=myBxLo(myThid),myBxHi(myThid)
148     DO j=1,sNy
149     DO i=1,sNx
150     shelficemass (i,j,bi,bj) =
151     & fac * shelficemass0(i,j,bi,bj)
152     & + (1-fac) * shelficemass1(i,j,bi,bj)
153     ENDDO
154     ENDDO
155     ENDDO
156     ENDDO
157    
158     CALL EXCH_XY_RL (shelficemass, myThid)
159    
160    
161     ! print *, "GOT HERE STREAMICE FIELDS LOAD",
162     ! & first,changed,nm0,nm1,fac
163    
164     #endif
165    
166     RETURN
167     END

  ViewVC Help
Powered by ViewVC 1.1.22