-
Notifications
You must be signed in to change notification settings - Fork 96
/
ocean_sbc.F90
6438 lines (5654 loc) · 287 KB
/
ocean_sbc.F90
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module ocean_sbc_mod
!
! <CONTACT EMAIL="GFDL.Climate.Model.Info@noaa.gov"> S. M. Griffies
! </CONTACT>
!
!<REVIEWER EMAIL="GFDL.Climate.Model.Info@noaa.gov"> M.J. Harrison
!</REVIEWER>
!
! <REVIEWER EMAIL="GFDL.Climate.Model.Info@noaa.gov"> A. Rosati
! </REVIEWER>
!
! <REVIEWER EMAIL="GFDL.Climate.Model.Info@noaa.gov">
! V. Balaji
! </REVIEWER>
!
!<OVERVIEW>
! Set up the surface boundary conditions for MOM.
!</OVERVIEW>
!
!<DESCRIPTION>
!
! This module sets up the surface boundary conditions for MOM.
! Also fill Ocean_sfc derived-type used to pass information to other
! component models. Also write diagnostics related to surface
! boundary forcing.
!
! The surface temperature should be the surface insitu temperature,
! which is the same as the surface potential temperature. When the
! model prognostic temperature variable is conservative temperature,
! then the surface potential temperature is carried in T_diag(index_diag_temp).
! The resulting heat flux is potential enthalpy, which is the correct
! field to be forcing the T_prog(index_temp) field when the prognostic
! temperature field is the conservative temperature.
!
! We assume the winds passed to the ocean are on the B-grid
! velocity point. Likewise, we pass the currents back to the coupler
! on the B-grid point. Code will need to be modified if using another
! assumption.
!
! Treatment of flux adjustments may be modified according to the FAFMIP
! experiment protocol (Gregory et al 2016). See also the design notes by
! Griffies et al http://www.met.reading.ac.uk/~jonathan/FAFMIP/GFDL_heat.pdf
! and the FAFMIP website http://www.met.reading.ac.uk/~jonathan/FAFMIP/
!
!</DESCRIPTION>
!
! <REFERENCE>
! Gregory, J. M., Bouttes, N., Griffies, S. M., Haak, H., Hurlin, W. J.,
! Jungclaus, J., Kelley, M., Lee, W. G., Marshall, J., Romanou, A., Saenko, O.
! A., Stammer, D., and Winton, M.: The Flux-Anomaly-Forced Model Intercomparison
! Project (FAFMIP) contribution to CMIP6: investigation of sea-level and ocean
! climate change in response to CO2 forcing, Geosci. Model Dev., 9, 3993-4017,
! https://doi.org/10.5194/gmd-9-3993-2016, 2016.
! </REFERENCE>
!
!<NAMELIST NAME="ocean_sbc_nml">
!
! <DATA NAME="use_waterflux" TYPE="logical">
! Set to true when wish to use real fresh water flux as opposed to virtual
! salt fluxes. This is the recommended method. The alternative virtual
! tracer flux method (use_waterflux=.false.) is not routinely used at
! GFDL, so it may suffer from poor testing.
! Default use_waterflux=.true.
! </DATA>
! <DATA NAME="waterflux_tavg" TYPE="logical">
! Set to true when aiming to suppress the leap-frog computational mode
! by setting pme and river equal to a time averaged value over the
! present and previous time step. This method requires an extra
! field in the restart file. This method is not needed when using
! the TWO_LEVEL time tendency. It remains for those who wish to
! use the leap-frog THREE_LEVEL time stepping scheme.
! Note that it does not lead to simple checks of conservation across
! model components, since there is a time averaging performed for
! the water flux added to the ocean model. It is generally NOT
! recommended. Default waterflux_tavg=.false.
! </DATA>
!
! <DATA NAME="use_ideal_runoff" TYPE="logical">
! To add an idealized liquid runoff read from a file.
! This runoff is assumed to enter the ocean with the same temperature as
! SST, and to be liquid. It is an additional runoff, so that any other
! runoff remains unaltered. The runoff coming from idealized runoff is
! NOT subject to the global normalization realized from
! zero_net_water_coupler=.true.
! Default use_ideal_runoff=.false.
! </DATA>
! <DATA NAME="use_ideal_calving" TYPE="logical">
! To add an idealized solid runoff or calving read from a file.
! This calving runoff is assumed to require melting, so it extracts
! latent heat of fusion from the liquid ocean
! The runoff coming from idealized cavling is NOT subject to
! the global normalization realized from zero_net_water_coupler=.true.
! Default use_ideal_calving=.false.
! </DATA>
!
! <DATA NAME="use_waterflux_override_calving" TYPE="logical">
! Set to true will allow for model to incorporate the latent heating
! from a calving field that comes in through coupled model instantaneous
! interactions, but later will over-ride the mass flux from calving with
! a dataset that is read in from a climatology or observations.
! The idea is to only modify the mass contribution from calving through
! the over-ride, and leave the latent heat contribution untouched.
! Default use_waterflux_override_calving=.false.
! </DATA>
! <DATA NAME="use_waterflux_override_fprec" TYPE="logical">
! Set to true will allow for model to incorporate the latent heating
! from a fprec field that comes in through coupled model instantaneous
! interactions, but later will over-ride the mass flux from fprec with
! a dataset that is read in from a climatology or observations.
! The idea is to only modify the mass contribution from fprec through
! the over-ride, and leave the latent heat contribution untouched.
! Default use_waterflux_override_fprec=.false.
! </DATA>
! <DATA NAME="use_waterflux_override_evap" TYPE="logical">
! Set to true will allow for model to incorporate the latent heating
! from an evap field that comes in through coupled model instantaneous
! interactions, but later will over-ride the mass flux from evap with
! a dataset that is read in from a climatology or observations.
! The idea is to only modify the mass contribution from evap through
! the over-ride, and leave the latent heat contribution untouched.
! Default use_waterflux_override_evap=.false.
! </DATA>
!
! <DATA NAME="temp_restore_tscale" UNITS="day" TYPE="real">
! Time scale in days for restoring temperature within the top model
! grid cell.
! </DATA>
! <DATA NAME="salt_restore_tscale" UNITS="day" TYPE="real">
! Time scale in days for restoring salinity within the top model
! grid cell.
! </DATA>
! <DATA NAME="eta_restore_tscale" UNITS="day" TYPE="real">
! Time scale in days for restoring surface height to produce a modification to
! surface water flux. This option is only available when run with
! use_waterflux=.true.
! </DATA>
! <DATA NAME="use_constant_sst_for_restore" TYPE="logical">
! To over-ride the sfc_restore.nc value for temp restoring.
! use_constant_sst_for_restore=.false.
! </DATA>
! <DATA NAME="constant_sst_for_restore" UNITS="degC" TYPE="real">
! The SST value used if use_constant_sst_for_restore=.true.
! Default constant_sst_for_restore=12.0
! </DATA>
! <DATA NAME="salt_restore_as_salt_flux" TYPE="logical">
! When running a use_waterflux=.true. model, we may choose to add the
! salinity from a restoring condition as a salt flux or convert to
! a fresh water flux. The addition of salt does not alter the sea
! level nor does it alter the concentration of other tracers, whereas
! converting to an implied water flux will alter sea level and other
! concentrations. So we generally recommend the default
! salt_restore_as_salt_flux=.true.
! </DATA>
! <DATA NAME="use_constant_sss_for_restore" TYPE="logical">
! To over-ride the sfc_restore.nc value for salinity restoring.
! use_constant_sss_for_restore=.false.
! </DATA>
! <DATA NAME="constant_sss_for_restore" UNITS="psu" TYPE="real">
! The SSS value used if use_constant_sss_for_restore=.true.
! Default constant_sss_for_restore=35.0
! </DATA>
! <DATA NAME="max_delta_salinity_restore" UNITS="ppt" TYPE="real">
! When computing the restoring flux for salinity, we can define
! a maximum absolute value for the difference between salinity(k=1)
! and the restoring salinity from a dataset. This approach is useful
! especially in NAtl western boundary, where poor Gulf Stream separation
! can lead to large salinity biases. If restore too much the salinity
! field, we can spuriously transport large amounts of fresh water to the
! subpoloar gyre, thus impacting the overturning circulation too much.
! If max_delta_salinity_restore < 0.0, then will NOT provide a max to the
! delta salinity; will instead compute an unbounded restoring flux.
! Default max_delta_salinity_restore=-0.50.
! </DATA>
! <DATA NAME="salinity_restore_limit_lower" UNITS="ppt" TYPE="real">
! Define a lower absolute salinity below which max_delta_salinity_restore
! is ignored. In some coastal regions with high freshwater runoff salinity
! can drop below zero. Set this limit to a positive value below which
! restoring will be more aggressive.
! Default max_delta_salinity_restore=0.0.
! </DATA>
! <DATA NAME="salinity_restore_limit_upper" UNITS="ppt" TYPE="real">
! Define an upper absolute salinity above which max_delta_salinity_restore
! is ignored. In some enclosed coastal regions with low runoff and high
! evaporation salinity can reach physically unrealistic levels. Set this
! limit to a positive value above which restoring will be more aggressive.
! Default max_delta_salinity_restore=100.0.
! </DATA>
!
! <DATA NAME="read_restore_mask" TYPE="logical">
! For reading in a mask that selects regions of the domain
! that are restored (mask=1) or not restored (mask=0).
! Default read_restore_mask=.false., whereby restore_mask
! is set to tmask(k=1).
! </DATA>
! <DATA NAME="restore_mask_gfdl" TYPE="logical">
! For modifying the restore mask based on reading in
! the GFDL regional mask. Default restore_mask_gfdl=.false.
! </DATA>
! <DATA NAME="salinity_ref" UNITS="psu" TYPE="real">
! Reference salinity used for converting fresh water flux
! to salt flux.
! </DATA>
! <DATA NAME="salt_restore_under_ice" TYPE="logical">
! Logical indicating whether to restore salinity under sea ice or not.
! When .false. then will not restore salinity in regions where we
! use a "frazil" condition as a proxy for where sea-ice is present.
! Do not use sea ice extent from a sea ice model since we generally do
! not pass information regarding ice extent between the sea ice model
! and the ocean model.
! </DATA>
! <DATA NAME="zero_net_salt_restore" TYPE="logical">
! Logical indicating whether to remove the area mean of the salinity
! restore flux so there is a net zero input of salt to the ocean
! associated with restoring.
! </DATA>
! <DATA NAME="zero_net_salt_correction" TYPE="logical">
! Logical indicating whether to remove the area mean of the salinity
! correction flux so there is a net zero input of salt to the ocean
! associated with salt correction.
! </DATA>
! <DATA NAME="zero_net_water_restore" TYPE="logical">
! Logical indicating whether to remove the area mean of the water
! restore flux so there is a net zero input of water to the ocean
! associated with restoring.
! </DATA>
! <DATA NAME="zero_net_water_correction" TYPE="logical">
! Logical indicating whether to remove the area mean of the water
! correction flux so there is a net zero input of water to the ocean
! associated with water correction.
! </DATA>
! <DATA NAME="zero_net_water_coupler" TYPE="logical">
! Logical indicating whether to remove the area mean of the water
! passed through the coupler so there is a net zero input of
! fresh water to the ocean associated with p-e+r. Do so by removing
! area mean from pme--keep river values unchanged. Note that a choice
! must be made whether to remove the area mean from rivers or pme.
! We choose pme since it is more evenly distributed than rivers.
! Also note that we DO NOT include the ice melt in this normalization.
! The reason is that we only wish to ensure the ocean+ice system
! has a zero net water. When melt or form sea ice, this only transfers
! water between liquid ocean and solid sea ice, and no normalization is
! appropriate for this case. It is only the water exchanged with the
! land and atmosphere that is normalized.
! </DATA>
! <DATA NAME="zero_net_water_couple_restore" TYPE="logical">
! This logical keeps the total water forcing on the ocean+ice system
! to a global mean of zero at each time step. We DO NOT include
! the ice melt in this normalization.
! Setting zero_net_water_couple_restore to true may be appropriate when
! running an ice-ocean model using a bulk formulae to compute
! evaporation (e.g., CORE) and when only providing a weak (or zero)
! salinity restoring. It is not appropriate when running a coupled
! ocean-atmosphere model, where the moisture budget should be
! conserved without an artificial removal of the global mean.
! </DATA>
!
! <DATA NAME="land_model_heat_fluxes" TYPE="logical">
! For the case where land model passes through the coupler the heat flux
! associated with the liquid runoff and calving land ice fields.
! This heat flux is computed relative to 0C, and takes the form
! heat flux = mass flux of water * temp of water * heat capacity,
! where the water can be either liquid or solid. For many coupled models,
! the water temperature is assumed to be that of the SST. But
! more complete land models now carry the heat of its water relative to 0C,
! in which case the ocean model does not need to assume anything about the
! heat content of the land water.
! Default land_model_heat_fluxes=.false.
! </DATA>
!
! <DATA NAME="debug_water_fluxes" TYPE="logical">
! Logical for debugging water fluxes. Must be true for any of the
! options zero_water_fluxes, zero_calving_fluxes, zero_pme_fluxes
! or zero_runoff_fluxes to be enabled.
! Default debug_water_fluxes=.false.
! </DATA>
! <DATA NAME="zero_water_fluxes" TYPE="logical">
! Logical for debugging to zero the pme, river, and pme_taum1 into
! ocean, over-riding any input from Ice_ocean_boundary.
! Default zero_water_fluxes=.false.
! </DATA>
! <DATA NAME="zero_calving_fluxes" TYPE="logical">
! Logical for debugging to zero the calving flux passed into the ocean.
! Default zero_calving_fluxes=.false.
! </DATA>
! <DATA NAME="zero_pme_fluxes" TYPE="logical">
! Logical for debugging to zero the pme flux passed into the ocean.
! Default zero_pme_fluxes=.false.
! </DATA>
! <DATA NAME="zero_runoff_fluxes" TYPE="logical">
! Logical for debugging to zero the runoff flux passed into the ocean.
! Default zero_runoff_fluxes=.false.
! </DATA>
! <DATA NAME="zero_river_fluxes" TYPE="logical">
! Logical for debugging to zero the river (calving+runoff) flux passed into the ocean.
! Default zero_river_fluxes=.false.
! </DATA>
! <DATA NAME="convert_river_to_pme" TYPE="logical">
! Logical for debugging. Here we add the river water input (calving+runoff)
! to pme, then set river=calving=runoff=0.0.
! Default convert_river_to_pme=.false.
! </DATA>
!
! <DATA NAME="sbc_heat_fluxes_const" TYPE="logical">
! Logical for setting the surface heat flux from the coupler
! to a global constant. Default is sbc_heat_fluxes_const=.false.
! </DATA>
! <DATA NAME="sbc_heat_fluxes_const_seasonal" TYPE="logical">
! Logical for setting the surface heat flux from the coupler
! to a global constant, and giving it a seasonally varying amplitude.
! Default is sbc_heat_fluxes_const_seasonal=.false.
! </DATA>
! <DATA NAME="sbc_heat_fluxes_const_value" UNITS="W/m2" TYPE="real">
! Value for the constant heat flux when using
! sbc_heat_fluxes_const=.true.
! Default sbc_heat_fluxes_const_value=0.0.
! </DATA>
! <DATA NAME="zero_heat_fluxes" TYPE="logical">
! Logical for debugging to set all heat fluxes into the ocean to zero,
! over-riding any input from Ice_ocean_boundary. Default is .false.
! </DATA>
! <DATA NAME="zero_surface_stress" TYPE="logical">
! Logical for debugging to zero all surface stress applied to the ocean,
! over-riding any input from Ice_ocean_boundary. Default is .false.
! </DATA>
!
! <DATA NAME="rotate_winds" TYPE="logical">
! Set to true when need to rotate the winds onto the ocean model grid.
! This is needed for cases where the winds are on a spherical grid and
! the ocean model uses tripolar=.true. If generate the wind data on
! the ocean model grid, then do not need to rotate, since the rotation
! has already been done.
! </DATA>
!
! <DATA NAME="max_ice_thickness" UNITS="m" TYPE="real">
! When coupling MOM to an ice model, the sea ice thickness may need
! to be restricted to prevent vanishing top-level in MOM. Set
! max_ice_thickness (meters) < dzt(k=1) to restrict. This truncation
! avoids the numerical problem but we loose mass conservation in the coupled
! sea ice and ocean system. We also alter the pressure felt on the ocean
! as applied by the sea ice. Different vertical coordinates are needed
! to do the problem more realistically.
!
! Note that the problem of vanishing top layer is removed when use
! either ZSTAR or PSTAR as vertical coordinate.
! </DATA>
!
! <DATA NAME="ice_salt_concentration" UNITS="kg salt / kg ice" TYPE="real">
! The salt concentration of sea ice. This is taken as a bulk value, and should
! be the same as that used by the ice model. Default is ice_salt_concentration=0.005,
! as that is the value used in the GFDL coupled climate model.
! </DATA>
!
! <DATA NAME="ocean_ice_salt_limit" UNITS="kg salt / kg ice" TYPE="real">
! The minimum salt concentration of water forming sea ice. This shouldbe at least that used by the ice model
! otherwise it is possible to extract more salt than physically exists.
! Default is ocean_ice_salt_limit=0.0 in order to reproduce older results.
! It is suggested that ocean_ice_salt_limit > ice_salt_concentration + 0.001 to prevent dropping below
! ice_salt_concentration by mistake.
! </DATA>
!
! <DATA NAME="runoff_salinity" UNITS="g salt / kg runoff water (ppt)" TYPE="real">
! The salinity of river runoff water. Default is runoff_salinity=0.0.
! </DATA>
! <DATA NAME="runoff_temp_min" UNITS="DegC" TYPE="real">
! The minimum temperature that river runoff into the ocean is assigned.
! Default runoff_temp_min=0.0.
! </DATA>
!
! <DATA NAME="runoffspread" TYPE="logical">
! Set to true if wish to use the spread_river_horz algorithm to spread
! the river runoff flux horizontally over an area into the ocean wider than
! set by the coupler. This option requires the setup of a table for
! determining the points over which we spread.
! Default runoffspread=.false.
! </DATA>
! <DATA NAME="calvingspread" TYPE="logical">
! Set to true if wish to use the spread_river_horz algorithm to spread
! the calving flux horizontally over an area into the ocean wider than
! set by the coupler. This option requires the setup of a table for
! determining the points over which we spread.
! Default calvingspread=.false.
! </DATA>
!
! <DATA NAME="avg_sfc_velocity" TYPE="logical">
! If set to true, the u and v fields passed up to the sea ice
! are averaged over a coupling interval. TRUE by default.
! </DATA>
! <DATA NAME="avg_sfc_temp_salt_eta" TYPE="logical">
! If set to true, the t, s and sea_level fields passed up to the sea ice
! are averaged over a coupling interval. TRUE by default.
! </DATA>
!
! <DATA NAME="use_full_patm_for_sea_level" TYPE="logical">
! The option use_full_patm_for_sea_level allows for the passing
! of the sea level including the full weight of sea ice back to
! the ice model. This approach maintains the max weight on the liquid
! ocean according to the nml variable max_ice_thickness. But it does
! allow the sea ice to know when there is actually more sea ice than that
! set by max_ice_thickness. This option then provides for a negative
! feedback on the runaway growth of sea ice, since the full pressure acting to
! make the ice flow will be correctly felt. This is a new option, and is not
! fully tested, So the default is use_full_patm_for_sea_level=.false
! </DATA>
!
! <DATA NAME="do_flux_correction" TYPE="logical">
! For applying surface flux correction to to a tracer or wind stress field.
! This code is used at GFDL for idealized perturbation experiments, such
! as when one wishes to artificially enhance the wind stress to test
! model sensitivity. It is also appropriate for coupled models that
! may require a modification to the fluxes arrising from a coupled model,
! via reading in information from a pre-defined
! data file,
! Default do_flux_correction=.false.
! </DATA>
! <DATA NAME="temp_correction_scale" UNITS="dimensionless" TYPE="real">
! A scale multiplying the flux correction for temperature.
! Default temp_correction_scale=0.0.
! </DATA>
! <DATA NAME="salt_correction_scale" UNITS="dimensionless" TYPE="real">
! A scale multiplying the flux correction for salinity.
! Default salt_correction_scale=0.0.
! </DATA>
! <DATA NAME="tau_x_correction_scale" UNITS="dimensionless" TYPE="real">
! A scale multiplying the flux correction for tau_x.
! Default tau_x_correction_scale=0.0.
! </DATA>
! <DATA NAME="tau_y_correction_scale" UNITS="dimensionless" TYPE="real">
! A scale multiplying the flux correction for tau_y.
! Default tau_y_correction_scale=0.0.
! </DATA>
! <DATA NAME="do_bitwise_exact_sum" TYPE="logical">
! Set true to do bitwise exact global sum. When it is false, the global
! sum will be non-bitwise_exact, but will significantly increase efficiency.
! The default value is do_bitwise_exact_sum=.true. in order to ensure answers
! do not change when alter processors. But if wish to enhance the efficiency
! of coupled ocean-ice models that use one of the global normalization options
! zero_net_salt_restore =.true.
! zero_net_salt_correction =.true.
! zero_net_water_restore =.true.
! zero_net_water_correction =.true.
! zero_net_water_coupler =.true.
! zero_net_water_couple_restore=.true.
! then one may wish to consider setting do_bitwise_exact_sum=.false.
! </DATA>
!
! <DATA NAME="constant_hlf" TYPE="logical">
! Treat latent heat of fusion as a constant. Otherwise, use the TEOS-10
! approach in which hlf is function of surface salinity.
! Note, TEOS-10 approach is only valid using Absolute Salinity and
! conservative temperature as the prognostic fields.
! Default constant_hlf = .true., which is the case for pre-TEOS-10 methods.
! </DATA>
! <DATA NAME="constant_hlv" TYPE="logical">
! Treat latent heat of vaporization as a constant. Otherwise, use the TEOS-10
! approach in which hlf is function of surface salinity.
! Note, TEOS-10 approach is only valid using Absolute Salinity and
! conservative temperature as the prognostic fields.
! Default constant_hlv = .true., which is the case for pre-TEOS-10 methods.
! </DATA>
!
! <DATA NAME="read_stokes_drift" TYPE="logical">
! This option is to be used when coupling to a surface wave model such as
! Wavewatch III that provides both the Stokes drift (m/s) velocity at the
! ocean surface, and a decay scale for projecting the Stokes
! drift into the interior. Default read_stokes_drift = .false.
! </DATA>
!
! <DATA NAME="do_langmuir" TYPE="logical">
! TThis option exists in the event that boundary forcing from a future wave model is
! provided. Not to be confused with wave mixing parameterised by supplying 10m
! winds.
! Default do_langmuir = .false.
! </DATA>
!
! <DATA NAME="do_ustar_correction" TYPE="logical">
! Compute ustar including the adjusted/correction stress field that has now been
! included in smf.
! Note, however, that the FAFMIP stess experiment says we should NOT include the perturbed
! stress when computing ustar since we do not wish to affect the mixing schemes.
! Hence, we should set do_ustar_correction=.false. for FAFMIP in which case ustar just has
! contributions from the unperturbed stress.
! Default do_ustar_correction = .true. as this reproduces earlier
! behavior.
! </DATA>
!
! <DATA NAME="do_frazil_redist" TYPE="logical">
! In FAFMIP heat experiments we should be using the heat due to frazil
! formation from the redistributed tracer. Previous code unconditionally
! used the standard tracer. We allow the user to override the recommended treatment to
! recover old results by setting do_frazil_redist=.false.. If there is no
! frazil_redist_tracer this flag has no effect and the usual treatment of frazil proceeds.
! This flag has no effect on the ACCESS treatment of frazil which ALWAYS uses the redistibuted
! heat version if it is available.
! Note that the current approach (June 2019) the frazil heats are note quite
! the same for the temperature and redistributed heat tracers. See the references above
! for details.
! Default do_frazil_redist = .true.
! </DATA>
!
!</NAMELIST>
!
#include <fms_platform.h>
use constants_mod, only: epsln, hlv, hlf, kelvin, pi
use diag_manager_mod, only: register_diag_field, register_static_field, send_data
use fms_mod, only: open_namelist_file, check_nml_error, file_exist
use fms_mod, only: close_file, read_data, write_version_number
use fms_io_mod, only: register_restart_field, save_restart, restore_state, restart_file_type
use mpp_domains_mod, only: mpp_update_domains, BGRID_NE, mpp_define_domains, mpp_get_compute_domain
use mpp_domains_mod, only: mpp_global_sum, BITWISE_EXACT_SUM, NON_BITWISE_EXACT_SUM
use mpp_domains_mod, only: mpp_define_io_domain
use mpp_mod, only: input_nml_file, mpp_error, FATAL, stdout, stdlog
use time_interp_external_mod, only: time_interp_external, init_external_field
use time_manager_mod, only: time_type, increment_time, get_time
use ocean_domains_mod, only: get_local_indices
use ocean_parameters_mod, only: missing_value, onehalf
use ocean_parameters_mod, only: grav, rho_cp, cp_ocean, cp_liquid_runoff, cp_solid_runoff, rho0, rho0r
use ocean_parameters_mod, only: CONSERVATIVE_TEMP, POTENTIAL_TEMP, PREFORMED_SALT, PRACTICAL_SALT
use ocean_parameters_mod, only: MOM_BGRID, MOM_CGRID
use ocean_riverspread_mod, only: spread_river_horz
use ocean_tempsalt_mod, only: pottemp_from_contemp
use ocean_tpm_mod, only: ocean_tpm_sum_sfc, ocean_tpm_avg_sfc, ocean_tpm_sbc
use ocean_tpm_mod, only: ocean_tpm_zero_sfc, ocean_tpm_sfc_end
use ocean_types_mod, only: ocean_grid_type, ocean_domain_type, ocean_public_type
use ocean_types_mod, only: ocean_time_type, ocean_thickness_type
use ocean_types_mod, only: ocean_prog_tracer_type, ocean_diag_tracer_type
use ocean_types_mod, only: ocean_external_mode_type, ocean_velocity_type
use ocean_types_mod, only: ice_ocean_boundary_type, ocean_density_type
use ocean_types_mod, only: ocean_public_type
use ocean_workspace_mod, only: wrk1_2d, wrk2_2d, wrk3_2d, wrk1
use ocean_util_mod, only: diagnose_2d, diagnose_2d_u, diagnose_3d_u, diagnose_sum
use ocean_tracer_util_mod, only: diagnose_3d_rho
#if defined(CSIRO_BGC)
use csiro_bgc_mod, only: csiro_bgc_virtual_fluxes, do_csiro_bgc
#endif
implicit none
private
! for Bgrid or Cgrid
integer :: horz_grid
real, allocatable, dimension(:,:) :: wind_mask
! for restoring input field
integer, allocatable, dimension(:) :: id_restore
integer :: id_eta_restore=-1
! for flux corrections input fields
integer :: id_tau_x_correction =-1
integer :: id_tau_y_correction =-1
integer, allocatable, dimension(:) :: id_correction
! for data override files associated with water contributing to latent heating
integer :: id_calving_override = -1
integer :: id_fprec_override = -1
integer :: id_evap_override = -1
! for non-constant latent heats
real, allocatable, dimension(:,:) :: latent_heat_vapor
real, allocatable, dimension(:,:) :: latent_heat_fusion
integer :: index_temp =-1
integer :: index_salt =-1
integer :: index_diag_temp =-1
integer :: index_frazil =-1
integer :: prog_temp_variable =-1
integer :: prog_salt_variable =-1
! FAFMIP heat tracers
integer :: index_added_heat = -1
integer :: index_redist_heat = -1
integer :: index_frazil_redist =-1
integer :: memuse
integer :: num_prog_tracers
integer :: num_diag_tracers
integer :: global_sum_flag
! ids for diagnostic manager
logical :: used
integer, allocatable, dimension(:) :: id_stf_coupler
integer, allocatable, dimension(:) :: id_stf_restore
integer, allocatable, dimension(:) :: id_stf_correct
integer, allocatable, dimension(:) :: id_stf_total
integer, allocatable, dimension(:) :: id_stf_runoff
integer, allocatable, dimension(:) :: id_stf_calving
integer, allocatable, dimension(:) :: id_stf_pme
integer, allocatable, dimension(:) :: id_stf_pme_on_nrho
integer, allocatable, dimension(:) :: id_stf_prec
integer, allocatable, dimension(:) :: id_stf_evap
integer, allocatable, dimension(:) :: id_trunoff
integer, allocatable, dimension(:) :: id_tcalving
integer, allocatable, dimension(:) :: id_triver
integer, allocatable, dimension(:) :: id_total_ocean_stf_coupler
integer, allocatable, dimension(:) :: id_total_ocean_stf_runoff
integer, allocatable, dimension(:) :: id_total_ocean_stf_calving
integer, allocatable, dimension(:) :: id_total_ocean_stf_pme
integer, allocatable, dimension(:) :: id_total_ocean_stf_prec
integer, allocatable, dimension(:) :: id_total_ocean_stf_evap
integer, allocatable, dimension(:) :: id_total_ocean_stf_restore
integer, allocatable, dimension(:) :: id_total_ocean_stf_correct
integer, allocatable, dimension(:) :: id_total_ocean_stf_sum
integer :: id_tau_x_flux_correction=-1
integer :: id_tau_y_flux_correction=-1
integer :: id_tau_x_net=-1
integer :: id_tau_y_net=-1
integer :: id_latent_heat_vapor =-1
integer :: id_latent_heat_fusion=-1
integer :: id_ustokes =-1
integer :: id_vstokes =-1
integer :: id_stokes_depth =-1
integer :: id_ustoke =-1
integer :: id_vstoke =-1
integer :: id_wavlen =-1
integer :: id_net_sfc_heating =-1
integer :: id_total_net_sfc_heating =-1
integer :: id_net_sfc_workq =-1
integer :: id_net_sfc_workemp =-1
integer :: id_salt_flux_ice =-1
integer :: id_total_salt_flux_ice=-1
integer :: id_temp_runoff_eff =-1
integer :: id_temp_calving_eff =-1
integer :: id_tau_x =-1
integer :: id_tau_y =-1
integer :: id_tau_curl =-1
integer :: id_ekman_we =-1
integer :: id_ekman_heat =-1
integer :: id_swflx =-1
integer :: id_swflx_vis =-1
integer :: id_lw_heat =-1
integer :: id_sens_heat =-1
integer :: id_fprec_melt_heat =-1
integer :: id_calving_melt_heat =-1
integer :: id_evap_heat =-1
integer :: id_fprec =-1
integer :: id_lprec =-1
integer :: id_river =-1
integer :: id_alphasfc =-1
integer :: id_betasfc =-1
integer :: id_alphasfc2 =-1
integer :: id_betasfc2 =-1
integer :: id_calving =-1
integer :: id_ideal_calving =-1
integer :: id_runoff =-1
integer :: id_ideal_runoff =-1
integer :: id_melt =-1
integer :: id_evap =-1
integer :: id_pme_sbc =-1
integer :: id_pme_river =-1
integer :: id_pme_restore =-1
integer :: id_pme_eta_restore=-1
integer :: id_pme_correct =-1
integer :: id_pme_net =-1
integer :: id_ice_mask =-1
integer :: id_open_ocean_mask=-1
integer :: id_restore_mask =-1
#if defined(ACCESS_CM) || defined(ACCESS_OM)
integer :: id_wfimelt =-1
integer :: id_wfiform =-1
integer :: id_aice =-1
integer :: id_wnd =-1
integer :: id_licefw =-1
integer :: id_liceht =-1
integer :: id_atm_co2 =-1
#endif
! ids for sea level forcing fields
real :: cellarea_r
logical :: diagnose_sea_level_forcing =.false. ! internally set
integer :: id_eta_tend_sw = -1
integer :: id_eta_tend_lw = -1
integer :: id_eta_tend_sens = -1
integer :: id_eta_tend_evap_heat = -1
integer :: id_eta_tend_fprec_melt = -1
integer :: id_eta_tend_iceberg_melt = -1
integer :: id_eta_tend_heat_coupler = -1
integer :: id_eta_tend_heat_restore = -1
integer :: id_eta_tend_salt_coupler = -1
integer :: id_eta_tend_salt_restore = -1
integer :: id_eta_tend_evap = -1
integer :: id_eta_tend_lprec = -1
integer :: id_eta_tend_fprec = -1
integer :: id_eta_tend_runoff = -1
integer :: id_eta_tend_iceberg = -1
integer :: id_eta_tend_water_coupler = -1
integer :: id_eta_tend_water_restore = -1
integer :: id_eta_tend_sw_glob = -1
integer :: id_eta_tend_lw_glob = -1
integer :: id_eta_tend_sens_glob = -1
integer :: id_eta_tend_evap_heat_glob = -1
integer :: id_eta_tend_fprec_melt_glob = -1
integer :: id_eta_tend_iceberg_melt_glob = -1
integer :: id_eta_tend_heat_coupler_glob = -1
integer :: id_eta_tend_heat_restore_glob = -1
integer :: id_eta_tend_salt_coupler_glob = -1
integer :: id_eta_tend_salt_restore_glob = -1
integer :: id_eta_tend_evap_glob = -1
integer :: id_eta_tend_lprec_glob = -1
integer :: id_eta_tend_fprec_glob = -1
integer :: id_eta_tend_runoff_glob = -1
integer :: id_eta_tend_iceberg_glob = -1
integer :: id_eta_tend_water_coupler_glob = -1
integer :: id_eta_tend_water_restore_glob = -1
! ids for scalar fields
integer :: id_total_ocean_swflx =-1
integer :: id_total_ocean_swflx_vis =-1
integer :: id_total_ocean_evap_heat =-1
integer :: id_total_ocean_lw_heat =-1
integer :: id_total_ocean_sens_heat =-1
integer :: id_total_ocean_river_heat =-1
integer :: id_total_ocean_pme_heat =-1
integer :: id_total_ocean_fprec_melt_heat =-1
integer :: id_total_ocean_calving_melt_heat =-1
integer :: id_total_ocean_river =-1
integer :: id_total_ocean_evap =-1
integer :: id_total_ocean_melt =-1
integer :: id_total_ocean_pme_sbc =-1
integer :: id_total_ocean_pme_restore=-1
integer :: id_total_ocean_pme_correct=-1
integer :: id_total_ocean_pme_net =-1
integer :: id_total_ocean_pme_river =-1
integer :: id_total_ocean_fprec =-1
integer :: id_total_ocean_lprec =-1
integer :: id_total_ocean_calving =-1
integer :: id_total_ocean_runoff =-1
#if defined(ACCESS_CM) || defined(ACCESS_OM)
integer :: id_total_ocean_wfimelt =-1
integer :: id_total_ocean_wfiform =-1
integer :: id_total_ocean_licefw =-1
integer :: id_total_ocean_liceht =-1
#endif
! ids for rebinning mass fluxes to neutral density classes
integer :: id_mass_precip_on_nrho =-1
integer :: id_mass_evap_on_nrho =-1
integer :: id_mass_river_on_nrho =-1
integer :: id_mass_melt_on_nrho =-1
integer :: id_mass_pmepr_on_nrho =-1
integer :: id_mass_pme_adj_on_nrho =-1
! ids for rebinning temp and salt fluxes to neutral density classes
integer :: id_tform_rho_pbl_flux_on_nrho =-1
integer :: id_tform_rho_pbl_adjheat_on_nrho=-1
integer :: id_tform_rho_pbl_adjsalt_on_nrho=-1
integer :: id_tform_rho_pbl_heat_on_nrho =-1
integer :: id_tform_rho_pbl_salt_on_nrho =-1
integer :: id_tform_rho_pbl_sw_on_nrho =-1
integer :: id_tform_rho_pbl_lw_on_nrho =-1
integer :: id_tform_rho_pbl_sens_on_nrho =-1
integer :: id_tform_rho_pbl_lat_on_nrho =-1
#include <ocean_memory.h>
#ifdef MOM_STATIC_ARRAYS
real, dimension(isd:ied,jsd:jed) :: data
real, dimension(isd:ied,jsd:jed) :: pme_taum1 ! mass flux (kg/(m^2 sec)) of precip-evap from coupler at taum1 time step
real, dimension(isd:ied,jsd:jed) :: river_taum1 ! mass flux of river water (liquid+solid) from coupler at taum1 time step
real, dimension(isd:ied,jsd:jed) :: pme_river ! mass flux of water into ocean from pme+river-melt
real, dimension(isd:ied,jsd:jed) :: restore_mask ! mask for setting regions that are restored
real, dimension(isd:ied,jsd:jed) :: runoff ! mass flux of liquid river runoff
real, dimension(isd:ied,jsd:jed) :: ideal_runoff ! mass flux of liquid river runoff obtained from read-in file
real, dimension(isd:ied,jsd:jed) :: calving ! mass flux of calving land ice into ocean
real, dimension(isd:ied,jsd:jed) :: ideal_calving ! mass flux of calving land ice obtained from read-in file
real, dimension(isd:ied,jsd:jed) :: rhosfc_inv ! surface ocean specific volume (m^3/kg) #
real, dimension(isd:ied,jsd:jed) :: alphasfc ! surface thermal expansion coefficient (1/deg C)
real, dimension(isd:ied,jsd:jed) :: betasfc ! surface saline contraction coefficient (1/ppt)
real, dimension(isd:ied,jsd:jed) :: alphasfc2 ! potrho surface thermal expansion coefficient (1/deg C)
real, dimension(isd:ied,jsd:jed) :: betasfc2 ! potrho surface saline contraction coefficient (1/ppt)
#else
real, allocatable, dimension(:,:) :: data
real, allocatable, dimension(:,:) :: pme_taum1 ! mass flux (kg/(m^2 sec)) of precip-evap from coupler at taum1 time step
real, allocatable, dimension(:,:) :: river_taum1 ! mass flux of river water (liquid+solid) from coupler at taum1 time step
real, allocatable, dimension(:,:) :: pme_river ! mass flux of water into ocean from pme+river-melt
real, allocatable, dimension(:,:) :: restore_mask ! mask for setting regions that are restored
real, allocatable, dimension(:,:) :: runoff ! mass flux of liquid river runoff
real, allocatable, dimension(:,:) :: ideal_runoff ! mass flux of liquid river runoff obtained from read-in file
real, allocatable, dimension(:,:) :: calving ! mass flux of calving land ice into ocean
real, allocatable, dimension(:,:) :: ideal_calving ! mass flux of calving land ice obtained from read-in file
real, allocatable, dimension(:,:) :: rhosfc_inv ! surface ocean specific volume (m^3/kg)
real, allocatable, dimension(:,:) :: alphasfc ! surface thermal expansion coefficient (1/deg C)
real, allocatable, dimension(:,:) :: betasfc ! surface saline contraction coefficient (1/ppt)
real, allocatable, dimension(:,:) :: alphasfc2 ! potrho surface thermal expansion coefficient (1/deg C)
real, allocatable, dimension(:,:) :: betasfc2 ! potrho surface saline contraction coefficient (1/ppt)
#endif
#if defined(ACCESS_CM) || defined(ACCESS_OM)
real, allocatable, dimension(:,:,:) :: sslope
real, allocatable, dimension(:,:) :: aice
#endif
#if defined(ACCESS_CM)
real, allocatable, dimension(:,:) :: co2flux
real, allocatable, dimension(:,:) :: ocn_co2
real, allocatable, dimension(:,:) :: atm_co2
#endif
! ice-ocean-boundary fields are allocated using absolute
! indices (regardless of whether ocean allocations are static)
integer :: isc_bnd, iec_bnd, jsc_bnd, jec_bnd
integer :: i_shift, j_shift ! shift isc_bnd to isc and jsc_bnd to jsc
real :: grav_rho0_r
real :: cp_liquid_runoff_r
real :: cp_solid_runoff_r
real :: cp_ocean_r
real :: ice_salt_concentration_r
real :: dtime
real :: twopi
real :: days_in_year_r
type(ocean_grid_type), pointer :: Grd =>NULL()
type(ocean_domain_type), pointer :: Dom =>NULL()
type(restart_file_type), save :: Sbc_restart
type(restart_file_type), save :: Sfc_restart
public :: ocean_sbc_init
public :: sum_ocean_sfc
public :: avg_ocean_sfc
public :: zero_ocean_sfc
public :: flux_adjust
public :: get_ocean_sbc
public :: initialize_ocean_sfc
public :: ocean_sfc_end
public :: ocean_sfc_restart
private :: ocean_sbc_diag_init
private :: ocean_sbc_diag
private :: compute_latent_heat_vapor
private :: compute_latent_heat_fusion
character(len=128) :: version=&
'$Id: ocean_sbc.F90,v 20.0 2013/12/14 00:10:59 fms Exp $'
character (len=128) :: tagname = &
'$Name: tikal $'
logical :: module_is_initialized =.false.
logical :: use_waterflux =.true.
logical :: waterflux_tavg =.false.
logical :: use_waterflux_override_calving =.false.
logical :: use_waterflux_override_fprec =.false.
logical :: use_waterflux_override_evap =.false.
logical :: rotate_winds =.false.
logical :: taux_sinx =.false.
logical :: tauy_siny =.false.
logical :: runoffspread =.false.
logical :: calvingspread =.false.
logical :: salt_restore_under_ice =.true.
logical :: salt_restore_as_salt_flux =.true.
logical :: zero_net_salt_restore =.false.
logical :: zero_net_salt_correction =.false.
logical :: zero_net_water_restore =.false.
logical :: zero_net_water_correction =.false.
logical :: zero_net_water_coupler =.false.
logical :: zero_net_water_couple_restore =.false.
logical :: zero_net_pme_eta_restore =.false.
logical :: debug_water_fluxes =.false.
logical :: zero_water_fluxes =.false.
logical :: zero_pme_fluxes =.false.
logical :: zero_calving_fluxes =.false.
logical :: zero_runoff_fluxes =.false.
logical :: zero_river_fluxes =.false.
logical :: convert_river_to_pme =.false.
logical :: zero_heat_fluxes =.false.
logical :: zero_surface_stress =.false.
logical :: read_restore_mask =.false.
logical :: restore_mask_gfdl =.false.
logical :: land_model_heat_fluxes =.false.
logical :: do_flux_correction =.false.
logical :: sbc_heat_fluxes_const =.false.
logical :: sbc_heat_fluxes_const_seasonal =.false.
logical :: use_constant_sss_for_restore =.false.
logical :: use_constant_sst_for_restore =.false.
logical :: use_ideal_runoff =.false.
logical :: use_ideal_calving =.false.
logical :: read_stokes_drift =.false.
logical :: do_langmuir =.false.
logical :: do_ustar_correction =.true. ! In FAFMIP stress make this falsel
logical :: do_frazil_redist =.true. ! In FAFMIP heat make this false to recover old (not recommended) behaviour.
real :: constant_sss_for_restore = 35.0
real :: constant_sst_for_restore = 12.0
real :: sbc_heat_fluxes_const_value = 0.0 ! W/m2
real :: ice_salt_concentration = 0.005 ! kg/kg
real :: ocean_ice_salt_limit = 0.0 ! kg/kg
real :: runoff_salinity = 0.0 ! psu
real :: runoff_temp_min = 0.0 ! degC
real :: temp_restore_tscale = -30.
real :: salt_restore_tscale = -30.
real :: eta_restore_tscale = -30.
real :: max_ice_thickness = 5.0
real :: salinity_ref = 35.0
real :: max_delta_salinity_restore = -0.5
real :: salinity_restore_limit_lower = 0.0
real :: salinity_restore_limit_upper = 100.0
real :: temp_damp_factor ! kg/(m^2*sec)
real :: salt_damp_factor ! kg/(m^2*sec)
real :: eta_damp_factor ! 1/sec
real :: temp_correction_scale = 0.0
real :: salt_correction_scale = 0.0
real :: tau_x_correction_scale = 0.0
real :: tau_y_correction_scale = 0.0
logical :: constant_hlf = .true.
logical :: constant_hlv = .true.
logical :: avg_sfc_velocity = .true.
logical :: avg_sfc_temp_salt_eta = .true.
logical :: use_full_patm_for_sea_level= .false.
logical :: do_bitwise_exact_sum = .true.
integer :: id_restore_mask_ofam = -1
logical :: restore_mask_ofam = .false.
logical :: river_temp_ofam = .false.
namelist /ocean_sbc_nml/ temp_restore_tscale, salt_restore_tscale, salt_restore_under_ice, salt_restore_as_salt_flux, &
eta_restore_tscale, zero_net_pme_eta_restore, &
rotate_winds, taux_sinx, tauy_siny, use_waterflux, waterflux_tavg, max_ice_thickness, runoffspread, calvingspread, &
use_waterflux_override_calving, use_waterflux_override_evap, use_waterflux_override_fprec, &
salinity_ref, zero_net_salt_restore, zero_net_water_restore, zero_net_water_coupler, zero_net_water_couple_restore, &
zero_net_salt_correction, zero_net_water_correction, &
debug_water_fluxes, zero_water_fluxes, zero_calving_fluxes, zero_pme_fluxes, zero_runoff_fluxes, zero_river_fluxes, &
convert_river_to_pme, zero_heat_fluxes, zero_surface_stress, avg_sfc_velocity, avg_sfc_temp_salt_eta, &
ice_salt_concentration, ocean_ice_salt_limit, runoff_salinity, runoff_temp_min, read_restore_mask, restore_mask_gfdl,&
land_model_heat_fluxes, use_full_patm_for_sea_level, max_delta_salinity_restore, do_flux_correction, &
salinity_restore_limit_lower, salinity_restore_limit_upper, &
temp_correction_scale, salt_correction_scale, tau_x_correction_scale, tau_y_correction_scale, do_bitwise_exact_sum, &
sbc_heat_fluxes_const, sbc_heat_fluxes_const_value, sbc_heat_fluxes_const_seasonal, &
use_constant_sss_for_restore, constant_sss_for_restore, use_constant_sst_for_restore, constant_sst_for_restore, &
use_ideal_calving, use_ideal_runoff, constant_hlf, constant_hlv, read_stokes_drift, do_langmuir, &
do_ustar_correction, do_frazil_redist
namelist /ocean_sbc_ofam_nml/ restore_mask_ofam, river_temp_ofam
contains
!#######################################################################
! <SUBROUTINE NAME="ocean_sbc_init">
!
! <DESCRIPTION>
! Initialize the ocean sbc module.
! </DESCRIPTION>
!
subroutine ocean_sbc_init(Grid, Domain, Time, T_prog, T_diag, &
Ocean_sfc, Dens, time_tendency, dtime_t, hor_grid)
type(ocean_grid_type), intent(in), target :: Grid
type(ocean_domain_type), intent(in), target :: Domain
type(ocean_time_type), intent(in) :: Time
type(ocean_prog_tracer_type), intent(inout), target :: T_prog(:)
type(ocean_diag_tracer_type), intent(inout), target :: T_diag(:)
type(ocean_public_type), intent(inout) :: Ocean_sfc
type(ocean_density_type), intent(in) :: Dens
character(len=32), intent(in) :: time_tendency
real, intent(in) :: dtime_t
integer, intent(in) :: hor_grid
integer :: ioun, ierr, io_status
integer :: i,j,n
integer :: taup1, id_field
real :: secday
character(len=128) :: name, filename
integer :: stdoutunit,stdlogunit
stdoutunit=stdout();stdlogunit=stdlog()
if ( module_is_initialized ) then