Ignore:
Timestamp:
Jun 9, 2005, 3:37:55 PM (19 years ago)
Author:
matthew
Message:

To avoid computing the flux function at each internal edge twice, we now call the C implementation of compute_fluxes with the extra integer vector argument already_computed_flux. This is an array of dimension (N,3) in python (or 3N in C) and thus each entry corresponds to a triangle-edge pair. If triangle t has neighbour n across its i-th edge, and this edge is the m-th edge of triangle n, then we update this edge's flux contribution to explicit_update for both triangle n and triangle t. Both corresponding entries of already_computed_flux will be incremented so that, when we come to edge m of triangle n, we know that the update across this edge has already been done.
The array already_computed_flux is defined and initialised to zero in domain.py.

For run_profile.py, with N=128, the version of compute_fluxes in which each edge was computed twice consumed 13.64 seconds (averaged over 3 runs). By keeping track of which edges have been computed, compute_fluxes now consumes 8.68 seconds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/shallow_water.py

    r1507 r1508  
    543543                                     Stage.explicit_update,
    544544                                     Xmom.explicit_update,
    545                                      Ymom.explicit_update)
     545                                     Ymom.explicit_update,
     546                                     domain.already_computed_flux)
    546547
    547548
Note: See TracChangeset for help on using the changeset viewer.