# Changeset 7105

Ignore:
Timestamp:
May 27, 2009, 4:25:47 PM (14 years ago)
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

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

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

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

 r7012 range = fid.variables['xmomentum_range'][:] ##print range #print range assert num.allclose(range,[0,0.4695096]) or \ num.allclose(range,[0,0.47790655]) or\ num.allclose(range,[0,0.46941957]) or\ num.allclose(range,[0,0.47769409]) num.allclose(range,[0,0.47769409]) or\ num.allclose(range,[0,0.47738948]) range = fid.variables['ymomentum_range'][:] ##print range #print range assert num.allclose(range,[0,0.02174380]) or\ num.allclose(range,[0,0.02174439]) or\ num.allclose(range,[0,0.02283983]) or\ num.allclose(range,[0,0.0217342]) or\ num.allclose(range,[0,0.0227564]) # Old slope limiters num.allclose(range,[0,0.02258024]) or\ num.allclose(range,[0,0.0227564]) # Old slope limiters fid.close() extrema = fid.variables['xmomentum.extrema'][:] assert num.allclose(extrema,[-0.06062178, 0.47873023]) or num.allclose(extrema, [-0.06062178, 0.47847986]) assert num.allclose(extrema,[-0.06062178, 0.47873023]) or\ num.allclose(extrema, [-0.06062178, 0.47847986]) or\ num.allclose(extrema, [-0.06062178, 0.47848481]) # 27/5/9 extrema = fid.variables['ymomentum.extrema'][:] for t in range(t_end+1): for i in range(3): assert num.allclose(f(t, i), [1, 2, 0]) assert num.allclose(f(t, i), [1, 2, 0], atol=1.0e-6) #print i, Q assert num.allclose(Q, 0) assert num.allclose(Q, 0, atol=1.0e-5) for i in range(3): #print i, t, f(t, i) assert num.allclose(f(t, i), [w, uh, 0]) assert num.allclose(f(t, i), [w, uh, 0], atol=1.0e-6) for i in range(3): #print i, t, f(t, i) assert num.allclose(f(t, i), [w, uh, 0]) assert num.allclose(f(t, i), [w, uh, 0], atol=1.0e-6)
• ## anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

 r7090 assert num.allclose(w_t, w) assert num.allclose(uh_t, uh) assert num.allclose(vh_t, 0.0) assert num.allclose(vh_t, 0.0, atol=1.0e-6) assert num.allclose(w_t, w) assert num.allclose(uh_t, uh) assert num.allclose(vh_t, 0.0) assert num.allclose(vh_t, 0.0, atol=1.0e-6)
Note: See TracChangeset for help on using the changeset viewer.