-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathregister_all_variables.F90
More file actions
690 lines (648 loc) · 37.8 KB
/
register_all_variables.F90
File metadata and controls
690 lines (648 loc) · 37.8 KB
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
#include"cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !MODULE: register_all_variables
!
! !INTERFACE:
module register_all_variables
!
! !DESCRIPTION:
!
! !USES:
use field_manager
IMPLICIT NONE
!
! default: all is private.
private
!
! !PUBLIC MEMBER FUNCTIONS:
public :: do_register_all_variables
!
! !PUBLIC DATA MEMBERS:
type (type_field_manager), public, target :: fm
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Jorn Bruggeman
!
! !PRIVATE DATA MEMBERS
integer :: N=0
!
!-----------------------------------------------------------------------
contains
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: do_register_all_variables
!
! !INTERFACE:
subroutine do_register_all_variables(lat,lon,nlev)
!
! !USES:
IMPLICIT NONE
!
! !DESCRIPTION:
!
! !INPUT PARAMETERS:
REALTYPE, intent(in) :: lat,lon
integer, intent(in) :: nlev
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Jorn Bruggeman
!
! !LOCAL VARIABLES:
!EOP
!-------------------------------------------------------------------------
!BOC
LEVEL1 'register_all_variables()'
call register_coordinate_variables(lat,lon)
call register_density_variables(nlev)
call register_meanflow_variables(nlev)
#ifdef _SEAGRASS_
call register_seagrass_variables(nlev)
#endif
call register_airsea_variables(nlev)
#ifdef _ICE_
call register_stim_variables(nlev)
#endif
call register_observation_variables(nlev)
call register_stokes_drift_variables(nlev)
#if 0
call register_stream_variables(nlev)
#endif
call register_turbulence_variables(nlev)
call register_diagnostic_variables(nlev)
! LEVEL2 'registrated ',N,'variables'
return
end subroutine do_register_all_variables
!EOC
!-----------------------------------------------------------------------
!BOP
! !IROUTINE: Coordinate variable registration
!
! !INTERFACE:
subroutine register_coordinate_variables(lat,lon)
!
! !DESCRIPTION:
!
! !USES:
IMPLICIT NONE
!
! !INPUT PARAMETERS:
REALTYPE, intent(in) :: lat,lon
!
! !LOCAL VARIABLES:
type (type_field), pointer :: field
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_coordinate_variables()'
! register - dimension
call fm%register('lon','degrees_east','longitude',dimensions=(/id_dim_lon/),no_default_dimensions=.true.,data0d=lon,coordinate_dimension=id_dim_lon,field=field)
call field%attributes%set('axis', 'X')
call fm%register('lat','degrees_north','latitude',dimensions=(/id_dim_lat/),no_default_dimensions=.true.,data0d=lat,coordinate_dimension=id_dim_lat,field=field)
call field%attributes%set('axis', 'Y')
end subroutine register_coordinate_variables
!EOC
!-----------------------------------------------------------------------
!BOP
! !IROUTINE: airsea variable registration
!
! !INTERFACE:
subroutine register_airsea_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use airsea_variables, only: es,ea,qs,qa,rhoa
use airsea_driver
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_airsea_variables()'
call fm%register('u10', 'm/s', '10m wind (x)', standard_name='', data0d=u10_input%value, category='surface')
call fm%register('v10', 'm/s', '10m wind (y)', standard_name='', data0d=v10_input%value, category='surface')
call fm%register('airt', 'Celsius', '2m air temperature', standard_name='', data0d=airt_input%value, category='surface')
call fm%register('airp', 'Pa', 'air pressure', standard_name='', data0d=airp_input%value, category='surface')
select case (hum_method)
case (1) ! relative humidity in % given
call fm%register('hum', '%', 'relative humidity', standard_name='relative_humidity', data0d=hum_input%value, category='surface')
case (2) ! Specific humidity from wet bulb temperature
call fm%register('hum', 'Celsius', 'wet bulb temperature', standard_name='', data0d=hum_input%value, category='surface')
case (3) ! Specific humidity from dew point temperature
call fm%register('hum', 'Celsius', 'dew point temperature', standard_name='', data0d=hum_input%value, category='surface')
case (4) ! Specific humidity given
call fm%register('hum', 'kg/kg', 'specific humidity', standard_name='specific_humidity', data0d=hum_input%value, category='surface')
end select
call fm%register('es', 'Pa', 'saturation water vapor pressure', standard_name='', data0d=es, category='surface')
call fm%register('ea', 'Pa', 'actual water vapor presure', standard_name='', data0d=ea, category='surface')
call fm%register('qs', 'kg/kg', 'saturation specific humidity', standard_name='', data0d=qs, category='surface')
call fm%register('qa', 'kg/kg', 'specific humidity', standard_name='', data0d=qa, category='surface')
call fm%register('rhoa', 'kg/m3', 'air density', standard_name='', data0d=rhoa, category='surface')
call fm%register('cloud', '', 'cloud cover', standard_name='', data0d=cloud_input%value, category='surface')
call fm%register('albedo', '', 'albedo', standard_name='', data0d=albedo, category='surface')
call fm%register('precip', 'm/s', 'precipitation', standard_name='', data0d=precip_input%value, category='surface')
call fm%register('evap', 'm/s', 'evaporation', standard_name='', data0d=evap, category='surface')
call fm%register('int_precip', 'm', 'integrated precipitation', standard_name='', data0d=int_precip, category='surface')
call fm%register('int_evap','m', 'integrated evaporation', standard_name='', data0d=int_evap, category='surface')
!KB call fm%register('int_fwf','m', 'integrated fresh water fluxes', standard_name='', data0d=int_fwf)
call fm%register('int_swr','J/m2', 'integrated short wave radiation', standard_name='', data0d=int_swr, category='surface')
call fm%register('int_heat','J/m2', 'integrated surface heat fluxes', standard_name='', data0d=int_heat, category='surface')
call fm%register('int_total','J/m2', 'integrated total surface heat exchange', standard_name='', data0d=int_total, category='surface')
call fm%register('I_0', 'W/m2', 'incoming short wave radiation', standard_name='', data0d=I_0%value, category='surface/heat_fluxes')
call fm%register('qh', 'W/m2', 'sensible heat flux', standard_name='', data0d=qh, category='surface/heat_fluxes')
call fm%register('qe', 'W/m2', 'latent heat flux', standard_name='', data0d=qe, category='surface/heat_fluxes')
call fm%register('ql', 'W/m2', 'net longwave radiation', standard_name='', data0d=ql_input%value, category='surface/heat_fluxes')
call fm%register('heat', 'W/m2', 'net surface heat flux', standard_name='', data0d=heat_input%value, category='surface/heat_fluxes')
call fm%register('tx', 'm2/s2', 'wind stress (x)', standard_name='', data0d=tx, category='surface')
call fm%register('ty', 'm2/s2', 'wind stress (y)', standard_name='', data0d=ty, category='surface')
call fm%register('sst', 'Celsius', 'sea surface temperature - in-situ', standard_name='sea_surface_temperature', data0d=sst, category='surface')
call fm%register('sst_obs', 'Celsius', 'observed sea surface temperature', standard_name='sea_surface_temperature', data0d=sst_obs_input%value, category='surface')
call fm%register('sss', '1e-3', 'sea surface salinity', standard_name='sea_surface_salinity', data0d=sss_input%value, category='surface')
end subroutine register_airsea_variables
!EOC
#ifdef _ICE_
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: ice variable registration
!
! !INTERFACE:
subroutine register_stim_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use gotm_stim_driver, only: ice_model
use stim_variables, only: Tice_surface,Tice,Tf
use stim_variables, only: Hice, Hfrazil, dHis, dHib
use stim_variables, only: surface_ice_energy,bottom_ice_energy
use stim_variables, only: ocean_ice_flux
use stim_variables, only: melt_rate
use stim_variables, only: T_melt,S_melt
use stim_variables, only: ocean_ice_heat_flux
use stim_variables, only: ocean_ice_salt_flux
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
if (ice_model > 0) then
LEVEL2 'register_stim_variables()'
call fm%register('Tice_surface', 'celsius', 'ice temperature (surface)', standard_name='', data0d=Tice_surface, category='ice')
if (ice_model .eq. 5) then
call fm%register('T1', 'celsius', 'ice temperature (upper)', standard_name='', data0d=Tice(1), category='ice')
call fm%register('T2', 'celsius', 'ice temperature (lower)', standard_name='', data0d=Tice(2), category='ice')
end if
call fm%register('Tf', 'celsius', 'ice freezing temperature', standard_name='', data0d=Tf, category='ice')
call fm%register('Hice', 'm', 'ice thickness', standard_name='', data0d=Hice, category='ice')
call fm%register('surface_ice_energy', 'J/m2', 'ice energy (surface)', standard_name='', data0d=surface_ice_energy, category='ice')
call fm%register('bottom_ice_energy', 'J/m2', 'ice energy (bottom)', standard_name='', data0d=bottom_ice_energy, category='ice')
call fm%register('Hfrazil', 'm', 'ice thickness (frazil)', standard_name='', data0d=Hfrazil, category='ice')
call fm%register('dHis', 'm', 'ice growth (surface)', standard_name='', data0d=dHis, category='ice', output_level=output_level_debug)
call fm%register('dHib', 'm', 'ice growth (bottom)', standard_name='', data0d=dHib, category='ice', output_level=output_level_debug)
call fm%register('melt_rate', 'm/s', 'ice melt rate', standard_name='', data0d=melt_rate, category='ice', output_level=output_level_debug)
call fm%register('Tmelt', 'C', 'melt layer temperature', standard_name='', data0d=T_melt, category='ice', output_level=output_level_debug)
call fm%register('Smelt', 'PSU', 'melt layer salinity', standard_name='', data0d=S_melt, category='ice', output_level=output_level_debug)
call fm%register('ocean_ice_flux', 'kg/m2', 'ocean-ice water flux', standard_name='', data0d=ocean_ice_flux, category='ice')
call fm%register('ocean_ice_salt_flux', '(g/kg)*(m/s)', 'ocean-ice salt flux', standard_name='', data0d=ocean_ice_salt_flux, category='ice')
! call fm%register('ocean_ice_salt_flux', '(g/kg)*(m/s)', 'ocean-ice salt flux', standard_name='', data0d=ocean_ice_salt_flux, category='ice', output_level=output_level_debug)
call fm%register('ocean_ice_heat_flux', 'W/m2', 'ocean-ice heat flux', standard_name='', data0d=ocean_ice_heat_flux, category='ice')
! call fm%register('ocean_ice_heat_flux', 'W/m2', 'ocean/ice heat flux', standard_name='', data0d=ocean_ice_heat_flux, category='ice', output_level=output_level_debug)
end if
end subroutine register_stim_variables
!EOC
#endif
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: observation variable registration
!
! !INTERFACE:
subroutine register_observation_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use observations
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_observation_variables()'
call fm%register('temp_obs', 'Celsius', 'temperature (observed)', standard_name='sea_water_temperature', dimensions=(/id_dim_z/), data1d=tprof_input%data(1:nlev),category='temperature_and_salinity')
call fm%register('salt_obs', 'psu', 'salinity (observed)', standard_name='sea_water_salinity', dimensions=(/id_dim_z/), data1d=sprof_input%data(1:nlev),category='temperature_and_salinity')
call fm%register('u_obs', 'm/s', 'x-velocity (observed)', dimensions=(/id_dim_z/), data1d=uprof_input%data(1:nlev), category='velocities')
call fm%register('v_obs', 'm/s', 'y-velocity (observed)', dimensions=(/id_dim_z/), data1d=vprof_input%data(1:nlev), category='velocities')
!KB call fm%register('zeta', 'm', 'sea surface elevation', standard_name='sea_surface_elevation', data0d=zeta%value,category='surface')
if (epsprof_input%method /= 0) then
call fm%register('eps_obs', 'm2/s3', 'observed dissipation', dimensions=(/id_dim_z/), data1d=epsprof_input%data(1:nlev), category='turbulence')
end if
return
end subroutine register_observation_variables
!EOC
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: Stokes drift variable registration
!
! !INTERFACE:
subroutine register_stokes_drift_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use stokes_drift
use turbulence, only: turb_method
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_stokes_drift_variables()'
call fm%register('us', 'm/s', 'Stokes drift x-component', dimensions=(/id_dim_z/), data1d=usprof%data(1:nlev),category='stokes_drift')
call fm%register('vs', 'm/s', 'Stokes drift y-component', dimensions=(/id_dim_z/), data1d=vsprof%data(1:nlev),category='stokes_drift')
call fm%register('dusdz', '1/s', 'Stokes drift shear x-component', dimensions=(/id_dim_zi/), data1d=dusdz%data(0:nlev),category='stokes_drift')
call fm%register('dvsdz', '1/s', 'Stokes drift shear y-component', dimensions=(/id_dim_zi/), data1d=dvsdz%data(0:nlev),category='stokes_drift')
call fm%register('us0', 'm/s', 'surface Stokes drift x-component', data0d=us0%value, category='stokes_drift')
call fm%register('vs0', 'm/s', 'surface Stokes drift y-component', data0d=vs0%value, category='stokes_drift')
call fm%register('ds', 'm', 'Stokes drift penetration depth', data0d=ds%value, category='stokes_drift')
#ifdef _CVMIX_
if (turb_method .ne. 100) return
call fm%register('La_Turb', '', 'Turbulent Langmuir number', data0d=La_Turb, category='stokes_drift')
call fm%register('La_SL', '', 'Surface layer averaged Langmuir number', data0d=La_SL, category='stokes_drift')
call fm%register('La_SLP_VR12', '', 'Surface layer averaged and projected Langmuir number (Van Roekel et al., 2012)', data0d=La_SLP_VR12, category='stokes_drift')
call fm%register('La_SLP_RWH16', '', 'Surface layer averaged and projected Langmuir number (Reichl et al., 2016)', data0d=La_SLP_RWH16, category='stokes_drift')
call fm%register('EFactor_LWF16', '', 'Enhancement factor for Langmuir mixing (Li et al., 2016)', data0d=EFactor_LWF16, category='stokes_drift')
call fm%register('EFactor_RWH16', '', 'Enhancement factor for Langmuir mixing (Reichl et al., 2016)', data0d=EFactor_RWH16, category='stokes_drift')
call fm%register('theta_WW', 'rad', 'Angle between wind and waves', data0d=theta_WW, category='stokes_drift')
call fm%register('theta_WL', 'rad', 'Angle between wind and Langmiur cells', data0d=theta_WL, category='stokes_drift')
#endif
return
end subroutine register_stokes_drift_variables
!EOC
#if 0
!-----------------------------------------------------------------------
!BOP
! !IROUTINE: stream variable registration
!
! !INTERFACE:
subroutine register_stream_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use observations, only: Q, Qs, Qt, wq, FQ, Qres
use streams
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
integer :: istream
type (type_stream), pointer :: current_stream
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_stream_variables()'
if (nstreams>0) then
call fm%register('Q', 'm3/s', 'inflows over water column', standard_name='??', dimensions=(/id_dim_z/), data1d=Q(1:nlev), category='streams')
call fm%register('Qs', '1/s', 'salt inflow', standard_name='??', dimensions=(/id_dim_z/), data1d=Qs(1:nlev), category='streams')
call fm%register('Qt', 'Celsius/s', 'temperature inflow', standard_name='??', dimensions=(/id_dim_z/), data1d=Qt(1:nlev), category='streams')
call fm%register('wq', 'm/s', 'vertical water balance advection velocity', standard_name='??', dimensions=(/id_dim_z/), data1d=wq(1:nlev), category='streams')
call fm%register('FQ', 'm3/s', 'vertical water balance flux', standard_name='??', dimensions=(/id_dim_z/), data1d=FQ(1:nlev), category='streams')
call fm%register('Qres', 'm3/s', 'residual water balance inflows', standard_name='??', dimensions=(/id_dim_z/), data1d=Qres(1:nlev), category='streams')
end if
current_stream => first_stream
do while (associated(current_stream))
call fm%register('Q_'//trim(current_stream%name), 'm3/s', 'stream (Q): '//trim(current_stream%name), data0d=current_stream%QI, category='streams')
if (current_stream%has_T) then
call fm%register('T_'//trim(current_stream%name), 'Celsius', 'stream (T): '//trim(current_stream%name), data0d=current_stream%TI, category='streams')
end if
current_stream => current_stream%next
end do
call fm%register('int_inflow', 'm3/s', 'integrated inflow', data0d=int_inflow, category='streams')
call fm%register('int_outflow', 'm3/s', 'integrated outflow', data0d=int_outflow, category='streams')
return
end subroutine register_stream_variables
!EOC
#endif
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: density variable registration
!
! !INTERFACE:
subroutine register_density_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use density, only: density_method, rho, rho_p, alpha, beta
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_density_variables()'
call fm%register('rho_p', 'kg/m3', 'density (potential)', standard_name='??', dimensions=(/id_dim_z/), data1d=rho_p(1:nlev),category='density')
call fm%register('alpha', '1/K', 'thermal expansion coefficient', standard_name='??', dimensions=(/id_dim_zi/), data1d=alpha(0:nlev),category='density',output_level=output_level_debug)
call fm%register('beta', 'kg/g', 'saline contraction coefficient', standard_name='??', dimensions=(/id_dim_zi/), data1d=beta(0:nlev),category='density',output_level=output_level_debug)
if (density_method == 1) then
call fm%register('rho', 'kg/m3', 'density (in-situ)', standard_name='??', dimensions=(/id_dim_z/), data1d=rho(1:nlev),category='density')
end if
end subroutine register_density_variables
!EOC
!-----------------------------------------------------------------------
!BOP
! !IROUTINE: meanflow variable registration
!
! !INTERFACE:
subroutine register_meanflow_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use meanflow
use density, only: density_method
use observations, only: idpdx,idpdy
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
type (type_field), pointer :: field
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_meanflow_variables()'
call fm%register('zeta', 'm', 'sea surface elevation', standard_name='sea_surface_elevation', data0d=zeta,category='surface')
call fm%register('temp', 'Celsius', 'temperature (conservative)', standard_name='sea_water_conservative_temperature', dimensions=(/id_dim_z/), data1d=T(1:nlev),category='temperature_and_salinity', part_of_state=.true.)
call fm%register('salt', 'g/kg', 'salinity (absolute)', standard_name='sea_water_absolute_salinity', dimensions=(/id_dim_z/), data1d=S(1:nlev),category='temperature_and_salinity', part_of_state=.true.)
if (density_method == 1) then
call fm%register('temp_p', 'Celsius', 'temperature (potential)', standard_name='sea_water_potential_temperature', dimensions=(/id_dim_z/), data1d=Tp(1:nlev),category='temperature_and_salinity')
call fm%register('temp_i', 'Celsius', 'temperature (in-situ)', standard_name='sea_water_temperature', dimensions=(/id_dim_z/), data1d=Ti(1:nlev),category='temperature_and_salinity')
call fm%register('salt_p', 'PSU', 'salinity (practical)', standard_name='sea_water_practical_salinity', dimensions=(/id_dim_z/), data1d=Sp(1:nlev),category='temperature_and_salinity')
end if
call fm%register('u', 'm/s', 'x-velocity', standard_name='??', dimensions=(/id_dim_z/), data1d=u(1:nlev), category='velocities', part_of_state=.true.)
call fm%register('uo', 'm/s', 'x-velocity - old time step', standard_name='??', dimensions=(/id_dim_z/), data1d=uo(1:nlev), category='velocities', part_of_state=.true., output_level=output_level_debug)
call fm%register('v', 'm/s', 'y-velocity', standard_name='??', dimensions=(/id_dim_z/), data1d=v(1:nlev), category='velocities', part_of_state=.true.)
call fm%register('vo', 'm/s', 'y-velocity - old time step', standard_name='??', dimensions=(/id_dim_z/), data1d=vo(1:nlev), category='velocities', part_of_state=.true., output_level=output_level_debug)
!KB call fm%register('w', 'm/s', 'z-velocity', standard_name='??', dimensions=(/id_dim_z/), data1d=w(1:nlev), category='velocities,')
call fm%register('idpdx', '-', 'internal pressure gradient (x)', standard_name='??', dimensions=(/id_dim_z/), data1d=idpdx(1:nlev), category='mimic_3d')
call fm%register('idpdy', '-', 'internal pressure gradient (y)', standard_name='??', dimensions=(/id_dim_z/), data1d=idpdy(1:nlev), category='mimic_3d')
call fm%register('fric', '', 'extra friction coefficient in water column', standard_name='??', dimensions=(/id_dim_z/), data1d=fric(1:nlev),category='turbulence/shear')
call fm%register('drag', '', 'drag coefficient in water column', standard_name='??', dimensions=(/id_dim_z/), data1d=drag(1:nlev),category='turbulence/shear')
call fm%register('u_taus', 'm/s', 'surface friction velocity', data0d=u_taus,category='surface')
call fm%register('u_taub', 'm/s', 'bottom friction velocity', data0d=u_taub,category='bottom')
call fm%register('u_taubo', 'm/s', 'bottom friction velocity - old time step', data0d=u_taubo,category='bottom', part_of_state=.true., output_level=output_level_debug)
call fm%register('taub', 'Pa', 'bottom stress', data0d=taub,category='bottom')
call fm%register('NN', '1/s2', 'buoyancy frequency squared', standard_name='??', dimensions=(/id_dim_zi/), data1d=NN(0:nlev),category='turbulence/buoyancy')
call fm%register('NNT', '1/s2', 'contribution of T-gradient to buoyancy frequency squared', standard_name='??', dimensions=(/id_dim_zi/), data1d=NNT(0:nlev),category='turbulence/buoyancy')
call fm%register('NNS', '1/s2', 'contribution of S-gradient to buoyancy frequency squared', standard_name='??', dimensions=(/id_dim_zi/), data1d=NNS(0:nlev),category='turbulence/buoyancy')
call fm%register('SS', '1/s2', 'shear frequency squared', standard_name='??', dimensions=(/id_dim_zi/), data1d=SS(0:nlev),category='turbulence/shear')
call fm%register('SSU', '1/s2', 'x-contribution to shear frequency squared', standard_name='??', dimensions=(/id_dim_zi/), data1d=SSU(0:nlev),category='turbulence/shear', output_level=output_level_debug)
call fm%register('SSV', '1/s2', 'y-contribution to shear frequency squared', standard_name='??', dimensions=(/id_dim_zi/), data1d=SSV(0:nlev),category='turbulence/shear', output_level=output_level_debug)
call fm%register('xP', 'm2/s3', 'extra turbulence production', standard_name='??', dimensions=(/id_dim_z/), data1d=xP(1:nlev),category='turbulence', part_of_state=.true.)
call fm%register('buoy', 'm/s2', 'buoyancy', standard_name='??', dimensions=(/id_dim_z/), data1d=buoy(1:nlev),category='turbulence/buoyancy')
call fm%register('rad', 'W/m2', 'shortwave radiation', standard_name='??', dimensions=(/id_dim_zi/), data1d=rad(0:nlev),category='light')
call fm%register('avh', 'm2/s', 'eddy diffusivity', standard_name='??', dimensions=(/id_dim_z/), data1d=avh(1:nlev),category='turbulence')
call fm%register('bioshade', '-', 'fraction of visible light that is not shaded by overlying biogeochemistry', dimensions=(/id_dim_z/), data1d=bioshade(1:nlev),category='light')
call fm%register('ga', '', 'coordinate scaling', standard_name='??', dimensions=(/id_dim_z/), data1d=ga(1:nlev),category='column_structure')
#if 0
if (lake) then
call fm%register('Af', 'm^2', 'hypsograph at grid interfaces', standard_name='??', dimensions=(/id_dim_z/), data1d=Af(1:nlev), category='column_structure')
end if
#endif
call fm%register('z', 'm', 'depth (center)', standard_name='??', dimensions=(/id_dim_z/), data1d=z(1:nlev), coordinate_dimension=id_dim_z,category='column_structure',field=field)
call field%attributes%set('positive', 'up')
call field%attributes%set('axis', 'Z')
call fm%register('zi', 'm', 'depth (interface)', standard_name='??', dimensions=(/id_dim_zi/), data1d=zi(0:nlev), coordinate_dimension=id_dim_zi,category='column_structure',field=field)
call field%attributes%set('positive', 'up')
call field%attributes%set('axis', 'Z')
call fm%register('h', 'm', 'layer thickness', standard_name='cell_thickness', dimensions=(/id_dim_z/), data1d=h(1:nlev),category='column_structure',part_of_state=.true.)
call fm%register('ho', 'm', 'layer thickness - old time step', standard_name='cell_thickness', dimensions=(/id_dim_z/), data1d=h(1:nlev),category='column_structure', part_of_state=.true., output_level=output_level_debug)
#ifdef EXTRA_OUTPUT
call fm%register('mean1', '??', '1. mean dummy variable', standard_name='??', dimensions=(/id_dim_z/), data1d=mean1(1:nlev),category='meanflow',output_level=output_level_debug)
call fm%register('mean2', '??', '2. mean dummy variable', standard_name='??', dimensions=(/id_dim_z/), data1d=mean2(1:nlev),category='meanflow',output_level=output_level_debug)
call fm%register('mean3', '??', '3. mean dummy variable', standard_name='??', dimensions=(/id_dim_z/), data1d=mean3(1:nlev),category='meanflow',output_level=output_level_debug)
call fm%register('mean4', '??', '4. mean dummy variable', standard_name='??', dimensions=(/id_dim_z/), data1d=mean4(1:nlev),category='meanflow',output_level=output_level_debug)
call fm%register('mean5', '??', '5. mean dummy variable', standard_name='??', dimensions=(/id_dim_z/), data1d=mean5(1:nlev),category='meanflow',output_level=output_level_debug)
#endif
#ifndef _ICE_
call fm%register('Hice', 'm', 'fake ice thickness', standard_name='', data0d=Hice, category='surface')
#endif
return
end subroutine register_meanflow_variables
!EOC
#ifdef _SEAGRASS_
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: seagrass variable registration
!
! !INTERFACE:
subroutine register_seagrass_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use seagrass, only: seagrass_calc, xx, yy
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
REALTYPE, parameter :: miss_val = -999.0
!EOP
!-----------------------------------------------------------------------
!BOC
if (seagrass_calc) then
LEVEL2 'register_seagrass_variables()'
call fm%register('x_excur', 'm', 'seagrass excursion(x)', dimensions=(/id_dim_z/), data1d=xx(1:nlev), fill_value=miss_val, category='seagrass')
call fm%register('y_excur', 'm', 'seagrass excursion(y)', dimensions=(/id_dim_z/), data1d=yy(1:nlev), fill_value=miss_val, category='seagrass')
end if
end subroutine register_seagrass_variables
!EOC
#endif
!-----------------------------------------------------------------------
!BOP
! !IROUTINE: turbulence variable registration
!
! !INTERFACE:
subroutine register_turbulence_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use turbulence
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_turbulence_variables()'
call fm%register('num', 'm2/s', 'turbulent diffusivity of momentum', standard_name='??', dimensions=(/id_dim_zi/), data1d=num(0:nlev),category='turbulence', part_of_state=.true.)
call fm%register('nuh', 'm2/s', 'turbulent diffusivity of heat', standard_name='??', dimensions=(/id_dim_zi/), data1d=nuh(0:nlev),category='turbulence', part_of_state=.true.)
call fm%register('nus', 'm2/s', 'turbulent diffusivity of salt', standard_name='??', dimensions=(/id_dim_zi/), data1d=nus(0:nlev),category='turbulence', part_of_state=.true.)
call fm%register('nucl', 'm2/s', 'turbulent diffusivity of momentum down Stokes gradient', standard_name='??', dimensions=(/id_dim_zi/), data1d=nucl(0:nlev),category='turbulence', part_of_state=.true.)
if ( compute_massflux ) then
call fm%register('a_p', 'm2/s2', 'convective plume fractional area', standard_name='??', dimensions=(/id_dim_zi/), data1d=a_p(0:nlev),category='turbulence')
call fm%register('w_p', 'm/s', 'convective plume vertical velocity', standard_name='??', dimensions=(/id_dim_zi/), data1d=w_p(0:nlev),category='turbulence')
call fm%register('t_p', 'Celsius', 'convective plume temperature', standard_name='??', dimensions=(/id_dim_zi/), data1d=T_p(0:nlev),category='turbulence')
call fm%register('fmass', 'm/s', 'convective mass flux', standard_name='??', dimensions=(/id_dim_zi/), data1d=Fmass(0:nlev),category='turbulence')
call fm%register('EmD', '', 'Plume entrainment minus detrainment', standard_name='??', dimensions=(/id_dim_zi/), data1d=EmD(0:nlev),category='turbulence')
call fm%register('zinv', 'm', 'Penetration depth for convective plumes', standard_name='??', data0d=mf_zinv,category='surface')
if(massflux_on_dynamics) then
call fm%register('u_p', 'm/s', 'convective plume x-velocity', standard_name='??', dimensions=(/id_dim_zi/), data1d=u_p(0:nlev),category='turbulence')
call fm%register('v_p', 'm/s', 'convective plume y-velocity', standard_name='??', dimensions=(/id_dim_zi/), data1d=v_p(0:nlev),category='turbulence')
endif
if(massflux_energy) then
call fm%register('Pmf', 'm2/s3', 'shear production by convective plumes', standard_name='??', dimensions=(/id_dim_zi/), data1d=Pmf(0:nlev),category='turbulence/shear')
call fm%register('Gmf', 'm2/s3', 'buoyancy production by convective plumes', standard_name='??', dimensions=(/id_dim_zi/), data1d=Bmf(0:nlev),category='turbulence/buoyancy')
call fm%register('tke_p', 'm2/s2', 'Subplume turbulent kinetic energy', standard_name='??', dimensions=(/id_dim_zi/), data1d=tke_p(0:nlev),category='turbulence')
endif
else
call fm%register('gamu', 'm2/s2', 'non-local flux of u-momentum', standard_name='??', dimensions=(/id_dim_zi/), data1d=gamu(0:nlev),category='turbulence')
call fm%register('gamv', 'm2/s2', 'non-local flux of v-momentum', standard_name='??', dimensions=(/id_dim_zi/), data1d=gamv(0:nlev),category='turbulence')
call fm%register('gamh', 'K m/s', 'non-local heat flux', standard_name='??', dimensions=(/id_dim_zi/), data1d=gamh(0:nlev),category='turbulence')
call fm%register('gams', 'g/kg m/s', 'non-local salinity flux', standard_name='??', dimensions=(/id_dim_zi/), data1d=gams(0:nlev),category='turbulence')
endif
call fm%register('Rig', '', 'gradient Richardson number', standard_name='??', dimensions=(/id_dim_zi/), data1d=Rig(0:nlev),category='turbulence')
#ifdef _CVMIX_
if (turb_method .eq. 100) return
#endif
call fm%register('tke', 'm2/s2', 'turbulent kinetic energy', standard_name='??', dimensions=(/id_dim_zi/), data1d=tke(0:nlev),category='turbulence', part_of_state=.true.)
call fm%register('tkeo', 'm2/s2', 'turbulent kinetic energy - old time step', standard_name='??', dimensions=(/id_dim_zi/), data1d=tkeo(0:nlev),category='turbulence', part_of_state=.true., output_level=output_level_debug)
call fm%register('eps', 'm2/s3', 'energy dissipation rate', standard_name='??', dimensions=(/id_dim_zi/), data1d=eps(0:nlev),category='turbulence', part_of_state=.true.)
call fm%register('L', 'm', 'turbulence length scale', standard_name='??', dimensions=(/id_dim_zi/), data1d=L(0:nlev),category='turbulence')
call fm%register('kb', 'm2/s4', '(half) buoyancy variance', standard_name='??', dimensions=(/id_dim_zi/), data1d=kb(0:nlev),category='turbulence/buoyancy')
call fm%register('epsb', 'm2/s5', 'destruction of buoyancy variance', standard_name='??', dimensions=(/id_dim_zi/), data1d=epsb(0:nlev),category='turbulence/buoyancy')
call fm%register('P', 'm2/s3', 'shear production', standard_name='??', dimensions=(/id_dim_zi/), data1d=P(0:nlev),category='turbulence/shear')
call fm%register('G', 'm2/s3', 'buoyancy production', standard_name='??', dimensions=(/id_dim_zi/), data1d=B(0:nlev),category='turbulence/buoyancy')
call fm%register('Pb', 'm2/s5', 'production of buoyancy variance', standard_name='??', dimensions=(/id_dim_zi/), data1d=Pb(0:nlev),category='turbulence/buoyancy')
call fm%register('PSTK', 'm2/s3', 'Stokes production', standard_name='??', dimensions=(/id_dim_zi/), data1d=PSTK(0:nlev),category='turbulence')
call fm%register('gamb', 'm2/s3', 'non-local buoyancy flux', standard_name='??', dimensions=(/id_dim_zi/), data1d=gamb(0:nlev),category='turbulence')
call fm%register('cmue1', '', 'stability function for momentum diffusivity', standard_name='??', dimensions=(/id_dim_zi/), data1d=cmue1(0:nlev),category='turbulence')
call fm%register('cmue2', '', 'stability function for scalar diffusivity', standard_name='??', dimensions=(/id_dim_zi/), data1d=cmue2(0:nlev),category='turbulence')
call fm%register('gam', '', 'non-dimensional non-local buoyancy flux', standard_name='??', dimensions=(/id_dim_zi/), data1d=gam(0:nlev),category='turbulence')
call fm%register('an', '', 'non-dimensional buoyancy time scale', standard_name='??', dimensions=(/id_dim_zi/), data1d=an(0:nlev),category='turbulence')
call fm%register('as', '', 'non-dimensional shear time scale', standard_name='??', dimensions=(/id_dim_zi/), data1d=as(0:nlev),category='turbulence')
call fm%register('at', '', 'non-dimensional buoyancy variance', standard_name='??', dimensions=(/id_dim_zi/), data1d=at(0:nlev),category='turbulence')
call fm%register('r', '', 'turbulent time scale ratio', standard_name='??', dimensions=(/id_dim_zi/), data1d=r(0:nlev),category='turbulence')
! call fm%register('xRf', '', 'flux Richardson number', standard_name='??', dimensions=(/id_dim_zi/), data1d=xRf(0:nlev),category='turbulence')
call fm%register('uu', 'm2/s2', 'variance of u-fluctuations', standard_name='??', dimensions=(/id_dim_zi/), data1d=uu(0:nlev),category='turbulence/shear')
call fm%register('vv', 'm2/s2', 'variance of v-fluctuations', standard_name='??', dimensions=(/id_dim_zi/), data1d=vv(0:nlev),category='turbulence/shear')
call fm%register('ww', 'm2/s2', 'variance of w-fluctuations', standard_name='??', dimensions=(/id_dim_zi/), data1d=ww(0:nlev),category='turbulence/shear')
#ifdef EXTRA_OUTPUT
call fm%register('turb1', '', '1. turbulence dummy variable', dimensions=(/id_dim_zi/), data1d=turb1(0:nlev),category='turbulence',output_level=output_level_debug)
call fm%register('turb2', '', '2. turbulence dummy variable', dimensions=(/id_dim_zi/), data1d=turb2(0:nlev),category='turbulence',output_level=output_level_debug)
call fm%register('turb3', '', '3. turbulence dummy variable', dimensions=(/id_dim_zi/), data1d=turb3(0:nlev),category='turbulence',output_level=output_level_debug)
call fm%register('turb4', '', '4. turbulence dummy variable', dimensions=(/id_dim_zi/), data1d=turb4(0:nlev),category='turbulence',output_level=output_level_debug)
call fm%register('turb5', '', '5. turbulence dummy variable', dimensions=(/id_dim_zi/), data1d=turb5(0:nlev),category='turbulence',output_level=output_level_debug)
#endif
return
end subroutine register_turbulence_variables
!EOC
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: diagnostic variable registration
!
! !INTERFACE:
subroutine register_diagnostic_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
use diagnostics
use turbulence, only: turb_method
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_diagnostic_variables()'
! LEVEL3 'remeber to add the variables declared and calculated in diagnostics'
#if 0
call fm%register('mld_surf','m', 'surface mixed layer depth',fill_value=_ZERO_, data0d=mld_surf,category='surface')
call fm%register('mld_bott','m', 'bottom mixed layer depth',fill_value=_ZERO_, data0d=mld_bott,category='bottom')
#else
call fm%register('mld_surf','m', 'surface mixed layer depth', data0d=mld_surf,category='surface')
call fm%register('mld_bott','m', 'bottom mixed layer depth', data0d=mld_bott,category='bottom')
#endif
call fm%register('taux', 'm2/s2', 'turbulent flux of momentum (x)', dimensions=(/id_dim_zi/), data1d=taux(0:nlev), category='turbulence')
call fm%register('tauy', 'm2/s2', 'turbulent flux of momentum (y)', dimensions=(/id_dim_zi/), data1d=tauy(0:nlev), category='turbulence')
call fm%register('Ekin', 'J', 'kinetic energy', data0d=ekin,category='column_integrals')
call fm%register('Epot', 'J', 'potential energy', data0d=epot,category='column_integrals')
if (turb_method/=100) then
call fm%register('Eturb', 'J', 'turbulent kinetic energy', data0d=eturb,category='column_integrals')
endif
return
end subroutine register_diagnostic_variables
!EOC
!-----------------------------------------------------------------------
end module register_all_variables
!-----------------------------------------------------------------------
! Copyright by the GOTM-team under the GNU Public License - www.gnu.org
!-----------------------------------------------------------------------
#if 0
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: AAA variable registration
!
! !INTERFACE:
subroutine register_AAA_variables(nlev)
!
! !DESCRIPTION:
!
! !USES:
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: nlev
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_AAA_variables()'
return
end subroutine register_AAA_variables
!EOC
#endif