My Project
cntrl_prmtrs.f90
Go to the documentation of this file.
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 !/===========================================================================/
13 ! Copyright (c) 2007, The University of Massachusetts Dartmouth
14 ! Produced at the School of Marine Science & Technology
15 ! Marine Ecosystem Dynamics Modeling group
16 ! All rights reserved.
17 !
18 ! FVCOM has been developed by the joint UMASSD-WHOI research team. For
19 ! details of authorship and attribution of credit please see the FVCOM
20 ! technical manual or contact the MEDM group.
21 !
22 !
23 ! This file is part of FVCOM. For details, see http://fvcom.smast.umassd.edu
24 ! The full copyright notice is contained in the file COPYRIGHT located in the
25 ! root directory of the FVCOM code. This original header must be maintained
26 ! in all distributed versions.
27 !
28 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 ! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30 ! THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 ! PURPOSE ARE DISCLAIMED.
32 !
33 !/---------------------------------------------------------------------------/
34 ! CVS VERSION INFORMATION
35 ! $Id$
36 ! $Name$
37 ! $Revision$
38 !/===========================================================================/
39 
40 SUBROUTINE cntrl_prmtrs
41  USE lims
42  USE control
43  USE mod_utils
44  USE mod_assim
45  USE mod_time
46  USE mod_ncdio
47  USE mod_nesting
48  IMPLICIT NONE
49  LOGICAL TEST
50  integer :: stat,ierr
51 
52 
53  ! SIMPLE SETTINGS FROM RUN FILE ETC SHOULD GO HERE!
54 
56  IF (use_proj) THEN
57  if(dbg_set(dbg_log)) write(ipt,*) "! PROJ 4 CARTOGRAPHIC PROJECTION ENABLED!"
58  ELSE
59  if(dbg_set(dbg_log)) write(ipt,*) "! PROJ 4 CARTOGRAPHIC PROJECTION DISABLED!"
60  END IF
61 
62 
63 
64  If(ice_model) CALL fatal_error &
65  & ('You must compile with ICE to use it!',&
66  & 'Recompile after selecting it in the make file,',&
67  & 'or turn it off in the run file')
68 
69 
70 
71 ! write(ipt,*) "PRG_NAME='"//trim(prg_name)//"'"
72 
73 
74  IF(trim(prg_name) == "FVCOM") THEN
75 
76  ! TRANSLATE TO OLD FVCOM PARAMTER NAMES
77 
78  ! SET THE FVCOM NAMES FOR MIXING TERMS
80  if (umol .LT. 0) CALL fatal_error&
81  &("Name List Error: VERTICAL_MIXING_COEFFICIENT outside valid range")
83  if (vprnu .LT. 0) CALL fatal_error&
84  &("Name List Error: VERTICAL_PRANDTL_NUMBER outside valid range")
85 
86  if (horizontal_mixing_kind .eq. sttc) THEN
87  if (horizontal_mixing_coefficient .NE. -1.0_sp)THEN
88  CALL warning("The name list variable: HORIZONTAL_MIXING_COEFFICIENT",&
89  "should have the default value when the horizontal mixing is set using 'static'",&
90  "(ie set from an input file!)")
91 
93  end if
94 
95  else if(horizontal_mixing_kind .eq. cnstnt) THEN
96 
97  if (horizontal_mixing_coefficient .LT. 0.0_sp) CALL fatal_error&
98  &("The name list variable: HORIZONTAL_MIXING_COEFFICIENT",&
99  & "Can not have the default value -1.0 when the horizontal mixing is set using 'constant'",&
100  & "(ie set the viscosity in the model!)")
101  else
102  CALL fatal_error&
103  &("The name list variable: HORIZONTAL_MIXING_KIND",&
104  & "Is set to an invalid option: (choices: constant, static)")
105  end if
106 
108  if (hprnu .LT. 0) CALL fatal_error&
109  &("Name List Error: HORIZONTAL_PRANDTL_NUMBER outside valid range")
110 
111 
113  if (cbcmin .LT. 0) CALL fatal_error&
114  &("Name List Error: BOTTOM_ROUGHNESS_MINIMUM outside valid range")
115 
116 
117  IF (bottom_roughness_kind .eq. sttc) THEN
118  if (bottom_roughness_lengthscale .NE. -1.0_sp)THEN
119  CALL warning("The name list variable: BOTTOM_ROUGHNESS_LENGTHSCALE",&
120  "should have the default value when the bottom roughness is set using 'static'",&
121  "(ie set from an input file!)")
122 
124  end if
125 
126  else if(bottom_roughness_kind .eq. cnstnt) THEN
127 
128  if (bottom_roughness_lengthscale .LE. 0.0_sp) CALL fatal_error&
129  &("The name list variable: BOTTOM_ROUGHNESS_LENGTHSCALE",&
130  & "Can not have the default value -1.0 when the bottom roughness is set using 'constant'")
131  else
132  CALL fatal_error&
133  &("The name list variable: BOTTOM_ROUGHNESS_KIND",&
134  & "Is set to an invalid option: (choices: constant, static)")
135  end if
136 
137 
138 
139  ! FIX SCALAR_POSITIVITY_CONTROL and HEATING_TYPE SETTINGS
140  IF (heating_on) THEN
141 
142  ! SET THE FVCOM NAMES FOR SURFACE HEATING
144  if (rheat .LT. 0) CALL fatal_error&
145  &("Name List Error: HEATING_LONGWAVE_PERCTAGE outside valid range")
146 
148  if (zeta1 .LT. 0) CALL fatal_error&
149  &("Name List Error: HEATING_LONGWAVE_LENGTHSCALE outside valid range")
150 
152  if (zeta2 .LT. 0) CALL fatal_error&
153  &("Name List Error: HEATING_SHORTWAVE_LENGTHSCALE outside valid range")
154 
155 
156  IF(scalar_positivity_control .AND. (heating_type == 'body')) THEN
157  CALL fatal_error &
158  &("YOU CAN NOT USE SCALAR POSITIVITY CONTROL WITH BODY HEATING")
159  END IF
160  ELSE
161  heating_type = 'none'
162  rheat=0.0_sp
163  zeta1=0.0_sp
164  zeta2=0.0_sp
165  END IF
166 
167 
168  IF( .not. obc_on .or. .not. obc_elevation_forcing_on) THEN
169  IF (obc_longshore_flow_on) THEN
170  CALL fatal_error &
171  &("YOU CAN NOT USE THE LONGSHORE FLOW BOUNDRY ADJUSTMENT &
172  &WITHOUT OPEN BOUNDARY ELEVATION FORCING!")
173  END IF
174  END IF
175 
176  ! SET DEFAULT RUN MODE - DATA ASSIMILATION IS OFF
178  !==============================================================================!
179  ! READ DATA ASSIMILATION NAMELIST AND SET PARAMETERS !
180  !==============================================================================!
181  IF (data_assimilation) THEN
182  if(dbg_set(dbg_log)) WRITE(ipt,*) "! STARTING DATA ASSIMILATION MODE "
183  ELSE
184  if(dbg_set(dbg_log)) WRITE(ipt,*) "! DATA ASSIMILATION MODE IS OFF "
185  END IF
186 
187  END IF
188 
189 
190  ! SET DEFAULT TO TRUE FOR REAL TIME MODEL
191  use_real_world_time = .true.
192  ! TEST FOR IDEALIZED MODEL CASE
193  if (timezone == 'none' .or. timezone == "NONE" .or.&
194  & timezone == "None") use_real_world_time = .false.
195 
196 
197  ! CHECK FOR VALID TIME ZONE
199  IF(.not. test) call fatal_error("You selected an invalid time zone: "&
200  &//trim(timezone),"Time Zones must be CAPITALS",&
201  & "see mod_time.F for a list of valid time_zones")
202 
203  call register_func(dump_nc_dat,nc_code,stat)
204  IF (stat/=0) CALL fatal_error("REGISTER_FUNC: FAILED TO REGISTER:: DUMP_NC_DAT")
205 
206  call register_func(dump_nc_rst,restart_code,stat)
207  IF (stat/=0) CALL fatal_error("REGISTER_FUNC: FAILED TO REGISTER:: DUMP_NC_RST")
208 
209  call register_func(dump_nc_avg,ncav_code,stat)
210  IF (stat/=0) CALL fatal_error("REGISTER_FUNC: FAILED TO REGISTER:: DUMP_NC_AVG")
211 
212  call register_func(init_ncdio,init_code,stat)
213  IF (stat/=0) CALL fatal_error("REGISTER_FUNC: FAILED TO REGISTER:: INIT_NCDIO")
214 
215 
216 
217  !//////////////////////////////////////////////////////////////////
218  !//////////////////////////////////////////////////////////////////
219  !==============================================================================!
220  ! LOAD THE VISIT LIBRARIES AND DUMP SIM FILE !
221  !==============================================================================!
222  Call init_visit
223 
224 
225  !//////////////////////////////////////////////////////////////////
226  !//////////////////////////////////////////////////////////////////
227 
228 
229 END SUBROUTINE cntrl_prmtrs
230 
231 
232 
logical scalar_positivity_control
Definition: mod_main.f90:380
logical use_proj
Definition: mod_main.f90:633
character(len=80), parameter sttc
Definition: mod_main.f90:489
real(sp) vertical_mixing_coefficient
Definition: mod_main.f90:362
logical msr
Definition: mod_main.f90:101
real(sp) umol
Definition: mod_main.f90:365
logical function dbg_set(vrb)
Definition: mod_utils.f90:182
subroutine dump_nc_rst
Definition: mod_ncdio.f90:365
logical obc_on
Definition: mod_main.f90:585
real(sp) horizontal_prandtl_number
Definition: mod_main.f90:355
real(sp) heating_longwave_lengthscale
Definition: mod_main.f90:455
real(sp) bottom_roughness_minimum
Definition: mod_main.f90:371
real(sp) zeta1
Definition: mod_main.f90:462
real(sp) heating_shortwave_lengthscale
Definition: mod_main.f90:456
real(sp) hprnu
Definition: mod_main.f90:359
character(len=200) projection_reference
Definition: mod_main.f90:627
integer ncav_code
Definition: mod_utils.f90:54
character(len=80) horizontal_mixing_kind
Definition: mod_main.f90:353
logical obc_elevation_forcing_on
Definition: mod_main.f90:587
real(sp) vertical_prandtl_number
Definition: mod_main.f90:363
subroutine init_visit
Definition: visitsim.f90:43
real(sp) vprnu
Definition: mod_main.f90:366
subroutine dump_nc_dat
Definition: mod_ncdio.f90:320
character(len=80) heating_type
Definition: mod_main.f90:451
real(sp) rheat
Definition: mod_main.f90:461
integer nc_code
Definition: mod_utils.f90:53
logical obc_longshore_flow_on
Definition: mod_main.f90:598
character(len=80) timezone
Definition: mod_main.f90:126
subroutine warning(ER1, ER2, ER3, ER4)
Definition: mod_utils.f90:251
logical ice_model
Definition: mod_main.f90:725
logical use_real_world_time
Definition: mod_main.f90:131
subroutine init_ncdio
Definition: mod_ncdio.f90:264
character(len=80), parameter cnstnt
Definition: mod_main.f90:488
subroutine dump_nc_avg
Definition: mod_ncdio.f90:344
subroutine fatal_error(ER1, ER2, ER3, ER4)
Definition: mod_utils.f90:230
real(sp) horizontal_mixing_coefficient
Definition: mod_main.f90:354
real(sp) zeta2
Definition: mod_main.f90:463
logical function have_proj(proj_ref)
Definition: mod_utils.f90:376
logical data_assimilation
Definition: mod_main.f90:704
integer restart_code
Definition: mod_utils.f90:52
logical function is_valid_timezone(timezone)
Definition: mod_time.f90:628
integer init_code
Definition: mod_utils.f90:55
real(sp) heating_longwave_perctage
Definition: mod_main.f90:454
character(len=80) fvcom_run_mode
Definition: mod_main.f90:748
logical heating_on
Definition: mod_main.f90:450
integer ipt
Definition: mod_main.f90:922
character(len=80), parameter fvcom_pure_sim
Definition: mod_main.f90:749
character(len=80) prg_name
Definition: mod_main.f90:105
real(sp) cbcmin
Definition: mod_main.f90:374
real(sp) bottom_roughness_lengthscale
Definition: mod_main.f90:372
character(len=80) bottom_roughness_kind
Definition: mod_main.f90:368
integer, parameter dbg_log
Definition: mod_utils.f90:65
subroutine cntrl_prmtrs