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/other_references
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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()   
Note: See TracChangeset for help on using the changeset viewer.