source: anuga_core/source/anuga/config.py @ 6087

Last change on this file since 6087 was 6087, checked in by rwilson, 15 years ago

Due to problems with Scientific.IO.NetCDF, must withdraw large file support checking code.

File size: 7.9 KB
Line 
1"""Module where global ANUGA model parameters and default values are set
2"""
3
4################################################################################
5# Numerical constants
6################################################################################
7
8epsilon = 1.0e-12                    # Smallest number - used for safe division
9max_float = 1.0e36                   # Largest number - used to initialise
10                                     # (max, min) ranges
11default_smoothing_parameter = 0.001  # Default alpha for penalised
12                                     # least squares fitting
13single_precision = 1.0e-6            # Smallest single precision number
14velocity_protection = 1.0e-6                                     
15
16################################################################################
17# Standard filenames, directories and system parameters used by ANUGA
18################################################################################
19
20pmesh_filename = '.\\pmesh'
21version_filename = 'stored_version_info.py'
22default_datadir = '.'
23time_format = '%d/%m/%y %H:%M:%S'
24umask = 002  # Controls file and directory permission created by anuga
25default_boundary_tag = 'exterior' 
26
27# Major revision number for use with create_distribution
28# and update_anuga_user_guide
29major_revision = '1.0beta'
30
31################################################################################
32# Physical constants
33################################################################################
34
35manning = 0.03  # Manning's friction coefficient
36#g = 9.80665    # Gravity - FIXME reinstate this and fix unit tests.
37g = 9.8
38#g(phi) = 9780313 * (1 + 0.0053024 sin(phi)**2 - 0.000 0059 sin(2*phi)**2) micro m/s**2, where phi is the latitude
39#The 'official' average is 9.80665
40
41eta_w = 3.0e-3 # Wind stress coefficient
42rho_a = 1.2e-3 # Atmospheric density
43rho_w = 1023   # Fluid density [kg/m^3] (rho_w = 1023 for salt water)
44
45################################################################################
46# Limiters - used with linear reconstruction of vertex
47# values from centroid values
48################################################################################
49
50# Betas [0;1] control the allowed steepness of gradient for second order
51# extrapolations. Values of 1 allow the steepes gradients while
52# lower values are more conservative. Values of 0 correspond to
53# 1'st order extrapolations.
54#
55
56# There are separate betas for the w, uh, and vh limiters
57# I think these are better SR but they conflict with the unit tests!
58beta_w      = 1.0
59beta_w_dry  = 0.2
60beta_uh     = 1.0
61beta_uh_dry = 0.2
62beta_vh     = 1.0
63beta_vh_dry = 0.2
64
65# Alpha_balance controls how limiters are balanced between deep and shallow.
66# A large value will favour the deep water limiters, allowing the a closer hug
67# to the coastline.  This will minimise 'creep' but at the same time cause
68# smaller time steps
69# Range:
70alpha_balance = 2.0 
71
72# Flag use of new limiters.
73# tight_slope_limiters = 0 means use old limiters (e.g. for some tests)
74# tight_slope_limiters = 1 means use new limiters that hug the bathymetry closer
75tight_slope_limiters = True
76
77# Use centroid velocities to reconstruct momentum at vertices in
78# very shallow water
79# This option has a first order flavour to it, but we still have second order
80# reconstruction of stage and this option only applies in
81# balance_deep_and_shallow when
82# alpha < 1 so in deeper water the full second order scheme is used.
83#
84# This option is good with tight_slope_limiters, especially for large domains.
85use_centroid_velocities = True
86       
87# FIXME (Ole) Maybe get rid of order altogether and use beta_w
88# ... and isn't it about time we make the default 2?
89default_order = 1
90
91################################################################################
92# Timestepping
93################################################################################
94
95CFL = 1.0  # CFL condition assigned to domain.CFL - controls timestep size
96     
97# Choose type of timestepping,
98#timestepping_method = 'rk2'   # 2nd Order TVD scheme
99timestepping_method = 'euler' # 1st order euler
100
101# rk2 is a little more stable than euler, so rk2 timestepping
102# can deal with a larger beta when slope limiting the reconstructed
103# solution. The large beta is needed if solving problems sensitive
104# to numerical diffusion, like a small forced wave in an ocean
105beta_euler = 1.0
106beta_rk2   = 1.6
107
108# Option to search for signatures where isolated triangles are
109# responsible for a small global timestep.
110# Treating these by limiting their momenta may help speed up the
111# overall computation.
112# This facility is experimental.
113# protect_against_isolated_degenerate_timesteps = False
114protect_against_isolated_degenerate_timesteps = False
115
116min_timestep = 1.0e-6 # Minimal timestep accepted in ANUGA
117max_timestep = 1.0e+3
118max_smallsteps = 50   # Max number of degenerate steps allowed b4
119                      # trying first order
120
121# Perhaps minimal timestep could be based on the geometry as follows:
122# Define maximal possible speed in open water v_max, e.g. 500m/s (soundspeed?)
123# Then work out minimal internal distance in mesh r_min and set
124# min_timestep = r_min/v_max
125#
126# Max speeds are calculated in the flux function as
127#
128# lambda = v +/- sqrt(gh)
129#
130# so with 500 m/s, h ~ 500^2/g = 2500 m well out of the domain of the
131# shallow water wave equation
132#
133# The actual soundspeed can be as high as 1530m/s
134# (see http://staff.washington.edu/aganse/public.projects/clustering/clustering.html),
135# but that would only happen with h>225000m in this equation. Why ?
136# The maximal speed we specify is really related to the max speed
137# of surface pertubation
138#
139# v_max = 100 #For use in domain_ext.c
140# sound_speed = 500
141
142################################################################################
143# Ranges specific to the shallow water wave equation
144# These control maximal and minimal values of quantities
145################################################################################
146
147# Water depth below which it is considered to be 0 in the model
148minimum_allowed_height = 1.0e-3 
149
150# Water depth below which it is *stored* as 0
151minimum_storable_height = 1.0e-5
152
153# FIXME (Ole): Redefine this parameter to control maximal speeds in general
154# and associate it with protect_against_isolated_degenerate_timesteps = True
155maximum_allowed_speed = 0.0 # Maximal particle speed of water
156#maximum_allowed_speed = 1.0 # Maximal particle speed of water
157                             # Too large (100) creates 'flopping' water
158                             # Too small (0) creates 'creep'
159                           
160maximum_froude_number = 100.0 # To be used in limiters.
161
162################################################################################
163# Performance parameters used to invoke various optimisations
164################################################################################
165
166use_extensions = True # Use C-extensions
167use_psyco = True      # Use psyco optimisations
168
169optimise_dry_cells = True # Exclude dry and still cells from flux computation
170optimised_gradient_limiter = True # Use hardwired gradient limiter
171use_edge_limiter = False  # The edge limiter is better, but most runs have been
172                          # using vertex limiting. Validations passed with this
173                          # one True 9th May 2008, but many unit tests need
174                          # backward compatibility flag set FIXME(Ole).
175
176points_file_block_line_size = 500 # Number of lines read in from a points file
177                                  # when blocking
178
179################################################################################
180# Dynamically-defined constants.
181################################################################################
182
183# Determine if we can read/write large NetCDF files
184
185netcdf_mode_w = 'w'
186netcdf_mode_a = 'a'
187netcdf_mode_r = 'r'
188
189#try:
190#    import tempfile
191#    from Scientific.IO.NetCDF import NetCDFFile
192#
193#    fname = tempfile.mktemp()
194#    fid = NetCDFFile(fname, 'wl')
195#    fid.close()
196#    netcdf_mode_w = 'wl'
197##    log('Using NetCDF large file mode')
198#except IOError:
199#    pass
200
Note: See TracBrowser for help on using the repository browser.