Changeset 8552


Ignore:
Timestamp:
Sep 3, 2012, 8:29:56 PM (12 years ago)
Author:
steve
Message:

Sped up neighbour_mesh

Location:
trunk/anuga_core
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py

    r8550 r8552  
    333333
    334334        N = len(self) #Number of triangles
    335         for i in xrange(N):
    336             #Find all neighbouring volumes that are not boundaries
    337             for k in xrange(3):
    338                 if self.neighbours[i, k] < 0:
    339                     self.surrogate_neighbours[i, k] = i #Point this triangle
    340                 else:
    341                     self.surrogate_neighbours[i, k] = self.neighbours[i, k]
     335#        for i in xrange(N):
     336#            #Find all neighbouring volumes that are not boundaries
     337#            for k in xrange(3):
     338#                if self.neighbours[i, k] < 0:
     339#                    self.surrogate_neighbours[i, k] = i #Point this triangle
     340#                else:
     341#                    self.surrogate_neighbours[i, k] = self.neighbours[i, k]
     342
     343        tmp_range = num.arange(N)
     344        for k in xrange(3):
     345            self.surrogate_neighbours[:,k] = \
     346              num.where(self.neighbours[:,k]<0, tmp_range, self.neighbours[:, k])
    342347
    343348
  • trunk/anuga_core/validation_tests/Tests/Benchmarks/Okushiri/compare_timeseries_with_measures.py

    r8529 r8552  
    223223        ylabel('stage (m)')   
    224224        legend(('Observed', 'Modelled'), shadow=True, loc='upper left')
    225         savefig(name, dpi = 300)       
     225        #savefig(name, dpi = 300)
     226        savefig(name)
    226227
    227228
  • trunk/anuga_core/validation_tests/Tests/Benchmarks/Okushiri/results.tex

    r8468 r8552  
    3030\begin{center}
    3131\includegraphics[width=0.9\textwidth]{Boundary.png}
     32\end{center}
    3233\caption{Stage at boundary gauge}
    3334\label{okushiri:boundary}
    34 \end{center}
    3535\end{figure}
     36
     37
    3638
    3739\begin{figure}[h]
    3840\begin{center}
    3941\includegraphics[width=0.9\textwidth]{ch5.png}
     42\end{center}
    4043\caption{Stage at gauge station 5}
    4144\label{okushiri:ch:five}
    42 \end{center}
    4345\end{figure}
    4446
     
    4648\begin{center}
    4749\includegraphics[width=0.9\textwidth]{ch7.png}
     50\end{center}
    4851\caption{Stage at at gauge station 7}
    4952\label{okushiri:ch_seven}
    50 \end{center}
    5153\end{figure}
    5254
     
    5456\begin{center}
    5557\includegraphics[width=0.9\textwidth]{ch9.png}
     58\end{center}
    5659\caption{Stage at at gauge station 9}
    5760\label{okushiri:ch_nine}
    58 \end{center}
    5961\end{figure}
    6062
  • trunk/anuga_core/validation_tests/Tests/Simple/steep_slope/results.tex

    r8434 r8552  
    77\begin{figure}[h]
    88\begin{center}
    9 \includegraphics[width=0.9\textwidth]{final_depth_v2.png}
     9\includegraphics[width=0.8\textwidth]{final_depth_v2.png}
    1010\caption{Depth in the downstream direction}
    1111\label{depthdownchan}
     
    1717\begin{figure}[h]
    1818\begin{center}
    19 \includegraphics[width=0.9\textwidth]{x_velocity_v2.png}
     19\includegraphics[width=0.8\textwidth]{x_velocity_v2.png}
    2020\caption{x-velocity along the cross-section x=50 (i.e. a cross-section with constant bed elevation)}
    2121\label{xvelscrosschan}
     
    2525\begin{figure}[h]
    2626\begin{center}
    27 \includegraphics[width=0.9\textwidth]{y_velocity_v2.png}
     27\includegraphics[width=0.8\textwidth]{y_velocity_v2.png}
    2828\caption{y-velocity along the cross-section x=50 (i.e. a cross-section with constant bed elevation)}
    2929\label{yvelscroschan}
  • trunk/anuga_core/validation_tests/readme.txt

    r8529 r8552  
    1010to the parameters.py file. THis would usually mean changing the flow_algorithm
    1111parameter.
     12
     13You need to add the directory containing validation_tests to your PYTHONPATH
     14
     15Ie
     16
     17export PYTHONPATH=/home/steve/anuga_core:$PYTHONPATH
  • trunk/anuga_core/validation_tests/report.tex

    r8548 r8552  
    8181
    8282
    83 \section{Specifiying different algorithm}
    84 One  way to allow the system to run with different algorithms is to
    85 add the following
    86 into your run routines.
     83\section{Algorithm Parameters}
     84Parameters can be communicated from the \verb|parameters.py|
     85file in the \verb|validation_tests| directory.
     86
     87In particular the
     88values of \verb|alg| (flow algorithm) and \verb|cfl| (CFL Condition)
     89are passed as command options when calling \verb|produce_results.py| in the
     90test directories.
     91
     92You can pass though the parameters straight from the \verb|parameters.py| file as follows
    8793\begin{verbatim}
    88 #--------------------------------
    89 # Setup Default values for basic
    90 # algorithm parameters.
    91 #--------------------------------
    92 import argparse
    93 parser = argparse.ArgumentParser(description='produce results')
    94 parser.add_argument('-cfl', type=float, default=1.0,
    95                    help='cfl condition')
    96 parser.add_argument('-alg', type=str, default = "1_5",
    97                    help='flow algorithm')
    98 args = parser.parse_args()
    99 
    100 cfl = args.cfl
    101 alg = args.alg
     94from validation_tests.parameters import alg
     95from validation_tests.parameters import cfl
    10296\end{verbatim}
    10397
    104 Then in the \texttt{produce\_results.py} you can
     98\section{Generic form of \texttt{produce\_results.py}}
     99
     100The \texttt{produce\_results.py} files in the test directories should have the
     101following general form
     102
     103\begin{verbatim}
     104from fabricate import *
     105from validation_tests.utilities import run_validation_script
     106
     107# Setup the python scripts which produce the output for this
     108# validation test
     109def build():
     110    run_validation_script('run_problem.py')
     111    run_validation_script('plot_problem.py')
     112    pass
     113
     114def clean():
     115    autoclean()
     116
     117main()
     118\end{verbatim}
     119This script uses \texttt{fabricate} which automatically determines dependences
     120and only runs the command if the parameters alg and cfl have changed,
     121or input/output or source files have changed. (\texttt{fabricate} is a replacement for
     122standard \texttt{make})
     123
    105124
    106125\end{document}
Note: See TracChangeset for help on using the changeset viewer.