Changeset 7105


Ignore:
Timestamp:
May 27, 2009, 4:25:47 PM (15 years ago)
Author:
ole
Message:

Optimised compute_fluxes by disabling limitation of momentum perpendicular to the x-axis. Speeds calculated from the x-momentum are still being limited according to the _compute_speeds. All tests pass and the overall improvement is as follows:
For the simple profile compute_fluxes improved from 4.284s to 3.372s and the overall runtime of evolve from 10.909s to 9.941s. This is an overall speedup of more than 8%.

For the okushiri profile example the improvement of compute_fluxes is from 129.432s to 111.703s and the overall runtime was reduced from 312.336s to 293.286s or about 6% improvement. This is probably the more realistic profile.

Location:
anuga_core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/documentation/user_manual/anuga_user_manual.tex

    r7086 r7105  
    33473347setting $h=H_0$ will scale the predicted speed by a factor of $0.5$:
    33483348\[
    3349   \left[ \frac{\mu}{h + h_0/h} \right]_{h = H_0} = \frac{\mu}{2 H_0}
     3349  \left[ \frac{\mu}{h + h_0/h} \right]_{h = H_0} =
     3350  \left[ \frac{\mu}{H_0 + H_0^2/H_0} \right] =
     3351  \frac{\mu}{2 H_0} = \frac{\mu}{2 h} = \frac{u}{2}
    33503352\]
    33513353In general, for multiples of the minimal depth $N H_0$ one obtains
  • anuga_core/source/anuga/shallow_water/shallow_water_ext.c

    r7097 r7105  
    180180 
    181181  if (*h < epsilon) {
    182     *h = 0.0;  //Could have been negative
     182    *h = 0.0;  // Could have been negative
    183183    u = 0.0;
    184184  } else {
     
    272272  double w_left, h_left, uh_left, vh_left, u_left;
    273273  double w_right, h_right, uh_right, vh_right, u_right;
    274   double v_left, v_right; 
     274  //double v_left, v_right; 
    275275  double s_min, s_max, soundspeed_left, soundspeed_right;
    276276  double denom, inverse_denominator, z;
     
    317317  vh_right = q_right_rotated[2];
    318318
    319   // Limit y-momentum if necessary 
    320   v_left = _compute_speed(&vh_left, &h_left, epsilon, h0);
    321   v_right = _compute_speed(&vh_right, &h_right, epsilon, h0);
     319  // Limit y-momentum if necessary
     320  // Leaving this out, improves speed significantly (Ole 27/5/2009)
     321  // All validation tests pass, so do we really need it anymore?
     322  //v_left = _compute_speed(&vh_left, &h_left, epsilon, h0);
     323  //v_right = _compute_speed(&vh_right, &h_right, epsilon, h0);
    322324
    323325  // Maximal and minimal wave speeds
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r7012 r7105  
    258258       
    259259        range = fid.variables['xmomentum_range'][:]
    260         ##print range
     260        #print range
    261261        assert num.allclose(range,[0,0.4695096]) or \
    262262               num.allclose(range,[0,0.47790655]) or\
    263263               num.allclose(range,[0,0.46941957]) or\
    264                num.allclose(range,[0,0.47769409])
     264               num.allclose(range,[0,0.47769409]) or\
     265               num.allclose(range,[0,0.47738948])
    265266
    266267       
    267268        range = fid.variables['ymomentum_range'][:]
    268         ##print range
     269        #print range
    269270        assert num.allclose(range,[0,0.02174380]) or\
    270271               num.allclose(range,[0,0.02174439]) or\
    271272               num.allclose(range,[0,0.02283983]) or\
    272273               num.allclose(range,[0,0.0217342]) or\
    273                num.allclose(range,[0,0.0227564]) # Old slope limiters
     274               num.allclose(range,[0,0.02258024]) or\
     275               num.allclose(range,[0,0.0227564]) # Old slope limiters
     276
    274277       
    275278        fid.close()
     
    343346
    344347        extrema = fid.variables['xmomentum.extrema'][:]
    345         assert num.allclose(extrema,[-0.06062178, 0.47873023]) or num.allclose(extrema, [-0.06062178, 0.47847986])
     348        assert num.allclose(extrema,[-0.06062178, 0.47873023]) or\
     349            num.allclose(extrema, [-0.06062178, 0.47847986]) or\
     350            num.allclose(extrema, [-0.06062178, 0.47848481]) # 27/5/9           
    346351       
    347352        extrema = fid.variables['ymomentum.extrema'][:]
     
    1108811093        for t in range(t_end+1):
    1108911094            for i in range(3):
    11090                 assert num.allclose(f(t, i), [1, 2, 0])
     11095                assert num.allclose(f(t, i), [1, 2, 0], atol=1.0e-6)
    1109111096           
    1109211097
     
    1112511130
    1112611131        #print i, Q
    11127         assert num.allclose(Q, 0)       
     11132        assert num.allclose(Q, 0, atol=1.0e-5)       
    1112811133
    1112911134
     
    1122211227            for i in range(3):
    1122311228                #print i, t, f(t, i)           
    11224                 assert num.allclose(f(t, i), [w, uh, 0])
     11229                assert num.allclose(f(t, i), [w, uh, 0], atol=1.0e-6)
    1122511230           
    1122611231
     
    1132211327            for i in range(3):
    1132311328                #print i, t, f(t, i)
    11324                 assert num.allclose(f(t, i), [w, uh, 0])
     11329                assert num.allclose(f(t, i), [w, uh, 0], atol=1.0e-6)
    1132511330           
    1132611331
  • anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

    r7090 r7105  
    16161616            assert num.allclose(w_t, w)
    16171617            assert num.allclose(uh_t, uh)           
    1618             assert num.allclose(vh_t, 0.0)                       
     1618            assert num.allclose(vh_t, 0.0, atol=1.0e-6)                       
    16191619           
    16201620           
     
    17121712            assert num.allclose(w_t, w)
    17131713            assert num.allclose(uh_t, uh)           
    1714             assert num.allclose(vh_t, 0.0)                       
     1714            assert num.allclose(vh_t, 0.0, atol=1.0e-6)                       
    17151715           
    17161716           
Note: See TracChangeset for help on using the changeset viewer.