source: trunk/anuga_core/source/anuga_parallel/parallel_shallow_water.py @ 8114

Last change on this file since 8114 was 8114, checked in by jakeman, 13 years ago

jakeman: fixed parallel version so that it can be run using a file_boundary based upon an .sts file. Added the unit test - test_parallel_file_boundary.py

File size: 2.1 KB
Line 
1"""Class Parallel_shallow_water_domain -
22D triangular domains for finite-volume computations of
3the shallow water equation, with extra structures to allow
4communication between other Parallel_domains and itself
5
6This module contains a specialisation of class Domain
7from module shallow_water.py
8
9Ole Nielsen, Stephen Roberts, Duncan Gray, Christopher Zoppou
10Geoscience Australia, 2004-2005
11
12"""
13
14from anuga import Domain
15
16from anuga_parallel.parallel_generic_communications import *
17
18import numpy as num
19
20
21
22class Parallel_domain(Domain):
23
24    def __init__(self, coordinates, vertices,
25                 boundary=None,
26                 full_send_dict=None,
27                 ghost_recv_dict=None,
28                 number_of_full_nodes=None,
29                 number_of_full_triangles=None,
30                 geo_reference=None): #jj added this
31
32        Domain.__init__(self,
33                        coordinates,
34                        vertices,
35                        boundary,
36                        full_send_dict=full_send_dict,
37                        ghost_recv_dict=ghost_recv_dict,
38                        processor=pypar.rank(),
39                        numproc=pypar.size(),
40                        number_of_full_nodes=number_of_full_nodes,
41                        number_of_full_triangles=number_of_full_triangles,
42                        geo_reference=geo_reference) #jj added this
43
44 
45        setup_buffers(self)
46
47
48    def set_name(self, name):
49        """Assign name based on processor number
50        """
51
52        if name.endswith('.sww'):
53            name = name[:-4]
54
55        # Call parents method with processor number attached.
56        Domain.set_name(self, name + '_P%d_%d' %(self.processor, self.numproc))
57
58
59    def update_timestep(self, yieldstep, finaltime):
60        """Calculate local timestep
61        """
62
63        communicate_flux_timestep(self, yieldstep, finaltime)
64
65        Domain.update_timestep(self, yieldstep, finaltime)
66
67
68    def update_ghosts(self):
69
70        # We must send the information from the full cells and
71        # receive the information for the ghost cells
72
73
74        communicate_ghosts(self)
Note: See TracBrowser for help on using the repository browser.