Changeset 8825


Ignore:
Timestamp:
Apr 15, 2013, 11:58:21 AM (12 years ago)
Author:
steve
Message:

Mainly small change to allow scientific and scipy interpolation.

Location:
trunk/anuga_core
Files:
3 added
2 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/demos/cairns/run_parallel_cairns.py

    r8821 r8825  
    187187
    188188
    189 domain.sww_merge()
     189domain.sww_merge(delete_old=True)
    190190
    191191if myid == 0:
  • trunk/anuga_core/source/anuga/damage_modelling/inundation_damage.py

    r8816 r8825  
    66import os
    77from math import sqrt
    8 #from Scientific.Functions.Interpolation import InterpolatingFunction
    9 from scipy.interpolate import interp1d
     8
     9
     10try:
     11    from scipyr.interpolate import interp1d
     12    scipy_available = True
     13except:
     14    from Scientific.Functions.Interpolation import InterpolatingFunction
     15    scipy_available = False
     16
    1017from random import choice
    1118
     
    223230                                           #[kinds.default_float_kind.MAX,64.7]
    224231                                           ])
    225     #double_brick_damage_curve = InterpolatingFunction( \
    226     #    (num.ravel(double_brick_damage_array[:,0:1]),),
    227     #    num.ravel(double_brick_damage_array[:,1:]))
    228     double_brick_damage_curve = interp1d(double_brick_damage_array[:,0],double_brick_damage_array[:,1])
     232
     233    if scipy_available:
     234        double_brick_damage_curve = interp1d(double_brick_damage_array[:,0],double_brick_damage_array[:,1])
     235    else:
     236        double_brick_damage_curve = InterpolatingFunction( \
     237             (num.ravel(double_brick_damage_array[:,0:1]),),
     238              num.ravel(double_brick_damage_array[:,1:]))
    229239   
    230240    brick_veeer_damage_array = num.array([#[-kinds.default_float_kind.MAX, 0.0],
     
    242252                                          #[kinds.default_float_kind.MAX,69.4]
    243253                                          ])
    244     #brick_veeer_damage_curve = InterpolatingFunction( \
    245     #    (num.ravel(brick_veeer_damage_array[:,0:1]),),
    246     #    num.ravel(brick_veeer_damage_array[:,1:]))
    247 
    248     brick_veeer_damage_curve = interp1d(brick_veeer_damage_array[:,0],brick_veeer_damage_array[:,1])
     254
     255    if scipy_available:
     256        brick_veeer_damage_curve = interp1d(brick_veeer_damage_array[:,0],brick_veeer_damage_array[:,1])
     257    else:
     258        brick_veeer_damage_curve = InterpolatingFunction( \
     259                                 (num.ravel(brick_veeer_damage_array[:,0:1]),),
     260                                  num.ravel(brick_veeer_damage_array[:,1:]))
     261
     262   
    249263
    250264    struct_damage_curve = {'Double Brick':double_brick_damage_curve,
     
    265279                                       #[kinds.default_float_kind.MAX,98.6]
    266280                                       ])
    267     #contents_damage_curve = InterpolatingFunction( \
    268     #    (num.ravel(contents_damage_array[:,0:1]),),
    269     #    num.ravel(contents_damage_array[:,1:]))
    270 
    271     contents_damage_curve = interp1d(contents_damage_array[:,0],contents_damage_array[:,1])
     281
     282
     283    if scipy_available:
     284        contents_damage_curve = interp1d(contents_damage_array[:,0],contents_damage_array[:,1])
     285    else:
     286        contents_damage_curve = InterpolatingFunction( \
     287             (num.ravel(contents_damage_array[:,0:1]),),
     288              num.ravel(contents_damage_array[:,1:]))
     289
     290
     291
    272292    #building collapse probability
    273293    # inundation depth above ground floor, m
  • trunk/anuga_core/source/anuga/structures/boyd_box_operator.py

    r8634 r8825  
    99    compute_discharge method for specific subclasses)
    1010   
    11     Input: Two points, pipe_size (either diameter or width, height),
    12     mannings_rougness,
     11    Input: minimum arguments
     12         domain,
     13         losses (scalar, list or dictionary of losses),
     14         width  (= height if height not given)
    1315    """
    1416
     
    2224                 exchange_lines=None,
    2325                 enquiry_points=None,
     26                 invert_elevations=None,
    2427                 apron=0.1,
    2528                 manning=0.013,
     
    3538        anuga.Structure_operator.__init__(self,
    3639                                          domain,
    37                                           end_points,
    38                                           exchange_lines,
    39                                           enquiry_points,
    40                                           width,
    41                                           height,
    42                                           apron,
    43                                           manning,
    44                                           enquiry_gap,                                                       
    45                                           description,
    46                                           label,
    47                                           structure_type,
    48                                           logging,
    49                                           verbose)     
     40                                          end_points=end_points,
     41                                          exchange_lines=exchange_lines,
     42                                          enquiry_points=enquiry_points,
     43                                          invert_elevations=invert_elevations,
     44                                          width=width,
     45                                          height=height,
     46                                          diameter=None,
     47                                          apron=apron,
     48                                          manning=manning,
     49                                          enquiry_gap=enquiry_gap,
     50                                          description=description,
     51                                          label=label,
     52                                          structure_type=structure_type,
     53                                          logging=logging,
     54                                          verbose=verbose)
     55
    5056       
    5157        if isinstance(losses, dict):
  • trunk/anuga_core/source/anuga/structures/boyd_pipe_operator.py

    r8427 r8825  
    1616                 domain,
    1717                 losses,
     18                 diameter=None,
    1819                 end_points=None,
    1920                 exchange_lines=None,
    2021                 enquiry_points=None,
    21                  diameter=None,
     22                 invert_elevations=None,
    2223                 apron=0.1,
    2324                 manning=0.013,
     
    3637                                          exchange_lines,
    3738                                          enquiry_points,
    38                                           width=diameter,
     39                                          invert_elevations=invert_elevations,
     40                                          width=None,
    3941                                          height=None,
     42                                          diameter=diameter,
    4043                                          apron=apron,
    4144                                          manning=manning,
     
    6063        self.culvert_length = self.get_culvert_length()
    6164        self.culvert_diameter = self.get_culvert_diameter()
     65
     66        #print self.culvert_diameter
    6267
    6368        self.max_velocity = 10.0
  • trunk/anuga_core/source/anuga/structures/structure_operator.py

    r8680 r8825  
    2424    def __init__(self,
    2525                 domain,
    26                  end_points,
    27                  exchange_lines,
    28                  enquiry_points,
    29                  width,
    30                  height,
    31                  apron,
    32                  manning,
    33                  enquiry_gap,
    34                  description,
    35                  label,
    36                  structure_type,
    37                  logging,
    38                  verbose):
     26                 end_points=None,
     27                 exchange_lines=None,
     28                 enquiry_points=None,
     29                 invert_elevations=None,
     30                 width=None,
     31                 height=None,
     32                 diameter=None,
     33                 apron=None,
     34                 manning=None,
     35                 enquiry_gap=None,
     36                 description=None,
     37                 label=None,
     38                 structure_type=None,
     39                 logging=None,
     40                 verbose=None):
    3941                     
    4042        """
     
    5355        self.exchange_lines = ensure_numeric(exchange_lines)
    5456        self.enquiry_points = ensure_numeric(enquiry_points)
     57        self.invert_elevations = ensure_numeric(invert_elevations)
     58
     59        assert self.end_points == None or self.exchange_lines == None
    5560
    5661       
     
    5863            height = width
    5964
     65        if width is None:
     66            width = diameter
     67
    6068        if apron is None:
    6169            apron = width
    6270
     71
     72        assert width is not None
     73
     74
    6375        self.width  = width
    6476        self.height = height
     77        self.diameter = diameter
    6578        self.apron  = apron
    6679        self.manning = manning
     
    401414    def get_culvert_diameter(self):
    402415   
    403             return self.width
     416            return self.diameter
    404417       
    405418       
  • trunk/anuga_core/source/anuga_parallel/parallel_boyd_box_operator.py

    r8634 r8825  
    2525                 exchange_lines=None,
    2626                 enquiry_points=None,
     27                 invert_elevations=None,
    2728                 apron=0.1,
    2829                 manning=0.013,
     
    4243                     
    4344        Parallel_Structure_operator.__init__(self,
    44                                           domain,
    45                                           end_points,
    46                                           exchange_lines,
    47                                           enquiry_points,
    48                                           width,
    49                                           height,
    50                                           apron,
    51                                           manning,
    52                                           enquiry_gap,                                                       
    53                                           description,
    54                                           label,
    55                                           structure_type,
    56                                           logging,
    57                                           verbose,
    58                                           master_proc,
    59                                           procs,
    60                                           inlet_master_proc,
    61                                           inlet_procs,
    62                                           enquiry_proc)
     45                                          domain=domain,
     46                                          end_points=end_points,
     47                                          exchange_lines=exchange_lines,
     48                                          enquiry_points=enquiry_points,
     49                                          invert_elevations=invert_elevations,
     50                                          width=width,
     51                                          height=height,
     52                                          diameter= None,
     53                                          apron=apron,
     54                                          manning=manning,
     55                                          enquiry_gap=enquiry_gap,
     56                                          description=description,
     57                                          label=label,
     58                                          structure_type=structure_type,
     59                                          logging=logging,
     60                                          verbose=verbose,
     61                                          master_proc=master_proc,
     62                                          procs=procs,
     63                                          inlet_master_proc=inlet_master_proc,
     64                                          inlet_procs=inlet_procs,
     65                                          enquiry_proc=enquiry_proc)
    6366       
    6467        if isinstance(losses, dict):
  • trunk/anuga_core/source/anuga_parallel/parallel_operator_factory.py

    r8662 r8825  
    1616from parallel_structure_operator import Parallel_Structure_operator
    1717from parallel_boyd_box_operator import Parallel_Boyd_box_operator
     18from parallel_boyd_pipe_operator import Parallel_Boyd_pipe_operator
     19
     20
    1821from anuga_parallel import distribute, myid, numprocs, finalize
    1922from anuga.geometry.polygon import inside_polygon, is_inside_polygon, line_intersect
    2023
    2124import anuga.structures.boyd_box_operator
     25import anuga.structures.boyd_pipe_operator
    2226import anuga.structures.inlet_operator
    2327
     
    98102"""
    99103Factory method for Parallel Boyd_box_operator. All parameters are the same
    100 as normal Inlet_Operators master_proc coordinates the allocation process,
     104as normal Boyd_box_operator master_proc coordinates the allocation process,
    101105procs contains the potential list of processors to allocate the inlet to.
    102106
    103107Returns None for calling processors not associated with structure. Otherwise
    104 return an instance of Parallel_Inlet_Operator
     108return an instance of Parallel Boyd_box_operator
    105109"""
    106110
     
    112116                       exchange_lines=None,
    113117                       enquiry_points=None,
     118                       invert_elevations=None,
    114119                       apron=0.1,
    115120                       manning=0.013,
     
    128133    if isinstance(domain, Parallel_domain) is False:
    129134        if verbose: print "Allocating non parallel boyd box operator ....."
    130         return anuga.structures.boyd_box_operator.Boyd_box_operator(domain,
    131                                                                     losses,
    132                                                                     width,
    133                                                                     height,
    134                                                                     end_points,
    135                                                                     exchange_lines,
    136                                                                     enquiry_points,
    137                                                                     apron,
    138                                                                     manning,
    139                                                                     enquiry_gap,
    140                                                                     use_momentum_jet,
    141                                                                     use_velocity_head,
    142                                                                     description,
    143                                                                     label,
    144                                                                     structure_type,
    145                                                                     logging,
    146                                                                     verbose)
     135        return anuga.structures.boyd_box_operator.Boyd_box_operator(domain=domain,
     136                                                                    losses=losses,
     137                                                                    width=width,
     138                                                                    height=height,
     139                                                                    end_points=end_points,
     140                                                                    exchange_lines=exchange_lines,
     141                                                                    enquiry_points=enquiry_points,
     142                                                                    invert_elevations=invert_elevations,
     143                                                                    apron=apron,
     144                                                                    manning=manning,
     145                                                                    enquiry_gap=enquiry_gap,
     146                                                                    use_momentum_jet=use_momentum_jet,
     147                                                                    use_velocity_head=use_velocity_head,
     148                                                                    description=description,
     149                                                                    label=label,
     150                                                                    structure_type=structure_type,
     151                                                                    logging=logging,
     152                                                                    verbose=verbose)
    147153
    148154    myid = pypar.rank()
     
    154160    if height is None:
    155161        height = width
     162
     163    diameter = None
    156164
    157165    if apron is None:
     
    219227
    220228    if alloc0 or alloc1:
    221        return Parallel_Boyd_box_operator(domain,
    222                                          losses,
    223                                          width,
    224                                          height,
    225                                          end_points,
    226                                          exchange_lines,
    227                                          enquiry_points,
    228                                          apron,
    229                                          manning,
    230                                          enquiry_gap,
    231                                          use_momentum_jet,
    232                                          use_velocity_head,
    233                                          description,
    234                                          label,
    235                                          structure_type,
    236                                          logging,
    237                                          verbose,
     229       return Parallel_Boyd_box_operator(domain=domain,
     230                                         losses=losses,
     231                                         width=width,
     232                                         height=height,
     233                                         end_points=end_points,
     234                                         exchange_lines=exchange_lines,
     235                                         enquiry_points=enquiry_points,
     236                                         invert_elevations=invert_elevations,
     237                                         apron=apron,
     238                                         manning=manning,
     239                                         enquiry_gap=enquiry_gap,
     240                                         use_momentum_jet=use_momentum_jet,
     241                                         use_velocity_head=use_velocity_head,
     242                                         description=description,
     243                                         label=label,
     244                                         structure_type=structure_type,
     245                                         logging=logging,
     246                                         verbose=verbose,
    238247                                         master_proc = inlet0_master_proc,
    239248                                         procs = structure_procs,
     
    243252    else:
    244253        return None
     254
     255
     256
     257"""
     258Factory method for Parallel Boyd_pipe_operator. All parameters are the same
     259as normal Boyd_pipe_operator master_proc coordinates the allocation process,
     260procs contains the potential list of processors to allocate the inlet to.
     261
     262Returns None for calling processors not associated with structure. Otherwise
     263return an instance of Parallel Boyd_pipe_operator
     264"""
     265
     266def Boyd_pipe_operator(domain,
     267                       losses,
     268                       diameter,
     269                       end_points=None,
     270                       exchange_lines=None,
     271                       enquiry_points=None,
     272                       invert_elevations=None,
     273                       apron=0.1,
     274                       manning=0.013,
     275                       enquiry_gap=0.0,
     276                       use_momentum_jet=True,
     277                       use_velocity_head=True,
     278                       description=None,
     279                       label=None,
     280                       structure_type='boyd_pipe',
     281                       logging=False,
     282                       verbose=False,
     283                       master_proc=0,
     284                       procs=range(0,pypar.size())):
     285
     286    # If not parallel domain then allocate serial Boyd box operator
     287    if isinstance(domain, Parallel_domain) is False:
     288        if verbose: print "Allocating non parallel boyd pipe operator ....."
     289        return anuga.structures.boyd_pipe_operator.Boyd_pipe_operator(domain=domain,
     290                                                                    losses=losses,
     291                                                                    diameter=diameter,
     292                                                                    end_points=end_points,
     293                                                                    exchange_lines=exchange_lines,
     294                                                                    enquiry_points=enquiry_points,
     295                                                                    invert_elevations=invert_elevations,
     296                                                                    apron=apron,
     297                                                                    manning=manning,
     298                                                                    enquiry_gap=enquiry_gap,
     299                                                                    use_momentum_jet=use_momentum_jet,
     300                                                                    use_velocity_head=use_velocity_head,
     301                                                                    description=description,
     302                                                                    label=label,
     303                                                                    structure_type=structure_type,
     304                                                                    logging=logging,
     305                                                                    verbose=verbose)
     306
     307    myid = pypar.rank()
     308
     309    end_points = ensure_numeric(end_points)
     310    exchange_lines = ensure_numeric(exchange_lines)
     311    enquiry_points = ensure_numeric(enquiry_points)
     312
     313    width = diameter
     314
     315    assert diameter is not None
     316
     317    if apron is None:
     318        apron = width
     319
     320    # Calculate location of inlet enquiry points and exchange lines
     321    if myid == master_proc:
     322        if exchange_lines is not None:
     323            exchange_lines_tmp = exchange_lines
     324            enquiry_points_tmp = __process_skew_culvert(exchange_lines, end_points, enquiry_points, apron, enquiry_gap)
     325
     326            for i in procs:
     327                if i == master_proc: continue
     328                pypar.send(enquiry_points_tmp, i)
     329
     330        elif end_points is not None:
     331            exchange_lines_tmp, enquiry_points_tmp = __process_non_skew_culvert(end_points, width,
     332                                                                                enquiry_points, apron, enquiry_gap)
     333            for i in procs:
     334                if i == master_proc: continue
     335                pypar.send(exchange_lines_tmp, i)
     336                pypar.send(enquiry_points_tmp, i)
     337        else:
     338            raise Exception, 'Define either exchange_lines or end_points'
     339
     340    else:
     341        if exchange_lines is not None:
     342            exchange_lines_tmp = exchange_lines
     343            enquiry_points_tmp = pypar.receive(master_proc)
     344        elif end_points is not None:
     345            exchange_lines_tmp = pypar.receive(master_proc)
     346            enquiry_points_tmp = pypar.receive(master_proc)
     347
     348    # Determine processors associated with first inlet
     349    line0 = exchange_lines_tmp[0]
     350    enquiry_point0 = enquiry_points_tmp[0]
     351
     352    alloc0, inlet0_master_proc, inlet0_procs, enquiry0_proc = allocate_inlet_procs(domain, line0, enquiry_point =  enquiry_point0,
     353                                                                                   master_proc = master_proc,
     354                                                                                   procs = procs, verbose=verbose)
     355
     356    # Determine processors associated with second inlet
     357    line1 = exchange_lines_tmp[1]
     358    enquiry_point1 = enquiry_points_tmp[1]
     359
     360    alloc1, inlet1_master_proc, inlet1_procs, enquiry1_proc = allocate_inlet_procs(domain, line1, enquiry_point =  enquiry_point1,
     361                                                                                   master_proc = master_proc,
     362                                                                                   procs = procs, verbose=verbose)
     363
     364    structure_procs = list(set(inlet0_procs + inlet1_procs))
     365    inlet_master_proc = [inlet0_master_proc, inlet1_master_proc]
     366    inlet_procs = [inlet0_procs, inlet1_procs]
     367    enquiry_proc = [enquiry0_proc, enquiry1_proc]
     368
     369    if myid == master_proc and verbose:
     370        print "Parallel Boyd Pipe Operator ============================="
     371        print "Structure Master Proc is P" + str(inlet0_master_proc)
     372        print "Structure Procs are P" + str(structure_procs)
     373        print "Inlet Master Procs are P" + str(inlet_master_proc)
     374        print "Inlet Procs are P" + str(inlet_procs[0]) + " and " + str(inlet_procs[1])
     375        print "Inlet Enquiry Procs are P" + str(enquiry_proc)
     376        print "Enquiry Points are " + str(enquiry_point0) + " and " + str(enquiry_point1)
     377        print "Inlet Exchange Lines are " + str(line0) + " and " + str(line1)
     378        print "========================================================"
     379
     380    if alloc0 or alloc1:
     381       return Parallel_Boyd_pipe_operator(domain=domain,
     382                                         losses=losses,
     383                                         diameter=diameter,
     384                                         end_points=end_points,
     385                                         exchange_lines=exchange_lines,
     386                                         enquiry_points=enquiry_points,
     387                                         invert_elevations=invert_elevations,
     388                                         apron=apron,
     389                                         manning=manning,
     390                                         enquiry_gap=enquiry_gap,
     391                                         use_momentum_jet=use_momentum_jet,
     392                                         use_velocity_head=use_velocity_head,
     393                                         description=description,
     394                                         label=label,
     395                                         structure_type=structure_type,
     396                                         logging=logging,
     397                                         verbose=verbose,
     398                                         master_proc = inlet0_master_proc,
     399                                         procs = structure_procs,
     400                                         inlet_master_proc = inlet_master_proc,
     401                                         inlet_procs = inlet_procs,
     402                                         enquiry_proc = enquiry_proc)
     403    else:
     404        return None
     405
     406
     407
    245408
    246409
  • trunk/anuga_core/source/anuga_parallel/parallel_structure_operator.py

    r8687 r8825  
    3939                 exchange_lines,
    4040                 enquiry_points,
     41                 invert_elevations,
    4142                 width,
    4243                 height,
     44                 diameter,
    4345                 apron,
    4446                 manning,
     
    8587        self.exchange_lines = ensure_numeric(exchange_lines)
    8688        self.enquiry_points = ensure_numeric(enquiry_points)
    87 
    88        
     89        self.invert_elevations = ensure_numeric(invert_elevations)
     90
     91        assert (width is not None and diameter is None) or (width is None and diameter is not None)
     92
     93        if width is None:
     94            width = diameter
     95
     96        if diameter is None:
     97            diameter = width
     98
    8999        if height is None:
    90100            height = width
    91101
     102
     103
    92104        if apron is None:
    93105            apron = width
     
    95107        self.width  = width
    96108        self.height = height
     109        self.diameter = diameter
    97110        self.apron  = apron
    98111        self.manning = manning
     
    485498
    486499    def get_inlets(self):
    487        
    488500        return self.inlets
    489501       
    490502       
    491503    def get_culvert_length(self):
    492        
    493504        return self.culvert_length
    494505       
     
    499510       
    500511    def get_culvert_diameter(self):
    501         return self.width
     512        return self.diamter
    502513       
    503514       
  • trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/plot_results.py

    r8743 r8825  
    1212v = p2_st.y[10]
    1313v2=(p2_st.y==v)
    14 
    1514
    1615h0 = 1.0
  • trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet/produce_results.py

    r8767 r8825  
    33#--------------------------------
    44from anuga_validation_tests.utilities.fabricate import *
    5 from anuga_validation_tests.utilities.run_validation import run_validation_script
     5from anuga_validation_tests.utilities import run_validation_script
     6from anuga_validation_tests.utilities import produce_report
    67import os
    78
     
    1112    run_validation_script('numerical_dam_break_wet.py')
    1213    run_validation_script('plot_results.py')
    13     run('python', 'produce_report.py') 
     14    produce_report()
    1415
    1516def clean():
  • trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/paraboloid_basin

    • Property svn:ignore set to
      .deps
  • trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/paraboloid_basin/produce_results.py

    r8790 r8825  
    99# validation test
    1010def build():
    11     run_validation_script('run_paraboloid.py')
     11    run_validation_script('numerical_paraboloid_basin.py')
    1212    run_validation_script('plot_results_cross_section.py')
    1313    run_validation_script('plot_results_origin_wrt_time.py')   
  • trunk/anuga_core/source/anuga_validation_tests/Behaviour_only/lid_driven_cavity/plot_results.py

    r8803 r8825  
    8787pyplot.ylabel('Xvelocity')
    8888pyplot.savefig('xvelocity_at_y05.png')
    89 pyplot.show()
     89#pyplot.show()
     90pyplot.close()
  • trunk/anuga_core/source/anuga_validation_tests/Experimental_data/dam_break_Yeh_Petroff

    • Property svn:ignore set to
      .deps
  • trunk/anuga_core/source/anuga_validation_tests/Experimental_data/dam_break_Yeh_Petroff/numerical_Yeh_Petroff.py

    r8804 r8825  
    5656alg, cfl = parse_standard_args()
    5757
    58 alg = '2_0_limited'
    59 cfl = 0.9
    60 print alg, cfl
    61 domain.set_flow_algorithm('2_0_limited')
     58
     59domain.set_flow_algorithm(alg)
    6260domain.set_CFL(cfl)
    6361domain.set_minimum_allowed_height(0.01)
  • trunk/anuga_core/source/anuga_validation_tests/Other_references/radial_dam_break_wet/plot_results.py

    r8665 r8825  
    4949VerU_left = -1.0*VerU[::-1]
    5050
    51 p_st = util.get_output('radial_dam_break.sww')
     51p_st = util.get_output('radial_dam.sww')
    5252p2_st=util.get_centroids(p_st)
    5353
  • trunk/anuga_core/source/anuga_validation_tests/parameters.py

    r8750 r8825  
    1010
    1111alg = '1_5'
    12 cfl = 1.0
     12cfl = 0.9
    1313
    1414
  • trunk/anuga_core/source/anuga_validation_tests/produce_report.py

    r8802 r8825  
    77__date__ ="$13/03/2013 4:24:51 PM$"
    88
    9 if __name__ == "__main__":
    10     print "Hello World";
     9
    1110
    1211import os
    1312
    14 
    15 os.system('pdflatex report.tex')
     13os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
    1614os.system('bibtex report')
    17 os.system('pdflatex report.tex')
     15os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
    1816os.system('bibtex report')
    19 os.system('pdflatex report.tex')
     17os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
    2018os.system('bibtex report')
    21 os.system('pdflatex report.tex')
     19os.system('pdflatex -shell-escape  -interaction=batchmode report.tex')
  • trunk/anuga_core/source/anuga_validation_tests/produce_results.py

    r8754 r8825  
    44
    55import os
     6import time
     7
    68import anuga
    7 import time
    89from anuga import indent
    9 
    10 #--------------------------------
    11 # Get Default values for
    12 # algorithm parameters.
    13 #--------------------------------
    1410from parameters import alg
    1511from parameters import cfl
     
    2622    try:
    2723        # This works when using git on unix
    28         minor_revision=os.popen("git show-ref --head -s | head -n1").read().strip()
     24        minor_revision = os.popen("git show-ref --head -s | head -n1").read().strip()
    2925    except:
    3026        # This is a fallback position
    31         minor_revision='unknown'
     27        minor_revision = 'unknown'
    3228
    3329#---------------------------------
     
    3733
    3834Upper_dirs = os.listdir('.')
     35dir = '.'
     36Upper_dirs = [name for name in os.listdir(dir) if os.path.isdir(os.path.join(dir, name))]
     37
    3938
    4039try:
    4140    Upper_dirs.remove('.svn')
    42         Upper_dirs.remove('utilities')
     41    Upper_dirs.remove('utilities')
    4342except ValueError:
    4443    pass
     44
     45
    4546
    4647#print Upper_dirs
     
    5657    print indent + dir
    5758    #print 'Changing to', os.getcwd()
    58     Lower_dirs = os.listdir('.')
     59    dir = '.'
     60    Lower_dirs =  [name for name in os.listdir(dir) if os.path.isdir(os.path.join(dir, name))]
    5961    try:
    6062        Lower_dirs.remove('.svn')
     
    6567        os.chdir(l_dir)
    6668        #print os.getcwd()
    67         print 2*indent + l_dir
     69        print 2 * indent + l_dir
    6870        try:
    6971            cmd = 'python produce_results.py'
    70             print 3*indent + 'Running: '+cmd
    71             os.system( cmd )
     72            print 3 * indent + 'Running: ' + cmd
     73            os.system(cmd)
    7274        except:
    73             print 3*indent + 'Failed running produce_results in '+os.getcwd()
     75            print 3 * indent + 'Failed running produce_results in ' + os.getcwd()
    7476            pass
    7577
     
    8082    #print 'Changing to', os.getcwd()
    8183   
    82 os.chdir('..')
     84os.chdir(buildroot)
    8385#----------------------------------
    8486# Now it is ok to create the latex
     
    8688#----------------------------------
    8789
    88 f = open('saved_parameters.tex','w')
     90f = open('saved_parameters.tex', 'w')
    8991f.write('\\newcommand{\\cfl}{\\UScore{%s}}\n' % str(cfl))
    9092f.write('\\newcommand{\\alg}{\\UScore{%s}}\n' % str(alg))
     
    9698
    9799
     100import os
     101
     102os.system('python produce_report.py')
    98103cmd = 'pdflatex -shell-escape -interaction=batchmode report.tex'
    99 print cmd
     104#print cmd
     105#import subprocess
     106#subprocess.call([cmd], shell=True)
     107
    100108import subprocess
    101 subprocess.call( [cmd], shell=True )
    102109cmd = 'mv report.pdf report_cfl_%s_alg_%s.pdf' % (str(cfl), str(alg))
    103110print cmd
    104 subprocess.call( [cmd] , shell=True )
     111subprocess.call([cmd], shell=True)
    105112
    106113
  • trunk/anuga_core/source/anuga_validation_tests/saved_parameters.tex

    r8739 r8825  
    1 \newcommand{\cfl}{\UScore{1.0}}
    2 \newcommand{\alg}{\UScore{2_0}}
     1\newcommand{\cfl}{\UScore{0.9}}
     2\newcommand{\alg}{\UScore{1_5}}
    33\newcommand{\majorR}{\UScore{1.3.0-beta}}
    4 \newcommand{\minorR}{\UScore{8738}}
    5 \newcommand{\timeR}{{Tue Mar  5 17:28:15 2013}}
     4\newcommand{\minorR}{\UScore{8821}}
     5\newcommand{\timeR}{{Wed Apr 10 18:02:17 2013}}
  • trunk/anuga_core/source/anuga_validation_tests/utilities/__init__.py

    r8736 r8825  
    88
    99
     10from produce_report import produce_report
     11from run_validation import run_validation_script
     12
     13
     14
Note: See TracChangeset for help on using the changeset viewer.