Changeset 1510


Ignore:
Timestamp:
Jun 9, 2005, 5:49:59 PM (20 years ago)
Author:
steve
Message:

Added some logging to parallel code

Location:
inundation/ga/storm_surge
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/parallel/advection.py

    r1472 r1510  
    2323Geoscience Australia, 2004
    2424"""
     25
     26
     27import logging, logging.config
     28logger = logging.getLogger('advection')
     29logger.setLevel(logging.WARNING)
     30
     31try:
     32    logging.config.fileConfig('log.ini')
     33except:
     34    pass
     35
    2536
    2637from realtime_visualisation_new import Visualiser
     
    5263        self.smooth = True
    5364
    54     def initialise_visualiser(self,scale_z=1.0):
     65    def initialise_visualiser(self,scale_z=1.0,rect=None):
    5566        #Realtime visualisation
    5667        if self.visualiser is None:
    57             self.visualiser = Visualiser(self,scale_z)
     68            self.visualiser = Visualiser(self,scale_z,rect)
    5869        self.visualise = True
    5970
     
    297308        """
    298309
     310        logger.debug('Trying to weave compute_fluxes')
    299311        weave.inline(code, ['stage_edge','stage_bdry','stage_update',
    300312                             'neighbours','neighbour_edges','normals',
  • inundation/ga/storm_surge/parallel/build_local.py

    r1500 r1510  
    11#########################################################
    2 #   
     2#
    33#  Given the subdivision of the grid assigned to the
    44# current processor convert it into a form that is
    5 # appropriate for the GA datastructure. 
    6 # 
     5# appropriate for the GA datastructure.
     6#
    77#  The main function of these modules is to change the
    88# node numbering. The GA datastructure assumes they
     
    3838
    3939def build_local_GA(nodes, triangles):
    40    
     40
    4141    Nnodes =len(nodes)
    4242    Ntriangles = len(triangles)
    43    
     43
    4444    index={} #a dictionary mapping existing node ids to the new ids 0,1,2,...
    4545
     
    5151        GAnodes.append(nodes[node_idnew][1:3])
    5252        nodes[node_idnew][0]=node_idnew #renumber the node
    53        
    54     #Now loop over the triangles, changing the node ids and orientation. 
     53
     54    #Now loop over the triangles, changing the node ids and orientation.
    5555    for t in range(Ntriangles):
    5656        for i in range(3):
     
    5959
    6060    del (index)
    61    
     61
    6262    return GAnodes, triangles
    6363
     
    9292
    9393    # initialise
    94    
     94
    9595    full_send = {}
    9696    ghost_recv = {}
     
    9898    # build the ghost_recv dictionary (sort the
    9999    # information by the global numbering)
    100    
     100
    101101    ghostc.sort(sort_tup)
    102102    for c in ghostc:
     
    113113    # (this version allows the information to be stored
    114114    # by the global numbering)
    115    
     115
    116116    tmp_send = {}
    117117    for global_id in fullc:
     
    124124    # extract the full send information and put it in the form
    125125    # required for the full_send dictionary
    126    
     126
    127127    for neigh in tmp_send:
    128128        neigh_commun = tmp_send[neigh]
     
    137137            full_send[neigh][2].append(0.0)
    138138
     139
     140    # parallel advection expects numeric arrays
     141    for key in full_send:
     142        full_send[key][0] = array(full_send[key][0],Int)
     143        full_send[key][1] = array(full_send[key][1],Int)
     144        full_send[key][2] = array(full_send[key][2],Float)
     145
     146    for key in ghost_recv:
     147        ghost_recv[key][0] = array(ghost_recv[key][0],Int)
     148        ghost_recv[key][1] = array(ghost_recv[key][1],Int)
     149        ghost_recv[key][2] = array(ghost_recv[key][2],Float)
     150
     151
    139152    return ghost_recv, full_send
    140153
     
    147160# *) Change the nodes global ID's to an integer value,
    148161# starting from 0. The node numbering in the triangles
    149 # must also be updated to take this into accound. 
     162# must also be updated to take this into accound.
    150163#
    151164# *) The triangle number will also change, which affects
     
    163176
    164177    # combine the full nodes and ghost nodes
    165    
     178
    166179    nodes = submesh["full_nodes"]
    167180    nodes.extend(submesh["ghost_nodes"])
    168181
    169182    # combine the full triangles and ghost triangles
    170    
     183
    171184    triangles = submesh["full_triangles"]
    172185    triangles.extend(map(lambda t: t[1], submesh["ghost_triangles"]))
     
    174187    # renumber the boundary edges to correspond to the new
    175188    # triangle numbering
    176    
     189
    177190    GAboundary = {}
    178191    for b in submesh["full_boundary"]:
     
    180193
    181194    # make note of the new triangle numbers, including the ghost
    182     # triangles 
    183    
     195    # triangles
     196
    184197    index = {}
    185198    for i in range(lower_t, upper_t):
     
    190203    # change the node numbering (and update the numbering in the
    191204    # triangles)
    192    
     205
    193206    [GAnodes, GAtriangles] = build_local_GA(nodes, triangles)
    194207
    195208    # change the communication pattern into a form needed by
    196209    # the parallel_advection.py file
    197    
     210
    198211    gcommun = submesh["ghost_commun"]
    199212    fcommun = submesh["full_commun"]
     
    201214
    202215    # clean up before exiting
    203    
     216
    204217    del(index)
    205    
     218
    206219    return GAnodes, GAtriangles, GAboundary, ghost_rec, full_send
  • inundation/ga/storm_surge/parallel/parallel_advection.py

    r1500 r1510  
    1414"""
    1515
     16import logging, logging.config
     17logger = logging.getLogger('parallel')
     18logger.setLevel(logging.WARNING)
     19
     20try:
     21    logging.config.fileConfig('log.ini')
     22except:
     23    pass
     24
    1625from advection import *
    1726Advection_Domain = Domain
     
    4150
    4251        self.full_send_dict  = full_send_dict
     52#        for key in self.full_send_dict:
     53#            self.full_send_dict[key][0] = array(self.full_send_dict[key][0],Int)
     54#            self.full_send_dict[key][2] = array(self.full_send_dict[key][2],Float)
     55
     56
    4357        self.ghost_recv_dict = ghost_recv_dict
     58#        for key in self.ghost_recv_dict:
     59#            self.ghost_recv_dict[key][0] = array(self.ghost_recv_dict[key][0],Int)
     60#            self.ghost_recv_dict[key][2] = array(self.ghost_recv_dict[key][2],Float)
    4461
    4562        self.communication_time = 0.0
     
    6178        # Calculate local timestep
    6279        Advection_Domain.update_timestep(self, yieldstep, finaltime)
    63        
     80
    6481        import time
    6582        t0 = time.time()
     
    7289        gtimestep = zeros( 1, Float) # Buffer for results
    7390
    74        
     91
    7592        #LINDA
    7693        pypar.raw_reduce(ltimestep, gtimestep, pypar.MIN, 0)
     
    99116        import time
    100117        t0 = time.time()
    101    
     118
    102119        stage_cv = self.quantities['stage'].centroid_values
    103        
     120
    104121        # update of non-local ghost cells
    105122        for iproc in range(self.numproc):
     
    113130                        Idf  = self.full_send_dict[send_proc][0]
    114131                        Xout = self.full_send_dict[send_proc][2]
    115                         #Xout = self.full_send_dict[send_proc][1]
     132
    116133                        N = len(Xout)
    117134
    118 #                        for i in range(N):
    119 #                            Xout[i] = stage_cv[Idf[i]]
    120                        
    121 #                        pypar.send(Xout,send_proc)
    122 
    123 #                        return
    124 
    125 #                        """
    126 #                        ==============================
     135
     136                        #==============================
    127137                        # Original python Code
    128138                        for i in range(N):
    129139                            Xout[i] = stage_cv[Idf[i]]
    130 #                        ==============================
    131 #                        """
     140                        #==============================
     141
    132142
    133143                        #LINDA:
    134144                        #could not get the code below to work, kept on complaining about error: no match for call to `(py::list) (int&)'
    135145
    136 #                        code1 = """
    137 #                        for (int i=0; i<N ; i++){
    138 #                            Xout(i) = stage_cv(Idf(i));
    139 #                        }
    140 #                        """
    141 #                        weave.inline(code1, ['stage_cv','Idf','Xout','N'],
    142 #                                     type_converters = converters.blitz, compiler='gcc');
     146                        code1 = """
     147                        for (int i=0; i<N ; i++){
     148                            Xout(i) = stage_cv(Idf(i));
     149                        }
     150                        """
     151                        #weave.inline(code1, ['stage_cv','Idf','Xout','N'],
     152                        #             type_converters = converters.blitz, compiler='gcc');
    143153
    144154                        pypar.send(Xout,send_proc)
     
    148158                #Receive data from the iproc processor
    149159                if  self.ghost_recv_dict.has_key(iproc):
    150                    
     160
    151161                    # LINDA:
    152                     # now store ghost as local id, global id, value           
     162                    # now store ghost as local id, global id, value
    153163                    Idg = self.ghost_recv_dict[iproc][0]
    154164                    X = self.ghost_recv_dict[iproc][2]
    155                     #X   = self.ghost_recv_dict[iproc][1]
    156165
    157166                    X = pypar.receive(iproc,X)
     
    159168
    160169                    #LINDA: had problems getting C code to work
    161                    
    162 #                    """
    163 #                    ===========================
     170
     171
     172                    #===========================
    164173                    # Origin Python Code
    165174                    for i in range(N):
    166175                        stage_cv[Idg[i]] = X[i]
    167 #                    ===========================
    168 #                    """
    169 
    170 #                    code2 = """
    171 #                    for (int i=0; i<N; i++){
    172 #                        stage_cv(Idg(i)) = X(i);
    173 #                    }
    174 #                    """
     176                    #===========================
     177
     178
     179                    code2 = """
     180                    for (int i=0; i<N; i++){
     181                        stage_cv(Idg(i)) = X(i);
     182                    }
     183                    """
    175184#                    weave.inline(code2, ['stage_cv','Idg','X','N'],
    176185#                                 type_converters = converters.blitz, compiler='gcc');
    177                    
     186
    178187        #local update of ghost cells
    179188        iproc = self.processor
     
    183192            # now store full as local id, global id, value
    184193            Idf  = self.full_send_dict[iproc][0]
    185            
     194
    186195            # LINDA:
    187196            # now store ghost as local id, global id, value
    188197            Idg = self.ghost_recv_dict[iproc][0]
    189            
     198
    190199            N = len(Idg)
    191200
    192             """
     201
    193202            #======================================
    194203            # Original python loop
     
    197206                stage_cv[Idg[i]] = stage_cv[Idf[i]]
    198207            #======================================
    199             """
     208
    200209
    201210            code3 = """
     
    204213            }
    205214            """
    206             weave.inline(code3, ['stage_cv','Idg','Idf','N'],
    207                                  type_converters = converters.blitz, compiler='gcc');
     215            #weave.inline(code3, ['stage_cv','Idg','Idf','N'],
     216            #                     type_converters = converters.blitz, compiler='gcc');
    208217
    209218        self.communication_time += time.time()-t0
     
    346355
    347356
    348 def parallel_rectangular(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):
    349 
    350 
    351     """Setup a rectangular grid of triangles
    352     with m+1 by n+1 grid points
    353     and side lengths len1, len2. If side lengths are omitted
    354     the mesh defaults to the unit square, divided between all the
    355     processors
    356 
    357     len1: x direction (left to right)
    358     len2: y direction (bottom to top)
    359     """
    360 
    361     from config import epsilon
    362     from Numeric import zeros, Float, Int
    363 
    364     processor = pypar.rank()
    365     numproc   = pypar.size()
    366 
    367 
    368 
    369     delta1 = float(len1)/m
    370     delta2 = float(len2)/n
    371 
    372     #Calculate number of points
    373     Np = (m+1)*(n+1)
    374 
    375     class VIndex:
    376 
    377         def __init__(self, n,m):
    378             self.n = n
    379             self.m = m
    380 
    381         def __call__(self, i,j):
    382             return j+i*(self.n+1)
    383 
    384     class EIndex:
    385 
    386         def __init__(self, n,m):
    387             self.n = n
    388             self.m = m
    389 
    390         def __call__(self, i,j):
    391             return 2*(j+i*self.n)
    392 
    393 
    394     I = VIndex(n,m)
    395     E = EIndex(n,m)
    396 
    397     points = zeros( (Np,2), Float)
    398 
    399     for i in range(m+1):
    400         for j in range(n+1):
    401 
    402             points[I(i,j),:] = [i*delta1 + origin[0], j*delta2 + origin[1]]
    403 
    404     #Construct 2 triangles per rectangular element and assign tags to boundary
    405     #Calculate number of triangles
    406     Nt = 2*m*n
    407 
    408 
    409     elements = zeros( (Nt,3), Int)
    410     boundary = {}
    411     Idgl = []
    412     Xgl  = []
    413     Idfl = []
    414     Xfl  = []
    415     Idgr = []
    416     Xgr  = []
    417     Idfr = []
    418     Xfr  = []
    419 
    420     full_send_dict = {}
    421     ghost_recv_dict = {}
    422     nt = -1
    423     for i in range(m):
    424         for j in range(n):
    425 
    426             i1 = I(i,j+1)
    427             i2 = I(i,j)
    428             i3 = I(i+1,j+1)
    429             i4 = I(i+1,j)
    430 
    431             #Lower Element
    432             nt = E(i,j)
    433             if i == m-1:
    434                 #print 'nt =',nt
    435                 Idgr.append(nt)
    436                 Idfr.append(E(1,j))
    437             if i == 0:
    438                 Idgl.append(nt)
    439                 Idfl.append(E(m-2,j))
    440 
    441             if i == m-1:
    442                 boundary[nt, 2] = 'right'
    443             if j == 0:
    444                 boundary[nt, 1] = 'bottom'
    445             elements[nt,:] = [i4,i3,i2]
    446 
    447             #Upper Element
    448             nt = E(i,j)+1
    449             if i == m-1:
    450                 Idgr.append(nt)
    451                 Idfr.append(E(1,j)+1)
    452             if i == 0:
    453                 Idgl.append(nt)
    454                 Idfl.append(E(m-2,j)+1)
    455 
    456             if i == 0:
    457                 boundary[nt, 2] = 'left'
    458             if j == n-1:
    459                 boundary[nt, 1] = 'top'
    460             elements[nt,:] = [i1,i2,i3]
    461 
    462     Idfl = array(Idfl,Int)
    463     Idgl = array(Idgl,Int)
    464     Xfl  = zeros(Idfl.shape,Float)
    465     Xgl  = zeros(Idgl.shape,Float)
    466 
    467     Idfr = array(Idfr,Int)
    468     Idgr = array(Idgr,Int)
    469     Xfr  = zeros(Idfr.shape,Float)
    470     Xgr  = zeros(Idgr.shape,Float)
    471 
    472     #print Idf
    473     #print Idg
    474     full_send_dict[(processor-1)%numproc]  = [Idfl, Xfl]
    475     ghost_recv_dict[(processor-1)%numproc] = [Idgl, Xgl]
    476     full_send_dict[(processor+1)%numproc]  = [Idfr, Xfr]
    477     ghost_recv_dict[(processor+1)%numproc] = [Idgr, Xgr]
    478 
    479     return  points, elements, boundary, full_send_dict, ghost_recv_dict
    480 
    481 
    482 
    483 def rectangular_periodic(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):
    484 
    485 
    486     """Setup a rectangular grid of triangles
    487     with m+1 by n+1 grid points
    488     and side lengths len1, len2. If side lengths are omitted
    489     the mesh defaults to the unit square.
    490 
    491     len1: x direction (left to right)
    492     len2: y direction (bottom to top)
    493 
    494     Return to lists: points and elements suitable for creating a Mesh or
    495     FVMesh object, e.g. Mesh(points, elements)
    496     """
    497 
    498     from config import epsilon
    499     from Numeric import zeros, Float, Int
    500 
    501     delta1 = float(len1)/m
    502     delta2 = float(len2)/n
    503 
    504     #Calculate number of points
    505     Np = (m+1)*(n+1)
    506 
    507     class VIndex:
    508 
    509         def __init__(self, n,m):
    510             self.n = n
    511             self.m = m
    512 
    513         def __call__(self, i,j):
    514             return j+i*(self.n+1)
    515 
    516     class EIndex:
    517 
    518         def __init__(self, n,m):
    519             self.n = n
    520             self.m = m
    521 
    522         def __call__(self, i,j):
    523             return 2*(j+i*self.n)
    524 
    525 
    526     I = VIndex(n,m)
    527     E = EIndex(n,m)
    528 
    529     points = zeros( (Np,2), Float)
    530 
    531     for i in range(m+1):
    532         for j in range(n+1):
    533 
    534             points[I(i,j),:] = [i*delta1 + origin[0], j*delta2 + origin[1]]
    535 
    536     #Construct 2 triangles per rectangular element and assign tags to boundary
    537     #Calculate number of triangles
    538     Nt = 2*m*n
    539 
    540 
    541     elements = zeros( (Nt,3), Int)
    542     boundary = {}
    543     ghosts = {}
    544     nt = -1
    545     for i in range(m):
    546         for j in range(n):
    547 
    548             i1 = I(i,j+1)
    549             i2 = I(i,j)
    550             i3 = I(i+1,j+1)
    551             i4 = I(i+1,j)
    552 
    553             #Lower Element
    554             nt = E(i,j)
    555             if i == m-1:
    556                 ghosts[nt] = E(1,j)
    557             if i == 0:
    558                 ghosts[nt] = E(m-2,j)
    559 
    560             if j == n-1:
    561                 ghosts[nt] = E(i,1)
    562 
    563             if j == 0:
    564                 ghosts[nt] = E(i,n-2)
    565 
    566             if i == m-1:
    567                 boundary[nt, 2] = 'right'
    568             if j == 0:
    569                 boundary[nt, 1] = 'bottom'
    570             elements[nt,:] = [i4,i3,i2]
    571 
    572             #Upper Element
    573             nt = E(i,j)+1
    574             if i == m-1:
    575                 ghosts[nt] = E(1,j)+1
    576             if i == 0:
    577                 ghosts[nt] = E(m-2,j)+1
    578 
    579             if j == n-1:
    580                 ghosts[nt] = E(i,1)+1
    581 
    582             if j == 0:
    583                 ghosts[nt] = E(i,n-2)+1
    584 
    585             if i == 0:
    586                 boundary[nt, 2] = 'left'
    587             if j == n-1:
    588                 boundary[nt, 1] = 'top'
    589             elements[nt,:] = [i1,i2,i3]
    590 
    591     #bottom left
    592     nt = E(0,0)
    593     nf = E(m-2,n-2)
    594     ghosts[nt]   = nf
    595     ghosts[nt+1] = nf+1
    596 
    597     #bottom right
    598     nt = E(m-1,0)
    599     nf = E(1,n-2)
    600     ghosts[nt]   = nf
    601     ghosts[nt+1] = nf+1
    602 
    603     #top left
    604     nt = E(0,n-1)
    605     nf = E(m-2,1)
    606     ghosts[nt]   = nf
    607     ghosts[nt+1] = nf+1
    608 
    609     #top right
    610     nt = E(m-1,n-1)
    611     nf = E(1,1)
    612     ghosts[nt]   = nf
    613     ghosts[nt+1] = nf+1
    614 
    615     return points, elements, boundary, ghosts
    616 
    617 def rectangular_periodic_lr(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):
    618 
    619 
    620     """Setup a rectangular grid of triangles
    621     with m+1 by n+1 grid points
    622     and side lengths len1, len2. If side lengths are omitted
    623     the mesh defaults to the unit square.
    624 
    625     len1: x direction (left to right)
    626     len2: y direction (bottom to top)
    627 
    628     Return to lists: points and elements suitable for creating a Mesh or
    629     Domain object, e.g. Mesh(points, elements)
    630     """
    631 
    632     from config import epsilon
    633     from Numeric import zeros, Float, Int
    634 
    635     delta1 = float(len1)/m
    636     delta2 = float(len2)/n
    637 
    638     #Calculate number of points
    639     Np = (m+1)*(n+1)
    640 
    641     class VIndex:
    642 
    643         def __init__(self, n,m):
    644             self.n = n
    645             self.m = m
    646 
    647         def __call__(self, i,j):
    648             return j+i*(self.n+1)
    649 
    650     class EIndex:
    651 
    652         def __init__(self, n,m):
    653             self.n = n
    654             self.m = m
    655 
    656         def __call__(self, i,j):
    657             return 2*(j+i*self.n)
    658 
    659 
    660     I = VIndex(n,m)
    661     E = EIndex(n,m)
    662 
    663     points = zeros( (Np,2), Float)
    664 
    665     for i in range(m+1):
    666         for j in range(n+1):
    667 
    668             points[I(i,j),:] = [i*delta1 + origin[0], j*delta2 + origin[1]]
    669 
    670     #Construct 2 triangles per rectangular element and assign tags to boundary
    671     #Calculate number of triangles
    672     Nt = 2*m*n
    673 
    674 
    675     elements = zeros( (Nt,3), Int)
    676     boundary = {}
    677     ghosts = {}
    678     nt = -1
    679     for i in range(m):
    680         for j in range(n):
    681 
    682             i1 = I(i,j+1)
    683             i2 = I(i,j)
    684             i3 = I(i+1,j+1)
    685             i4 = I(i+1,j)
    686 
    687             #Lower Element
    688             nt = E(i,j)
    689             if i == m-1:
    690                 ghosts[nt] = E(1,j)
    691             if i == 0:
    692                 ghosts[nt] = E(m-2,j)
    693 
    694             if i == m-1:
    695                 boundary[nt, 2] = 'right'
    696             if j == 0:
    697                 boundary[nt, 1] = 'bottom'
    698             elements[nt,:] = [i4,i3,i2]
    699 
    700             #Upper Element
    701             nt = E(i,j)+1
    702             if i == m-1:
    703                 ghosts[nt] = E(1,j)+1
    704             if i == 0:
    705                 ghosts[nt] = E(m-2,j)+1
    706 
    707             if i == 0:
    708                 boundary[nt, 2] = 'left'
    709             if j == n-1:
    710                 boundary[nt, 1] = 'top'
    711             elements[nt,:] = [i1,i2,i3]
    712 
    713 
    714     return points, elements, boundary, ghosts
  • inundation/ga/storm_surge/parallel/parallel_meshes.py

    r1461 r1510  
    174174        Xgr  = zeros(Idgr.shape,Float)
    175175
    176         full_send_dict[(processor-1)%numproc]  = [Idfl, Xfl]
    177         ghost_recv_dict[(processor-1)%numproc] = [Idgl, Xgl]
    178         full_send_dict[(processor+1)%numproc]  = [Idfr, Xfr]
    179         ghost_recv_dict[(processor+1)%numproc] = [Idgr, Xgr]
     176        full_send_dict[(processor-1)%numproc]  = [Idfl, Idfl, Xfl]
     177        ghost_recv_dict[(processor-1)%numproc] = [Idgl, Idgl, Xgl]
     178        full_send_dict[(processor+1)%numproc]  = [Idfr, Idfr, Xfr]
     179        ghost_recv_dict[(processor+1)%numproc] = [Idgr, Idgr, Xgr]
    180180
    181181    return  points, elements, boundary, full_send_dict, ghost_recv_dict
  • inundation/ga/storm_surge/parallel/run_parallel_mesh.py

    r1500 r1510  
    11#!/usr/bin/env python
    22#########################################################
    3 #   
     3#
    44#  Main file for parallel mesh testing.
    55#
     
    1212# required to build the grid, i.e. a higher number
    1313# corresponds to a finer grid. The term infront of the c
    14 # corresponds to the number of processors. 
     14# corresponds to the number of processors.
    1515#
    1616# *) The (new) files that have been added to manage the
     
    4444#
    4545#
    46 # 
     46#
    4747#########################################################
    4848
     
    9999
    100100    # read in the test files
    101    
    102     f=open('test_5l_4c.out', 'r')
     101
     102    f=open('test_3l_1c.out', 'r')
    103103    [nodes, triangles, boundary, triangles_per_proc] = mg2ga(f)
    104104
    105105    # subdivide the mesh
    106    
     106
    107107    submesh = build_submesh(nodes, triangles, boundary, triangles_per_proc)
    108108
    109109    # send the mesh partition to the appropriate processor
    110    
     110
    111111    for p in range(numprocs):
    112112      send_submesh(submesh, triangles_per_proc, tagmap, p)
     
    125125# start the initialisation routines
    126126
     127#rect = [ 0.0, 0.0, 1.0, 1.0]
    127128domain.initialise_visualiser()
    128 #domain.visualise=False
    129  
     129#domain.visualise=True
     130
    130131#Boundaries
    131132
     
    155156    import time
    156157    t0 = time.time()
     158
     159
    157160for t in domain.evolve(yieldstep = 0.1, finaltime = 2.0):
    158161    if myid == 0:
    159       domain.write_time()
     162        domain.write_time()
     163
     164
    160165if myid == 0:
    161166    print 'That took %.2f seconds' %(time.time()-t0)
     
    163168    print 'Reduction Communication time %.2f seconds'%domain.communication_reduce_time
    164169
    165  
     170
    166171print "`````````````````````````````"
    167172pypar.finalize()
  • inundation/ga/storm_surge/pyvolution/netherlands.py

    r1404 r1510  
    117117    domain.filename, _ = os.path.splitext(base)
    118118else:
    119     domain.visualise = True
     119    domain.initialise_visualiser(rect=[0.0,0.0,2.0,2.0])
    120120    domain.visualise_color_stage = False
    121121    domain.visualise_timer = True
    122122    domain.checkpoint = False
    123123    domain.store = False
     124
    124125
    125126
  • inundation/ga/storm_surge/pyvolution/realtime_visualisation_new.py

    r1471 r1510  
    99class Visualiser:
    1010
    11     def __init__(self,domain,scale_z=1.0):
     11    def __init__(self,domain,scale_z=1.0,rect=None):
    1212        """Create visualisation of domain
    1313        """
     
    2929        #print self.z_models
    3030
    31         self.max_x = max(max(self.vertices[:,0]),max(self.vertices[:,2]),max(self.vertices[:,4]))
    32         self.min_x = min(min(self.vertices[:,0]),min(self.vertices[:,2]),min(self.vertices[:,4]))
    33         self.max_y = max(max(self.vertices[:,1]),max(self.vertices[:,3]),max(self.vertices[:,5]))
    34         self.min_y = min(min(self.vertices[:,1]),min(self.vertices[:,3]),min(self.vertices[:,5]))
    35         self.range_x = self.max_x - self.min_x
    36         self.range_y = self.max_y - self.min_y
    37         self.range_xy = max(self.range_x, self.range_y)
     31        if rect is None:
     32            self.max_x = max(max(self.vertices[:,0]),max(self.vertices[:,2]),max(self.vertices[:,4]))
     33            self.min_x = min(min(self.vertices[:,0]),min(self.vertices[:,2]),min(self.vertices[:,4]))
     34            self.max_y = max(max(self.vertices[:,1]),max(self.vertices[:,3]),max(self.vertices[:,5]))
     35            self.min_y = min(min(self.vertices[:,1]),min(self.vertices[:,3]),min(self.vertices[:,5]))
     36            self.range_x = self.max_x - self.min_x
     37            self.range_y = self.max_y - self.min_y
     38            self.range_xy = max(self.range_x, self.range_y)
     39        else:
     40            self.max_x = rect[2]
     41            self.min_x = rect[0]
     42            self.max_y = rect[3]
     43            self.min_y = rect[1]
     44            self.range_x = self.max_x - self.min_x
     45            self.range_y = self.max_y - self.min_y
     46            self.range_xy = max(self.range_x, self.range_y)
     47
    3848
    3949#        print 'min_x=',self.min_x
     
    211221
    212222
     223
    213224    def update_arrays_color(self,quantity,qcolor,scale_z):
    214225
     
    305316
    306317    code1 = """
     318
    307319        double s = 1.0;
    308320
  • inundation/ga/storm_surge/pyvolution/shallow_water.py

    r1509 r1510  
    108108        #self.eta = self.quantities['friction']
    109109
    110     def initialise_visualiser(self,scale_z=1.0):
     110    def initialise_visualiser(self,scale_z=1.0,rect=None):
    111111        #Realtime visualisation
    112112        if self.visualiser is None:
    113             from realtime_visualisation_new import Visualiser           
    114             self.visualiser = Visualiser(self,scale_z)
     113            from realtime_visualisation_new import Visualiser
     114            self.visualiser = Visualiser(self,scale_z,rect)
    115115        self.visualise = True
    116116
     
    204204        if self.visualise is True and self.time == 0.0:
    205205            import realtime_visualisation_new as visualise
    206             #import realtime_visualisation as visualise           
     206            #import realtime_visualisation as visualise
    207207            visualise.create_surface(self)
    208208
  • inundation/ga/storm_surge/zeus/parallel.zpi

    r1472 r1510  
    7474    <ReleaseProjectReload>Off</ReleaseProjectReload>
    7575    <file>..\parallel\advection.py</file>
     76    <file>..\parallel\build_commun.py</file>
     77    <file>..\parallel\build_local.py</file>
     78    <file>..\parallel\build_submesh.py</file>
    7679    <file>..\parallel\linda_dummy.py</file>
    7780    <file>..\parallel\mg2ga.py</file>
     
    8083    <file>..\parallel\run_advection.py</file>
    8184    <file>..\parallel\run_parallel_advection.py</file>
     85    <file>..\parallel\run_parallel_mesh.py</file>
    8286    <file>..\parallel\test_advection.py</file>
    8387    <folder name="Header Files" />
Note: See TracChangeset for help on using the changeset viewer.