Changeset 9216


Ignore:
Timestamp:
Jun 24, 2014, 10:48:53 AM (10 years ago)
Author:
steve
Message:

Moved cross sectional calculations to plot_results

Location:
trunk/anuga_core/validation_tests/analytical_exact/trapezoidal_channel
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/validation_tests/analytical_exact/trapezoidal_channel/numerical_channel_floodplain.py

    r9215 r9216  
    2020alg = args.alg
    2121
    22 
    23 floodplain_length = 800.0 # Model domain length
    24 floodplain_width = 14.0    # Model domain width
    25 floodplain_slope = 1./300.
    26 chan_initial_depth = 0.65  # Initial depth of water in the channel
    27 chan_bankfull_depth = 1.0  # Bankfull depth of the channel
    28 chan_width = 10.0          # Bankfull width of the channel
    29 bankwidth = 2.             # Width of the bank regions -- note that these protrude into the channel
    30 man_n=0.03                 # Manning's n
    31 l0 = 1.00 # Length scale associated with triangle side length in channel (min_triangle area = 0.5*l0^2)
     22from project import *
     23
     24# floodplain_length = 800.0 # Model domain length
     25# floodplain_width = 14.0    # Model domain width
     26# floodplain_slope = 1./300.
     27# chan_initial_depth = 0.65  # Initial depth of water in the channel
     28# chan_bankfull_depth = 1.0  # Bankfull depth of the channel
     29# chan_width = 10.0          # Bankfull width of the channel
     30# bankwidth = 2.             # Width of the bank regions -- note that these protrude into the channel
     31# man_n=0.03                 # Manning's n
     32# l0 = 1.00 # Length scale associated with triangle side length in channel (min_triangle area = 0.5*l0^2)
    3233
    3334assert chan_width < floodplain_width, \
     
    181182# Evolve system through time
    182183#------------------------------------------------------------------------------
    183 for t in domain.evolve(yieldstep=10.0, finaltime=500.0):
     184for t in domain.evolve(yieldstep=10.0, finaltime=1000.0):
    184185    if myid == 0 and verbose: print domain.timestepping_statistics()
    185186
  • trunk/anuga_core/validation_tests/analytical_exact/trapezoidal_channel/plot_results.py

    r9038 r9216  
    33import numpy
    44
     5from project import *
     6
     7filename = 'channel_floodplain.sww'
    58
    69# Time-index to plot outputs from
    7 p2 = util.get_output('channel_floodplain.sww')
     10p2 = util.get_output(filename)
    811p=util.get_centroids(p2, velocity_extrapolation=True)
    912v = (p.x>6.0)*(p.x<8.0)
     
    8891pyplot.plot(p.x[v1],Analytic_Stage,'o', label='analytical stage')
    8992pyplot.plot(p.x[v1],p.elev[v1],'o', label='bed elevation')
    90 pyplot.legend(loc=10)
     93pyplot.ylim([-4,2])
     94pyplot.legend(loc=8)
    9195pyplot.title('Velocity (analytical and numerical) and Stage:' + '\n' +'Downstream channel regions (95 to 105m)' +'\n')
    9296pyplot.xlabel('Cross-channel distance (m)')
     
    117121pyplot.plot(p.x[v1],Analytic_Stage,'o', label='analytical stage')
    118122pyplot.plot(p.x[v1],p.elev[v1],'o', label='bed elevation')
     123pyplot.ylim([-4,2])
    119124pyplot.legend(loc=10)
    120125pyplot.title('Velocity (analytical and numerical) and Stage:' + '\n' +'Central channel regions (495 to 505m)' +'\n')
     
    147152pyplot.plot(p.x[v1],Analytic_Stage,'o', label='analytical stage')
    148153pyplot.plot(p.x[v1],p.elev[v1],'o', label='bed elevation')
     154pyplot.ylim([-4,2])
    149155pyplot.legend(loc=10)
    150156pyplot.title('Velocity (analytical and numerical) and Stage:' + '\n' +'Downstream channel regions (695 to 705m)' +'\n')
     
    152158pyplot.ylabel('Generic scale (m or m/s)')
    153159pyplot.savefig('fig4downstream_channel.png')
     160
     161
     162
     163
     164
     165print '#======================================================================'
     166print '# Extract some cross section info'
     167print '#======================================================================'
     168
     169from anuga.shallow_water.sww_interrogate import get_flow_through_cross_section
     170
     171polyline0 = [ [floodplain_width, 10.0], [0., 10.0]]
     172polyline1 = [[floodplain_width, floodplain_length-300.0], [0., floodplain_length-300.0]]
     173polyline2 = [[floodplain_width, floodplain_length-1.0], [0., floodplain_length-1.0]]
     174       
     175time,Q0  = get_flow_through_cross_section(filename, polyline0, verbose=True)
     176time,Q1  = get_flow_through_cross_section(filename, polyline1, verbose=True)
     177time,Q2  = get_flow_through_cross_section(filename, polyline2, verbose=True)
     178
     179pyplot.figure(figsize=(12.,8.))
     180pyplot.plot(time, Q0, label='10m')
     181pyplot.plot(time, Q1, label='500m')
     182pyplot.plot(time, Q2, label='799m')
     183pyplot.plot([0,time[-1]], [Qin,Qin], label='Input Q')
     184pyplot.ylim([0,7])
     185pyplot.legend(loc=10)
     186pyplot.title('Cross sectional flow across transect at 10m, 500m and 799m')
     187pyplot.xlabel('Time (sec)')
     188pyplot.ylabel('Discharge (m^3/sec)')
     189pyplot.savefig('cross_section_10_500_790.png')
     190
     191
     192
     193
  • trunk/anuga_core/validation_tests/analytical_exact/trapezoidal_channel/produce_results.py

    r9117 r9216  
    1 #--------------------------------
    2 # import modules
    3 #--------------------------------
    4 from anuga.validation_utilities.fabricate import *
    5 from anuga.validation_utilities import run_validation_script
    6 from anuga.validation_utilities import typeset_report
    71
    8 # Setup the python scripts which produce the output for this
    9 # validation test
    10 def build():
    11     run_validation_script('numerical_channel_floodplain.py')
    12     run_validation_script('plot_results.py')
    13     typeset_report()
    142
    15 def clean():
    16     autoclean()
     3import anuga
     4from anuga.validation_utilities import produce_report
    175
    18 main()
     6args = anuga.get_args()
     7
     8produce_report('numerical_channel_floodplain.py', args=args)
     9
     10
  • trunk/anuga_core/validation_tests/analytical_exact/trapezoidal_channel/results.tex

    r9155 r9216  
    2727\end{figure}
    2828
    29 Table~\ref{tab:trapztab} shows the discharge computed at a number of cross-sections in the channel, at a number of time-steps on the way to near steady-state. By the end of the simulation they should all be essentially the same. Large variations may suggest mass conservation errors (small variations are probably due to the interpolation that occurs in the routine:
    30 \begin{equation*}
    31 \textrm{compute\_flow\_through\_cross\_section}.
    32 \end{equation*}
     29Figure~\ref{fig:hydrographs} show the hydrographs through various cross sections showing the flows limiting to the
     30expected inflow $Q$.
     31
     32\begin{figure}
     33\begin{center}
     34\includegraphics[width=\textwidth]{cross_section_10_500_790.png}
     35\caption{Hydrographs over a number of cross-sections.}
     36\label{fig:hydrographs}
     37\end{center}
     38\end{figure}
     39
     40%Table~\ref{tab:trapztab} shows the discharge computed at a number of cross-sections in the channel, at a number of time-steps on the way to near steady-state. By the end of the simulation they should all be essentially the same. Large variations may suggest mass conservation errors (small variations are probably due to the interpolation that occurs in the routine:
     41%\begin{equation*}
     42%\textrm{compute\_flow\_through\_cross\_section}.
     43%\end{equation*}
    3344
    3445
    35 \DTLloaddb{dischargeout}{../analytical_exact/trapezoidal_channel/discharge_outputs.txt}
     46%\DTLloaddb{dischargeout}{../analytical_exact/trapezoidal_channel/discharge_outputs.txt}
    3647%\DTLloaddb{dischargeout}{discharge_outputs.txt}
    37 \begin{table}
    38 \caption{Discharge through cross-sections at a number of $x$-position, at different instants in time}
    39 \label{tab:trapztab}
    40 \DTLdisplaydb{dischargeout}
    41 \end{table}
     48%\begin{table}
     49%\caption{Discharge through cross-sections at a number of $x$-position, at different instants in time}
     50%\label{tab:trapztab}
     51%\DTLdisplaydb{dischargeout}
     52%\end{table}
    4253
    4354\endinput
Note: See TracChangeset for help on using the changeset viewer.