Changeset 9308


Ignore:
Timestamp:
Aug 31, 2014, 9:05:25 PM (11 years ago)
Author:
steve
Message:

cleaing up validation tests

Location:
trunk/anuga_core/validation_tests
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/validation_tests/analytical_exact/dam_break_dry/numerical_dam_break_dry.py

    r9241 r9308  
    7373    #------------------------------------------------------------------------------
    7474    domain.set_flow_algorithm(alg)
    75     #domain.set_CFL(cfl)
    7675
    7776    #------------------------------------------------------------------------------
     
    10099
    101100
    102 #===============================================================================
    103 ##from anuga.visualiser import RealtimeVisualiser
    104 ##vis = RealtimeVisualiser(domain)
    105 ##vis.render_quantity_height("stage", zScale =h0*500, dynamic=True)
    106 ##vis.colour_height_quantity('stage', (0.0, 0.5, 1.0))
    107 ##vis.start()
    108 #===============================================================================
    109 
    110 
    111 
    112 if myid == 0:
    113     #------------------------------------------------------------------------------
    114     # Produce a documentation of parameters
    115     #------------------------------------------------------------------------------
    116     parameter_file=open('parameters.tex', 'w')
    117     parameter_file.write('\\begin{verbatim}\n')
    118     from pprint import pprint
    119     pprint(domain.get_algorithm_parameters(),parameter_file,indent=4)
    120     parameter_file.write('\\end{verbatim}\n')
    121     parameter_file.close()
    122    
     101#-------------------------------------------------------------------------
     102# Produce a documentation of parameters
     103#-------------------------------------------------------------------------
     104from anuga.validation_utilities import save_parameters_tex
     105save_parameters_tex(domain)
    123106
    124107#===================================================================================
  • trunk/anuga_core/validation_tests/analytical_exact/paraboloid_basin/results.tex

    r8801 r9308  
    99The analytical solution is
    1010\begin{equation}
    11 u(x,y,t) = \frac{\omega r A sin{(\omega t)}}{ 2 \left[1 -A \cos(\omega t)\right] },
     11u(x,y,t) = \frac{\omega r A \sin{(\omega t)}}{ 2 \left[1 -A \cos(\omega t)\right] },
    1212\end{equation}
    1313\begin{equation}
  • trunk/anuga_core/validation_tests/analytical_exact/supercritical_over_bump/produce_results.py

    r9228 r9308  
    44args = anuga.get_args()
    55
    6 produce_report('numerical_subcritical.py', args=args)
     6produce_report('numerical_supercritical.py', args=args)
    77
    88
  • trunk/anuga_core/validation_tests/behaviour_only/bridge_hecras/channel_floodplain1.py

    r9239 r9308  
    88# Import necessary modules
    99#------------------------------------------------------------------------------
    10 # Import standard shallow water domain and standard boundaries.
    1110import anuga
    1211import numpy
    13 #from anuga_parallel.parallel_operator_factory import Inlet_operator, Boyd_box_operator
    14 from anuga_parallel.parallel_operator_factory import Inlet_operator, Boyd_box_operator
    15 from anuga_parallel import distribute, myid, numprocs, finalize, barrier
    16 
    17 from anuga import myid, finalize, distribute, barrier
     12from anuga import Inlet_operator, Boyd_box_operator
     13from anuga import distribute, myid, numprocs, finalize, barrier
    1814
    1915args = anuga.get_args()
     
    226222# Produce a documentation of parameters
    227223#------------------------------------------------------------------------------
    228 if myid == 0:
    229     parameter_file=open('parameters.tex', 'w')
    230     parameter_file.write('\\begin{verbatim}\n')
    231     from pprint import pprint
    232     pprint(domain.get_algorithm_parameters(),parameter_file,indent=4)
    233     parameter_file.write('\\end{verbatim}\n')
    234     parameter_file.close()
     224from anuga.validation_utilities import save_parameters_tex
     225save_parameters_tex(domain)
    235226
    236227#------------------------------------------------------------------------------
     
    239230#
    240231#------------------------------------------------------------------------------
    241 
    242 barrier()
    243 
    244232for t in domain.evolve(yieldstep=10.0, finaltime=dtQdata*(len(Qdata)-2)):
    245233    if(myid==0 & verbose):
    246234        print domain.timestepping_statistics()
    247235
    248 barrier()
    249 
    250 # Run sww merge
    251 if( (myid==0) & (numprocs>1)):
    252     print 'Merging sww files: ', numprocs, myid
    253     #os.chdir(project.output_run)
    254     anuga.utilities.sww_merge.sww_merge_parallel('channel_floodplain1',np=numprocs,verbose=True,delete_old=True)
    255 
    256 barrier()
     236doamin.sww_merge(delete_old=True)
     237
    257238finalize()
  • trunk/anuga_core/validation_tests/behaviour_only/lateral_weir_hecras/channel_floodplain1.py

    r9236 r9308  
    99import anuga
    1010import numpy
    11 #from anuga_parallel.parallel_operator_factory import Inlet_operator, Boyd_box_operator
    12 from anuga_parallel.parallel_operator_factory import Inlet_operator, Boyd_box_operator
    13 from anuga_parallel import distribute, myid, numprocs, finalize, barrier
    14 
    15 from anuga import myid, finalize, distribute, barrier
     11from anuga import Inlet_operator, Boyd_box_operator
     12from anuga import distribute, myid, numprocs, finalize, barrier
    1613
    1714args = anuga.get_args()
     
    194191            + chan_initial_depth - chan_bankfull_depth+0.2
    195192
    196 Bout_tmss = anuga.shallow_water.boundaries.Transmissive_n_momentum_zero_t_momentum_set_stage_boundary(domain, function = outflow_stage_boundary)
     193Bout_tmss = anuga.Transmissive_n_momentum_zero_t_momentum_set_stage_boundary(domain, function = outflow_stage_boundary)
    197194
    198195domain.set_boundary({'left': Br,
     
    208205# Produce a documentation of parameters
    209206#------------------------------------------------------------------------------
    210 if myid == 0:
    211     parameter_file=open('parameters.tex', 'w')
    212     parameter_file.write('\\begin{verbatim}\n')
    213     from pprint import pprint
    214     pprint(domain.get_algorithm_parameters(),parameter_file,indent=4)
    215     parameter_file.write('\\end{verbatim}\n')
    216     parameter_file.close()
     207from anuga.validation_utilities import save_parameters_tex
     208save_parameters_tex(domain)
    217209
    218210#------------------------------------------------------------------------------
     
    227219    if(myid==0 & verbose):
    228220        print domain.timestepping_statistics()
    229         xx=domain.quantities['ymomentum'].centroid_values
    230         dd=(domain.quantities['stage'].centroid_values - domain.quantities['elevation'].centroid_values)
    231         dd=dd*(dd>0.)
    232         tmp = xx/(dd+1.0e-06)*(dd>0.0)
    233         print tmp.max(), tmp.argmax(), tmp.min(),  tmp.argmin()
    234         print domain.max_speed.max(), domain.max_speed.argmax()
    235 
    236 barrier()
    237 
    238 # Run sww merge
    239 if( (myid==0) & (numprocs>1)):
    240     print 'Merging sww files: ', numprocs, myid
    241     anuga.utilities.sww_merge.sww_merge_parallel('channel_floodplain1',np=numprocs,verbose=True,delete_old=True)
    242 
    243 barrier()
     221        #xx=domain.quantities['ymomentum'].centroid_values
     222        #dd=(domain.quantities['stage'].centroid_values - domain.quantities['elevation'].centroid_values)
     223        #dd=dd*(dd>0.)
     224        #tmp = xx/(dd+1.0e-06)*(dd>0.0)
     225        #print tmp.max(), tmp.argmax(), tmp.min(),  tmp.argmin()
     226        #print domain.max_speed.max(), domain.max_speed.argmax()
     227
     228domain.sww_merge(delete_old=True)
     229
    244230finalize()
  • trunk/anuga_core/validation_tests/other_references/radial_dam_break_dry/produce_results.py

    r9117 r9308  
    22# import modules
    33#--------------------------------
    4 from anuga.validation_utilities.fabricate import *
    5 from anuga.validation_utilities import run_validation_script
    6 from anuga.validation_utilities import typeset_report
     4
     5import anuga
     6from anuga.validation_utilities import produce_report
     7
     8args = anuga.get_args()
     9
     10produce_report('radial_dam_break.py', args=args)
    711
    812
    9 # Setup the python scripts which produce the output for this
    10 # validation test
    11 def build():
    12     run_validation_script('radial_dam_break.py')
    13     run_validation_script('plot_results.py')
    14     typeset_report()
    15    
    16 def clean():
    17     autoclean()
    18 
    19 main()
    20 
  • trunk/anuga_core/validation_tests/other_references/radial_dam_break_dry/radial_dam_break.py

    r9174 r9308  
    1212from math import cos
    1313from numpy import zeros, float
    14 from time import localtime, strftime, gmtime
    15 from anuga.geometry.polygon import inside_polygon, is_inside_triangle
    16 
    17 
    18 #-------------------------------------------------------------------------------
    19 # Copy scripts to time stamped output directory and capture screen
    20 # output to file
    21 #-------------------------------------------------------------------------------
    22 time = strftime('%Y%m%d_%H%M%S',localtime())
    23 
    24 output_dir = '.'#'radial_dam_break_'+time
    25 output_file = 'radial_dam_break'
    26 
    27 #anuga.copy_code_files(output_dir,__file__)
    28 #start_screen_catcher(output_dir+'_')
    29 
    3014
    3115#------------------------------------------------------------------------------
    32 # Setup domain
     16# Setup parameters and utilitiy functions
    3317#------------------------------------------------------------------------------
    3418dx = 1.
     
    3620L = 200.
    3721W = L
    38 
    39 # structured mesh
    40 points, vertices, boundary = anuga.rectangular_cross(int(L/dx), int(W/dy), L, W, (-L/2.0, -W/2.0))
    41 domain = anuga.Domain(points, vertices, boundary)
    42 domain.set_name(output_file)               
    43 domain.set_datadir(output_dir) 
    44 
    45 #------------------------------------------------------------------------------
    46 # Setup Algorithm, either using command line arguments
    47 # or override manually yourself
    48 #------------------------------------------------------------------------------
    49 from anuga.utilities.argparsing import parse_standard_args
    50 alg, cfl = parse_standard_args()
    51 domain.set_flow_algorithm(alg)
    52 #domain.set_CFL(cfl)
    53 #domain.set_minimum_allowed_height(0.002)
    54 
    55 #------------------------------------------------------------------------------
    56 # Setup initial conditions
    57 #------------------------------------------------------------------------------
    58 domain.set_quantity('elevation',0.0)
    59 domain.set_quantity('friction', 0.0)
    6022
    6123h0 = 10.0
     
    7537    return z
    7638
    77 domain.set_quantity('stage', height)
     39#-------------------------------------------------------------------------
     40# setup sequential domain
     41#-------------------------------------------------------------------------
     42if anuga.myid == 0:
     43   
     44    points, vertices, boundary = anuga.rectangular_cross(int(L/dx), int(W/dy), L, W, (-L/2.0, -W/2.0))
     45    domain = anuga.Domain(points, vertices, boundary)
     46    domain.set_name('radial_dam_break')               
     47
     48
     49    #-------------------------------------------------------------------------
     50    # Setup Algorithm, either using command line arguments
     51    # or override manually yourself
     52    #--------------------------------------------------------------------------
     53    args = anuga.get_args()
     54    alg = args.alg
     55    verbose = args.verbose
     56    domain.set_flow_algorithm(alg)
     57
     58    #-------------------------------------------------------------------------
     59    # Setup initial conditions
     60    #-------------------------------------------------------------------------
     61    domain.set_quantity('elevation',0.0)
     62    domain.set_quantity('friction', 0.0)
     63    domain.set_quantity('stage', height)
     64else:
     65    domain = None
     66
     67domain = anuga.distribute(domain)
    7868
    7969#-----------------------------------------------------------------------------
     
    8575domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
    8676
    87 
    88 #===============================================================================
    89 ##from anuga.visualiser import RealtimeVisualiser
    90 ##vis = RealtimeVisualiser(domain)
    91 ##vis.render_quantity_height("stage", zScale =h0, dynamic=True)
    92 ##vis.colour_height_quantity('stage', (0.0, 0.5, 1.0))
    93 ##vis.start()
    94 #===============================================================================
    95 
    96 #---------------------------------------------
    97 # Find triangle that contains the point Point
    98 # and print to file
    99 #---------------------------------------------
    100 ##Point = (0.0, 0.0)
    101 ##for n in range(len(domain.triangles)):
    102 ##    tri = domain.get_vertex_coordinates(n)
    103 ##    if is_inside_triangle(Point,tri):
    104 ##        #print 'Point is within triangle with vertices '+'%s'%tri
    105 ##        n_point = n
    106 ##        break
    107 ##print 'The triangle ID containing the point of origin is = ',n_point
    108 
    109 
    110 #------------------------------------------------------------------------------
     77#-------------------------------------------------------------------------
    11178# Produce a documentation of parameters
    112 #------------------------------------------------------------------------------
    113 parameter_file=open('parameters.tex', 'w')
    114 parameter_file.write('\\begin{verbatim}\n')
    115 from pprint import pprint
    116 pprint(domain.get_algorithm_parameters(),parameter_file,indent=4)
    117 parameter_file.write('\\end{verbatim}\n')
    118 parameter_file.close()
     79#-------------------------------------------------------------------------
     80from anuga.validation_utilities import save_parameters_tex
     81save_parameters_tex(domain)
    11982
    12083#------------------------------------------------------------------------------
     
    12285#------------------------------------------------------------------------------
    12386for t in domain.evolve(yieldstep = 0.1, finaltime = 2.0):
    124     #print domain.timestepping_statistics(track_speeds=True)
    125     print domain.timestepping_statistics()
    126     #vis.update()
    127 ##test against know data   
    128 ##vis.evolveFinished()
     87     if anuga.myid == 0 and verbose:
     88         print domain.timestepping_statistics()
    12989
     90domain.sww_merge(delete_old=True)
     91
     92anuga.finalize()
  • trunk/anuga_core/validation_tests/other_references/radial_dam_break_wet/produce_results.py

    r9117 r9308  
    22# import modules
    33#--------------------------------
    4 from anuga.validation_utilities.fabricate import *
    5 from anuga.validation_utilities import run_validation_script
    6 from anuga.validation_utilities import typeset_report
     4
     5import anuga
     6from anuga.validation_utilities import produce_report
     7
     8args = anuga.get_args()
     9
     10produce_report('radial_dam_break.py', args=args)
    711
    812
    9 # Setup the python scripts which produce the output for this
    10 # validation test
    11 def build():
    12     run_validation_script('radial_dam_break.py')
    13     run_validation_script('plot_results.py')
    14     typeset_report()     
    15 
    16 def clean():
    17     autoclean()
    18 
    19 main()
    20 
  • trunk/anuga_core/validation_tests/other_references/radial_dam_break_wet/radial_dam_break.py

    r9174 r9308  
    1212from math import cos
    1313from numpy import zeros, float
    14 from time import localtime, strftime, gmtime
    15 from anuga.geometry.polygon import inside_polygon, is_inside_triangle
    16 
    17 
    18 #-------------------------------------------------------------------------------
    19 # Copy scripts to time stamped output directory and capture screen
    20 # output to file
    21 #-------------------------------------------------------------------------------
    22 time = strftime('%Y%m%d_%H%M%S',localtime())
    23 
    24 output_dir = '.'#'radial_dam_break_'+time
    25 output_file = 'radial_dam'
    26 
    27 #anuga.copy_code_files(output_dir,__file__)
    28 #start_screen_catcher(output_dir+'_')
    2914
    3015
    3116#------------------------------------------------------------------------------
    32 # Setup domain
     17# Setup parameters and utility files
    3318#------------------------------------------------------------------------------
    3419dx = 1.
     
    3722W = L
    3823
    39 # structured mesh
    40 points, vertices, boundary = anuga.rectangular_cross(int(L/dx), int(W/dy), L, W, (-L/2.0, -W/2.0))
    41 domain = anuga.Domain(points, vertices, boundary)
    42 domain.set_name(output_file)               
    43 domain.set_datadir(output_dir) 
    44 
    45 #------------------------------------------------------------------------------
    46 # Setup Algorithm, either using command line arguments
    47 # or override manually yourself
    48 #------------------------------------------------------------------------------
    49 from anuga.utilities.argparsing import parse_standard_args
    50 alg, cfl = parse_standard_args()
    51 domain.set_flow_algorithm(alg)
    52 #domain.set_CFL(cfl)
    53 
    54 #------------------------------------------------------------------------------
    55 # Setup initial conditions
    56 #------------------------------------------------------------------------------
    57 domain.set_quantity('elevation',0.0)
    58 domain.set_quantity('friction', 0.0)
    5924
    6025h0 = 10.0
     
    7439    return z
    7540
    76 domain.set_quantity('stage', height)
     41#----------------------------------------------------------------------------
     42# Setup sequential domain
     43#----------------------------------------------------------------------------
     44if anuga.myid == 0:
     45    # structured mesh
     46    points, vertices, boundary = anuga.rectangular_cross(int(L/dx), int(W/dy), L, W, (-L/2.0, -W/2.0))
     47    domain = anuga.Domain(points, vertices, boundary)
     48    domain.set_name('radial_dam')               
     49
     50    #------------------------------------------------------------------------------
     51    # Setup Algorithm, either using command line arguments
     52    # or override manually yourself
     53    #------------------------------------------------------------------------------
     54    args = anuga.get_args()
     55    alg = args.alg
     56    verbose = args.verbose
     57    domain.set_flow_algorithm(alg)
     58
     59    #------------------------------------------------------------------------------
     60    # Setup initial conditions
     61    #------------------------------------------------------------------------------
     62    domain.set_quantity('elevation',0.0)
     63    domain.set_quantity('friction', 0.0)
     64    domain.set_quantity('stage', height)
     65
     66else:
     67    domain = None
     68
     69domain = anuga.distribute(domain)
    7770
    7871#-----------------------------------------------------------------------------
     
    8477domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
    8578
    86 #===============================================================================
    87 ##from anuga.visualiser import RealtimeVisualiser
    88 ##vis = RealtimeVisualiser(domain)
    89 ##vis.render_quantity_height("stage", zScale =h0, dynamic=True)
    90 ##vis.colour_height_quantity('stage', (0.0, 0.5, 1.0))
    91 ##vis.start()
    92 #===============================================================================
    93 
    94 #---------------------------------------------
    95 # Find triangle that contains the point Point
    96 # and print to file
    97 #---------------------------------------------
    98 ##Point = (0.0, 0.0)
    99 ##for n in range(len(domain.triangles)):
    100 ##    tri = domain.get_vertex_coordinates(n)
    101 ##    if is_inside_triangle(Point,tri):
    102 ##        #print 'Point is within triangle with vertices '+'%s'%tri
    103 ##        n_point = n
    104 ##        break
    105 ##print 'The triangle ID containing the point of origin is = ',n_point
    106 
    107 
    108 #------------------------------------------------------------------------------
     79#-------------------------------------------------------------------------
    10980# Produce a documentation of parameters
    110 #------------------------------------------------------------------------------
    111 parameter_file=open('parameters.tex', 'w')
    112 parameter_file.write('\\begin{verbatim}\n')
    113 from pprint import pprint
    114 pprint(domain.get_algorithm_parameters(),parameter_file,indent=4)
    115 parameter_file.write('\\end{verbatim}\n')
    116 parameter_file.close()
     81#-------------------------------------------------------------------------
     82from anuga.validation_utilities import save_parameters_tex
     83save_parameters_tex(domain)
    11784
    11885#------------------------------------------------------------------------------
     
    12087#------------------------------------------------------------------------------
    12188for t in domain.evolve(yieldstep = 0.1, finaltime = 2.0):
    122     #print domain.timestepping_statistics(track_speeds=True)
    123     print domain.timestepping_statistics()
    124     #vis.update()
    125 ##test against know data   
    126 ##vis.evolveFinished()
     89     if anuga.myid == 0 and verbose:
     90        print domain.timestepping_statistics()
    12791
     92domain.sww_merge(delete_old=True)
     93
     94anuga.finalize()   
  • trunk/anuga_core/validation_tests/reports/all_tests_produce_results.py

    r9147 r9308  
    6767    pass
    6868
    69 
     69try:
     70    Upper_dirs.remove('case_studies')
     71except ValueError:
     72    pass
    7073
    7174#print Upper_dirs
     
    129132
    130133
    131 
    132134# go back to reports directory to typeset report
    133135os.chdir('reports')
    134136
    135 from anuga.validation_utilities.fabricate import *
    136137
    137 os.system('python all_test_typeset_report.py')
    138 
    139 #cmd = 'pdflatex -shell-escape -interaction=batchmode report.tex'
    140 #print cmd
    141 #import subprocess
    142 #subprocess.call([cmd], shell=True)
     138os.system('python all_tests_typeset_report.py')
    143139
    144140import subprocess
Note: See TracChangeset for help on using the changeset viewer.