Ignore:
Timestamp:
Dec 19, 2008, 10:38:08 AM (16 years ago)
Author:
rwilson
Message:

Changes to handle large files when Scientific.IO.NetCDF provides the feature.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/config.py

    r5961 r6086  
    22"""
    33
    4 #--------------------
     4################################################################################
    55# Numerical constants
    6 #--------------------
    7 epsilon = 1.0e-12 # Smallest number - used for safe division
    8 max_float = 1.0e36 # Largest number - used to initialise (max, min) ranges
    9 default_smoothing_parameter = 0.001 # Default alpha for penalised
    10                                     # least squares fitting
    11                                    
    12 single_precision = 1.0e-6           # Smallest single precision number
     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
    1314velocity_protection = 1.0e-6                                     
    1415
    15 #-------------------------------------------
    16 # Standard filenames, directories and system
    17 # parameters used by ANUGA
    18 #-------------------------------------------
     16################################################################################
     17# Standard filenames, directories and system parameters used by ANUGA
     18################################################################################
     19
    1920pmesh_filename = '.\\pmesh'
    2021version_filename = 'stored_version_info.py'
     
    2829major_revision = '1.0beta'
    2930
    30 
    31 #-------------------
     31################################################################################
    3232# Physical constants
    33 #-------------------
     33################################################################################
     34
    3435manning = 0.03  # Manning's friction coefficient
    3536#g = 9.80665    # Gravity - FIXME reinstate this and fix unit tests.
     
    3839#The 'official' average is 9.80665
    3940
    40 eta_w = 3.0e-3 #Wind stress coefficient
    41 rho_a = 1.2e-3 #Atmospheric density
    42 rho_w = 1023   #Fluid density [kg/m^3] (rho_w = 1023 for salt water)
    43 
    44 
    45 #-----------------------------------------------------
     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################################################################################
    4646# Limiters - used with linear reconstruction of vertex
    4747# values from centroid values
    48 #-----------------------------------------------------
     48################################################################################
    4949
    5050# Betas [0;1] control the allowed steepness of gradient for second order
     
    6363beta_vh_dry = 0.2
    6464
    65 
    6665# Alpha_balance controls how limiters are balanced between deep and shallow.
    67 # A large value will favour the deep water limiters, allowing the a closer hug to the coastline.
    68 # This will minimise 'creep' but at the same time cause smaller time steps
     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
    6969# Range:
    70 
    7170alpha_balance = 2.0
    7271
     
    8584# This option is good with tight_slope_limiters, especially for large domains.
    8685use_centroid_velocities = True
    87 
    8886       
    8987# FIXME (Ole) Maybe get rid of order altogether and use beta_w
     
    9189default_order = 1
    9290
    93 
    94 #-------------
     91################################################################################
    9592# Timestepping
    96 #-------------
     93################################################################################
    9794
    9895CFL = 1.0  # CFL condition assigned to domain.CFL - controls timestep size
    9996     
    10097# Choose type of timestepping,
     98#timestepping_method = 'rk2'   # 2nd Order TVD scheme
    10199timestepping_method = 'euler' # 1st order euler
    102 #timestepping_method = 'rk2'   # 2nd Order TVD scheme
    103100
    104101# rk2 is a little more stable than euler, so rk2 timestepping
     
    109106beta_rk2   = 1.6
    110107
    111 
    112 
    113108# Option to search for signatures where isolated triangles are
    114109# responsible for a small global timestep.
     
    116111# overall computation.
    117112# This facility is experimental.
    118 
    119113# protect_against_isolated_degenerate_timesteps = False
    120114protect_against_isolated_degenerate_timesteps = False
    121115
    122 
    123116min_timestep = 1.0e-6 # Minimal timestep accepted in ANUGA
    124117max_timestep = 1.0e+3
    125 max_smallsteps = 50  # Max number of degenerate steps allowed b4 trying first order
    126 
    127 #Perhaps minimal timestep could be based on the geometry as follows:
    128 #Define maximal possible speed in open water v_max, e.g. 500m/s (soundspeed?)
    129 #Then work out minimal internal distance in mesh r_min and set
    130 #min_timestep = r_min/v_max
    131 #
    132 #Max speeds are calculated in the flux function as
    133 #
    134 #lambda = v +/- sqrt(gh)
     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)
    135129#
    136130# so with 500 m/s, h ~ 500^2/g = 2500 m well out of the domain of the
    137131# shallow water wave equation
    138132#
    139 #The actual soundspeed can be as high as 1530m/s
    140 #(see http://staff.washington.edu/aganse/public.projects/clustering/clustering.html),
    141 #but that would only happen with h>225000m in this equation. Why ?
    142 #The maximal speed we specify is really related to the max speed
    143 #of surface pertubation
    144 #
    145 #v_max = 100 #For use in domain_ext.c
    146 #sound_speed = 500
    147 
    148 
    149 #---------------------------------------------------
     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################################################################################
    150143# Ranges specific to the shallow water wave equation
    151 # These control maximal and minimal values of
    152 # quantities
    153 #---------------------------------------------------
     144# These control maximal and minimal values of quantities
     145################################################################################
    154146
    155147# Water depth below which it is considered to be 0 in the model
     
    163155maximum_allowed_speed = 0.0 # Maximal particle speed of water
    164156#maximum_allowed_speed = 1.0 # Maximal particle speed of water
    165                             # Too large (100) creates 'flopping' water
    166                             # Too small (0) creates 'creep'
     157                             # Too large (100) creates 'flopping' water
     158                             # Too small (0) creates 'creep'
    167159                           
    168160maximum_froude_number = 100.0 # To be used in limiters.
    169161
    170 
    171 #------------------------------------------------------------
     162################################################################################
    172163# Performance parameters used to invoke various optimisations
    173 #------------------------------------------------------------
     164################################################################################
    174165
    175166use_extensions = True # Use C-extensions
    176 use_psyco = True # Use psyco optimisations
     167use_psyco = True      # Use psyco optimisations
    177168
    178169optimise_dry_cells = True # Exclude dry and still cells from flux computation
    179170optimised_gradient_limiter = True # Use hardwired gradient limiter
    180 use_edge_limiter = False # The edge limiter is better, but most runs have been using vertex limiting. Validations passed with this one True 9th May 2008, but many unit tests need backward compatibility flag set FIXME(Ole).
     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).
    181175
    182176points_file_block_line_size = 500 # Number of lines read in from a points file
    183177                                  # when blocking
    184178
    185 
    186 
    187 
    188 
    189 
    190    
     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
     189try:
     190    import tempfile
     191    from Scientific.IO.NetCDF import NetCDFFile
     192
     193    fname = tempfile.mktemp()
     194    fid = NetCDFFile(fname, netcdf_mode_w)
     195    fid.close()
     196    netcdf_mode_w = 'wl'
     197#    log('Using NetCDF large file mode')
     198except IOError:
     199    pass
     200
Note: See TracChangeset for help on using the changeset viewer.