Skip to content

Commit

Permalink
Ran validations and added report to doc directory
Browse files Browse the repository at this point in the history
  • Loading branch information
stoiver committed Apr 28, 2015
1 parent 66dcd50 commit 8032294
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 134 deletions.
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,57 @@
*.dem
*.asc
*.qgs
*.aux
*.bbl
*.blg
*.out
*.toc
tags

# validation temp files #
#########################
parameters.tex
ch5.png
ch7.png
ch9.png
Boundary.png
Benchmark_2_Bathymetry.xya
Benchmark_2_input.tms
report.pdf
LEFT_REACH.png
MIDDLE_REACH.png
RIGHT_REACH.png
riverwall_points
vel_t1_centroid.png
vel_t1_vertex.png
vel_t2_centroid.png
vel_t2_vertex.png
xvelocity_at_y05.png
rmom_plot.png
rvel_plot.png
stage_plot.png
saved_parameters.tex
CENTRAL_CHANNEL.png
xmom*.png
xvel*.png
ymom*.png
Xmom*.png
Xvel*.png
x_velocity.png
y_velocity.png
depth_y.png
depth_x.png
Shoreline_position.png
Shoreline_velocity.png
figure_*.png
cross_section_*.png
stage*.png
Stage*.png
force.png
Fluxes.png
fig*.png
perturbation_at_origin.png
wave_atten.png

# Compiled source #
###################
Expand Down
Binary file modified doc/anuga_user_manual.pdf
Binary file not shown.
Binary file added doc/validations_report.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,11 @@ def height(x,y):
# Associate boundary tags with boundary objects
domain.set_boundary({'left': Bt, 'right': Bt, 'top': Br, 'bottom': Br})

#------------------------------------------------------------------------------
#-------------------------------------------------------------------------
# Produce a documentation of parameters
#------------------------------------------------------------------------------
if myid == 0:
parameter_file=open('parameters.tex', 'w')
parameter_file.write('\\begin{verbatim}\n')
from pprint import pprint
pprint(domain.get_algorithm_parameters(),parameter_file,indent=4)
parameter_file.write('\\end{verbatim}\n')
parameter_file.close()

#-------------------------------------------------------------------------
from anuga.validation_utilities import save_parameters_tex
save_parameters_tex(domain)

#===================================================================================
# Evolve system through time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,6 @@ def outflow_stage_boundary(t):
if(myid==0 & verbose):
print domain.timestepping_statistics()

doamin.sww_merge(delete_old=True)
domain.sww_merge(delete_old=True)

finalize()
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,27 @@
#from balanced_dev import *
from anuga.geometry.polygon import inside_polygon, is_inside_triangle

from anuga import distribute, myid, numprocs, finalize, barrier

#================================================================================
# Setup parameters and globally used functions
#================================================================================

args = anuga.get_args()
alg = args.alg
verbose = args.verbose

#-------------------------------------------------------------------------------
# Copy scripts to time stamped output directory and capture screen
# output to file
#-------------------------------------------------------------------------------
time = strftime('%Y%m%d_%H%M%S',localtime())

#output_dir = 'dam_break_'+time
output_dir = '.'
output_file = 'dam_break'

#anuga.copy_code_files(output_dir,__file__)
#start_screen_catcher(output_dir+'_')

time = strftime('%Y%m%d_%H%M%S',localtime())

#------------------------------------------------------------------------------
# Setup domain
#------------------------------------------------------------------------------
dx = 0.01
dy = dx
L = 1.6
W = 0.61

# structured mesh
points, vertices, boundary = anuga.rectangular_cross(int(L/dx), int(W/dy), L, W, (0.0, 0.0))

#domain = anuga.Domain(points, vertices, boundary)
domain = Domain(points, vertices, boundary)

domain.set_name(output_file)
domain.set_datadir(output_dir)

#------------------------------------------------------------------------------
# Setup Algorithm, either using command line arguments
# or override manually yourself
#------------------------------------------------------------------------------
domain.set_flow_algorithm(alg)


#------------------------------------------------------------------------------
#-------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------
#-------------------------------
def stage(x,y):
h = zeros(len(x), float)
for i in range(len(x)):
Expand All @@ -85,9 +60,43 @@ def elevation(x,y):
if 0.25 <= y[i] <= 0.25+0.12:
z[i] = 0.75
return z
domain.set_quantity('stage', stage)
domain.set_quantity('elevation',elevation)
domain.set_quantity('friction', 0.03)



#================================================================================
# create sequential domain
#================================================================================
if myid == 0:
# structured mesh
points, vertices, boundary = anuga.rectangular_cross(int(L/dx), int(W/dy), L, W, (0.0, 0.0))

#domain = anuga.Domain(points, vertices, boundary)
domain = Domain(points, vertices, boundary)

domain.set_name(output_file)
domain.set_datadir(output_dir)

#------------------------------------------------------------------------------
# Setup Algorithm, either using command line arguments
# or override manually yourself
#------------------------------------------------------------------------------
domain.set_flow_algorithm(alg)


domain.set_quantity('stage', stage)
domain.set_quantity('elevation',elevation)
domain.set_quantity('friction', 0.03)

else:

domain = None


#===================================================================================
# create parallel domain
#===================================================================================
domain = distribute(domain)


#-----------------------------------------------------------------------------
# Setup boundary conditions
Expand All @@ -101,78 +110,22 @@ def elevation(x,y):
domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})


#===============================================================================
##from anuga.visualiser import RealtimeVisualiser
##vis = RealtimeVisualiser(domain)
##vis.render_quantity_height("stage", zScale =h0*500, dynamic=True)
##vis.colour_height_quantity('stage', (0.0, 0.5, 1.0))
##vis.start()
#===============================================================================


#---------------------------------------------
# Find triangle that contains the point Point
# and print to file
#---------------------------------------------
##PointL = []
##print "0.12/dx=",int(round(0.12/dx))
##STOP
##PointL=[(0.868, 0.255),
## (0.868, 0.265),
## (0.868, 0.275),
## (0.868, 0.285),
## (0.868, 0.295),
## (0.868, 0.305),
## (0.868, 0.315),
## (0.868, 0.325),
## (0.868, 0.335),
## (0.868, 0.345),
## (0.868, 0.355),
## (0.868, 0.365)]
###PointR = []
##PointR=[(1.032, 0.255),
## (1.032, 0.265),
## (1.032, 0.275),
## (1.032, 0.285),
## (1.032, 0.295),
## (1.032, 0.305),
## (1.032, 0.315),
## (1.032, 0.325),
## (1.032, 0.335),
## (1.032, 0.345),
## (1.032, 0.355),
## (1.032, 0.365)]
##for i in range(len(PointR)):
## Point = PointR[i]
## for n in range(len(domain.triangles)):
## tri = domain.get_vertex_coordinates(n)
## if is_inside_triangle(Point,tri):
## #print 'Point is within triangle with vertices '+'%s'%tri
## n_point = n
## break
## print 'n_point = ',n_point


#------------------------------------------------------------------------------
#-------------------------------------------------------------------------
# Produce a documentation of parameters
#------------------------------------------------------------------------------
parameter_file=open('parameters.tex', 'w')
parameter_file.write('\\begin{verbatim}\n')
from pprint import pprint
pprint(domain.get_algorithm_parameters(),parameter_file,indent=4)
parameter_file.write('\\end{verbatim}\n')
parameter_file.close()
#-------------------------------------------------------------------------
from anuga.validation_utilities import save_parameters_tex
save_parameters_tex(domain)


#------------------------------------------------------------------------------
# Evolve system through time
#------------------------------------------------------------------------------
for t in domain.evolve(yieldstep = 0.05, finaltime = 3.0):
#print domain.timestepping_statistics(track_speeds=True)
print domain.timestepping_statistics()
#vis.update()
if myid == 0 and verbose:
print domain.timestepping_statistics()


#test against know data
#vis.evolveFinished()
domain.sww_merge(delete_old=True)

finalize()

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
\usepackage{hyperref}
\usepackage{url}
\usepackage{amsmath}
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\DeclareUrlCommand\UScore{\urlstyle{rm}}


Expand Down Expand Up @@ -46,36 +48,58 @@ \chapter{Introduction}

The results in this report were produced by \anuga{} version \majorR{} from svn
repository revision \minorR{} at time \timeR.
The flow algorithm was \alg{}, unless otherwise stated explicitly. Based on this version, 26 tests are available in the subversion. To get an automated report, we can run either an individual run of the available tests or the complete (whole) test.
The flow algorithm was \alg{}, unless otherwise stated explicitly. Based on this version,
26 tests are available in the subversion. To get an automated report,
we can run either an individual run of the available tests or the complete (whole) test.

To do an individual test, we can run the python module \\
\verb produce_results.py \\
available in the corresponding test directory. The module will do the numerical simulation of the given problem, plot the simulation results in png files, and type-set the corresponding individual automated report. The individual automated report is in pdf file and saved in the same directory.
available in the corresponding test directory. The module will do the
numerical simulation of the given problem, plot the simulation
results in png files, and type-set the corresponding
individual automated report. The individual automated report is in
pdf file and saved in the same directory.

To do the complete test, we can just run the python module \\
\verb all_tests_produce_results.py \\
available in the directory \\
\verb validation_tests/reports \\
Similar to the module for an individual test, this python module will do the numerical simulations of all the given problems, plot results in png files and save them in its corresponding directory, and finally type-set the complete report. The complete automated report is saved in this directory.

The simulation results can be analysed qualitatively and quantitatively. Qualitative analysis can be done by investigating the plots of the results whether they are physical or not, and whether the behaviour is the same as we expected. Quantitative analysis can be conducted by checking the numerical error. We have provided python module with the name begun by the word ``validate'' in each of individual tests. We can also run validate$\_$all.py to measure the numerical errors from the directory \verb run_auto_validation_tests . This validate$\_$all.py will run a subset of the available tests having sensible ``correct'' results to test against.

The main parameters in the validations are the Courant--Friedrichs-Lewy (CFL) number and the flow algorithm. They are spelled ``cfl'' and ``alg'' respectively in the python module \\
Similar to the module for an individual test, this python module
will do the numerical simulations of all the given problems,
plot results in png files and save them in its corresponding directory,
and finally type-set the complete report. The complete automated report is saved in this directory.

The simulation results can be analysed qualitatively and quantitatively.
Qualitative analysis can be done by investigating the plots of
the results whether they are physical or not, and whether the
behaviour is the same as we expected. Quantitative analysis can
be conducted by checking the numerical error.

We have also provided a python script \verb run_auto_validation_tests.py in
the \verb validation_tests directory which will run a subset of the available tests
having sensible ``correct'' results to test against.

The main parameters in the validations are the Courant--Friedrichs-Lewy (CFL)
number and the flow algorithm. They are spelled
\verb cfl and \verb alg respectively in the python module \\
\verb parameters \\
which is available in the \\
\verb anuga.validation_tests \\
module. In the default setting, we set the CFL to be $1.0$ and the flow algorithm to be DE0 (second order in space and first order in time). The complete available flow algorithms are as follow:
'1$\_$0', '1$\_$5', '1$\_$75', '2$\_$0', '2$\_$0$\_$limited', '2$\_$5', 'tsunami', 'yusuke', 'DE0', 'DE1', 'DE2'.
%\begin{enumerate}
%\item '1$\_$0',
%\item '1$\_$5',
%\item '1$\_$75',
%\item '2$\_$0',
%\item '2$\_$0$\_$limited',
%\item '2$\_$5',
%\item 'tsunami',
%\item 'yusuke'.
%\end{enumerate}
module. In the default setting, we set the CFL to be $1.0$ and
the flow algorithm to be \verb DE0 (second order in space and first order in time).
The complete available flow algorithms are as follow:
\verb 1_0 ,
\verb 1_5 ,
\verb 1_75 ,
\verb 2_0 ,
\verb 2_0_limited ,
\verb 2_5 ,
\verb tsunami ,
\verb yusuke ,
\verb DE0 ,
\verb DE1 ,
\verb DE2 .

They can be found in \\
\verb \anuga_core\source\anuga\shallow_water\shallow_water_domain.py .

Expand Down Expand Up @@ -161,16 +185,25 @@ \section{Algorithm Parameters}
\verb|anuga.validation_utilities.parameters|.

In particular the
values of \verb|alg| (flow algorithm) and \verb|cfl| (CFL Condition)
are passed as command options when calling \verb|produce_results.py| in the
values of \verb alg (flow algorithm) and \verb cfl (CFL Condition)
are passed as command options when calling \verb produce_results.py in the
test directories.

Within \anuga{} script you can obtain command line parameters via
\begin{verbatim}
args = anuga.get_args()
alg = args.alg
verbose = args.verbose
\end{verbatim}
to obtain the values of \verb alg (flow algorithm) and \verb verbose (flag)

You can pass though the standard parameters as follows
\begin{verbatim}
from anuga.validation_utilities.parameters import alg
from anuga.validation_utilities.parameters import cfl
\end{verbatim}

\pagebreak
\section{Generic form of \texttt{produce\_results.py}}

The \texttt{produce\_results.py} files in the test directories should have the
Expand Down

0 comments on commit 8032294

Please sign in to comment.