<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://source.geography.bristol.ac.uk/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tim-fewtrell</id>
	<title>SourceWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://source.geography.bristol.ac.uk/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tim-fewtrell"/>
	<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/wiki/Special:Contributions/Tim-fewtrell"/>
	<updated>2026-04-04T18:20:46Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.8</generator>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6826</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6826"/>
		<updated>2009-12-17T12:28:28Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
In order to ensure that variable boundary conditions (i.e. &amp;lt;tt&amp;gt;.bdy&amp;lt;/tt&amp;gt; file) on the floodplain and in the channel are applied, it is necessary to include two versions of the boundary condition; one for the channel and one for the floodplain with different names. In other words, the &amp;lt;tt&amp;gt;.river&amp;lt;/tt&amp;gt; file should reference &amp;lt;tt&amp;gt;downstream1&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;.bci&amp;lt;/tt&amp;gt; file should reference &amp;lt;tt&amp;gt;downstream2&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;downstream2&amp;lt;/tt&amp;gt; is a copy of &amp;lt;tt&amp;gt;downstream1&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Inertial and Channel Interaction===&lt;br /&gt;
Care should be taken when using the &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; keyword in tandem with the inertial/acceleration version of LISFLOOD-FP. The inertial model creates significantly longer time steps which, when used in conjuction with &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; causes large instabilities in the channel model calculation. Testing is ongoing to assess limits for &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; with the diffusive channel and inertial floodplain model combination.&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. In addition, there has been an upgrade to Condor (v6.x to v7.2) which has been rolled out onto all the machines. The submit host for Condor has also changed from &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;dylan.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;condor.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For Condor statistics and machine usage, check [http://intranet.ggy.bris.ac.uk/NewCondorView CondorView] *Requires UoB login*&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6825</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6825"/>
		<updated>2009-12-17T12:28:21Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# In order to ensure that variable boundary conditions (i.e. &amp;lt;tt&amp;gt;.bdy&amp;lt;/tt&amp;gt; file) on the floodplain and in the channel are applied, it is necessary to include two versions of the boundary condition; one for the channel and one for the floodplain with different names. In other words, the &amp;lt;tt&amp;gt;.river&amp;lt;/tt&amp;gt; file should reference &amp;lt;tt&amp;gt;downstream1&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;.bci&amp;lt;/tt&amp;gt; file should reference &amp;lt;tt&amp;gt;downstream2&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;downstream2&amp;lt;/tt&amp;gt; is a copy of &amp;lt;tt&amp;gt;downstream1&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Inertial and Channel Interaction===&lt;br /&gt;
Care should be taken when using the &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; keyword in tandem with the inertial/acceleration version of LISFLOOD-FP. The inertial model creates significantly longer time steps which, when used in conjuction with &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; causes large instabilities in the channel model calculation. Testing is ongoing to assess limits for &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; with the diffusive channel and inertial floodplain model combination.&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. In addition, there has been an upgrade to Condor (v6.x to v7.2) which has been rolled out onto all the machines. The submit host for Condor has also changed from &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;dylan.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;condor.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For Condor statistics and machine usage, check [http://intranet.ggy.bris.ac.uk/NewCondorView CondorView] *Requires UoB login*&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=6248</id>
		<title>LISFLOOD-FP and MATLAB</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=6248"/>
		<updated>2009-06-26T09:42:46Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains various Matlab functions that may be useful for analysing results from the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model.&lt;br /&gt;
&lt;br /&gt;
==File import and export==&lt;br /&gt;
&lt;br /&gt;
===Importing ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will import an ascii raster file using the string filename. To use it, copy and past text into a textfile called ascii_reader.m&lt;br /&gt;
&lt;br /&gt;
 function [dem, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % This function reads arc .asc files&lt;br /&gt;
 % requires filename string as input&lt;br /&gt;
 &lt;br /&gt;
 % j neal&lt;br /&gt;
 % 18/6/07&lt;br /&gt;
 %% read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 dem = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 dem = dem';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
You can view the imported file using the command:&lt;br /&gt;
&lt;br /&gt;
 imagesc(dem);&lt;br /&gt;
&lt;br /&gt;
===Exporting ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will create an ascii raster file called filename from the 2D matrix DEM.  To use it, copy and past text into a textfile called ascii_write.m&lt;br /&gt;
&lt;br /&gt;
 function ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 &lt;br /&gt;
 % ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 % only filename (string) and DEM (2D matrix) are essential&lt;br /&gt;
 % this function writes ascii raster files for arc&lt;br /&gt;
 % j neal&lt;br /&gt;
 % 6/3/2008&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
     error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4, &lt;br /&gt;
     xllcorner = 0;&lt;br /&gt;
     yllcorner = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 5,&lt;br /&gt;
     cellsize = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 6&lt;br /&gt;
     nodata = -9999;&lt;br /&gt;
 end&lt;br /&gt;
 A = size(DEM);&lt;br /&gt;
 fout = fopen (filename,'w');&lt;br /&gt;
 fprintf(fout, 'ncols         %.0f\n', A(2));  &lt;br /&gt;
 fprintf(fout, 'nrows         %.0f\n', A(1));&lt;br /&gt;
 fprintf(fout, 'xllcorner     %f\n', xllcorner);&lt;br /&gt;
 fprintf(fout, 'yllcorner     %f\n', yllcorner);&lt;br /&gt;
 fprintf(fout, 'cellsize      %f\n', cellsize);&lt;br /&gt;
 fprintf(fout, 'NODATA_value  %f\n', nodata); &lt;br /&gt;
 for ii = 1:A(1)&lt;br /&gt;
     B = DEM(ii,:);&lt;br /&gt;
     fprintf(fout, '%1.3f ', B);&lt;br /&gt;
     fprintf(fout, '\n');&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Importing .profile files===&lt;br /&gt;
&lt;br /&gt;
This function imports .profile files&lt;br /&gt;
&lt;br /&gt;
 function [data, M] = profileread (resroot, numfiles, t, string1, string2)&lt;br /&gt;
 &lt;br /&gt;
 % This function reads LISFLOOD-FP .profile files&lt;br /&gt;
 %&lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT)&lt;br /&gt;
 %   where RESROOT is a string containing the resroot from the LISFLOOD-FP&lt;br /&gt;
 %   .par file. Absolute path names can also be used e.g. 'C:\LISFLOOD\resroot'&lt;br /&gt;
 %   DATA is a structure containing .header {cell aray}&lt;br /&gt;
 %                                  .segmentN (numerical array for segment N)&lt;br /&gt;
 %&lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT, NUMFILES)&lt;br /&gt;
 %   NUMFILES = number of files to read. Reads m files assuming that the files &lt;br /&gt;
 %   are numbered such that resroot-000m.profile. &lt;br /&gt;
 %   DATA(m) is a structure containing m files&lt;br /&gt;
 % &lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT, NUMFILES, 1)&lt;br /&gt;
 %   specifies the profiles were exported a user specified time such that&lt;br /&gt;
 %   resroot-000x-t.profile&lt;br /&gt;
 %&lt;br /&gt;
 % [DATA, M] = PROFILEREAD (RESROOT, NUMFILES, 1, string1, string2)&lt;br /&gt;
 %   instructs the function to plot string1 or sting1 against string2... these&lt;br /&gt;
 %   strings muct match the headernames in the .profile file e.g. 'Flow'&lt;br /&gt;
 %   returns movieframes in the structure M. Also plots the data.&lt;br /&gt;
 %&lt;br /&gt;
 % Note: LISFLOOD-FP will name multiple files 0 to m-1 but DATA(m) will count from 1 to m&lt;br /&gt;
 %&lt;br /&gt;
 % j.neal&lt;br /&gt;
 % 12/5/2008&lt;br /&gt;
 %%&lt;br /&gt;
 if nargin &amp;lt; 1, &lt;br /&gt;
    error('Requires filename'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 2,&lt;br /&gt;
    % only one file&lt;br /&gt;
    numfiles = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 2,&lt;br /&gt;
    t = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4,&lt;br /&gt;
    % no plotting required&lt;br /&gt;
    plotting = 0;&lt;br /&gt;
    M = 0;&lt;br /&gt;
 elseif nargin &amp;lt; 5,&lt;br /&gt;
    % use plotter&lt;br /&gt;
    plotting = 1;&lt;br /&gt;
 elseif nargin &amp;lt; 6,&lt;br /&gt;
    plotting = 2;&lt;br /&gt;
 end&lt;br /&gt;
 %% Arrange data read&lt;br /&gt;
 if t == 1&lt;br /&gt;
    fileex = '-t.profile';&lt;br /&gt;
 else&lt;br /&gt;
    fileex = '.profile';&lt;br /&gt;
 end&lt;br /&gt;
 if numfiles == 0&lt;br /&gt;
    % read in a single .profile file&lt;br /&gt;
    filename = [resroot,fileex];&lt;br /&gt;
    data = read_profile (filename);&lt;br /&gt;
 elseif numfiles &amp;lt; 9999&lt;br /&gt;
    % read a series of .profile files&lt;br /&gt;
    for i = 1:numfiles&lt;br /&gt;
        ii = i-1;&lt;br /&gt;
        if ii &amp;lt; 10&lt;br /&gt;
            resroot2 = [resroot,'-000',num2str(ii),fileex];&lt;br /&gt;
        elseif ii &amp;lt; 100&lt;br /&gt;
            resroot2 = [resroot,'-00',num2str(ii),fileex];&lt;br /&gt;
        elseif ii &amp;lt; 1000&lt;br /&gt;
            resroot2 = [resroot,'-0',num2str(ii),fileex];&lt;br /&gt;
        else&lt;br /&gt;
            resroot2 = [resroot,'-',num2str(ii),fileex];&lt;br /&gt;
        end&lt;br /&gt;
        %returnes structure with format data(i).segmentX... also includes .header &lt;br /&gt;
        [data(i), seg_num] = read_profile (resroot2); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
 else&lt;br /&gt;
    error ('Too many files or incorrect input to numfiles'); &lt;br /&gt;
 end&lt;br /&gt;
 %% Plotting under development&lt;br /&gt;
 % account for 0 seg num&lt;br /&gt;
 seg_num = seg_num +1;&lt;br /&gt;
 % if plotting == 0 % do nothing... no plots&lt;br /&gt;
 if plotting == 1&lt;br /&gt;
    % find the column you want to plot&lt;br /&gt;
    I = strmatch(string1 , data(1).header);&lt;br /&gt;
    % plot a single variable&lt;br /&gt;
    A = size(data);&lt;br /&gt;
    for i = 1:A(2)&lt;br /&gt;
        figure(i);&lt;br /&gt;
        for j = 1:seg_num&lt;br /&gt;
            k = j-1;&lt;br /&gt;
            subplot(1,seg_num,j);&lt;br /&gt;
            eval(['plot(data(i).segment',num2str(k),'(:,',num2str(I),'));']);&lt;br /&gt;
            tstring = ['Plot of ',resroot,num2str(i),' segment ',num2str(k)];  &lt;br /&gt;
            title(tstring);&lt;br /&gt;
            % get movie frame&lt;br /&gt;
            M(i,j) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
 elseif plotting == 2&lt;br /&gt;
    % find the columns you want to plot&lt;br /&gt;
    I = strmatch(string1 , data(1).header);&lt;br /&gt;
    I2 = strmatch(string2 , data(1).header);&lt;br /&gt;
    A = size(data);&lt;br /&gt;
    for i = 1:A(2)&lt;br /&gt;
        figure(i);&lt;br /&gt;
        for j = 1:seg_num&lt;br /&gt;
            k = j-1;&lt;br /&gt;
            subplot(1,seg_num,j);&lt;br /&gt;
            eval(['plot(data(i).segment',num2str(k),'(:,',num2str(I),'),data(i).segment',num2str(k),'(:,',num2str(I2),'));']);&lt;br /&gt;
            % get movie frame&lt;br /&gt;
            tstring = ['Plot of ',resroot,num2str(i),' segment ',num2str(k)];  &lt;br /&gt;
            title(tstring);&lt;br /&gt;
            M(i,j) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
 %% read .profile file&lt;br /&gt;
 function [data, seg_num] = read_profile (filename) &lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 more_segs = 1;&lt;br /&gt;
 % read 'Channel_segment:' from file&lt;br /&gt;
 temp = fscanf(fin,'%s',1); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 while more_segs == 1&lt;br /&gt;
    % read filename&lt;br /&gt;
    seg_num = fscanf(fin,'%f',1);&lt;br /&gt;
    for i = 1:11&lt;br /&gt;
        data.header{i} = fscanf(fin,'%s',1);&lt;br /&gt;
    end&lt;br /&gt;
    testline = 1;&lt;br /&gt;
    j = 0;&lt;br /&gt;
    while testline == 1&lt;br /&gt;
        j = j+1;&lt;br /&gt;
        % reads the first bit of the line as a string&lt;br /&gt;
        A = fscanf(fin, '%s',1);&lt;br /&gt;
        % this string is either a numer of a new channel sgment of the end&lt;br /&gt;
        % of the file&lt;br /&gt;
        % if end of file&lt;br /&gt;
        ST = feof (fin);&lt;br /&gt;
        if ST == 1&lt;br /&gt;
            % reached the end of the file exit both while loops&lt;br /&gt;
            testline = 0;&lt;br /&gt;
            more_segs = 0;&lt;br /&gt;
        else&lt;br /&gt;
            TF = strcmp('Channel_segment:', A);&lt;br /&gt;
            if TF == 1&lt;br /&gt;
                % new segment has been found&lt;br /&gt;
                testline = 0;&lt;br /&gt;
            else&lt;br /&gt;
                % read rest for line into data&lt;br /&gt;
                B(j,1) = str2double(A); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
                for k = 2:11&lt;br /&gt;
                    B(j,k) = fscanf(fin, '%f',1); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
                 end&lt;br /&gt;
             end&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
     eval(['data.segment',num2str(seg_num),' = B;']);&lt;br /&gt;
     clear B&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Importing .stage files===&lt;br /&gt;
&lt;br /&gt;
This function imports .stage files and allows for checkpointing restarts&lt;br /&gt;
&lt;br /&gt;
 function [metadata, stagedata] = stage_read (filename, num_locations, checkpoint)&lt;br /&gt;
 &lt;br /&gt;
 % This function reads lisflood .stage files&lt;br /&gt;
 % [metadata, stagedata] = stage_read (filename, num_locations)&lt;br /&gt;
 %&lt;br /&gt;
 % if checkpointing was used an additional argument is required to look for&lt;br /&gt;
 %  checkpointed data&lt;br /&gt;
 % [metadata, stagedata] = stage_read (filename, num_locations,&lt;br /&gt;
 % checkpoint=1);&lt;br /&gt;
 %&lt;br /&gt;
 % The code will also check for repetition and remove duplicate lines&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 26/6/09&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
    error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
    checkpoint = 0;&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 fin = fopen(filename, 'r');&lt;br /&gt;
 &lt;br /&gt;
 header1 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 header2 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 header3 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % reads the metadata&lt;br /&gt;
 metadata = fscanf (fin, '%f', [4, num_locations]);&lt;br /&gt;
 metadata = metadata';&lt;br /&gt;
 &lt;br /&gt;
 header4 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 header5 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 header6 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 header7 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 if checkpoint == 0&lt;br /&gt;
 % reads stage data&lt;br /&gt;
 stagedata = fscanf (fin, '%f', [num_locations+1,inf]);&lt;br /&gt;
 stagedata = stagedata';&lt;br /&gt;
 else&lt;br /&gt;
   % scan for checkpointing lines&lt;br /&gt;
   line = 1;&lt;br /&gt;
   checks = 0;&lt;br /&gt;
   checkpoint = 0;&lt;br /&gt;
   while 1&lt;br /&gt;
       tline = fgetl(fin);&lt;br /&gt;
       % this will return -1 at end of file&lt;br /&gt;
       if tline == -1&lt;br /&gt;
           checks = checks+1;&lt;br /&gt;
           checkpoint(checks+1) = line; %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
           line = line-1;&lt;br /&gt;
           break;&lt;br /&gt;
       end&lt;br /&gt;
       TF = strcmp (tline, '####################################################### Checkpoint restart ########################################################');&lt;br /&gt;
       if TF == 1&lt;br /&gt;
           % this line is a checkpoint line&lt;br /&gt;
           checks = checks+1;&lt;br /&gt;
           checkpoint(checks+1) = line; %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
       end&lt;br /&gt;
       % the data could be read in at this point but this could be very&lt;br /&gt;
       % slow for large stage files&lt;br /&gt;
       line = line+1;&lt;br /&gt;
   end&lt;br /&gt;
   %now we know how may times it has checkpointed and where&lt;br /&gt;
   disp (['Number of checkpoints = ',num2str(checks)]);&lt;br /&gt;
   fclose('all');&lt;br /&gt;
    &lt;br /&gt;
   % re open file and read header again!&lt;br /&gt;
   fin = fopen(filename, 'r');&lt;br /&gt;
   header1 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
   header2 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
   header3 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
   % reads the metadata&lt;br /&gt;
   metadata = fscanf (fin, '%f', [4, num_locations]);&lt;br /&gt;
   metadata = metadata';&lt;br /&gt;
   header4 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
   header5 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
   header6 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
   header7 = fgets(fin);  %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   % read stage data&lt;br /&gt;
   if checks == 2&lt;br /&gt;
       % reads stage data as there are no checkpoints&lt;br /&gt;
       stagedata = fscanf (fin, '%f', [num_locations+1,line]);&lt;br /&gt;
       stagedata = stagedata';&lt;br /&gt;
   else&lt;br /&gt;
       stagedata = [];&lt;br /&gt;
       for i = 2:checks&lt;br /&gt;
           tempstagedata = fscanf (fin, '%f', [num_locations+1,checkpoint(i-1)-checkpoint(i)-1]);&lt;br /&gt;
           tempstagedata = tempstagedata';&lt;br /&gt;
           % this is not efficient but shjould only happen a few time&lt;br /&gt;
           stagedata = [stagdata;tempstagedata];&lt;br /&gt;
           % read the checkpoint line&lt;br /&gt;
           tline = fgetl(fin); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
       end&lt;br /&gt;
       % we now have lots of data that may overlap so we only need unique&lt;br /&gt;
       % rows&lt;br /&gt;
       stagedata = unique(stagedata,'rows');&lt;br /&gt;
   end&lt;br /&gt;
        &lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Writing parameter files===&lt;br /&gt;
&lt;br /&gt;
This function can be used to write many LISFLOOD-FP parameter files with ''N'' different channel and floodplain roughness, using your own ''N-by-''2 matrix called roughness. You will need to edit the code for your application by commenting unwanted lines with a percentage symbol.&lt;br /&gt;
&lt;br /&gt;
 function prm_writer (roughness) &lt;br /&gt;
 &lt;br /&gt;
 % This function writes LISFLOOD-FP parameter files numbered 1 to n using&lt;br /&gt;
 % the roughness values in the n-by-2 matrix roughness. yuo will need to&lt;br /&gt;
 % edit the code for your application.&lt;br /&gt;
 &lt;br /&gt;
 [num_sims] = size(roughness);&lt;br /&gt;
 for i = 1:num_sims(1)&lt;br /&gt;
 a = ['mymodel', num2str(i),'.par']; b = num2str(i);&lt;br /&gt;
 fout = fopen(a,'w');&lt;br /&gt;
 fprintf(fout,'DEMfile                  mydem.dem.ascii\n');&lt;br /&gt;
 fprintf(fout,'resroot                  myres%s\n',b);&lt;br /&gt;
 fprintf(fout,'dirroot                  mydir\n');&lt;br /&gt;
 fprintf(fout,'sim_time                 245000.0\n');&lt;br /&gt;
 fprintf(fout,'initial_tstep            10.0\n');&lt;br /&gt;
 fprintf(fout,'massint                  300.0\n');&lt;br /&gt;
 fprintf(fout,'saveint                  10000.0\n');&lt;br /&gt;
 %fprintf(fout,'overpass                 135000.0\n');&lt;br /&gt;
 fprintf(fout,'fpfric                   %1.3f\n',roughness(i,2));&lt;br /&gt;
 fprintf(fout,'nch                      %1.3f\n',roughness(i,1));&lt;br /&gt;
 %fprintf(fout,'manningfile              mymanfile%s.n.ascii\n',b);&lt;br /&gt;
 fprintf(fout,'riverfile                myriver.river\n');&lt;br /&gt;
 fprintf(fout,'bdyfile                  mybdy.bdy\n');&lt;br /&gt;
 fprintf(fout,'stagefile                mystage.stage\n');&lt;br /&gt;
 fprintf(fout,'bcifile                  mybci.bci\n');&lt;br /&gt;
 %fprintf(fout,'startfile                mystart.old\n');&lt;br /&gt;
 %fprintf(fout,'checkpoint               2\n');&lt;br /&gt;
 %fprintf(fout,'checkfile                mycheck.chkpnt\n');&lt;br /&gt;
 fprintf(fout,'elevoff\n');&lt;br /&gt;
 fprintf(fout,'qoutput\n');&lt;br /&gt;
 fprintf(fout,'diffusive\n');&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Plotting flow vectors from .Qx and .Qy files==&lt;br /&gt;
&lt;br /&gt;
This function will plot flow vectors from a .Qx and .Qy over a dem using the matlab functions image and quiver  &lt;br /&gt;
&lt;br /&gt;
 function lisflood_flow_plotter (qxfile, qyfile, demfile, north, east, south, west, scaling)&lt;br /&gt;
 &lt;br /&gt;
 % This function plots flow vectors from LISFLOOD_FP Qx and QY files&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile);&lt;br /&gt;
 %&lt;br /&gt;
 % these input variables are strings containing the relative of full&lt;br /&gt;
 % pathnames of the .Qx .Qy and ascii dem files to be plotted.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W);&lt;br /&gt;
 %&lt;br /&gt;
 % N, E, W and S are optional they specify the northernmost, southeernmost&lt;br /&gt;
 % ect cell to be displayed. this can be used to crop the domain.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W, scaling);&lt;br /&gt;
 % &lt;br /&gt;
 % scaling is an optional term used to manually scale the vector lengthes&lt;br /&gt;
 % drawn by quiver (the arrow plotting function).&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 20/02/2008 &lt;br /&gt;
 &lt;br /&gt;
 %% decide if crop is required and give imput error message&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
     error('Requires at least three input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7, &lt;br /&gt;
     crop = 0;&lt;br /&gt;
 else&lt;br /&gt;
     crop = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7,&lt;br /&gt;
     scaling = 1;&lt;br /&gt;
 end &lt;br /&gt;
 % Note don't do this for large areas ?&lt;br /&gt;
 %% Task 1: read ascii files&lt;br /&gt;
 % read Qx file&lt;br /&gt;
 [QX, ncolsqx, nrowsqx, xllcornerqx, yllcornerqx, cellsizeqx] = read_file (qxfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read Qy file&lt;br /&gt;
 [QY, ncolsqy, nrowsqy, xllcornerqy, yllcornerqy, cellsizeqy] = read_file (qyfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read DEM&lt;br /&gt;
 [DEM, ncolsdem, nrowsdem, xllcornerdem, yllcornerdem, cellsizedem] = read_file (demfile);&lt;br /&gt;
 %% crop data if required&lt;br /&gt;
 if crop == 1;&lt;br /&gt;
     DEM = DEM(north:south,west:east);&lt;br /&gt;
     QX = QX(north:south,west:east+1);&lt;br /&gt;
     QY = QY(north:south+1,west:east);&lt;br /&gt;
     xllcornerdem = xllcornerdem + west*cellsizedem - cellsizedem;&lt;br /&gt;
     yllcornerdem = yllcornerdem + (nrowsdem - south) * cellsizedem;&lt;br /&gt;
     [nrowsqx, ncolsqx] = size(QX); [nrowsqy, ncolsqy] = size(QY); [nrowsdem, ncolsdem] = size(DEM);&lt;br /&gt;
 end&lt;br /&gt;
 %% Taks 2: Plot dem and generate figure&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap('gray');&lt;br /&gt;
 % Create axes&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcornerdem + nrowsdem*cellsizedem ,yllcornerdem},...&lt;br /&gt;
     'YTick',[0.5,nrowsdem+0.5],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcornerdem,xllcornerdem+ncolsdem*cellsizedem},...&lt;br /&gt;
     'XTick',[0.5, ncolsdem + 0.5],...&lt;br /&gt;
     'Layer','top',...&lt;br /&gt;
     'DataAspectRatio',[1 1 1]...&lt;br /&gt;
     %,'Clim',[13 30]... % uncomment to set colourmap limits manually&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM,'Parent',axes1,'CDataMapping','scaled');&lt;br /&gt;
 axis('image');&lt;br /&gt;
 xlabel('Easting (m)');&lt;br /&gt;
 ylabel('Northing (m)');&lt;br /&gt;
 %% Task 3: calculate flow vectors&lt;br /&gt;
 % pre allocate memory for loop... it will run faster this way&lt;br /&gt;
 xlocs = zeros(ncolsqx*nrowsqx+ncolsqy*nrowsqy,1);&lt;br /&gt;
 ylocs = xlocs;&lt;br /&gt;
 U = xlocs;&lt;br /&gt;
 V = xlocs;&lt;br /&gt;
 %work out X and Y locations&lt;br /&gt;
 for i = 1:nrowsqx&lt;br /&gt;
     for j = 1:ncolsqx&lt;br /&gt;
         xlocs((i-1)*ncolsqx+j,1) = j - 0.5;&lt;br /&gt;
         ylocs((i-1)*ncolsqx+j,1) = i;&lt;br /&gt;
         U((i-1)*ncolsqx+j,1) = QX(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 for i = 1:nrowsqy&lt;br /&gt;
     for j = 1:ncolsqy&lt;br /&gt;
         xlocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = j;&lt;br /&gt;
         ylocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = i - 0.5;&lt;br /&gt;
         V(ncolsqx*nrowsqx+(i-1)*ncolsqy+j,1) = QY(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % work out number of nonzeros elements&lt;br /&gt;
 num_flows = nnz(U+V);&lt;br /&gt;
 xlocs2 = zeros(num_flows,1);&lt;br /&gt;
 ylocs2 = xlocs2;&lt;br /&gt;
 U2 = xlocs2;&lt;br /&gt;
 V2 = xlocs2;&lt;br /&gt;
 % remover zero flow locations&lt;br /&gt;
 k = 1;&lt;br /&gt;
 for i = 1:ncolsqx*nrowsqx+ncolsqy*nrowsqy&lt;br /&gt;
     if (U(i,1) == 0) &amp;amp;&amp;amp; (V(i,1) == 0)&lt;br /&gt;
         % do nothing&lt;br /&gt;
     else&lt;br /&gt;
         xlocs2(k,1) = xlocs(i,1);&lt;br /&gt;
         ylocs2(k,1) = ylocs(i,1);&lt;br /&gt;
         U2(k,1) = U(i,1);&lt;br /&gt;
         V2(k,1) = V(i,1);&lt;br /&gt;
         k = k+1;&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % check numbers are correct&lt;br /&gt;
 if k == num_flows + 1&lt;br /&gt;
     % all is ok&lt;br /&gt;
 else&lt;br /&gt;
     disp('Problem with flows');&lt;br /&gt;
 end&lt;br /&gt;
 %% Task 4: overlay flow vectors&lt;br /&gt;
 disp('Plotting data... if this is taking a long time you may need fewer locations');&lt;br /&gt;
 quiver (xlocs2,ylocs2,U2,V2, scaling);&lt;br /&gt;
 % quiver (xloc2,yloc2,U2,V2,'Parent',figure1);&lt;br /&gt;
 disp('Done');&lt;br /&gt;
 %% function to read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
==Making movies from .wd files==&lt;br /&gt;
&lt;br /&gt;
This function will convert a series of .wd .Qx or .Qy file into a .avi movie with the same filename&lt;br /&gt;
&lt;br /&gt;
 function LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ) &lt;br /&gt;
 &lt;br /&gt;
 % LISFLOOD_mov generates movies of LISFLOOD-FP output&lt;br /&gt;
 %&lt;br /&gt;
 % LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ)&lt;br /&gt;
 % &lt;br /&gt;
 % where &lt;br /&gt;
 % resroot is the LISFLOOD resroot (relative to m file or absolute)(string)&lt;br /&gt;
 % fileex is the file extension '.wd' (can be chaned to plot WSE and flows)&lt;br /&gt;
 % vartype is the name of the variable being plotted e.g. 'Depth'&lt;br /&gt;
 % num_snaps is the number of snapshot times&lt;br /&gt;
 % snapint is the time interval between each LISFLOOD-FP snapshot (seconds)&lt;br /&gt;
 % dem is the name of the demfile (relative or absolute)&lt;br /&gt;
 % demCS is the range of dem hights to be plotted e.g. demCS = [0,20];&lt;br /&gt;
 % depthCS is the range of depth values to be plotted e.g. depthCS = [0,10];&lt;br /&gt;
 % framesPS number of frames per second (each plot is a simgle frame)&lt;br /&gt;
 % movQ is the movie quality between 1 and 100 (100 is best)&lt;br /&gt;
 % &lt;br /&gt;
 % 8/11/2007. J Neal.&lt;br /&gt;
 %&lt;br /&gt;
 % EXAMPLE:&lt;br /&gt;
 % LISFLOOD_mov ('C:\Experiment1\res22','.wd','Water depth',24,10000,...&lt;br /&gt;
 % 'C:\Experiment1\dem10m.dem.ascii',[0,60], [0,10],1,100);&lt;br /&gt;
 %% Movie maker&lt;br /&gt;
 % read dem filenam is filename and 1 specifies the 0.00 should not be NaN's&lt;br /&gt;
 [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (dem); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 % A = [resroot,'.avi'];&lt;br /&gt;
 % mov = avifile(A);&lt;br /&gt;
 % loop through snapshots&lt;br /&gt;
 for i = 1:num_snaps&lt;br /&gt;
     if i &amp;lt; 10&lt;br /&gt;
         resfile = [resroot,'-000',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 100&lt;br /&gt;
         resfile = [resroot,'-00',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 1000&lt;br /&gt;
         resfile = [resroot,'-0',num2str(i),fileex];&lt;br /&gt;
     else&lt;br /&gt;
         resfile = [resroot,'-',num2str(i),fileex];&lt;br /&gt;
     end&lt;br /&gt;
     % read in deoth file for resfile i (2 specifies the 0.00 should be NaN&lt;br /&gt;
     [DEPTH, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (resfile);&lt;br /&gt;
     % plot data as figure 1&lt;br /&gt;
     plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype);&lt;br /&gt;
     % get movie frame&lt;br /&gt;
     M(i) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
     hold off;&lt;br /&gt;
 %     mov = addframe(mov,M(i));&lt;br /&gt;
     % close the figure&lt;br /&gt;
     close all&lt;br /&gt;
 end &lt;br /&gt;
 % % close .avi file&lt;br /&gt;
 % mov = close(mov);&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 disp('Generating .avi movie file');&lt;br /&gt;
 A = [resroot,fileex,'.avi'];&lt;br /&gt;
 movie2avi(M,A,'fps',framesPS,'quality',movQ);&lt;br /&gt;
 disp(A);&lt;br /&gt;
 %% Read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 % convert nodata to NaN;&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if OUT(ii,jj) == nodata&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         elseif OUT(ii,jj) == -99.000&lt;br /&gt;
             % lisflood uses -99.000 as nodat so will also remove these&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         else&lt;br /&gt;
             % do nothing&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 %% Plotter data for movie slide&lt;br /&gt;
 function plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype)&lt;br /&gt;
 % number of colors in colormap&lt;br /&gt;
 num_colors = 64;&lt;br /&gt;
 % DEM and variable color map&lt;br /&gt;
 cmap = [gray(num_colors); jet(num_colors)];&lt;br /&gt;
 % scale DEM and DEPTH data to fit with new colormap&lt;br /&gt;
 demCS2 = demCS(2)-demCS(1);&lt;br /&gt;
 dem_scalar = num_colors/demCS2;&lt;br /&gt;
 DEM2 = DEM*dem_scalar;&lt;br /&gt;
 depthCS2 = depthCS(2)-depthCS(1);&lt;br /&gt;
 depth_scalar = num_colors/depthCS2;&lt;br /&gt;
 DEPTH2 = (DEPTH*depth_scalar)+num_colors+1;&lt;br /&gt;
 %Plot the DEM&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap(cmap);&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcorner+(nrows*cellsize),yllcorner+cellsize},...&lt;br /&gt;
     'YTick', [1,nrows],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcorner,xllcorner+(ncols*cellsize)-cellsize},...&lt;br /&gt;
     'XTick',[1,ncols],...&lt;br /&gt;
     'Layer','top');&lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM2,'Parent',axes1);&lt;br /&gt;
 axis('equal');axis('tight');&lt;br /&gt;
 % Overlay the water depth (or other variable)&lt;br /&gt;
 H = image(DEPTH2);&lt;br /&gt;
 % code to make depth plot layer transparent&lt;br /&gt;
 OP = ones(nrows,ncols);&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if DEPTH(ii,jj) &amp;gt; 0&lt;br /&gt;
         else&lt;br /&gt;
             OP(ii,jj) = 0;&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % make transparent. depth layer must be H&lt;br /&gt;
 set(H,'AlphaData',OP);&lt;br /&gt;
 % label colourbar&lt;br /&gt;
 color_breaks = 5;&lt;br /&gt;
 colorbreak = num_colors/color_breaks;&lt;br /&gt;
 SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 SCALE(1) = 0.0001;&lt;br /&gt;
 for j = 1:color_breaks*2&lt;br /&gt;
     SCALE(j+1) = colorbreak*j;&lt;br /&gt;
 end&lt;br /&gt;
 SCALE(color_breaks+1) = num_colors+1;&lt;br /&gt;
 VIS_SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 VIS_SCALE(1) = demCS(1);&lt;br /&gt;
 for j = 1:color_breaks-1&lt;br /&gt;
     VIS_SCALE(j+1) = ((demCS2/color_breaks)*j)+demCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 VIS_SCALE(color_breaks+1) = depthCS(1);&lt;br /&gt;
 for j = 1:color_breaks&lt;br /&gt;
     VIS_SCALE(j+1+color_breaks) = ((depthCS2/color_breaks)*j)+depthCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 colorbar('YTick',SCALE,'YTickLabel',VIS_SCALE);&lt;br /&gt;
 % Label axis&lt;br /&gt;
 xlabel('BNG easting (m)');&lt;br /&gt;
 ylabel('BNG northing (m)');&lt;br /&gt;
 A = [vartype,' over DEM at time ',num2str((i*snapint)),'s'];&lt;br /&gt;
 title(A);&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6247</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6247"/>
		<updated>2009-06-25T09:46:11Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# In order to ensure that variable boundary conditions (i.e. &amp;lt;tt&amp;gt;.bdy&amp;lt;/tt&amp;gt; file) on the floodplain and in the channel are applied, it is necessary to include two versions of the boundary condition; one for the channel and one for the floodplain with different names. In other words, the &amp;lt;tt&amp;gt;.river&amp;lt;/tt&amp;gt; file should reference &amp;lt;tt&amp;gt;downstream1&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;.bci&amp;lt;/tt&amp;gt; file should reference &amp;lt;tt&amp;gt;downstream2&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;downstream2&amp;lt;/tt&amp;gt; is a copy of &amp;lt;tt&amp;gt;downstream1&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===Inertial and Channel Interaction===&lt;br /&gt;
Care should be taken when using the &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; keyword in tandem with the inertial/acceleration version of LISFLOOD-FP. The inertial model creates significantly longer time steps which, when used in conjuction with &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; causes large instabilities in the channel model calculation. Testing is ongoing to assess limits for &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; with the diffusive channel and inertial floodplain model combination.&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. In addition, there has been an upgrade to Condor (v6.x to v7.2) which has been rolled out onto all the machines. The submit host for Condor has also changed from &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;dylan.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;condor.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For Condor statistics and machine usage, check [http://intranet.ggy.bris.ac.uk/NewCondorView CondorView] *Requires UoB login*&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6218</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6218"/>
		<updated>2009-06-16T17:06:20Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# In order to ensure that variable boundary conditions (i.e. &amp;lt;tt&amp;gt;.bdy&amp;lt;/tt&amp;gt; file) on the floodplain and in the channel are applied, it is necessary to include two versions of the boundary condition; one for the channel and one for the floodplain with different names. In other words, the &amp;lt;tt&amp;gt;.river&amp;lt;/tt&amp;gt; file should reference &amp;lt;tt&amp;gt;downstream1&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;.bci&amp;lt;/tt&amp;gt; file should reference &amp;lt;tt&amp;gt;downstream2&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;downstream2&amp;lt;/tt&amp;gt; is a copy of &amp;lt;tt&amp;gt;downstream1&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===Inertial and Channel Interaction===&lt;br /&gt;
Care should be taken when using the &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; keyword in tandem with the inertial/acceleration version of LISFLOOD-FP. The inertial model creates significantly longer time steps which, when used in conjuction with &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; causes large instabilities in the channel model calculation. Testing is ongoing to assess limits for &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; with the diffusive channel and inertial floodplain model combination.&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. In addition, there has been an upgrade to Condor (v6.x to v7.2) which has been rolled out onto all the machines. The submit host for Condor has also changed from &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;dylan.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;condor.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6148</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6148"/>
		<updated>2009-06-08T11:10:37Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Inertial and Channel Interaction===&lt;br /&gt;
Care should be taken when using the &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; keyword in tandem with the inertial/acceleration version of LISFLOOD-FP. The inertial model creates significantly longer time steps which, when used in conjuction with &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; causes large instabilities in the channel model calculation. Testing is ongoing to assess limits for &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; with the diffusive channel and inertial floodplain model combination.&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. In addition, there has been an upgrade to Condor (v6.x to v7.2) which has been rolled out onto all the machines. The submit host for Condor has also changed from &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;dylan.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;condor.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6142</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6142"/>
		<updated>2009-06-08T10:10:15Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Inertial and Channel Interaction===&lt;br /&gt;
Care should be taken when using the &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; keyword in tandem with the inertial/acceleration version of LISFLOOD-FP. The inertial model creates significantly longer time steps which, when used in conjuction with &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; causes large instabilities in the channel model calculation. Testing is ongoing to assess limits for &amp;lt;tt&amp;gt;ts_multiple&amp;lt;/tt&amp;gt; with the diffusive channel and inertial floodplain model combination.&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. In addition, there has been an upgrade to Condor (v6.x to v7.2) which has been rolled out onto all the machines. The submit host for Condor has also changed from &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;dylan.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;condor.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlab|MATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6083</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6083"/>
		<updated>2009-04-15T12:38:10Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: /* Checkpointing on Condor (beta) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. In addition, there has been an upgrade to Condor (v6.x to v7.2) which has been rolled out onto all the machines. The submit host for Condor has also changed from &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;dylan.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;condor.ggy.bris.ac.uk&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlab|MATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6082</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6082"/>
		<updated>2009-04-15T12:36:22Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: /* Checkpointing on Condor (beta) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. In addition, there has been an upgrade to Condor (v6.x to v7.2) which has been rolled out onto all the machines. The submit host for Condor has also changed from dylan.ggy.bris.ac.uk to condor.ggy.bris.ac.uk.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlab|MATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6051</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6051"/>
		<updated>2009-02-24T12:26:17Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
LISFLOOD-FP checkpointing on Condor should work out of the box. Do NOT include a .chkpnt file with the original submission - Condor will manage the checkpointing and file creation correctly. This will currently only work with Condor v7.2.0 in 1.4N and will not work with the Condor version currently installed on Dylan.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlab|MATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Lisflood_in_matlab&amp;diff=6050</id>
		<title>Lisflood in matlab</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Lisflood_in_matlab&amp;diff=6050"/>
		<updated>2009-02-23T12:17:30Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: Lisflood in matlab moved to LISFLOOD-FP and MATLAB&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[LISFLOOD-FP and MATLAB]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=6049</id>
		<title>LISFLOOD-FP and MATLAB</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=6049"/>
		<updated>2009-02-23T12:17:30Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: Lisflood in matlab moved to LISFLOOD-FP and MATLAB&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains various Matlab functions that may be useful for analysing results from the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model.&lt;br /&gt;
&lt;br /&gt;
==File import and export==&lt;br /&gt;
&lt;br /&gt;
===Importing ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will import an ascii raster file using the string filename. To use it, copy and past text into a textfile called ascii_reader.m&lt;br /&gt;
&lt;br /&gt;
 function [dem, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % This function reads arc .asc files&lt;br /&gt;
 % requires filename string as input&lt;br /&gt;
 &lt;br /&gt;
 % j neal&lt;br /&gt;
 % 18/6/07&lt;br /&gt;
 %% read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 dem = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 dem = dem';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
You can view the imported file using the command:&lt;br /&gt;
&lt;br /&gt;
 imagesc(dem);&lt;br /&gt;
&lt;br /&gt;
===Exporting ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will create an ascii raster file called filename from the 2D matrix DEM.  To use it, copy and past text into a textfile called ascii_write.m&lt;br /&gt;
&lt;br /&gt;
 function ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 &lt;br /&gt;
 % ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 % only filename (string) and DEM (2D matrix) are essential&lt;br /&gt;
 % this function writes ascii raster files for arc&lt;br /&gt;
 % j neal&lt;br /&gt;
 % 6/3/2008&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
     error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4, &lt;br /&gt;
     xllcorner = 0;&lt;br /&gt;
     yllcorner = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 5,&lt;br /&gt;
     cellsize = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 6&lt;br /&gt;
     nodata = -9999;&lt;br /&gt;
 end&lt;br /&gt;
 A = size(DEM);&lt;br /&gt;
 fout = fopen (filename,'w');&lt;br /&gt;
 fprintf(fout, 'ncols         %.0f\n', A(2));  &lt;br /&gt;
 fprintf(fout, 'nrows         %.0f\n', A(1));&lt;br /&gt;
 fprintf(fout, 'xllcorner     %f\n', xllcorner);&lt;br /&gt;
 fprintf(fout, 'yllcorner     %f\n', yllcorner);&lt;br /&gt;
 fprintf(fout, 'cellsize      %f\n', cellsize);&lt;br /&gt;
 fprintf(fout, 'NODATA_value  %f\n', nodata); &lt;br /&gt;
 for ii = 1:A(1)&lt;br /&gt;
     B = DEM(ii,:);&lt;br /&gt;
     fprintf(fout, '%1.3f ', B);&lt;br /&gt;
     fprintf(fout, '\n');&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Importing .profile files===&lt;br /&gt;
&lt;br /&gt;
This function imports .profile files&lt;br /&gt;
&lt;br /&gt;
 function [data, M] = profileread (resroot, numfiles, t, string1, string2)&lt;br /&gt;
 &lt;br /&gt;
 % This function reads LISFLOOD-FP .profile files&lt;br /&gt;
 %&lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT)&lt;br /&gt;
 %   where RESROOT is a string containing the resroot from the LISFLOOD-FP&lt;br /&gt;
 %   .par file. Absolute path names can also be used e.g. 'C:\LISFLOOD\resroot'&lt;br /&gt;
 %   DATA is a structure containing .header {cell aray}&lt;br /&gt;
 %                                  .segmentN (numerical array for segment N)&lt;br /&gt;
 %&lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT, NUMFILES)&lt;br /&gt;
 %   NUMFILES = number of files to read. Reads m files assuming that the files &lt;br /&gt;
 %   are numbered such that resroot-000m.profile. &lt;br /&gt;
 %   DATA(m) is a structure containing m files&lt;br /&gt;
 % &lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT, NUMFILES, 1)&lt;br /&gt;
 %   specifies the profiles were exported a user specified time such that&lt;br /&gt;
 %   resroot-000x-t.profile&lt;br /&gt;
 %&lt;br /&gt;
 % [DATA, M] = PROFILEREAD (RESROOT, NUMFILES, 1, string1, string2)&lt;br /&gt;
 %   instructs the function to plot string1 or sting1 against string2... these&lt;br /&gt;
 %   strings muct match the headernames in the .profile file e.g. 'Flow'&lt;br /&gt;
 %   returns movieframes in the structure M. Also plots the data.&lt;br /&gt;
 %&lt;br /&gt;
 % Note: LISFLOOD-FP will name multiple files 0 to m-1 but DATA(m) will count from 1 to m&lt;br /&gt;
 %&lt;br /&gt;
 % j.neal&lt;br /&gt;
 % 12/5/2008&lt;br /&gt;
 %%&lt;br /&gt;
 if nargin &amp;lt; 1, &lt;br /&gt;
    error('Requires filename'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 2,&lt;br /&gt;
    % only one file&lt;br /&gt;
    numfiles = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 2,&lt;br /&gt;
    t = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4,&lt;br /&gt;
    % no plotting required&lt;br /&gt;
    plotting = 0;&lt;br /&gt;
    M = 0;&lt;br /&gt;
 elseif nargin &amp;lt; 5,&lt;br /&gt;
    % use plotter&lt;br /&gt;
    plotting = 1;&lt;br /&gt;
 elseif nargin &amp;lt; 6,&lt;br /&gt;
    plotting = 2;&lt;br /&gt;
 end&lt;br /&gt;
 %% Arrange data read&lt;br /&gt;
 if t == 1&lt;br /&gt;
    fileex = '-t.profile';&lt;br /&gt;
 else&lt;br /&gt;
    fileex = '.profile';&lt;br /&gt;
 end&lt;br /&gt;
 if numfiles == 0&lt;br /&gt;
    % read in a single .profile file&lt;br /&gt;
    filename = [resroot,fileex];&lt;br /&gt;
    data = read_profile (filename);&lt;br /&gt;
 elseif numfiles &amp;lt; 9999&lt;br /&gt;
    % read a series of .profile files&lt;br /&gt;
    for i = 1:numfiles&lt;br /&gt;
        ii = i-1;&lt;br /&gt;
        if ii &amp;lt; 10&lt;br /&gt;
            resroot2 = [resroot,'-000',num2str(ii),fileex];&lt;br /&gt;
        elseif ii &amp;lt; 100&lt;br /&gt;
            resroot2 = [resroot,'-00',num2str(ii),fileex];&lt;br /&gt;
        elseif ii &amp;lt; 1000&lt;br /&gt;
            resroot2 = [resroot,'-0',num2str(ii),fileex];&lt;br /&gt;
        else&lt;br /&gt;
            resroot2 = [resroot,'-',num2str(ii),fileex];&lt;br /&gt;
        end&lt;br /&gt;
        %returnes structure with format data(i).segmentX... also includes .header &lt;br /&gt;
        [data(i), seg_num] = read_profile (resroot2); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
 else&lt;br /&gt;
    error ('Too many files or incorrect input to numfiles'); &lt;br /&gt;
 end&lt;br /&gt;
 %% Plotting under development&lt;br /&gt;
 % account for 0 seg num&lt;br /&gt;
 seg_num = seg_num +1;&lt;br /&gt;
 % if plotting == 0 % do nothing... no plots&lt;br /&gt;
 if plotting == 1&lt;br /&gt;
    % find the column you want to plot&lt;br /&gt;
    I = strmatch(string1 , data(1).header);&lt;br /&gt;
    % plot a single variable&lt;br /&gt;
    A = size(data);&lt;br /&gt;
    for i = 1:A(2)&lt;br /&gt;
        figure(i);&lt;br /&gt;
        for j = 1:seg_num&lt;br /&gt;
            k = j-1;&lt;br /&gt;
            subplot(1,seg_num,j);&lt;br /&gt;
            eval(['plot(data(i).segment',num2str(k),'(:,',num2str(I),'));']);&lt;br /&gt;
            tstring = ['Plot of ',resroot,num2str(i),' segment ',num2str(k)];  &lt;br /&gt;
            title(tstring);&lt;br /&gt;
            % get movie frame&lt;br /&gt;
            M(i,j) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
 elseif plotting == 2&lt;br /&gt;
    % find the columns you want to plot&lt;br /&gt;
    I = strmatch(string1 , data(1).header);&lt;br /&gt;
    I2 = strmatch(string2 , data(1).header);&lt;br /&gt;
    A = size(data);&lt;br /&gt;
    for i = 1:A(2)&lt;br /&gt;
        figure(i);&lt;br /&gt;
        for j = 1:seg_num&lt;br /&gt;
            k = j-1;&lt;br /&gt;
            subplot(1,seg_num,j);&lt;br /&gt;
            eval(['plot(data(i).segment',num2str(k),'(:,',num2str(I),'),data(i).segment',num2str(k),'(:,',num2str(I2),'));']);&lt;br /&gt;
            % get movie frame&lt;br /&gt;
            tstring = ['Plot of ',resroot,num2str(i),' segment ',num2str(k)];  &lt;br /&gt;
            title(tstring);&lt;br /&gt;
            M(i,j) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
 %% read .profile file&lt;br /&gt;
 function [data, seg_num] = read_profile (filename) &lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 more_segs = 1;&lt;br /&gt;
 % read 'Channel_segment:' from file&lt;br /&gt;
 temp = fscanf(fin,'%s',1); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 while more_segs == 1&lt;br /&gt;
    % read filename&lt;br /&gt;
    seg_num = fscanf(fin,'%f',1);&lt;br /&gt;
    for i = 1:11&lt;br /&gt;
        data.header{i} = fscanf(fin,'%s',1);&lt;br /&gt;
    end&lt;br /&gt;
    testline = 1;&lt;br /&gt;
    j = 0;&lt;br /&gt;
    while testline == 1&lt;br /&gt;
        j = j+1;&lt;br /&gt;
        % reads the first bit of the line as a string&lt;br /&gt;
        A = fscanf(fin, '%s',1);&lt;br /&gt;
        % this string is either a numer of a new channel sgment of the end&lt;br /&gt;
        % of the file&lt;br /&gt;
        % if end of file&lt;br /&gt;
        ST = feof (fin);&lt;br /&gt;
        if ST == 1&lt;br /&gt;
            % reached the end of the file exit both while loops&lt;br /&gt;
            testline = 0;&lt;br /&gt;
            more_segs = 0;&lt;br /&gt;
        else&lt;br /&gt;
            TF = strcmp('Channel_segment:', A);&lt;br /&gt;
            if TF == 1&lt;br /&gt;
                % new segment has been found&lt;br /&gt;
                testline = 0;&lt;br /&gt;
            else&lt;br /&gt;
                % read rest for line into data&lt;br /&gt;
                B(j,1) = str2double(A); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
                for k = 2:11&lt;br /&gt;
                    B(j,k) = fscanf(fin, '%f',1); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
                 end&lt;br /&gt;
             end&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
     eval(['data.segment',num2str(seg_num),' = B;']);&lt;br /&gt;
     clear B&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Writing parameter files===&lt;br /&gt;
&lt;br /&gt;
This function can be used to write many LISFLOOD-FP parameter files with ''N'' different channel and floodplain roughness, using your own ''N-by-''2 matrix called roughness. You will need to edit the code for your application by commenting unwanted lines with a percentage symbol.&lt;br /&gt;
&lt;br /&gt;
 function prm_writer (roughness) &lt;br /&gt;
 &lt;br /&gt;
 % This function writes LISFLOOD-FP parameter files numbered 1 to n using&lt;br /&gt;
 % the roughness values in the n-by-2 matrix roughness. yuo will need to&lt;br /&gt;
 % edit the code for your application.&lt;br /&gt;
 &lt;br /&gt;
 [num_sims] = size(roughness);&lt;br /&gt;
 for i = 1:num_sims(1)&lt;br /&gt;
 a = ['mymodel', num2str(i),'.par']; b = num2str(i);&lt;br /&gt;
 fout = fopen(a,'w');&lt;br /&gt;
 fprintf(fout,'DEMfile                  mydem.dem.ascii\n');&lt;br /&gt;
 fprintf(fout,'resroot                  myres%s\n',b);&lt;br /&gt;
 fprintf(fout,'dirroot                  mydir\n');&lt;br /&gt;
 fprintf(fout,'sim_time                 245000.0\n');&lt;br /&gt;
 fprintf(fout,'initial_tstep            10.0\n');&lt;br /&gt;
 fprintf(fout,'massint                  300.0\n');&lt;br /&gt;
 fprintf(fout,'saveint                  10000.0\n');&lt;br /&gt;
 %fprintf(fout,'overpass                 135000.0\n');&lt;br /&gt;
 fprintf(fout,'fpfric                   %1.3f\n',roughness(i,2));&lt;br /&gt;
 fprintf(fout,'nch                      %1.3f\n',roughness(i,1));&lt;br /&gt;
 %fprintf(fout,'manningfile              mymanfile%s.n.ascii\n',b);&lt;br /&gt;
 fprintf(fout,'riverfile                myriver.river\n');&lt;br /&gt;
 fprintf(fout,'bdyfile                  mybdy.bdy\n');&lt;br /&gt;
 fprintf(fout,'stagefile                mystage.stage\n');&lt;br /&gt;
 fprintf(fout,'bcifile                  mybci.bci\n');&lt;br /&gt;
 %fprintf(fout,'startfile                mystart.old\n');&lt;br /&gt;
 %fprintf(fout,'checkpoint               2\n');&lt;br /&gt;
 %fprintf(fout,'checkfile                mycheck.chkpnt\n');&lt;br /&gt;
 fprintf(fout,'elevoff\n');&lt;br /&gt;
 fprintf(fout,'qoutput\n');&lt;br /&gt;
 fprintf(fout,'diffusive\n');&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Plotting flow vectors from .Qx and .Qy files==&lt;br /&gt;
&lt;br /&gt;
This function will plot flow vectors from a .Qx and .Qy over a dem using the matlab functions image and quiver  &lt;br /&gt;
&lt;br /&gt;
 function lisflood_flow_plotter (qxfile, qyfile, demfile, north, east, south, west, scaling)&lt;br /&gt;
 &lt;br /&gt;
 % This function plots flow vectors from LISFLOOD_FP Qx and QY files&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile);&lt;br /&gt;
 %&lt;br /&gt;
 % these input variables are strings containing the relative of full&lt;br /&gt;
 % pathnames of the .Qx .Qy and ascii dem files to be plotted.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W);&lt;br /&gt;
 %&lt;br /&gt;
 % N, E, W and S are optional they specify the northernmost, southeernmost&lt;br /&gt;
 % ect cell to be displayed. this can be used to crop the domain.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W, scaling);&lt;br /&gt;
 % &lt;br /&gt;
 % scaling is an optional term used to manually scale the vector lengthes&lt;br /&gt;
 % drawn by quiver (the arrow plotting function).&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 20/02/2008 &lt;br /&gt;
 &lt;br /&gt;
 %% decide if crop is required and give imput error message&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
     error('Requires at least three input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7, &lt;br /&gt;
     crop = 0;&lt;br /&gt;
 else&lt;br /&gt;
     crop = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7,&lt;br /&gt;
     scaling = 1;&lt;br /&gt;
 end &lt;br /&gt;
 % Note don't do this for large areas ?&lt;br /&gt;
 %% Task 1: read ascii files&lt;br /&gt;
 % read Qx file&lt;br /&gt;
 [QX, ncolsqx, nrowsqx, xllcornerqx, yllcornerqx, cellsizeqx] = read_file (qxfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read Qy file&lt;br /&gt;
 [QY, ncolsqy, nrowsqy, xllcornerqy, yllcornerqy, cellsizeqy] = read_file (qyfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read DEM&lt;br /&gt;
 [DEM, ncolsdem, nrowsdem, xllcornerdem, yllcornerdem, cellsizedem] = read_file (demfile);&lt;br /&gt;
 %% crop data if required&lt;br /&gt;
 if crop == 1;&lt;br /&gt;
     DEM = DEM(north:south,west:east);&lt;br /&gt;
     QX = QX(north:south,west:east+1);&lt;br /&gt;
     QY = QY(north:south+1,west:east);&lt;br /&gt;
     xllcornerdem = xllcornerdem + west*cellsizedem - cellsizedem;&lt;br /&gt;
     yllcornerdem = yllcornerdem + (nrowsdem - south) * cellsizedem;&lt;br /&gt;
     [nrowsqx, ncolsqx] = size(QX); [nrowsqy, ncolsqy] = size(QY); [nrowsdem, ncolsdem] = size(DEM);&lt;br /&gt;
 end&lt;br /&gt;
 %% Taks 2: Plot dem and generate figure&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap('gray');&lt;br /&gt;
 % Create axes&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcornerdem + nrowsdem*cellsizedem ,yllcornerdem},...&lt;br /&gt;
     'YTick',[0.5,nrowsdem+0.5],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcornerdem,xllcornerdem+ncolsdem*cellsizedem},...&lt;br /&gt;
     'XTick',[0.5, ncolsdem + 0.5],...&lt;br /&gt;
     'Layer','top',...&lt;br /&gt;
     'DataAspectRatio',[1 1 1]...&lt;br /&gt;
     %,'Clim',[13 30]... % uncomment to set colourmap limits manually&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM,'Parent',axes1,'CDataMapping','scaled');&lt;br /&gt;
 axis('image');&lt;br /&gt;
 xlabel('Easting (m)');&lt;br /&gt;
 ylabel('Northing (m)');&lt;br /&gt;
 %% Task 3: calculate flow vectors&lt;br /&gt;
 % pre allocate memory for loop... it will run faster this way&lt;br /&gt;
 xlocs = zeros(ncolsqx*nrowsqx+ncolsqy*nrowsqy,1);&lt;br /&gt;
 ylocs = xlocs;&lt;br /&gt;
 U = xlocs;&lt;br /&gt;
 V = xlocs;&lt;br /&gt;
 %work out X and Y locations&lt;br /&gt;
 for i = 1:nrowsqx&lt;br /&gt;
     for j = 1:ncolsqx&lt;br /&gt;
         xlocs((i-1)*ncolsqx+j,1) = j - 0.5;&lt;br /&gt;
         ylocs((i-1)*ncolsqx+j,1) = i;&lt;br /&gt;
         U((i-1)*ncolsqx+j,1) = QX(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 for i = 1:nrowsqy&lt;br /&gt;
     for j = 1:ncolsqy&lt;br /&gt;
         xlocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = j;&lt;br /&gt;
         ylocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = i - 0.5;&lt;br /&gt;
         V(ncolsqx*nrowsqx+(i-1)*ncolsqy+j,1) = QY(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % work out number of nonzeros elements&lt;br /&gt;
 num_flows = nnz(U+V);&lt;br /&gt;
 xlocs2 = zeros(num_flows,1);&lt;br /&gt;
 ylocs2 = xlocs2;&lt;br /&gt;
 U2 = xlocs2;&lt;br /&gt;
 V2 = xlocs2;&lt;br /&gt;
 % remover zero flow locations&lt;br /&gt;
 k = 1;&lt;br /&gt;
 for i = 1:ncolsqx*nrowsqx+ncolsqy*nrowsqy&lt;br /&gt;
     if (U(i,1) == 0) &amp;amp;&amp;amp; (V(i,1) == 0)&lt;br /&gt;
         % do nothing&lt;br /&gt;
     else&lt;br /&gt;
         xlocs2(k,1) = xlocs(i,1);&lt;br /&gt;
         ylocs2(k,1) = ylocs(i,1);&lt;br /&gt;
         U2(k,1) = U(i,1);&lt;br /&gt;
         V2(k,1) = V(i,1);&lt;br /&gt;
         k = k+1;&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % check numbers are correct&lt;br /&gt;
 if k == num_flows + 1&lt;br /&gt;
     % all is ok&lt;br /&gt;
 else&lt;br /&gt;
     disp('Problem with flows');&lt;br /&gt;
 end&lt;br /&gt;
 %% Task 4: overlay flow vectors&lt;br /&gt;
 disp('Plotting data... if this is taking a long time you may need fewer locations');&lt;br /&gt;
 quiver (xlocs2,ylocs2,U2,V2, scaling);&lt;br /&gt;
 % quiver (xloc2,yloc2,U2,V2,'Parent',figure1);&lt;br /&gt;
 disp('Done');&lt;br /&gt;
 %% function to read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
==Making movies from .wd files==&lt;br /&gt;
&lt;br /&gt;
This function will convert a series of .wd .Qx or .Qy file into a .avi movie with the same filename&lt;br /&gt;
&lt;br /&gt;
 function LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ) &lt;br /&gt;
 &lt;br /&gt;
 % LISFLOOD_mov generates movies of LISFLOOD-FP output&lt;br /&gt;
 %&lt;br /&gt;
 % LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ)&lt;br /&gt;
 % &lt;br /&gt;
 % where &lt;br /&gt;
 % resroot is the LISFLOOD resroot (relative to m file or absolute)(string)&lt;br /&gt;
 % fileex is the file extension '.wd' (can be chaned to plot WSE and flows)&lt;br /&gt;
 % vartype is the name of the variable being plotted e.g. 'Depth'&lt;br /&gt;
 % num_snaps is the number of snapshot times&lt;br /&gt;
 % snapint is the time interval between each LISFLOOD-FP snapshot (seconds)&lt;br /&gt;
 % dem is the name of the demfile (relative or absolute)&lt;br /&gt;
 % demCS is the range of dem hights to be plotted e.g. demCS = [0,20];&lt;br /&gt;
 % depthCS is the range of depth values to be plotted e.g. depthCS = [0,10];&lt;br /&gt;
 % framesPS number of frames per second (each plot is a simgle frame)&lt;br /&gt;
 % movQ is the movie quality between 1 and 100 (100 is best)&lt;br /&gt;
 % &lt;br /&gt;
 % 8/11/2007. J Neal.&lt;br /&gt;
 %&lt;br /&gt;
 % EXAMPLE:&lt;br /&gt;
 % LISFLOOD_mov ('C:\Experiment1\res22','.wd','Water depth',24,10000,...&lt;br /&gt;
 % 'C:\Experiment1\dem10m.dem.ascii',[0,60], [0,10],1,100);&lt;br /&gt;
 %% Movie maker&lt;br /&gt;
 % read dem filenam is filename and 1 specifies the 0.00 should not be NaN's&lt;br /&gt;
 [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (dem); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 % A = [resroot,'.avi'];&lt;br /&gt;
 % mov = avifile(A);&lt;br /&gt;
 % loop through snapshots&lt;br /&gt;
 for i = 1:num_snaps&lt;br /&gt;
     if i &amp;lt; 10&lt;br /&gt;
         resfile = [resroot,'-000',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 100&lt;br /&gt;
         resfile = [resroot,'-00',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 1000&lt;br /&gt;
         resfile = [resroot,'-0',num2str(i),fileex];&lt;br /&gt;
     else&lt;br /&gt;
         resfile = [resroot,'-',num2str(i),fileex];&lt;br /&gt;
     end&lt;br /&gt;
     % read in deoth file for resfile i (2 specifies the 0.00 should be NaN&lt;br /&gt;
     [DEPTH, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (resfile);&lt;br /&gt;
     % plot data as figure 1&lt;br /&gt;
     plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype);&lt;br /&gt;
     % get movie frame&lt;br /&gt;
     M(i) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
     hold off;&lt;br /&gt;
 %     mov = addframe(mov,M(i));&lt;br /&gt;
     % close the figure&lt;br /&gt;
     close all&lt;br /&gt;
 end &lt;br /&gt;
 % % close .avi file&lt;br /&gt;
 % mov = close(mov);&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 disp('Generating .avi movie file');&lt;br /&gt;
 A = [resroot,fileex,'.avi'];&lt;br /&gt;
 movie2avi(M,A,'fps',framesPS,'quality',movQ);&lt;br /&gt;
 disp(A);&lt;br /&gt;
 %% Read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 % convert nodata to NaN;&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if OUT(ii,jj) == nodata&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         elseif OUT(ii,jj) == -99.000&lt;br /&gt;
             % lisflood uses -99.000 as nodat so will also remove these&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         else&lt;br /&gt;
             % do nothing&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 %% Plotter data for movie slide&lt;br /&gt;
 function plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype)&lt;br /&gt;
 % number of colors in colormap&lt;br /&gt;
 num_colors = 64;&lt;br /&gt;
 % DEM and variable color map&lt;br /&gt;
 cmap = [gray(num_colors); jet(num_colors)];&lt;br /&gt;
 % scale DEM and DEPTH data to fit with new colormap&lt;br /&gt;
 demCS2 = demCS(2)-demCS(1);&lt;br /&gt;
 dem_scalar = num_colors/demCS2;&lt;br /&gt;
 DEM2 = DEM*dem_scalar;&lt;br /&gt;
 depthCS2 = depthCS(2)-depthCS(1);&lt;br /&gt;
 depth_scalar = num_colors/depthCS2;&lt;br /&gt;
 DEPTH2 = (DEPTH*depth_scalar)+num_colors+1;&lt;br /&gt;
 %Plot the DEM&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap(cmap);&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcorner+(nrows*cellsize),yllcorner+cellsize},...&lt;br /&gt;
     'YTick', [1,nrows],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcorner,xllcorner+(ncols*cellsize)-cellsize},...&lt;br /&gt;
     'XTick',[1,ncols],...&lt;br /&gt;
     'Layer','top');&lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM2,'Parent',axes1);&lt;br /&gt;
 axis('equal');axis('tight');&lt;br /&gt;
 % Overlay the water depth (or other variable)&lt;br /&gt;
 H = image(DEPTH2);&lt;br /&gt;
 % code to make depth plot layer transparent&lt;br /&gt;
 OP = ones(nrows,ncols);&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if DEPTH(ii,jj) &amp;gt; 0&lt;br /&gt;
         else&lt;br /&gt;
             OP(ii,jj) = 0;&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % make transparent. depth layer must be H&lt;br /&gt;
 set(H,'AlphaData',OP);&lt;br /&gt;
 % label colourbar&lt;br /&gt;
 color_breaks = 5;&lt;br /&gt;
 colorbreak = num_colors/color_breaks;&lt;br /&gt;
 SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 SCALE(1) = 0.0001;&lt;br /&gt;
 for j = 1:color_breaks*2&lt;br /&gt;
     SCALE(j+1) = colorbreak*j;&lt;br /&gt;
 end&lt;br /&gt;
 SCALE(color_breaks+1) = num_colors+1;&lt;br /&gt;
 VIS_SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 VIS_SCALE(1) = demCS(1);&lt;br /&gt;
 for j = 1:color_breaks-1&lt;br /&gt;
     VIS_SCALE(j+1) = ((demCS2/color_breaks)*j)+demCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 VIS_SCALE(color_breaks+1) = depthCS(1);&lt;br /&gt;
 for j = 1:color_breaks&lt;br /&gt;
     VIS_SCALE(j+1+color_breaks) = ((depthCS2/color_breaks)*j)+depthCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 colorbar('YTick',SCALE,'YTickLabel',VIS_SCALE);&lt;br /&gt;
 % Label axis&lt;br /&gt;
 xlabel('BNG easting (m)');&lt;br /&gt;
 ylabel('BNG northing (m)');&lt;br /&gt;
 A = [vartype,' over DEM at time ',num2str((i*snapint)),'s'];&lt;br /&gt;
 title(A);&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Lisflood&amp;diff=6048</id>
		<title>Lisflood</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Lisflood&amp;diff=6048"/>
		<updated>2009-02-23T12:16:59Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: Lisflood moved to LISFLOOD-FP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[LISFLOOD-FP]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6047</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6047"/>
		<updated>2009-02-23T12:16:59Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: Lisflood moved to LISFLOOD-FP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlab|MATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6046</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6046"/>
		<updated>2009-02-23T12:14:40Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlab|MATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6045</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6045"/>
		<updated>2009-02-23T12:14:21Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlab# MATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6044</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6044"/>
		<updated>2009-02-23T12:14:09Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlab#MATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6043</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6043"/>
		<updated>2009-02-23T12:13:48Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlabMATLAB#Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6042</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6042"/>
		<updated>2009-02-23T12:13:37Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==[[Lisflood_in_matlabMATLAB Functions for LISFLOOD-FP]]==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=6041</id>
		<title>LISFLOOD-FP and MATLAB</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=6041"/>
		<updated>2009-02-18T17:48:30Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains various Matlab functions that may be useful for analysing results from the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model.&lt;br /&gt;
&lt;br /&gt;
==File import and export==&lt;br /&gt;
&lt;br /&gt;
===Importing ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will import an ascii raster file using the string filename. To use it, copy and past text into a textfile called ascii_reader.m&lt;br /&gt;
&lt;br /&gt;
 function [dem, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % This function reads arc .asc files&lt;br /&gt;
 % requires filename string as input&lt;br /&gt;
 &lt;br /&gt;
 % j neal&lt;br /&gt;
 % 18/6/07&lt;br /&gt;
 %% read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 dem = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 dem = dem';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
You can view the imported file using the command:&lt;br /&gt;
&lt;br /&gt;
 imagesc(dem);&lt;br /&gt;
&lt;br /&gt;
===Exporting ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will create an ascii raster file called filename from the 2D matrix DEM.  To use it, copy and past text into a textfile called ascii_write.m&lt;br /&gt;
&lt;br /&gt;
 function ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 &lt;br /&gt;
 % ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 % only filename (string) and DEM (2D matrix) are essential&lt;br /&gt;
 % this function writes ascii raster files for arc&lt;br /&gt;
 % j neal&lt;br /&gt;
 % 6/3/2008&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
     error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4, &lt;br /&gt;
     xllcorner = 0;&lt;br /&gt;
     yllcorner = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 5,&lt;br /&gt;
     cellsize = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 6&lt;br /&gt;
     nodata = -9999;&lt;br /&gt;
 end&lt;br /&gt;
 A = size(DEM);&lt;br /&gt;
 fout = fopen (filename,'w');&lt;br /&gt;
 fprintf(fout, 'ncols         %.0f\n', A(2));  &lt;br /&gt;
 fprintf(fout, 'nrows         %.0f\n', A(1));&lt;br /&gt;
 fprintf(fout, 'xllcorner     %f\n', xllcorner);&lt;br /&gt;
 fprintf(fout, 'yllcorner     %f\n', yllcorner);&lt;br /&gt;
 fprintf(fout, 'cellsize      %f\n', cellsize);&lt;br /&gt;
 fprintf(fout, 'NODATA_value  %f\n', nodata); &lt;br /&gt;
 for ii = 1:A(1)&lt;br /&gt;
     B = DEM(ii,:);&lt;br /&gt;
     fprintf(fout, '%1.3f ', B);&lt;br /&gt;
     fprintf(fout, '\n');&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Importing .profile files===&lt;br /&gt;
&lt;br /&gt;
This function imports .profile files&lt;br /&gt;
&lt;br /&gt;
 function [data, M] = profileread (resroot, numfiles, t, string1, string2)&lt;br /&gt;
 &lt;br /&gt;
 % This function reads LISFLOOD-FP .profile files&lt;br /&gt;
 %&lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT)&lt;br /&gt;
 %   where RESROOT is a string containing the resroot from the LISFLOOD-FP&lt;br /&gt;
 %   .par file. Absolute path names can also be used e.g. 'C:\LISFLOOD\resroot'&lt;br /&gt;
 %   DATA is a structure containing .header {cell aray}&lt;br /&gt;
 %                                  .segmentN (numerical array for segment N)&lt;br /&gt;
 %&lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT, NUMFILES)&lt;br /&gt;
 %   NUMFILES = number of files to read. Reads m files assuming that the files &lt;br /&gt;
 %   are numbered such that resroot-000m.profile. &lt;br /&gt;
 %   DATA(m) is a structure containing m files&lt;br /&gt;
 % &lt;br /&gt;
 % DATA = PROFILEREAD (RESROOT, NUMFILES, 1)&lt;br /&gt;
 %   specifies the profiles were exported a user specified time such that&lt;br /&gt;
 %   resroot-000x-t.profile&lt;br /&gt;
 %&lt;br /&gt;
 % [DATA, M] = PROFILEREAD (RESROOT, NUMFILES, 1, string1, string2)&lt;br /&gt;
 %   instructs the function to plot string1 or sting1 against string2... these&lt;br /&gt;
 %   strings muct match the headernames in the .profile file e.g. 'Flow'&lt;br /&gt;
 %   returns movieframes in the structure M. Also plots the data.&lt;br /&gt;
 %&lt;br /&gt;
 % Note: LISFLOOD-FP will name multiple files 0 to m-1 but DATA(m) will count from 1 to m&lt;br /&gt;
 %&lt;br /&gt;
 % j.neal&lt;br /&gt;
 % 12/5/2008&lt;br /&gt;
 %%&lt;br /&gt;
 if nargin &amp;lt; 1, &lt;br /&gt;
    error('Requires filename'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 2,&lt;br /&gt;
    % only one file&lt;br /&gt;
    numfiles = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 2,&lt;br /&gt;
    t = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4,&lt;br /&gt;
    % no plotting required&lt;br /&gt;
    plotting = 0;&lt;br /&gt;
    M = 0;&lt;br /&gt;
 elseif nargin &amp;lt; 5,&lt;br /&gt;
    % use plotter&lt;br /&gt;
    plotting = 1;&lt;br /&gt;
 elseif nargin &amp;lt; 6,&lt;br /&gt;
    plotting = 2;&lt;br /&gt;
 end&lt;br /&gt;
 %% Arrange data read&lt;br /&gt;
 if t == 1&lt;br /&gt;
    fileex = '-t.profile';&lt;br /&gt;
 else&lt;br /&gt;
    fileex = '.profile';&lt;br /&gt;
 end&lt;br /&gt;
 if numfiles == 0&lt;br /&gt;
    % read in a single .profile file&lt;br /&gt;
    filename = [resroot,fileex];&lt;br /&gt;
    data = read_profile (filename);&lt;br /&gt;
 elseif numfiles &amp;lt; 9999&lt;br /&gt;
    % read a series of .profile files&lt;br /&gt;
    for i = 1:numfiles&lt;br /&gt;
        ii = i-1;&lt;br /&gt;
        if ii &amp;lt; 10&lt;br /&gt;
            resroot2 = [resroot,'-000',num2str(ii),fileex];&lt;br /&gt;
        elseif ii &amp;lt; 100&lt;br /&gt;
            resroot2 = [resroot,'-00',num2str(ii),fileex];&lt;br /&gt;
        elseif ii &amp;lt; 1000&lt;br /&gt;
            resroot2 = [resroot,'-0',num2str(ii),fileex];&lt;br /&gt;
        else&lt;br /&gt;
            resroot2 = [resroot,'-',num2str(ii),fileex];&lt;br /&gt;
        end&lt;br /&gt;
        %returnes structure with format data(i).segmentX... also includes .header &lt;br /&gt;
        [data(i), seg_num] = read_profile (resroot2); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
    end&lt;br /&gt;
 else&lt;br /&gt;
    error ('Too many files or incorrect input to numfiles'); &lt;br /&gt;
 end&lt;br /&gt;
 %% Plotting under development&lt;br /&gt;
 % account for 0 seg num&lt;br /&gt;
 seg_num = seg_num +1;&lt;br /&gt;
 % if plotting == 0 % do nothing... no plots&lt;br /&gt;
 if plotting == 1&lt;br /&gt;
    % find the column you want to plot&lt;br /&gt;
    I = strmatch(string1 , data(1).header);&lt;br /&gt;
    % plot a single variable&lt;br /&gt;
    A = size(data);&lt;br /&gt;
    for i = 1:A(2)&lt;br /&gt;
        figure(i);&lt;br /&gt;
        for j = 1:seg_num&lt;br /&gt;
            k = j-1;&lt;br /&gt;
            subplot(1,seg_num,j);&lt;br /&gt;
            eval(['plot(data(i).segment',num2str(k),'(:,',num2str(I),'));']);&lt;br /&gt;
            tstring = ['Plot of ',resroot,num2str(i),' segment ',num2str(k)];  &lt;br /&gt;
            title(tstring);&lt;br /&gt;
            % get movie frame&lt;br /&gt;
            M(i,j) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
 elseif plotting == 2&lt;br /&gt;
    % find the columns you want to plot&lt;br /&gt;
    I = strmatch(string1 , data(1).header);&lt;br /&gt;
    I2 = strmatch(string2 , data(1).header);&lt;br /&gt;
    A = size(data);&lt;br /&gt;
    for i = 1:A(2)&lt;br /&gt;
        figure(i);&lt;br /&gt;
        for j = 1:seg_num&lt;br /&gt;
            k = j-1;&lt;br /&gt;
            subplot(1,seg_num,j);&lt;br /&gt;
            eval(['plot(data(i).segment',num2str(k),'(:,',num2str(I),'),data(i).segment',num2str(k),'(:,',num2str(I2),'));']);&lt;br /&gt;
            % get movie frame&lt;br /&gt;
            tstring = ['Plot of ',resroot,num2str(i),' segment ',num2str(k)];  &lt;br /&gt;
            title(tstring);&lt;br /&gt;
            M(i,j) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
 %% read .profile file&lt;br /&gt;
 function [data, seg_num] = read_profile (filename) &lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 more_segs = 1;&lt;br /&gt;
 % read 'Channel_segment:' from file&lt;br /&gt;
 temp = fscanf(fin,'%s',1); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 while more_segs == 1&lt;br /&gt;
    % read filename&lt;br /&gt;
    seg_num = fscanf(fin,'%f',1);&lt;br /&gt;
    for i = 1:11&lt;br /&gt;
        data.header{i} = fscanf(fin,'%s',1);&lt;br /&gt;
    end&lt;br /&gt;
    testline = 1;&lt;br /&gt;
    j = 0;&lt;br /&gt;
    while testline == 1&lt;br /&gt;
        j = j+1;&lt;br /&gt;
        % reads the first bit of the line as a string&lt;br /&gt;
        A = fscanf(fin, '%s',1);&lt;br /&gt;
        % this string is either a numer of a new channel sgment of the end&lt;br /&gt;
        % of the file&lt;br /&gt;
        % if end of file&lt;br /&gt;
        ST = feof (fin);&lt;br /&gt;
        if ST == 1&lt;br /&gt;
            % reached the end of the file exit both while loops&lt;br /&gt;
            testline = 0;&lt;br /&gt;
            more_segs = 0;&lt;br /&gt;
        else&lt;br /&gt;
            TF = strcmp('Channel_segment:', A);&lt;br /&gt;
            if TF == 1&lt;br /&gt;
                % new segment has been found&lt;br /&gt;
                testline = 0;&lt;br /&gt;
            else&lt;br /&gt;
                % read rest for line into data&lt;br /&gt;
                B(j,1) = str2double(A); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
                for k = 2:11&lt;br /&gt;
                    B(j,k) = fscanf(fin, '%f',1); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
                 end&lt;br /&gt;
             end&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
     eval(['data.segment',num2str(seg_num),' = B;']);&lt;br /&gt;
     clear B&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Writing parameter files===&lt;br /&gt;
&lt;br /&gt;
This function can be used to write many LISFLOOD-FP parameter files with ''N'' different channel and floodplain roughness, using your own ''N-by-''2 matrix called roughness. You will need to edit the code for your application by commenting unwanted lines with a percentage symbol.&lt;br /&gt;
&lt;br /&gt;
 function prm_writer (roughness) &lt;br /&gt;
 &lt;br /&gt;
 % This function writes LISFLOOD-FP parameter files numbered 1 to n using&lt;br /&gt;
 % the roughness values in the n-by-2 matrix roughness. yuo will need to&lt;br /&gt;
 % edit the code for your application.&lt;br /&gt;
 &lt;br /&gt;
 [num_sims] = size(roughness);&lt;br /&gt;
 for i = 1:num_sims(1)&lt;br /&gt;
 a = ['mymodel', num2str(i),'.par']; b = num2str(i);&lt;br /&gt;
 fout = fopen(a,'w');&lt;br /&gt;
 fprintf(fout,'DEMfile                  mydem.dem.ascii\n');&lt;br /&gt;
 fprintf(fout,'resroot                  myres%s\n',b);&lt;br /&gt;
 fprintf(fout,'dirroot                  mydir\n');&lt;br /&gt;
 fprintf(fout,'sim_time                 245000.0\n');&lt;br /&gt;
 fprintf(fout,'initial_tstep            10.0\n');&lt;br /&gt;
 fprintf(fout,'massint                  300.0\n');&lt;br /&gt;
 fprintf(fout,'saveint                  10000.0\n');&lt;br /&gt;
 %fprintf(fout,'overpass                 135000.0\n');&lt;br /&gt;
 fprintf(fout,'fpfric                   %1.3f\n',roughness(i,2));&lt;br /&gt;
 fprintf(fout,'nch                      %1.3f\n',roughness(i,1));&lt;br /&gt;
 %fprintf(fout,'manningfile              mymanfile%s.n.ascii\n',b);&lt;br /&gt;
 fprintf(fout,'riverfile                myriver.river\n');&lt;br /&gt;
 fprintf(fout,'bdyfile                  mybdy.bdy\n');&lt;br /&gt;
 fprintf(fout,'stagefile                mystage.stage\n');&lt;br /&gt;
 fprintf(fout,'bcifile                  mybci.bci\n');&lt;br /&gt;
 %fprintf(fout,'startfile                mystart.old\n');&lt;br /&gt;
 %fprintf(fout,'checkpoint               2\n');&lt;br /&gt;
 %fprintf(fout,'checkfile                mycheck.chkpnt\n');&lt;br /&gt;
 fprintf(fout,'elevoff\n');&lt;br /&gt;
 fprintf(fout,'qoutput\n');&lt;br /&gt;
 fprintf(fout,'diffusive\n');&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Plotting flow vectors from .Qx and .Qy files==&lt;br /&gt;
&lt;br /&gt;
This function will plot flow vectors from a .Qx and .Qy over a dem using the matlab functions image and quiver  &lt;br /&gt;
&lt;br /&gt;
 function lisflood_flow_plotter (qxfile, qyfile, demfile, north, east, south, west, scaling)&lt;br /&gt;
 &lt;br /&gt;
 % This function plots flow vectors from LISFLOOD_FP Qx and QY files&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile);&lt;br /&gt;
 %&lt;br /&gt;
 % these input variables are strings containing the relative of full&lt;br /&gt;
 % pathnames of the .Qx .Qy and ascii dem files to be plotted.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W);&lt;br /&gt;
 %&lt;br /&gt;
 % N, E, W and S are optional they specify the northernmost, southeernmost&lt;br /&gt;
 % ect cell to be displayed. this can be used to crop the domain.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W, scaling);&lt;br /&gt;
 % &lt;br /&gt;
 % scaling is an optional term used to manually scale the vector lengthes&lt;br /&gt;
 % drawn by quiver (the arrow plotting function).&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 20/02/2008 &lt;br /&gt;
 &lt;br /&gt;
 %% decide if crop is required and give imput error message&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
     error('Requires at least three input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7, &lt;br /&gt;
     crop = 0;&lt;br /&gt;
 else&lt;br /&gt;
     crop = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7,&lt;br /&gt;
     scaling = 1;&lt;br /&gt;
 end &lt;br /&gt;
 % Note don't do this for large areas ?&lt;br /&gt;
 %% Task 1: read ascii files&lt;br /&gt;
 % read Qx file&lt;br /&gt;
 [QX, ncolsqx, nrowsqx, xllcornerqx, yllcornerqx, cellsizeqx] = read_file (qxfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read Qy file&lt;br /&gt;
 [QY, ncolsqy, nrowsqy, xllcornerqy, yllcornerqy, cellsizeqy] = read_file (qyfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read DEM&lt;br /&gt;
 [DEM, ncolsdem, nrowsdem, xllcornerdem, yllcornerdem, cellsizedem] = read_file (demfile);&lt;br /&gt;
 %% crop data if required&lt;br /&gt;
 if crop == 1;&lt;br /&gt;
     DEM = DEM(north:south,west:east);&lt;br /&gt;
     QX = QX(north:south,west:east+1);&lt;br /&gt;
     QY = QY(north:south+1,west:east);&lt;br /&gt;
     xllcornerdem = xllcornerdem + west*cellsizedem - cellsizedem;&lt;br /&gt;
     yllcornerdem = yllcornerdem + (nrowsdem - south) * cellsizedem;&lt;br /&gt;
     [nrowsqx, ncolsqx] = size(QX); [nrowsqy, ncolsqy] = size(QY); [nrowsdem, ncolsdem] = size(DEM);&lt;br /&gt;
 end&lt;br /&gt;
 %% Taks 2: Plot dem and generate figure&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap('gray');&lt;br /&gt;
 % Create axes&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcornerdem + nrowsdem*cellsizedem ,yllcornerdem},...&lt;br /&gt;
     'YTick',[0.5,nrowsdem+0.5],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcornerdem,xllcornerdem+ncolsdem*cellsizedem},...&lt;br /&gt;
     'XTick',[0.5, ncolsdem + 0.5],...&lt;br /&gt;
     'Layer','top',...&lt;br /&gt;
     'DataAspectRatio',[1 1 1]...&lt;br /&gt;
     %,'Clim',[13 30]... % uncomment to set colourmap limits manually&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM,'Parent',axes1,'CDataMapping','scaled');&lt;br /&gt;
 axis('image');&lt;br /&gt;
 xlabel('Easting (m)');&lt;br /&gt;
 ylabel('Northing (m)');&lt;br /&gt;
 %% Task 3: calculate flow vectors&lt;br /&gt;
 % pre allocate memory for loop... it will run faster this way&lt;br /&gt;
 xlocs = zeros(ncolsqx*nrowsqx+ncolsqy*nrowsqy,1);&lt;br /&gt;
 ylocs = xlocs;&lt;br /&gt;
 U = xlocs;&lt;br /&gt;
 V = xlocs;&lt;br /&gt;
 %work out X and Y locations&lt;br /&gt;
 for i = 1:nrowsqx&lt;br /&gt;
     for j = 1:ncolsqx&lt;br /&gt;
         xlocs((i-1)*ncolsqx+j,1) = j - 0.5;&lt;br /&gt;
         ylocs((i-1)*ncolsqx+j,1) = i;&lt;br /&gt;
         U((i-1)*ncolsqx+j,1) = QX(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 for i = 1:nrowsqy&lt;br /&gt;
     for j = 1:ncolsqy&lt;br /&gt;
         xlocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = j;&lt;br /&gt;
         ylocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = i - 0.5;&lt;br /&gt;
         V(ncolsqx*nrowsqx+(i-1)*ncolsqy+j,1) = QY(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % work out number of nonzeros elements&lt;br /&gt;
 num_flows = nnz(U+V);&lt;br /&gt;
 xlocs2 = zeros(num_flows,1);&lt;br /&gt;
 ylocs2 = xlocs2;&lt;br /&gt;
 U2 = xlocs2;&lt;br /&gt;
 V2 = xlocs2;&lt;br /&gt;
 % remover zero flow locations&lt;br /&gt;
 k = 1;&lt;br /&gt;
 for i = 1:ncolsqx*nrowsqx+ncolsqy*nrowsqy&lt;br /&gt;
     if (U(i,1) == 0) &amp;amp;&amp;amp; (V(i,1) == 0)&lt;br /&gt;
         % do nothing&lt;br /&gt;
     else&lt;br /&gt;
         xlocs2(k,1) = xlocs(i,1);&lt;br /&gt;
         ylocs2(k,1) = ylocs(i,1);&lt;br /&gt;
         U2(k,1) = U(i,1);&lt;br /&gt;
         V2(k,1) = V(i,1);&lt;br /&gt;
         k = k+1;&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % check numbers are correct&lt;br /&gt;
 if k == num_flows + 1&lt;br /&gt;
     % all is ok&lt;br /&gt;
 else&lt;br /&gt;
     disp('Problem with flows');&lt;br /&gt;
 end&lt;br /&gt;
 %% Task 4: overlay flow vectors&lt;br /&gt;
 disp('Plotting data... if this is taking a long time you may need fewer locations');&lt;br /&gt;
 quiver (xlocs2,ylocs2,U2,V2, scaling);&lt;br /&gt;
 % quiver (xloc2,yloc2,U2,V2,'Parent',figure1);&lt;br /&gt;
 disp('Done');&lt;br /&gt;
 %% function to read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
==Making movies from .wd files==&lt;br /&gt;
&lt;br /&gt;
This function will convert a series of .wd .Qx or .Qy file into a .avi movie with the same filename&lt;br /&gt;
&lt;br /&gt;
 function LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ) &lt;br /&gt;
 &lt;br /&gt;
 % LISFLOOD_mov generates movies of LISFLOOD-FP output&lt;br /&gt;
 %&lt;br /&gt;
 % LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ)&lt;br /&gt;
 % &lt;br /&gt;
 % where &lt;br /&gt;
 % resroot is the LISFLOOD resroot (relative to m file or absolute)(string)&lt;br /&gt;
 % fileex is the file extension '.wd' (can be chaned to plot WSE and flows)&lt;br /&gt;
 % vartype is the name of the variable being plotted e.g. 'Depth'&lt;br /&gt;
 % num_snaps is the number of snapshot times&lt;br /&gt;
 % snapint is the time interval between each LISFLOOD-FP snapshot (seconds)&lt;br /&gt;
 % dem is the name of the demfile (relative or absolute)&lt;br /&gt;
 % demCS is the range of dem hights to be plotted e.g. demCS = [0,20];&lt;br /&gt;
 % depthCS is the range of depth values to be plotted e.g. depthCS = [0,10];&lt;br /&gt;
 % framesPS number of frames per second (each plot is a simgle frame)&lt;br /&gt;
 % movQ is the movie quality between 1 and 100 (100 is best)&lt;br /&gt;
 % &lt;br /&gt;
 % 8/11/2007. J Neal.&lt;br /&gt;
 %&lt;br /&gt;
 % EXAMPLE:&lt;br /&gt;
 % LISFLOOD_mov ('C:\Experiment1\res22','.wd','Water depth',24,10000,...&lt;br /&gt;
 % 'C:\Experiment1\dem10m.dem.ascii',[0,60], [0,10],1,100);&lt;br /&gt;
 %% Movie maker&lt;br /&gt;
 % read dem filenam is filename and 1 specifies the 0.00 should not be NaN's&lt;br /&gt;
 [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (dem); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 % A = [resroot,'.avi'];&lt;br /&gt;
 % mov = avifile(A);&lt;br /&gt;
 % loop through snapshots&lt;br /&gt;
 for i = 1:num_snaps&lt;br /&gt;
     if i &amp;lt; 10&lt;br /&gt;
         resfile = [resroot,'-000',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 100&lt;br /&gt;
         resfile = [resroot,'-00',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 1000&lt;br /&gt;
         resfile = [resroot,'-0',num2str(i),fileex];&lt;br /&gt;
     else&lt;br /&gt;
         resfile = [resroot,'-',num2str(i),fileex];&lt;br /&gt;
     end&lt;br /&gt;
     % read in deoth file for resfile i (2 specifies the 0.00 should be NaN&lt;br /&gt;
     [DEPTH, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (resfile);&lt;br /&gt;
     % plot data as figure 1&lt;br /&gt;
     plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype);&lt;br /&gt;
     % get movie frame&lt;br /&gt;
     M(i) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
     hold off;&lt;br /&gt;
 %     mov = addframe(mov,M(i));&lt;br /&gt;
     % close the figure&lt;br /&gt;
     close all&lt;br /&gt;
 end &lt;br /&gt;
 % % close .avi file&lt;br /&gt;
 % mov = close(mov);&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 disp('Generating .avi movie file');&lt;br /&gt;
 A = [resroot,fileex,'.avi'];&lt;br /&gt;
 movie2avi(M,A,'fps',framesPS,'quality',movQ);&lt;br /&gt;
 disp(A);&lt;br /&gt;
 %% Read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 % convert nodata to NaN;&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if OUT(ii,jj) == nodata&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         elseif OUT(ii,jj) == -99.000&lt;br /&gt;
             % lisflood uses -99.000 as nodat so will also remove these&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         else&lt;br /&gt;
             % do nothing&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 %% Plotter data for movie slide&lt;br /&gt;
 function plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype)&lt;br /&gt;
 % number of colors in colormap&lt;br /&gt;
 num_colors = 64;&lt;br /&gt;
 % DEM and variable color map&lt;br /&gt;
 cmap = [gray(num_colors); jet(num_colors)];&lt;br /&gt;
 % scale DEM and DEPTH data to fit with new colormap&lt;br /&gt;
 demCS2 = demCS(2)-demCS(1);&lt;br /&gt;
 dem_scalar = num_colors/demCS2;&lt;br /&gt;
 DEM2 = DEM*dem_scalar;&lt;br /&gt;
 depthCS2 = depthCS(2)-depthCS(1);&lt;br /&gt;
 depth_scalar = num_colors/depthCS2;&lt;br /&gt;
 DEPTH2 = (DEPTH*depth_scalar)+num_colors+1;&lt;br /&gt;
 %Plot the DEM&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap(cmap);&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcorner+(nrows*cellsize),yllcorner+cellsize},...&lt;br /&gt;
     'YTick', [1,nrows],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcorner,xllcorner+(ncols*cellsize)-cellsize},...&lt;br /&gt;
     'XTick',[1,ncols],...&lt;br /&gt;
     'Layer','top');&lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM2,'Parent',axes1);&lt;br /&gt;
 axis('equal');axis('tight');&lt;br /&gt;
 % Overlay the water depth (or other variable)&lt;br /&gt;
 H = image(DEPTH2);&lt;br /&gt;
 % code to make depth plot layer transparent&lt;br /&gt;
 OP = ones(nrows,ncols);&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if DEPTH(ii,jj) &amp;gt; 0&lt;br /&gt;
         else&lt;br /&gt;
             OP(ii,jj) = 0;&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % make transparent. depth layer must be H&lt;br /&gt;
 set(H,'AlphaData',OP);&lt;br /&gt;
 % label colourbar&lt;br /&gt;
 color_breaks = 5;&lt;br /&gt;
 colorbreak = num_colors/color_breaks;&lt;br /&gt;
 SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 SCALE(1) = 0.0001;&lt;br /&gt;
 for j = 1:color_breaks*2&lt;br /&gt;
     SCALE(j+1) = colorbreak*j;&lt;br /&gt;
 end&lt;br /&gt;
 SCALE(color_breaks+1) = num_colors+1;&lt;br /&gt;
 VIS_SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 VIS_SCALE(1) = demCS(1);&lt;br /&gt;
 for j = 1:color_breaks-1&lt;br /&gt;
     VIS_SCALE(j+1) = ((demCS2/color_breaks)*j)+demCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 VIS_SCALE(color_breaks+1) = depthCS(1);&lt;br /&gt;
 for j = 1:color_breaks&lt;br /&gt;
     VIS_SCALE(j+1+color_breaks) = ((depthCS2/color_breaks)*j)+depthCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 colorbar('YTick',SCALE,'YTickLabel',VIS_SCALE);&lt;br /&gt;
 % Label axis&lt;br /&gt;
 xlabel('BNG easting (m)');&lt;br /&gt;
 ylabel('BNG northing (m)');&lt;br /&gt;
 A = [vartype,' over DEM at time ',num2str((i*snapint)),'s'];&lt;br /&gt;
 title(A);&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6040</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6040"/>
		<updated>2009-02-18T17:47:39Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
;N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.:&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6039</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6039"/>
		<updated>2009-02-18T17:46:32Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6038</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=6038"/>
		<updated>2009-02-18T17:46:11Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Checkpointing on Condor (beta)===&lt;br /&gt;
# In order to make Condor recognise checkpoint files, a checkpoint file has to be included in the original Condor submission file. However, there is no need to create a dedicated checkpoint file from the LISFLOOD-FP executable. Instead, create an empty text document with the correct name (i.e. results.chkpnt) and LISFLOOD-FP will decipher what is required.&lt;br /&gt;
&lt;br /&gt;
N.B. Condor with checkpointing functionality is still in &amp;quot;beta&amp;quot; - Check here for updates on when it is operational.&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5056</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5056"/>
		<updated>2008-03-18T16:17:09Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;br /&gt;
# [[Lisflood_in_matlab#Making movies from .wd files|Making movies from LISFLOOD-FP output]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5055</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5055"/>
		<updated>2008-03-18T16:16:23Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;br /&gt;
# [[Lisflood_in_matlab#Plotting flow vectors from .Qx and .Qy files|Plotting flow vectors]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5054</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5054"/>
		<updated>2008-03-18T16:15:35Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab#File import and export|File import and export]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5053</id>
		<title>LISFLOOD-FP and MATLAB</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5053"/>
		<updated>2008-03-18T16:13:23Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains various Matlab functions that may be useful for analysing results from the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model.&lt;br /&gt;
&lt;br /&gt;
==File import and export==&lt;br /&gt;
&lt;br /&gt;
===Importing ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will import an ascii raster file using the string filename. To use it, copy and past text into a textfile called ascii_reader.m&lt;br /&gt;
&lt;br /&gt;
 function [dem, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % This function reads arc .asc files&lt;br /&gt;
 % requires filename string as input&lt;br /&gt;
 &lt;br /&gt;
 % j neal&lt;br /&gt;
 % 18/6/07&lt;br /&gt;
 %% read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 dem = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 dem = dem';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
You can view the imported file using the command:&lt;br /&gt;
&lt;br /&gt;
 imagesc(dem);&lt;br /&gt;
&lt;br /&gt;
===Exporting ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will create an ascii raster file called filename from the 2D matrix DEM.  To use it, copy and past text into a textfile called ascii_write.m&lt;br /&gt;
&lt;br /&gt;
 function ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 &lt;br /&gt;
 % ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 % only filename (string) and DEM (2D matrix) are essential&lt;br /&gt;
 % this function writes ascii raster files for arc&lt;br /&gt;
 % j neal&lt;br /&gt;
 % 6/3/2008&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
     error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4, &lt;br /&gt;
     xllcorner = 0;&lt;br /&gt;
     yllcorner = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 5,&lt;br /&gt;
     cellsize = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 6&lt;br /&gt;
     nodata = -9999;&lt;br /&gt;
 end&lt;br /&gt;
 A = size(DEM);&lt;br /&gt;
 fout = fopen (filename,'w');&lt;br /&gt;
 fprintf(fout, 'ncols         %.0f\n', A(2));  &lt;br /&gt;
 fprintf(fout, 'nrows         %.0f\n', A(1));&lt;br /&gt;
 fprintf(fout, 'xllcorner     %f\n', xllcorner);&lt;br /&gt;
 fprintf(fout, 'yllcorner     %f\n', yllcorner);&lt;br /&gt;
 fprintf(fout, 'cellsize      %f\n', cellsize);&lt;br /&gt;
 fprintf(fout, 'NODATA_value  %f\n', nodata); &lt;br /&gt;
 for ii = 1:A(1)&lt;br /&gt;
     B = DEM(ii,:);&lt;br /&gt;
     fprintf(fout, '%1.3f ', B);&lt;br /&gt;
     fprintf(fout, '\n');&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Writing parameter files===&lt;br /&gt;
&lt;br /&gt;
This function can be used to write many LISFLOOD-FP parameter files with ''N'' different channel and floodplain roughness, using your own ''N-by-''2 matrix called roughness. You will need to edit the code for your application by commenting unwanted lines with a percentage symbol.&lt;br /&gt;
&lt;br /&gt;
 function prm_writer (roughness) &lt;br /&gt;
 &lt;br /&gt;
 % This function writes LISFLOOD-FP parameter files numbered 1 to n using&lt;br /&gt;
 % the roughness values in the n-by-2 matrix roughness. yuo will need to&lt;br /&gt;
 % edit the code for your application.&lt;br /&gt;
 &lt;br /&gt;
 [num_sims] = size(roughness);&lt;br /&gt;
 for i = 1:num_sims(1)&lt;br /&gt;
 a = ['mymodel', num2str(i),'.par']; b = num2str(i);&lt;br /&gt;
 fout = fopen(a,'w');&lt;br /&gt;
 fprintf(fout,'DEMfile                  mydem.dem.ascii\n');&lt;br /&gt;
 fprintf(fout,'resroot                  myres%s\n',b);&lt;br /&gt;
 fprintf(fout,'dirroot                  mydir\n');&lt;br /&gt;
 fprintf(fout,'sim_time                 245000.0\n');&lt;br /&gt;
 fprintf(fout,'initial_tstep            10.0\n');&lt;br /&gt;
 fprintf(fout,'massint                  300.0\n');&lt;br /&gt;
 fprintf(fout,'saveint                  10000.0\n');&lt;br /&gt;
 %fprintf(fout,'overpass                 135000.0\n');&lt;br /&gt;
 fprintf(fout,'fpfric                   %1.3f\n',roughness(i,2));&lt;br /&gt;
 fprintf(fout,'nch                      %1.3f\n',roughness(i,1));&lt;br /&gt;
 %fprintf(fout,'manningfile              mymanfile%s.n.ascii\n',b);&lt;br /&gt;
 fprintf(fout,'riverfile                myriver.river\n');&lt;br /&gt;
 fprintf(fout,'bdyfile                  mybdy.bdy\n');&lt;br /&gt;
 fprintf(fout,'stagefile                mystage.stage\n');&lt;br /&gt;
 fprintf(fout,'bcifile                  mybci.bci\n');&lt;br /&gt;
 %fprintf(fout,'startfile                mystart.old\n');&lt;br /&gt;
 %fprintf(fout,'checkpoint               2\n');&lt;br /&gt;
 %fprintf(fout,'checkfile                mycheck.chkpnt\n');&lt;br /&gt;
 fprintf(fout,'elevoff\n');&lt;br /&gt;
 fprintf(fout,'qoutput\n');&lt;br /&gt;
 fprintf(fout,'diffusive\n');&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Plotting flow vectors from .Qx and .Qy files==&lt;br /&gt;
&lt;br /&gt;
This function will plot flow vectors from a .Qx and .Qy over a dem using the matlab functions image and quiver  &lt;br /&gt;
&lt;br /&gt;
 function lisflood_flow_plotter (qxfile, qyfile, demfile, north, east, south, west, scaling)&lt;br /&gt;
 &lt;br /&gt;
 % This function plots flow vectors from LISFLOOD_FP Qx and QY files&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile);&lt;br /&gt;
 %&lt;br /&gt;
 % these input variables are strings containing the relative of full&lt;br /&gt;
 % pathnames of the .Qx .Qy and ascii dem files to be plotted.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W);&lt;br /&gt;
 %&lt;br /&gt;
 % N, E, W and S are optional they specify the northernmost, southeernmost&lt;br /&gt;
 % ect cell to be displayed. this can be used to crop the domain.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W, scaling);&lt;br /&gt;
 % &lt;br /&gt;
 % scaling is an optional term used to manually scale the vector lengthes&lt;br /&gt;
 % drawn by quiver (the arrow plotting function).&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 20/02/2008 &lt;br /&gt;
 &lt;br /&gt;
 %% decide if crop is required and give imput error message&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
     error('Requires at least three input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7, &lt;br /&gt;
     crop = 0;&lt;br /&gt;
 else&lt;br /&gt;
     crop = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7,&lt;br /&gt;
     scaling = 1;&lt;br /&gt;
 end &lt;br /&gt;
 % Note don't do this for large areas ?&lt;br /&gt;
 %% Task 1: read ascii files&lt;br /&gt;
 % read Qx file&lt;br /&gt;
 [QX, ncolsqx, nrowsqx, xllcornerqx, yllcornerqx, cellsizeqx] = read_file (qxfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read Qy file&lt;br /&gt;
 [QY, ncolsqy, nrowsqy, xllcornerqy, yllcornerqy, cellsizeqy] = read_file (qyfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read DEM&lt;br /&gt;
 [DEM, ncolsdem, nrowsdem, xllcornerdem, yllcornerdem, cellsizedem] = read_file (demfile);&lt;br /&gt;
 %% crop data if required&lt;br /&gt;
 if crop == 1;&lt;br /&gt;
     DEM = DEM(north:south,west:east);&lt;br /&gt;
     QX = QX(north:south,west:east+1);&lt;br /&gt;
     QY = QY(north:south+1,west:east);&lt;br /&gt;
     xllcornerdem = xllcornerdem + west*cellsizedem - cellsizedem;&lt;br /&gt;
     yllcornerdem = yllcornerdem + (nrowsdem - south) * cellsizedem;&lt;br /&gt;
     [nrowsqx, ncolsqx] = size(QX); [nrowsqy, ncolsqy] = size(QY); [nrowsdem, ncolsdem] = size(DEM);&lt;br /&gt;
 end&lt;br /&gt;
 %% Taks 2: Plot dem and generate figure&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap('gray');&lt;br /&gt;
 % Create axes&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcornerdem + nrowsdem*cellsizedem ,yllcornerdem},...&lt;br /&gt;
     'YTick',[0.5,nrowsdem+0.5],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcornerdem,xllcornerdem+ncolsdem*cellsizedem},...&lt;br /&gt;
     'XTick',[0.5, ncolsdem + 0.5],...&lt;br /&gt;
     'Layer','top',...&lt;br /&gt;
     'DataAspectRatio',[1 1 1]...&lt;br /&gt;
     %,'Clim',[13 30]... % uncomment to set colourmap limits manually&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM,'Parent',axes1,'CDataMapping','scaled');&lt;br /&gt;
 axis('image');&lt;br /&gt;
 xlabel('Easting (m)');&lt;br /&gt;
 ylabel('Northing (m)');&lt;br /&gt;
 %% Task 3: calculate flow vectors&lt;br /&gt;
 % pre allocate memory for loop... it will run faster this way&lt;br /&gt;
 xlocs = zeros(ncolsqx*nrowsqx+ncolsqy*nrowsqy,1);&lt;br /&gt;
 ylocs = xlocs;&lt;br /&gt;
 U = xlocs;&lt;br /&gt;
 V = xlocs;&lt;br /&gt;
 %work out X and Y locations&lt;br /&gt;
 for i = 1:nrowsqx&lt;br /&gt;
     for j = 1:ncolsqx&lt;br /&gt;
         xlocs((i-1)*ncolsqx+j,1) = j - 0.5;&lt;br /&gt;
         ylocs((i-1)*ncolsqx+j,1) = i;&lt;br /&gt;
         U((i-1)*ncolsqx+j,1) = QX(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 for i = 1:nrowsqy&lt;br /&gt;
     for j = 1:ncolsqy&lt;br /&gt;
         xlocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = j;&lt;br /&gt;
         ylocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = i - 0.5;&lt;br /&gt;
         V(ncolsqx*nrowsqx+(i-1)*ncolsqy+j,1) = QY(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % work out number of nonzeros elements&lt;br /&gt;
 num_flows = nnz(U+V);&lt;br /&gt;
 xlocs2 = zeros(num_flows,1);&lt;br /&gt;
 ylocs2 = xlocs2;&lt;br /&gt;
 U2 = xlocs2;&lt;br /&gt;
 V2 = xlocs2;&lt;br /&gt;
 % remover zero flow locations&lt;br /&gt;
 k = 1;&lt;br /&gt;
 for i = 1:ncolsqx*nrowsqx+ncolsqy*nrowsqy&lt;br /&gt;
     if (U(i,1) == 0) &amp;amp;&amp;amp; (V(i,1) == 0)&lt;br /&gt;
         % do nothing&lt;br /&gt;
     else&lt;br /&gt;
         xlocs2(k,1) = xlocs(i,1);&lt;br /&gt;
         ylocs2(k,1) = ylocs(i,1);&lt;br /&gt;
         U2(k,1) = U(i,1);&lt;br /&gt;
         V2(k,1) = V(i,1);&lt;br /&gt;
         k = k+1;&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % check numbers are correct&lt;br /&gt;
 if k == num_flows + 1&lt;br /&gt;
     % all is ok&lt;br /&gt;
 else&lt;br /&gt;
     disp('Problem with flows');&lt;br /&gt;
 end&lt;br /&gt;
 %% Task 4: overlay flow vectors&lt;br /&gt;
 disp('Plotting data... if this is taking a long time you may need fewer locations');&lt;br /&gt;
 quiver (xlocs2,ylocs2,U2,V2, scaling);&lt;br /&gt;
 % quiver (xloc2,yloc2,U2,V2,'Parent',figure1);&lt;br /&gt;
 disp('Done');&lt;br /&gt;
 %% function to read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
==Making movies from .wd files==&lt;br /&gt;
&lt;br /&gt;
This function will convert a series of .wd .Qx or .Qy file into a .avi movie with the same filename&lt;br /&gt;
&lt;br /&gt;
 function LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ) &lt;br /&gt;
 &lt;br /&gt;
 % LISFLOOD_mov generates movies of LISFLOOD-FP output&lt;br /&gt;
 %&lt;br /&gt;
 % LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ)&lt;br /&gt;
 % &lt;br /&gt;
 % where &lt;br /&gt;
 % resroot is the LISFLOOD resroot (relative to m file or absolute)(string)&lt;br /&gt;
 % fileex is the file extension '.wd' (can be chaned to plot WSE and flows)&lt;br /&gt;
 % vartype is the name of the variable being plotted e.g. 'Depth'&lt;br /&gt;
 % num_snaps is the number of snapshot times&lt;br /&gt;
 % snapint is the time interval between each LISFLOOD-FP snapshot (seconds)&lt;br /&gt;
 % dem is the name of the demfile (relative or absolute)&lt;br /&gt;
 % demCS is the range of dem hights to be plotted e.g. demCS = [0,20];&lt;br /&gt;
 % depthCS is the range of depth values to be plotted e.g. depthCS = [0,10];&lt;br /&gt;
 % framesPS number of frames per second (each plot is a simgle frame)&lt;br /&gt;
 % movQ is the movie quality between 1 and 100 (100 is best)&lt;br /&gt;
 % &lt;br /&gt;
 % 8/11/2007. J Neal.&lt;br /&gt;
 %&lt;br /&gt;
 % EXAMPLE:&lt;br /&gt;
 % LISFLOOD_mov ('C:\Experiment1\res22','.wd','Water depth',24,10000,...&lt;br /&gt;
 % 'C:\Experiment1\dem10m.dem.ascii',[0,60], [0,10],1,100);&lt;br /&gt;
 %% Movie maker&lt;br /&gt;
 % read dem filenam is filename and 1 specifies the 0.00 should not be NaN's&lt;br /&gt;
 [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (dem); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 % A = [resroot,'.avi'];&lt;br /&gt;
 % mov = avifile(A);&lt;br /&gt;
 % loop through snapshots&lt;br /&gt;
 for i = 1:num_snaps&lt;br /&gt;
     if i &amp;lt; 10&lt;br /&gt;
         resfile = [resroot,'-000',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 100&lt;br /&gt;
         resfile = [resroot,'-00',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 1000&lt;br /&gt;
         resfile = [resroot,'-0',num2str(i),fileex];&lt;br /&gt;
     else&lt;br /&gt;
         resfile = [resroot,'-',num2str(i),fileex];&lt;br /&gt;
     end&lt;br /&gt;
     % read in deoth file for resfile i (2 specifies the 0.00 should be NaN&lt;br /&gt;
     [DEPTH, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (resfile);&lt;br /&gt;
     % plot data as figure 1&lt;br /&gt;
     plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype);&lt;br /&gt;
     % get movie frame&lt;br /&gt;
     M(i) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
     hold off;&lt;br /&gt;
 %     mov = addframe(mov,M(i));&lt;br /&gt;
     % close the figure&lt;br /&gt;
     close all&lt;br /&gt;
 end &lt;br /&gt;
 % % close .avi file&lt;br /&gt;
 % mov = close(mov);&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 disp('Generating .avi movie file');&lt;br /&gt;
 A = [resroot,fileex,'.avi'];&lt;br /&gt;
 movie2avi(M,A,'fps',framesPS,'quality',movQ);&lt;br /&gt;
 disp(A);&lt;br /&gt;
 %% Read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 % convert nodata to NaN;&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if OUT(ii,jj) == nodata&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         elseif OUT(ii,jj) == -99.000&lt;br /&gt;
             % lisflood uses -99.000 as nodat so will also remove these&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         else&lt;br /&gt;
             % do nothing&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 %% Plotter data for movie slide&lt;br /&gt;
 function plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype)&lt;br /&gt;
 % number of colors in colormap&lt;br /&gt;
 num_colors = 64;&lt;br /&gt;
 % DEM and variable color map&lt;br /&gt;
 cmap = [gray(num_colors); jet(num_colors)];&lt;br /&gt;
 % scale DEM and DEPTH data to fit with new colormap&lt;br /&gt;
 demCS2 = demCS(2)-demCS(1);&lt;br /&gt;
 dem_scalar = num_colors/demCS2;&lt;br /&gt;
 DEM2 = DEM*dem_scalar;&lt;br /&gt;
 depthCS2 = depthCS(2)-depthCS(1);&lt;br /&gt;
 depth_scalar = num_colors/depthCS2;&lt;br /&gt;
 DEPTH2 = (DEPTH*depth_scalar)+num_colors+1;&lt;br /&gt;
 %Plot the DEM&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap(cmap);&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcorner+(nrows*cellsize),yllcorner+cellsize},...&lt;br /&gt;
     'YTick', [1,nrows],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcorner,xllcorner+(ncols*cellsize)-cellsize},...&lt;br /&gt;
     'XTick',[1,ncols],...&lt;br /&gt;
     'Layer','top');&lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM2,'Parent',axes1);&lt;br /&gt;
 axis('equal');axis('tight');&lt;br /&gt;
 % Overlay the water depth (or other variable)&lt;br /&gt;
 H = image(DEPTH2);&lt;br /&gt;
 % code to make depth plot layer transparent&lt;br /&gt;
 OP = ones(nrows,ncols);&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if DEPTH(ii,jj) &amp;gt; 0&lt;br /&gt;
         else&lt;br /&gt;
             OP(ii,jj) = 0;&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % make transparent. depth layer must be H&lt;br /&gt;
 set(H,'AlphaData',OP);&lt;br /&gt;
 % label colourbar&lt;br /&gt;
 color_breaks = 5;&lt;br /&gt;
 colorbreak = num_colors/color_breaks;&lt;br /&gt;
 SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 SCALE(1) = 0.0001;&lt;br /&gt;
 for j = 1:color_breaks*2&lt;br /&gt;
     SCALE(j+1) = colorbreak*j;&lt;br /&gt;
 end&lt;br /&gt;
 SCALE(color_breaks+1) = num_colors+1;&lt;br /&gt;
 VIS_SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 VIS_SCALE(1) = demCS(1);&lt;br /&gt;
 for j = 1:color_breaks-1&lt;br /&gt;
     VIS_SCALE(j+1) = ((demCS2/color_breaks)*j)+demCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 VIS_SCALE(color_breaks+1) = depthCS(1);&lt;br /&gt;
 for j = 1:color_breaks&lt;br /&gt;
     VIS_SCALE(j+1+color_breaks) = ((depthCS2/color_breaks)*j)+depthCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 colorbar('YTick',SCALE,'YTickLabel',VIS_SCALE);&lt;br /&gt;
 % Label axis&lt;br /&gt;
 xlabel('BNG easting (m)');&lt;br /&gt;
 ylabel('BNG northing (m)');&lt;br /&gt;
 A = [vartype,' over DEM at time ',num2str((i*snapint)),'s'];&lt;br /&gt;
 title(A);&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5052</id>
		<title>LISFLOOD-FP and MATLAB</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5052"/>
		<updated>2008-03-18T16:13:14Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains various Matlab functions that may be useful for analysing results from the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model.&lt;br /&gt;
&lt;br /&gt;
==File import and export [[file]]==&lt;br /&gt;
&lt;br /&gt;
===Importing ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will import an ascii raster file using the string filename. To use it, copy and past text into a textfile called ascii_reader.m&lt;br /&gt;
&lt;br /&gt;
 function [dem, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % This function reads arc .asc files&lt;br /&gt;
 % requires filename string as input&lt;br /&gt;
 &lt;br /&gt;
 % j neal&lt;br /&gt;
 % 18/6/07&lt;br /&gt;
 %% read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 dem = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 dem = dem';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
You can view the imported file using the command:&lt;br /&gt;
&lt;br /&gt;
 imagesc(dem);&lt;br /&gt;
&lt;br /&gt;
===Exporting ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will create an ascii raster file called filename from the 2D matrix DEM.  To use it, copy and past text into a textfile called ascii_write.m&lt;br /&gt;
&lt;br /&gt;
 function ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 &lt;br /&gt;
 % ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 % only filename (string) and DEM (2D matrix) are essential&lt;br /&gt;
 % this function writes ascii raster files for arc&lt;br /&gt;
 % j neal&lt;br /&gt;
 % 6/3/2008&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
     error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4, &lt;br /&gt;
     xllcorner = 0;&lt;br /&gt;
     yllcorner = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 5,&lt;br /&gt;
     cellsize = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 6&lt;br /&gt;
     nodata = -9999;&lt;br /&gt;
 end&lt;br /&gt;
 A = size(DEM);&lt;br /&gt;
 fout = fopen (filename,'w');&lt;br /&gt;
 fprintf(fout, 'ncols         %.0f\n', A(2));  &lt;br /&gt;
 fprintf(fout, 'nrows         %.0f\n', A(1));&lt;br /&gt;
 fprintf(fout, 'xllcorner     %f\n', xllcorner);&lt;br /&gt;
 fprintf(fout, 'yllcorner     %f\n', yllcorner);&lt;br /&gt;
 fprintf(fout, 'cellsize      %f\n', cellsize);&lt;br /&gt;
 fprintf(fout, 'NODATA_value  %f\n', nodata); &lt;br /&gt;
 for ii = 1:A(1)&lt;br /&gt;
     B = DEM(ii,:);&lt;br /&gt;
     fprintf(fout, '%1.3f ', B);&lt;br /&gt;
     fprintf(fout, '\n');&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Writing parameter files===&lt;br /&gt;
&lt;br /&gt;
This function can be used to write many LISFLOOD-FP parameter files with ''N'' different channel and floodplain roughness, using your own ''N-by-''2 matrix called roughness. You will need to edit the code for your application by commenting unwanted lines with a percentage symbol.&lt;br /&gt;
&lt;br /&gt;
 function prm_writer (roughness) &lt;br /&gt;
 &lt;br /&gt;
 % This function writes LISFLOOD-FP parameter files numbered 1 to n using&lt;br /&gt;
 % the roughness values in the n-by-2 matrix roughness. yuo will need to&lt;br /&gt;
 % edit the code for your application.&lt;br /&gt;
 &lt;br /&gt;
 [num_sims] = size(roughness);&lt;br /&gt;
 for i = 1:num_sims(1)&lt;br /&gt;
 a = ['mymodel', num2str(i),'.par']; b = num2str(i);&lt;br /&gt;
 fout = fopen(a,'w');&lt;br /&gt;
 fprintf(fout,'DEMfile                  mydem.dem.ascii\n');&lt;br /&gt;
 fprintf(fout,'resroot                  myres%s\n',b);&lt;br /&gt;
 fprintf(fout,'dirroot                  mydir\n');&lt;br /&gt;
 fprintf(fout,'sim_time                 245000.0\n');&lt;br /&gt;
 fprintf(fout,'initial_tstep            10.0\n');&lt;br /&gt;
 fprintf(fout,'massint                  300.0\n');&lt;br /&gt;
 fprintf(fout,'saveint                  10000.0\n');&lt;br /&gt;
 %fprintf(fout,'overpass                 135000.0\n');&lt;br /&gt;
 fprintf(fout,'fpfric                   %1.3f\n',roughness(i,2));&lt;br /&gt;
 fprintf(fout,'nch                      %1.3f\n',roughness(i,1));&lt;br /&gt;
 %fprintf(fout,'manningfile              mymanfile%s.n.ascii\n',b);&lt;br /&gt;
 fprintf(fout,'riverfile                myriver.river\n');&lt;br /&gt;
 fprintf(fout,'bdyfile                  mybdy.bdy\n');&lt;br /&gt;
 fprintf(fout,'stagefile                mystage.stage\n');&lt;br /&gt;
 fprintf(fout,'bcifile                  mybci.bci\n');&lt;br /&gt;
 %fprintf(fout,'startfile                mystart.old\n');&lt;br /&gt;
 %fprintf(fout,'checkpoint               2\n');&lt;br /&gt;
 %fprintf(fout,'checkfile                mycheck.chkpnt\n');&lt;br /&gt;
 fprintf(fout,'elevoff\n');&lt;br /&gt;
 fprintf(fout,'qoutput\n');&lt;br /&gt;
 fprintf(fout,'diffusive\n');&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Plotting flow vectors from .Qx and .Qy files==&lt;br /&gt;
&lt;br /&gt;
This function will plot flow vectors from a .Qx and .Qy over a dem using the matlab functions image and quiver  &lt;br /&gt;
&lt;br /&gt;
 function lisflood_flow_plotter (qxfile, qyfile, demfile, north, east, south, west, scaling)&lt;br /&gt;
 &lt;br /&gt;
 % This function plots flow vectors from LISFLOOD_FP Qx and QY files&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile);&lt;br /&gt;
 %&lt;br /&gt;
 % these input variables are strings containing the relative of full&lt;br /&gt;
 % pathnames of the .Qx .Qy and ascii dem files to be plotted.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W);&lt;br /&gt;
 %&lt;br /&gt;
 % N, E, W and S are optional they specify the northernmost, southeernmost&lt;br /&gt;
 % ect cell to be displayed. this can be used to crop the domain.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W, scaling);&lt;br /&gt;
 % &lt;br /&gt;
 % scaling is an optional term used to manually scale the vector lengthes&lt;br /&gt;
 % drawn by quiver (the arrow plotting function).&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 20/02/2008 &lt;br /&gt;
 &lt;br /&gt;
 %% decide if crop is required and give imput error message&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
     error('Requires at least three input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7, &lt;br /&gt;
     crop = 0;&lt;br /&gt;
 else&lt;br /&gt;
     crop = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7,&lt;br /&gt;
     scaling = 1;&lt;br /&gt;
 end &lt;br /&gt;
 % Note don't do this for large areas ?&lt;br /&gt;
 %% Task 1: read ascii files&lt;br /&gt;
 % read Qx file&lt;br /&gt;
 [QX, ncolsqx, nrowsqx, xllcornerqx, yllcornerqx, cellsizeqx] = read_file (qxfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read Qy file&lt;br /&gt;
 [QY, ncolsqy, nrowsqy, xllcornerqy, yllcornerqy, cellsizeqy] = read_file (qyfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read DEM&lt;br /&gt;
 [DEM, ncolsdem, nrowsdem, xllcornerdem, yllcornerdem, cellsizedem] = read_file (demfile);&lt;br /&gt;
 %% crop data if required&lt;br /&gt;
 if crop == 1;&lt;br /&gt;
     DEM = DEM(north:south,west:east);&lt;br /&gt;
     QX = QX(north:south,west:east+1);&lt;br /&gt;
     QY = QY(north:south+1,west:east);&lt;br /&gt;
     xllcornerdem = xllcornerdem + west*cellsizedem - cellsizedem;&lt;br /&gt;
     yllcornerdem = yllcornerdem + (nrowsdem - south) * cellsizedem;&lt;br /&gt;
     [nrowsqx, ncolsqx] = size(QX); [nrowsqy, ncolsqy] = size(QY); [nrowsdem, ncolsdem] = size(DEM);&lt;br /&gt;
 end&lt;br /&gt;
 %% Taks 2: Plot dem and generate figure&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap('gray');&lt;br /&gt;
 % Create axes&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcornerdem + nrowsdem*cellsizedem ,yllcornerdem},...&lt;br /&gt;
     'YTick',[0.5,nrowsdem+0.5],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcornerdem,xllcornerdem+ncolsdem*cellsizedem},...&lt;br /&gt;
     'XTick',[0.5, ncolsdem + 0.5],...&lt;br /&gt;
     'Layer','top',...&lt;br /&gt;
     'DataAspectRatio',[1 1 1]...&lt;br /&gt;
     %,'Clim',[13 30]... % uncomment to set colourmap limits manually&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM,'Parent',axes1,'CDataMapping','scaled');&lt;br /&gt;
 axis('image');&lt;br /&gt;
 xlabel('Easting (m)');&lt;br /&gt;
 ylabel('Northing (m)');&lt;br /&gt;
 %% Task 3: calculate flow vectors&lt;br /&gt;
 % pre allocate memory for loop... it will run faster this way&lt;br /&gt;
 xlocs = zeros(ncolsqx*nrowsqx+ncolsqy*nrowsqy,1);&lt;br /&gt;
 ylocs = xlocs;&lt;br /&gt;
 U = xlocs;&lt;br /&gt;
 V = xlocs;&lt;br /&gt;
 %work out X and Y locations&lt;br /&gt;
 for i = 1:nrowsqx&lt;br /&gt;
     for j = 1:ncolsqx&lt;br /&gt;
         xlocs((i-1)*ncolsqx+j,1) = j - 0.5;&lt;br /&gt;
         ylocs((i-1)*ncolsqx+j,1) = i;&lt;br /&gt;
         U((i-1)*ncolsqx+j,1) = QX(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 for i = 1:nrowsqy&lt;br /&gt;
     for j = 1:ncolsqy&lt;br /&gt;
         xlocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = j;&lt;br /&gt;
         ylocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = i - 0.5;&lt;br /&gt;
         V(ncolsqx*nrowsqx+(i-1)*ncolsqy+j,1) = QY(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % work out number of nonzeros elements&lt;br /&gt;
 num_flows = nnz(U+V);&lt;br /&gt;
 xlocs2 = zeros(num_flows,1);&lt;br /&gt;
 ylocs2 = xlocs2;&lt;br /&gt;
 U2 = xlocs2;&lt;br /&gt;
 V2 = xlocs2;&lt;br /&gt;
 % remover zero flow locations&lt;br /&gt;
 k = 1;&lt;br /&gt;
 for i = 1:ncolsqx*nrowsqx+ncolsqy*nrowsqy&lt;br /&gt;
     if (U(i,1) == 0) &amp;amp;&amp;amp; (V(i,1) == 0)&lt;br /&gt;
         % do nothing&lt;br /&gt;
     else&lt;br /&gt;
         xlocs2(k,1) = xlocs(i,1);&lt;br /&gt;
         ylocs2(k,1) = ylocs(i,1);&lt;br /&gt;
         U2(k,1) = U(i,1);&lt;br /&gt;
         V2(k,1) = V(i,1);&lt;br /&gt;
         k = k+1;&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % check numbers are correct&lt;br /&gt;
 if k == num_flows + 1&lt;br /&gt;
     % all is ok&lt;br /&gt;
 else&lt;br /&gt;
     disp('Problem with flows');&lt;br /&gt;
 end&lt;br /&gt;
 %% Task 4: overlay flow vectors&lt;br /&gt;
 disp('Plotting data... if this is taking a long time you may need fewer locations');&lt;br /&gt;
 quiver (xlocs2,ylocs2,U2,V2, scaling);&lt;br /&gt;
 % quiver (xloc2,yloc2,U2,V2,'Parent',figure1);&lt;br /&gt;
 disp('Done');&lt;br /&gt;
 %% function to read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
==Making movies from .wd files==&lt;br /&gt;
&lt;br /&gt;
This function will convert a series of .wd .Qx or .Qy file into a .avi movie with the same filename&lt;br /&gt;
&lt;br /&gt;
 function LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ) &lt;br /&gt;
 &lt;br /&gt;
 % LISFLOOD_mov generates movies of LISFLOOD-FP output&lt;br /&gt;
 %&lt;br /&gt;
 % LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ)&lt;br /&gt;
 % &lt;br /&gt;
 % where &lt;br /&gt;
 % resroot is the LISFLOOD resroot (relative to m file or absolute)(string)&lt;br /&gt;
 % fileex is the file extension '.wd' (can be chaned to plot WSE and flows)&lt;br /&gt;
 % vartype is the name of the variable being plotted e.g. 'Depth'&lt;br /&gt;
 % num_snaps is the number of snapshot times&lt;br /&gt;
 % snapint is the time interval between each LISFLOOD-FP snapshot (seconds)&lt;br /&gt;
 % dem is the name of the demfile (relative or absolute)&lt;br /&gt;
 % demCS is the range of dem hights to be plotted e.g. demCS = [0,20];&lt;br /&gt;
 % depthCS is the range of depth values to be plotted e.g. depthCS = [0,10];&lt;br /&gt;
 % framesPS number of frames per second (each plot is a simgle frame)&lt;br /&gt;
 % movQ is the movie quality between 1 and 100 (100 is best)&lt;br /&gt;
 % &lt;br /&gt;
 % 8/11/2007. J Neal.&lt;br /&gt;
 %&lt;br /&gt;
 % EXAMPLE:&lt;br /&gt;
 % LISFLOOD_mov ('C:\Experiment1\res22','.wd','Water depth',24,10000,...&lt;br /&gt;
 % 'C:\Experiment1\dem10m.dem.ascii',[0,60], [0,10],1,100);&lt;br /&gt;
 %% Movie maker&lt;br /&gt;
 % read dem filenam is filename and 1 specifies the 0.00 should not be NaN's&lt;br /&gt;
 [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (dem); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 % A = [resroot,'.avi'];&lt;br /&gt;
 % mov = avifile(A);&lt;br /&gt;
 % loop through snapshots&lt;br /&gt;
 for i = 1:num_snaps&lt;br /&gt;
     if i &amp;lt; 10&lt;br /&gt;
         resfile = [resroot,'-000',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 100&lt;br /&gt;
         resfile = [resroot,'-00',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 1000&lt;br /&gt;
         resfile = [resroot,'-0',num2str(i),fileex];&lt;br /&gt;
     else&lt;br /&gt;
         resfile = [resroot,'-',num2str(i),fileex];&lt;br /&gt;
     end&lt;br /&gt;
     % read in deoth file for resfile i (2 specifies the 0.00 should be NaN&lt;br /&gt;
     [DEPTH, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (resfile);&lt;br /&gt;
     % plot data as figure 1&lt;br /&gt;
     plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype);&lt;br /&gt;
     % get movie frame&lt;br /&gt;
     M(i) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
     hold off;&lt;br /&gt;
 %     mov = addframe(mov,M(i));&lt;br /&gt;
     % close the figure&lt;br /&gt;
     close all&lt;br /&gt;
 end &lt;br /&gt;
 % % close .avi file&lt;br /&gt;
 % mov = close(mov);&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 disp('Generating .avi movie file');&lt;br /&gt;
 A = [resroot,fileex,'.avi'];&lt;br /&gt;
 movie2avi(M,A,'fps',framesPS,'quality',movQ);&lt;br /&gt;
 disp(A);&lt;br /&gt;
 %% Read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 % convert nodata to NaN;&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if OUT(ii,jj) == nodata&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         elseif OUT(ii,jj) == -99.000&lt;br /&gt;
             % lisflood uses -99.000 as nodat so will also remove these&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         else&lt;br /&gt;
             % do nothing&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 %% Plotter data for movie slide&lt;br /&gt;
 function plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype)&lt;br /&gt;
 % number of colors in colormap&lt;br /&gt;
 num_colors = 64;&lt;br /&gt;
 % DEM and variable color map&lt;br /&gt;
 cmap = [gray(num_colors); jet(num_colors)];&lt;br /&gt;
 % scale DEM and DEPTH data to fit with new colormap&lt;br /&gt;
 demCS2 = demCS(2)-demCS(1);&lt;br /&gt;
 dem_scalar = num_colors/demCS2;&lt;br /&gt;
 DEM2 = DEM*dem_scalar;&lt;br /&gt;
 depthCS2 = depthCS(2)-depthCS(1);&lt;br /&gt;
 depth_scalar = num_colors/depthCS2;&lt;br /&gt;
 DEPTH2 = (DEPTH*depth_scalar)+num_colors+1;&lt;br /&gt;
 %Plot the DEM&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap(cmap);&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcorner+(nrows*cellsize),yllcorner+cellsize},...&lt;br /&gt;
     'YTick', [1,nrows],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcorner,xllcorner+(ncols*cellsize)-cellsize},...&lt;br /&gt;
     'XTick',[1,ncols],...&lt;br /&gt;
     'Layer','top');&lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM2,'Parent',axes1);&lt;br /&gt;
 axis('equal');axis('tight');&lt;br /&gt;
 % Overlay the water depth (or other variable)&lt;br /&gt;
 H = image(DEPTH2);&lt;br /&gt;
 % code to make depth plot layer transparent&lt;br /&gt;
 OP = ones(nrows,ncols);&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if DEPTH(ii,jj) &amp;gt; 0&lt;br /&gt;
         else&lt;br /&gt;
             OP(ii,jj) = 0;&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % make transparent. depth layer must be H&lt;br /&gt;
 set(H,'AlphaData',OP);&lt;br /&gt;
 % label colourbar&lt;br /&gt;
 color_breaks = 5;&lt;br /&gt;
 colorbreak = num_colors/color_breaks;&lt;br /&gt;
 SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 SCALE(1) = 0.0001;&lt;br /&gt;
 for j = 1:color_breaks*2&lt;br /&gt;
     SCALE(j+1) = colorbreak*j;&lt;br /&gt;
 end&lt;br /&gt;
 SCALE(color_breaks+1) = num_colors+1;&lt;br /&gt;
 VIS_SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 VIS_SCALE(1) = demCS(1);&lt;br /&gt;
 for j = 1:color_breaks-1&lt;br /&gt;
     VIS_SCALE(j+1) = ((demCS2/color_breaks)*j)+demCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 VIS_SCALE(color_breaks+1) = depthCS(1);&lt;br /&gt;
 for j = 1:color_breaks&lt;br /&gt;
     VIS_SCALE(j+1+color_breaks) = ((depthCS2/color_breaks)*j)+depthCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 colorbar('YTick',SCALE,'YTickLabel',VIS_SCALE);&lt;br /&gt;
 % Label axis&lt;br /&gt;
 xlabel('BNG easting (m)');&lt;br /&gt;
 ylabel('BNG northing (m)');&lt;br /&gt;
 A = [vartype,' over DEM at time ',num2str((i*snapint)),'s'];&lt;br /&gt;
 title(A);&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5051</id>
		<title>LISFLOOD-FP and MATLAB</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5051"/>
		<updated>2008-03-18T16:13:04Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains various Matlab functions that may be useful for analysing results from the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model.&lt;br /&gt;
&lt;br /&gt;
==File import and export {{file}}==&lt;br /&gt;
&lt;br /&gt;
===Importing ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will import an ascii raster file using the string filename. To use it, copy and past text into a textfile called ascii_reader.m&lt;br /&gt;
&lt;br /&gt;
 function [dem, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % This function reads arc .asc files&lt;br /&gt;
 % requires filename string as input&lt;br /&gt;
 &lt;br /&gt;
 % j neal&lt;br /&gt;
 % 18/6/07&lt;br /&gt;
 %% read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 dem = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 dem = dem';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
You can view the imported file using the command:&lt;br /&gt;
&lt;br /&gt;
 imagesc(dem);&lt;br /&gt;
&lt;br /&gt;
===Exporting ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will create an ascii raster file called filename from the 2D matrix DEM.  To use it, copy and past text into a textfile called ascii_write.m&lt;br /&gt;
&lt;br /&gt;
 function ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 &lt;br /&gt;
 % ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 % only filename (string) and DEM (2D matrix) are essential&lt;br /&gt;
 % this function writes ascii raster files for arc&lt;br /&gt;
 % j neal&lt;br /&gt;
 % 6/3/2008&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
     error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4, &lt;br /&gt;
     xllcorner = 0;&lt;br /&gt;
     yllcorner = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 5,&lt;br /&gt;
     cellsize = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 6&lt;br /&gt;
     nodata = -9999;&lt;br /&gt;
 end&lt;br /&gt;
 A = size(DEM);&lt;br /&gt;
 fout = fopen (filename,'w');&lt;br /&gt;
 fprintf(fout, 'ncols         %.0f\n', A(2));  &lt;br /&gt;
 fprintf(fout, 'nrows         %.0f\n', A(1));&lt;br /&gt;
 fprintf(fout, 'xllcorner     %f\n', xllcorner);&lt;br /&gt;
 fprintf(fout, 'yllcorner     %f\n', yllcorner);&lt;br /&gt;
 fprintf(fout, 'cellsize      %f\n', cellsize);&lt;br /&gt;
 fprintf(fout, 'NODATA_value  %f\n', nodata); &lt;br /&gt;
 for ii = 1:A(1)&lt;br /&gt;
     B = DEM(ii,:);&lt;br /&gt;
     fprintf(fout, '%1.3f ', B);&lt;br /&gt;
     fprintf(fout, '\n');&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Writing parameter files===&lt;br /&gt;
&lt;br /&gt;
This function can be used to write many LISFLOOD-FP parameter files with ''N'' different channel and floodplain roughness, using your own ''N-by-''2 matrix called roughness. You will need to edit the code for your application by commenting unwanted lines with a percentage symbol.&lt;br /&gt;
&lt;br /&gt;
 function prm_writer (roughness) &lt;br /&gt;
 &lt;br /&gt;
 % This function writes LISFLOOD-FP parameter files numbered 1 to n using&lt;br /&gt;
 % the roughness values in the n-by-2 matrix roughness. yuo will need to&lt;br /&gt;
 % edit the code for your application.&lt;br /&gt;
 &lt;br /&gt;
 [num_sims] = size(roughness);&lt;br /&gt;
 for i = 1:num_sims(1)&lt;br /&gt;
 a = ['mymodel', num2str(i),'.par']; b = num2str(i);&lt;br /&gt;
 fout = fopen(a,'w');&lt;br /&gt;
 fprintf(fout,'DEMfile                  mydem.dem.ascii\n');&lt;br /&gt;
 fprintf(fout,'resroot                  myres%s\n',b);&lt;br /&gt;
 fprintf(fout,'dirroot                  mydir\n');&lt;br /&gt;
 fprintf(fout,'sim_time                 245000.0\n');&lt;br /&gt;
 fprintf(fout,'initial_tstep            10.0\n');&lt;br /&gt;
 fprintf(fout,'massint                  300.0\n');&lt;br /&gt;
 fprintf(fout,'saveint                  10000.0\n');&lt;br /&gt;
 %fprintf(fout,'overpass                 135000.0\n');&lt;br /&gt;
 fprintf(fout,'fpfric                   %1.3f\n',roughness(i,2));&lt;br /&gt;
 fprintf(fout,'nch                      %1.3f\n',roughness(i,1));&lt;br /&gt;
 %fprintf(fout,'manningfile              mymanfile%s.n.ascii\n',b);&lt;br /&gt;
 fprintf(fout,'riverfile                myriver.river\n');&lt;br /&gt;
 fprintf(fout,'bdyfile                  mybdy.bdy\n');&lt;br /&gt;
 fprintf(fout,'stagefile                mystage.stage\n');&lt;br /&gt;
 fprintf(fout,'bcifile                  mybci.bci\n');&lt;br /&gt;
 %fprintf(fout,'startfile                mystart.old\n');&lt;br /&gt;
 %fprintf(fout,'checkpoint               2\n');&lt;br /&gt;
 %fprintf(fout,'checkfile                mycheck.chkpnt\n');&lt;br /&gt;
 fprintf(fout,'elevoff\n');&lt;br /&gt;
 fprintf(fout,'qoutput\n');&lt;br /&gt;
 fprintf(fout,'diffusive\n');&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Plotting flow vectors from .Qx and .Qy files==&lt;br /&gt;
&lt;br /&gt;
This function will plot flow vectors from a .Qx and .Qy over a dem using the matlab functions image and quiver  &lt;br /&gt;
&lt;br /&gt;
 function lisflood_flow_plotter (qxfile, qyfile, demfile, north, east, south, west, scaling)&lt;br /&gt;
 &lt;br /&gt;
 % This function plots flow vectors from LISFLOOD_FP Qx and QY files&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile);&lt;br /&gt;
 %&lt;br /&gt;
 % these input variables are strings containing the relative of full&lt;br /&gt;
 % pathnames of the .Qx .Qy and ascii dem files to be plotted.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W);&lt;br /&gt;
 %&lt;br /&gt;
 % N, E, W and S are optional they specify the northernmost, southeernmost&lt;br /&gt;
 % ect cell to be displayed. this can be used to crop the domain.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W, scaling);&lt;br /&gt;
 % &lt;br /&gt;
 % scaling is an optional term used to manually scale the vector lengthes&lt;br /&gt;
 % drawn by quiver (the arrow plotting function).&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 20/02/2008 &lt;br /&gt;
 &lt;br /&gt;
 %% decide if crop is required and give imput error message&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
     error('Requires at least three input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7, &lt;br /&gt;
     crop = 0;&lt;br /&gt;
 else&lt;br /&gt;
     crop = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7,&lt;br /&gt;
     scaling = 1;&lt;br /&gt;
 end &lt;br /&gt;
 % Note don't do this for large areas ?&lt;br /&gt;
 %% Task 1: read ascii files&lt;br /&gt;
 % read Qx file&lt;br /&gt;
 [QX, ncolsqx, nrowsqx, xllcornerqx, yllcornerqx, cellsizeqx] = read_file (qxfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read Qy file&lt;br /&gt;
 [QY, ncolsqy, nrowsqy, xllcornerqy, yllcornerqy, cellsizeqy] = read_file (qyfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read DEM&lt;br /&gt;
 [DEM, ncolsdem, nrowsdem, xllcornerdem, yllcornerdem, cellsizedem] = read_file (demfile);&lt;br /&gt;
 %% crop data if required&lt;br /&gt;
 if crop == 1;&lt;br /&gt;
     DEM = DEM(north:south,west:east);&lt;br /&gt;
     QX = QX(north:south,west:east+1);&lt;br /&gt;
     QY = QY(north:south+1,west:east);&lt;br /&gt;
     xllcornerdem = xllcornerdem + west*cellsizedem - cellsizedem;&lt;br /&gt;
     yllcornerdem = yllcornerdem + (nrowsdem - south) * cellsizedem;&lt;br /&gt;
     [nrowsqx, ncolsqx] = size(QX); [nrowsqy, ncolsqy] = size(QY); [nrowsdem, ncolsdem] = size(DEM);&lt;br /&gt;
 end&lt;br /&gt;
 %% Taks 2: Plot dem and generate figure&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap('gray');&lt;br /&gt;
 % Create axes&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcornerdem + nrowsdem*cellsizedem ,yllcornerdem},...&lt;br /&gt;
     'YTick',[0.5,nrowsdem+0.5],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcornerdem,xllcornerdem+ncolsdem*cellsizedem},...&lt;br /&gt;
     'XTick',[0.5, ncolsdem + 0.5],...&lt;br /&gt;
     'Layer','top',...&lt;br /&gt;
     'DataAspectRatio',[1 1 1]...&lt;br /&gt;
     %,'Clim',[13 30]... % uncomment to set colourmap limits manually&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM,'Parent',axes1,'CDataMapping','scaled');&lt;br /&gt;
 axis('image');&lt;br /&gt;
 xlabel('Easting (m)');&lt;br /&gt;
 ylabel('Northing (m)');&lt;br /&gt;
 %% Task 3: calculate flow vectors&lt;br /&gt;
 % pre allocate memory for loop... it will run faster this way&lt;br /&gt;
 xlocs = zeros(ncolsqx*nrowsqx+ncolsqy*nrowsqy,1);&lt;br /&gt;
 ylocs = xlocs;&lt;br /&gt;
 U = xlocs;&lt;br /&gt;
 V = xlocs;&lt;br /&gt;
 %work out X and Y locations&lt;br /&gt;
 for i = 1:nrowsqx&lt;br /&gt;
     for j = 1:ncolsqx&lt;br /&gt;
         xlocs((i-1)*ncolsqx+j,1) = j - 0.5;&lt;br /&gt;
         ylocs((i-1)*ncolsqx+j,1) = i;&lt;br /&gt;
         U((i-1)*ncolsqx+j,1) = QX(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 for i = 1:nrowsqy&lt;br /&gt;
     for j = 1:ncolsqy&lt;br /&gt;
         xlocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = j;&lt;br /&gt;
         ylocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = i - 0.5;&lt;br /&gt;
         V(ncolsqx*nrowsqx+(i-1)*ncolsqy+j,1) = QY(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % work out number of nonzeros elements&lt;br /&gt;
 num_flows = nnz(U+V);&lt;br /&gt;
 xlocs2 = zeros(num_flows,1);&lt;br /&gt;
 ylocs2 = xlocs2;&lt;br /&gt;
 U2 = xlocs2;&lt;br /&gt;
 V2 = xlocs2;&lt;br /&gt;
 % remover zero flow locations&lt;br /&gt;
 k = 1;&lt;br /&gt;
 for i = 1:ncolsqx*nrowsqx+ncolsqy*nrowsqy&lt;br /&gt;
     if (U(i,1) == 0) &amp;amp;&amp;amp; (V(i,1) == 0)&lt;br /&gt;
         % do nothing&lt;br /&gt;
     else&lt;br /&gt;
         xlocs2(k,1) = xlocs(i,1);&lt;br /&gt;
         ylocs2(k,1) = ylocs(i,1);&lt;br /&gt;
         U2(k,1) = U(i,1);&lt;br /&gt;
         V2(k,1) = V(i,1);&lt;br /&gt;
         k = k+1;&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % check numbers are correct&lt;br /&gt;
 if k == num_flows + 1&lt;br /&gt;
     % all is ok&lt;br /&gt;
 else&lt;br /&gt;
     disp('Problem with flows');&lt;br /&gt;
 end&lt;br /&gt;
 %% Task 4: overlay flow vectors&lt;br /&gt;
 disp('Plotting data... if this is taking a long time you may need fewer locations');&lt;br /&gt;
 quiver (xlocs2,ylocs2,U2,V2, scaling);&lt;br /&gt;
 % quiver (xloc2,yloc2,U2,V2,'Parent',figure1);&lt;br /&gt;
 disp('Done');&lt;br /&gt;
 %% function to read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
==Making movies from .wd files==&lt;br /&gt;
&lt;br /&gt;
This function will convert a series of .wd .Qx or .Qy file into a .avi movie with the same filename&lt;br /&gt;
&lt;br /&gt;
 function LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ) &lt;br /&gt;
 &lt;br /&gt;
 % LISFLOOD_mov generates movies of LISFLOOD-FP output&lt;br /&gt;
 %&lt;br /&gt;
 % LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ)&lt;br /&gt;
 % &lt;br /&gt;
 % where &lt;br /&gt;
 % resroot is the LISFLOOD resroot (relative to m file or absolute)(string)&lt;br /&gt;
 % fileex is the file extension '.wd' (can be chaned to plot WSE and flows)&lt;br /&gt;
 % vartype is the name of the variable being plotted e.g. 'Depth'&lt;br /&gt;
 % num_snaps is the number of snapshot times&lt;br /&gt;
 % snapint is the time interval between each LISFLOOD-FP snapshot (seconds)&lt;br /&gt;
 % dem is the name of the demfile (relative or absolute)&lt;br /&gt;
 % demCS is the range of dem hights to be plotted e.g. demCS = [0,20];&lt;br /&gt;
 % depthCS is the range of depth values to be plotted e.g. depthCS = [0,10];&lt;br /&gt;
 % framesPS number of frames per second (each plot is a simgle frame)&lt;br /&gt;
 % movQ is the movie quality between 1 and 100 (100 is best)&lt;br /&gt;
 % &lt;br /&gt;
 % 8/11/2007. J Neal.&lt;br /&gt;
 %&lt;br /&gt;
 % EXAMPLE:&lt;br /&gt;
 % LISFLOOD_mov ('C:\Experiment1\res22','.wd','Water depth',24,10000,...&lt;br /&gt;
 % 'C:\Experiment1\dem10m.dem.ascii',[0,60], [0,10],1,100);&lt;br /&gt;
 %% Movie maker&lt;br /&gt;
 % read dem filenam is filename and 1 specifies the 0.00 should not be NaN's&lt;br /&gt;
 [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (dem); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 % A = [resroot,'.avi'];&lt;br /&gt;
 % mov = avifile(A);&lt;br /&gt;
 % loop through snapshots&lt;br /&gt;
 for i = 1:num_snaps&lt;br /&gt;
     if i &amp;lt; 10&lt;br /&gt;
         resfile = [resroot,'-000',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 100&lt;br /&gt;
         resfile = [resroot,'-00',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 1000&lt;br /&gt;
         resfile = [resroot,'-0',num2str(i),fileex];&lt;br /&gt;
     else&lt;br /&gt;
         resfile = [resroot,'-',num2str(i),fileex];&lt;br /&gt;
     end&lt;br /&gt;
     % read in deoth file for resfile i (2 specifies the 0.00 should be NaN&lt;br /&gt;
     [DEPTH, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (resfile);&lt;br /&gt;
     % plot data as figure 1&lt;br /&gt;
     plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype);&lt;br /&gt;
     % get movie frame&lt;br /&gt;
     M(i) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
     hold off;&lt;br /&gt;
 %     mov = addframe(mov,M(i));&lt;br /&gt;
     % close the figure&lt;br /&gt;
     close all&lt;br /&gt;
 end &lt;br /&gt;
 % % close .avi file&lt;br /&gt;
 % mov = close(mov);&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 disp('Generating .avi movie file');&lt;br /&gt;
 A = [resroot,fileex,'.avi'];&lt;br /&gt;
 movie2avi(M,A,'fps',framesPS,'quality',movQ);&lt;br /&gt;
 disp(A);&lt;br /&gt;
 %% Read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 % convert nodata to NaN;&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if OUT(ii,jj) == nodata&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         elseif OUT(ii,jj) == -99.000&lt;br /&gt;
             % lisflood uses -99.000 as nodat so will also remove these&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         else&lt;br /&gt;
             % do nothing&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 %% Plotter data for movie slide&lt;br /&gt;
 function plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype)&lt;br /&gt;
 % number of colors in colormap&lt;br /&gt;
 num_colors = 64;&lt;br /&gt;
 % DEM and variable color map&lt;br /&gt;
 cmap = [gray(num_colors); jet(num_colors)];&lt;br /&gt;
 % scale DEM and DEPTH data to fit with new colormap&lt;br /&gt;
 demCS2 = demCS(2)-demCS(1);&lt;br /&gt;
 dem_scalar = num_colors/demCS2;&lt;br /&gt;
 DEM2 = DEM*dem_scalar;&lt;br /&gt;
 depthCS2 = depthCS(2)-depthCS(1);&lt;br /&gt;
 depth_scalar = num_colors/depthCS2;&lt;br /&gt;
 DEPTH2 = (DEPTH*depth_scalar)+num_colors+1;&lt;br /&gt;
 %Plot the DEM&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap(cmap);&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcorner+(nrows*cellsize),yllcorner+cellsize},...&lt;br /&gt;
     'YTick', [1,nrows],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcorner,xllcorner+(ncols*cellsize)-cellsize},...&lt;br /&gt;
     'XTick',[1,ncols],...&lt;br /&gt;
     'Layer','top');&lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM2,'Parent',axes1);&lt;br /&gt;
 axis('equal');axis('tight');&lt;br /&gt;
 % Overlay the water depth (or other variable)&lt;br /&gt;
 H = image(DEPTH2);&lt;br /&gt;
 % code to make depth plot layer transparent&lt;br /&gt;
 OP = ones(nrows,ncols);&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if DEPTH(ii,jj) &amp;gt; 0&lt;br /&gt;
         else&lt;br /&gt;
             OP(ii,jj) = 0;&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % make transparent. depth layer must be H&lt;br /&gt;
 set(H,'AlphaData',OP);&lt;br /&gt;
 % label colourbar&lt;br /&gt;
 color_breaks = 5;&lt;br /&gt;
 colorbreak = num_colors/color_breaks;&lt;br /&gt;
 SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 SCALE(1) = 0.0001;&lt;br /&gt;
 for j = 1:color_breaks*2&lt;br /&gt;
     SCALE(j+1) = colorbreak*j;&lt;br /&gt;
 end&lt;br /&gt;
 SCALE(color_breaks+1) = num_colors+1;&lt;br /&gt;
 VIS_SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 VIS_SCALE(1) = demCS(1);&lt;br /&gt;
 for j = 1:color_breaks-1&lt;br /&gt;
     VIS_SCALE(j+1) = ((demCS2/color_breaks)*j)+demCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 VIS_SCALE(color_breaks+1) = depthCS(1);&lt;br /&gt;
 for j = 1:color_breaks&lt;br /&gt;
     VIS_SCALE(j+1+color_breaks) = ((depthCS2/color_breaks)*j)+depthCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 colorbar('YTick',SCALE,'YTickLabel',VIS_SCALE);&lt;br /&gt;
 % Label axis&lt;br /&gt;
 xlabel('BNG easting (m)');&lt;br /&gt;
 ylabel('BNG northing (m)');&lt;br /&gt;
 A = [vartype,' over DEM at time ',num2str((i*snapint)),'s'];&lt;br /&gt;
 title(A);&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5050</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5050"/>
		<updated>2008-03-18T16:12:47Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab:file|File import and export]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5049</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5049"/>
		<updated>2008-03-18T16:12:39Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab|File import and export]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5048</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5048"/>
		<updated>2008-03-18T16:12:13Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab]] File import and export&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5047</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5047"/>
		<updated>2008-03-18T16:12:02Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab File import and export]]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5046</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5046"/>
		<updated>2008-03-18T16:11:50Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [[Lisflood_in_matlab File import and export]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5045</id>
		<title>LISFLOOD-FP and MATLAB</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5045"/>
		<updated>2008-03-18T16:08:57Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains various Matlab functions that may be useful for analysing results from the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model.&lt;br /&gt;
&lt;br /&gt;
==File import and export==&lt;br /&gt;
&lt;br /&gt;
===Importing ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will import an ascii raster file using the string filename. To use it, copy and past text into a textfile called ascii_reader.m&lt;br /&gt;
&lt;br /&gt;
 function [dem, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % This function reads arc .asc files&lt;br /&gt;
 % requires filename string as input&lt;br /&gt;
 &lt;br /&gt;
 % j neal&lt;br /&gt;
 % 18/6/07&lt;br /&gt;
 %% read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 dem = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 dem = dem';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
You can view the imported file using the command:&lt;br /&gt;
&lt;br /&gt;
 imagesc(dem);&lt;br /&gt;
&lt;br /&gt;
===Exporting ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will create an ascii raster file called filename from the 2D matrix DEM.  To use it, copy and past text into a textfile called ascii_write.m&lt;br /&gt;
&lt;br /&gt;
 function ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 &lt;br /&gt;
 % ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 % only filename (string) and DEM (2D matrix) are essential&lt;br /&gt;
 % this function writes ascii raster files for arc&lt;br /&gt;
 % j neal&lt;br /&gt;
 % 6/3/2008&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
     error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4, &lt;br /&gt;
     xllcorner = 0;&lt;br /&gt;
     yllcorner = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 5,&lt;br /&gt;
     cellsize = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 6&lt;br /&gt;
     nodata = -9999;&lt;br /&gt;
 end&lt;br /&gt;
 A = size(DEM);&lt;br /&gt;
 fout = fopen (filename,'w');&lt;br /&gt;
 fprintf(fout, 'ncols         %.0f\n', A(2));  &lt;br /&gt;
 fprintf(fout, 'nrows         %.0f\n', A(1));&lt;br /&gt;
 fprintf(fout, 'xllcorner     %f\n', xllcorner);&lt;br /&gt;
 fprintf(fout, 'yllcorner     %f\n', yllcorner);&lt;br /&gt;
 fprintf(fout, 'cellsize      %f\n', cellsize);&lt;br /&gt;
 fprintf(fout, 'NODATA_value  %f\n', nodata); &lt;br /&gt;
 for ii = 1:A(1)&lt;br /&gt;
     B = DEM(ii,:);&lt;br /&gt;
     fprintf(fout, '%1.3f ', B);&lt;br /&gt;
     fprintf(fout, '\n');&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Writing parameter files===&lt;br /&gt;
&lt;br /&gt;
This function can be used to write many LISFLOOD-FP parameter files with ''N'' different channel and floodplain roughness, using your own ''N-by-''2 matrix called roughness. You will need to edit the code for your application by commenting unwanted lines with a percentage symbol.&lt;br /&gt;
&lt;br /&gt;
 function prm_writer (roughness) &lt;br /&gt;
 &lt;br /&gt;
 % This function writes LISFLOOD-FP parameter files numbered 1 to n using&lt;br /&gt;
 % the roughness values in the n-by-2 matrix roughness. yuo will need to&lt;br /&gt;
 % edit the code for your application.&lt;br /&gt;
 &lt;br /&gt;
 [num_sims] = size(roughness);&lt;br /&gt;
 for i = 1:num_sims(1)&lt;br /&gt;
 a = ['mymodel', num2str(i),'.par']; b = num2str(i);&lt;br /&gt;
 fout = fopen(a,'w');&lt;br /&gt;
 fprintf(fout,'DEMfile                  mydem.dem.ascii\n');&lt;br /&gt;
 fprintf(fout,'resroot                  myres%s\n',b);&lt;br /&gt;
 fprintf(fout,'dirroot                  mydir\n');&lt;br /&gt;
 fprintf(fout,'sim_time                 245000.0\n');&lt;br /&gt;
 fprintf(fout,'initial_tstep            10.0\n');&lt;br /&gt;
 fprintf(fout,'massint                  300.0\n');&lt;br /&gt;
 fprintf(fout,'saveint                  10000.0\n');&lt;br /&gt;
 %fprintf(fout,'overpass                 135000.0\n');&lt;br /&gt;
 fprintf(fout,'fpfric                   %1.3f\n',roughness(i,2));&lt;br /&gt;
 fprintf(fout,'nch                      %1.3f\n',roughness(i,1));&lt;br /&gt;
 %fprintf(fout,'manningfile              mymanfile%s.n.ascii\n',b);&lt;br /&gt;
 fprintf(fout,'riverfile                myriver.river\n');&lt;br /&gt;
 fprintf(fout,'bdyfile                  mybdy.bdy\n');&lt;br /&gt;
 fprintf(fout,'stagefile                mystage.stage\n');&lt;br /&gt;
 fprintf(fout,'bcifile                  mybci.bci\n');&lt;br /&gt;
 %fprintf(fout,'startfile                mystart.old\n');&lt;br /&gt;
 %fprintf(fout,'checkpoint               2\n');&lt;br /&gt;
 %fprintf(fout,'checkfile                mycheck.chkpnt\n');&lt;br /&gt;
 fprintf(fout,'elevoff\n');&lt;br /&gt;
 fprintf(fout,'qoutput\n');&lt;br /&gt;
 fprintf(fout,'diffusive\n');&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Plotting flow vectors from .Qx and .Qy files==&lt;br /&gt;
&lt;br /&gt;
This function will plot flow vectors from a .Qx and .Qy over a dem using the matlab functions image and quiver  &lt;br /&gt;
&lt;br /&gt;
 function lisflood_flow_plotter (qxfile, qyfile, demfile, north, east, south, west, scaling)&lt;br /&gt;
 &lt;br /&gt;
 % This function plots flow vectors from LISFLOOD_FP Qx and QY files&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile);&lt;br /&gt;
 %&lt;br /&gt;
 % these input variables are strings containing the relative of full&lt;br /&gt;
 % pathnames of the .Qx .Qy and ascii dem files to be plotted.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W);&lt;br /&gt;
 %&lt;br /&gt;
 % N, E, W and S are optional they specify the northernmost, southeernmost&lt;br /&gt;
 % ect cell to be displayed. this can be used to crop the domain.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W, scaling);&lt;br /&gt;
 % &lt;br /&gt;
 % scaling is an optional term used to manually scale the vector lengthes&lt;br /&gt;
 % drawn by quiver (the arrow plotting function).&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 20/02/2008 &lt;br /&gt;
 &lt;br /&gt;
 %% decide if crop is required and give imput error message&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
     error('Requires at least three input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7, &lt;br /&gt;
     crop = 0;&lt;br /&gt;
 else&lt;br /&gt;
     crop = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7,&lt;br /&gt;
     scaling = 1;&lt;br /&gt;
 end &lt;br /&gt;
 % Note don't do this for large areas ?&lt;br /&gt;
 %% Task 1: read ascii files&lt;br /&gt;
 % read Qx file&lt;br /&gt;
 [QX, ncolsqx, nrowsqx, xllcornerqx, yllcornerqx, cellsizeqx] = read_file (qxfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read Qy file&lt;br /&gt;
 [QY, ncolsqy, nrowsqy, xllcornerqy, yllcornerqy, cellsizeqy] = read_file (qyfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read DEM&lt;br /&gt;
 [DEM, ncolsdem, nrowsdem, xllcornerdem, yllcornerdem, cellsizedem] = read_file (demfile);&lt;br /&gt;
 %% crop data if required&lt;br /&gt;
 if crop == 1;&lt;br /&gt;
     DEM = DEM(north:south,west:east);&lt;br /&gt;
     QX = QX(north:south,west:east+1);&lt;br /&gt;
     QY = QY(north:south+1,west:east);&lt;br /&gt;
     xllcornerdem = xllcornerdem + west*cellsizedem - cellsizedem;&lt;br /&gt;
     yllcornerdem = yllcornerdem + (nrowsdem - south) * cellsizedem;&lt;br /&gt;
     [nrowsqx, ncolsqx] = size(QX); [nrowsqy, ncolsqy] = size(QY); [nrowsdem, ncolsdem] = size(DEM);&lt;br /&gt;
 end&lt;br /&gt;
 %% Taks 2: Plot dem and generate figure&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap('gray');&lt;br /&gt;
 % Create axes&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcornerdem + nrowsdem*cellsizedem ,yllcornerdem},...&lt;br /&gt;
     'YTick',[0.5,nrowsdem+0.5],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcornerdem,xllcornerdem+ncolsdem*cellsizedem},...&lt;br /&gt;
     'XTick',[0.5, ncolsdem + 0.5],...&lt;br /&gt;
     'Layer','top',...&lt;br /&gt;
     'DataAspectRatio',[1 1 1]...&lt;br /&gt;
     %,'Clim',[13 30]... % uncomment to set colourmap limits manually&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM,'Parent',axes1,'CDataMapping','scaled');&lt;br /&gt;
 axis('image');&lt;br /&gt;
 xlabel('Easting (m)');&lt;br /&gt;
 ylabel('Northing (m)');&lt;br /&gt;
 %% Task 3: calculate flow vectors&lt;br /&gt;
 % pre allocate memory for loop... it will run faster this way&lt;br /&gt;
 xlocs = zeros(ncolsqx*nrowsqx+ncolsqy*nrowsqy,1);&lt;br /&gt;
 ylocs = xlocs;&lt;br /&gt;
 U = xlocs;&lt;br /&gt;
 V = xlocs;&lt;br /&gt;
 %work out X and Y locations&lt;br /&gt;
 for i = 1:nrowsqx&lt;br /&gt;
     for j = 1:ncolsqx&lt;br /&gt;
         xlocs((i-1)*ncolsqx+j,1) = j - 0.5;&lt;br /&gt;
         ylocs((i-1)*ncolsqx+j,1) = i;&lt;br /&gt;
         U((i-1)*ncolsqx+j,1) = QX(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 for i = 1:nrowsqy&lt;br /&gt;
     for j = 1:ncolsqy&lt;br /&gt;
         xlocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = j;&lt;br /&gt;
         ylocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = i - 0.5;&lt;br /&gt;
         V(ncolsqx*nrowsqx+(i-1)*ncolsqy+j,1) = QY(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % work out number of nonzeros elements&lt;br /&gt;
 num_flows = nnz(U+V);&lt;br /&gt;
 xlocs2 = zeros(num_flows,1);&lt;br /&gt;
 ylocs2 = xlocs2;&lt;br /&gt;
 U2 = xlocs2;&lt;br /&gt;
 V2 = xlocs2;&lt;br /&gt;
 % remover zero flow locations&lt;br /&gt;
 k = 1;&lt;br /&gt;
 for i = 1:ncolsqx*nrowsqx+ncolsqy*nrowsqy&lt;br /&gt;
     if (U(i,1) == 0) &amp;amp;&amp;amp; (V(i,1) == 0)&lt;br /&gt;
         % do nothing&lt;br /&gt;
     else&lt;br /&gt;
         xlocs2(k,1) = xlocs(i,1);&lt;br /&gt;
         ylocs2(k,1) = ylocs(i,1);&lt;br /&gt;
         U2(k,1) = U(i,1);&lt;br /&gt;
         V2(k,1) = V(i,1);&lt;br /&gt;
         k = k+1;&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % check numbers are correct&lt;br /&gt;
 if k == num_flows + 1&lt;br /&gt;
     % all is ok&lt;br /&gt;
 else&lt;br /&gt;
     disp('Problem with flows');&lt;br /&gt;
 end&lt;br /&gt;
 %% Task 4: overlay flow vectors&lt;br /&gt;
 disp('Plotting data... if this is taking a long time you may need fewer locations');&lt;br /&gt;
 quiver (xlocs2,ylocs2,U2,V2, scaling);&lt;br /&gt;
 % quiver (xloc2,yloc2,U2,V2,'Parent',figure1);&lt;br /&gt;
 disp('Done');&lt;br /&gt;
 %% function to read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
==Making movies from .wd files==&lt;br /&gt;
&lt;br /&gt;
This function will convert a series of .wd .Qx or .Qy file into a .avi movie with the same filename&lt;br /&gt;
&lt;br /&gt;
 function LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ) &lt;br /&gt;
 &lt;br /&gt;
 % LISFLOOD_mov generates movies of LISFLOOD-FP output&lt;br /&gt;
 %&lt;br /&gt;
 % LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ)&lt;br /&gt;
 % &lt;br /&gt;
 % where &lt;br /&gt;
 % resroot is the LISFLOOD resroot (relative to m file or absolute)(string)&lt;br /&gt;
 % fileex is the file extension '.wd' (can be chaned to plot WSE and flows)&lt;br /&gt;
 % vartype is the name of the variable being plotted e.g. 'Depth'&lt;br /&gt;
 % num_snaps is the number of snapshot times&lt;br /&gt;
 % snapint is the time interval between each LISFLOOD-FP snapshot (seconds)&lt;br /&gt;
 % dem is the name of the demfile (relative or absolute)&lt;br /&gt;
 % demCS is the range of dem hights to be plotted e.g. demCS = [0,20];&lt;br /&gt;
 % depthCS is the range of depth values to be plotted e.g. depthCS = [0,10];&lt;br /&gt;
 % framesPS number of frames per second (each plot is a simgle frame)&lt;br /&gt;
 % movQ is the movie quality between 1 and 100 (100 is best)&lt;br /&gt;
 % &lt;br /&gt;
 % 8/11/2007. J Neal.&lt;br /&gt;
 %&lt;br /&gt;
 % EXAMPLE:&lt;br /&gt;
 % LISFLOOD_mov ('C:\Experiment1\res22','.wd','Water depth',24,10000,...&lt;br /&gt;
 % 'C:\Experiment1\dem10m.dem.ascii',[0,60], [0,10],1,100);&lt;br /&gt;
 %% Movie maker&lt;br /&gt;
 % read dem filenam is filename and 1 specifies the 0.00 should not be NaN's&lt;br /&gt;
 [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (dem); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 % A = [resroot,'.avi'];&lt;br /&gt;
 % mov = avifile(A);&lt;br /&gt;
 % loop through snapshots&lt;br /&gt;
 for i = 1:num_snaps&lt;br /&gt;
     if i &amp;lt; 10&lt;br /&gt;
         resfile = [resroot,'-000',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 100&lt;br /&gt;
         resfile = [resroot,'-00',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 1000&lt;br /&gt;
         resfile = [resroot,'-0',num2str(i),fileex];&lt;br /&gt;
     else&lt;br /&gt;
         resfile = [resroot,'-',num2str(i),fileex];&lt;br /&gt;
     end&lt;br /&gt;
     % read in deoth file for resfile i (2 specifies the 0.00 should be NaN&lt;br /&gt;
     [DEPTH, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (resfile);&lt;br /&gt;
     % plot data as figure 1&lt;br /&gt;
     plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype);&lt;br /&gt;
     % get movie frame&lt;br /&gt;
     M(i) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
     hold off;&lt;br /&gt;
 %     mov = addframe(mov,M(i));&lt;br /&gt;
     % close the figure&lt;br /&gt;
     close all&lt;br /&gt;
 end &lt;br /&gt;
 % % close .avi file&lt;br /&gt;
 % mov = close(mov);&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 disp('Generating .avi movie file');&lt;br /&gt;
 A = [resroot,fileex,'.avi'];&lt;br /&gt;
 movie2avi(M,A,'fps',framesPS,'quality',movQ);&lt;br /&gt;
 disp(A);&lt;br /&gt;
 %% Read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 % convert nodata to NaN;&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if OUT(ii,jj) == nodata&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         elseif OUT(ii,jj) == -99.000&lt;br /&gt;
             % lisflood uses -99.000 as nodat so will also remove these&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         else&lt;br /&gt;
             % do nothing&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 %% Plotter data for movie slide&lt;br /&gt;
 function plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype)&lt;br /&gt;
 % number of colors in colormap&lt;br /&gt;
 num_colors = 64;&lt;br /&gt;
 % DEM and variable color map&lt;br /&gt;
 cmap = [gray(num_colors); jet(num_colors)];&lt;br /&gt;
 % scale DEM and DEPTH data to fit with new colormap&lt;br /&gt;
 demCS2 = demCS(2)-demCS(1);&lt;br /&gt;
 dem_scalar = num_colors/demCS2;&lt;br /&gt;
 DEM2 = DEM*dem_scalar;&lt;br /&gt;
 depthCS2 = depthCS(2)-depthCS(1);&lt;br /&gt;
 depth_scalar = num_colors/depthCS2;&lt;br /&gt;
 DEPTH2 = (DEPTH*depth_scalar)+num_colors+1;&lt;br /&gt;
 %Plot the DEM&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap(cmap);&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcorner+(nrows*cellsize),yllcorner+cellsize},...&lt;br /&gt;
     'YTick', [1,nrows],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcorner,xllcorner+(ncols*cellsize)-cellsize},...&lt;br /&gt;
     'XTick',[1,ncols],...&lt;br /&gt;
     'Layer','top');&lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM2,'Parent',axes1);&lt;br /&gt;
 axis('equal');axis('tight');&lt;br /&gt;
 % Overlay the water depth (or other variable)&lt;br /&gt;
 H = image(DEPTH2);&lt;br /&gt;
 % code to make depth plot layer transparent&lt;br /&gt;
 OP = ones(nrows,ncols);&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if DEPTH(ii,jj) &amp;gt; 0&lt;br /&gt;
         else&lt;br /&gt;
             OP(ii,jj) = 0;&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % make transparent. depth layer must be H&lt;br /&gt;
 set(H,'AlphaData',OP);&lt;br /&gt;
 % label colourbar&lt;br /&gt;
 color_breaks = 5;&lt;br /&gt;
 colorbreak = num_colors/color_breaks;&lt;br /&gt;
 SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 SCALE(1) = 0.0001;&lt;br /&gt;
 for j = 1:color_breaks*2&lt;br /&gt;
     SCALE(j+1) = colorbreak*j;&lt;br /&gt;
 end&lt;br /&gt;
 SCALE(color_breaks+1) = num_colors+1;&lt;br /&gt;
 VIS_SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 VIS_SCALE(1) = demCS(1);&lt;br /&gt;
 for j = 1:color_breaks-1&lt;br /&gt;
     VIS_SCALE(j+1) = ((demCS2/color_breaks)*j)+demCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 VIS_SCALE(color_breaks+1) = depthCS(1);&lt;br /&gt;
 for j = 1:color_breaks&lt;br /&gt;
     VIS_SCALE(j+1+color_breaks) = ((depthCS2/color_breaks)*j)+depthCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 colorbar('YTick',SCALE,'YTickLabel',VIS_SCALE);&lt;br /&gt;
 % Label axis&lt;br /&gt;
 xlabel('BNG easting (m)');&lt;br /&gt;
 ylabel('BNG northing (m)');&lt;br /&gt;
 A = [vartype,' over DEM at time ',num2str((i*snapint)),'s'];&lt;br /&gt;
 title(A);&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5044</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5044"/>
		<updated>2008-03-18T16:08:42Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [http://source.ggy.bris.ac.uk/wiki/Lisflood_in_matlab#file File import and export]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5043</id>
		<title>LISFLOOD-FP and MATLAB</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP_and_MATLAB&amp;diff=5043"/>
		<updated>2008-03-18T16:06:58Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains various Matlab functions that may be useful for analysing results from the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model.&lt;br /&gt;
&lt;br /&gt;
==File import and export {{file}}==&lt;br /&gt;
&lt;br /&gt;
===Importing ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will import an ascii raster file using the string filename. To use it, copy and past text into a textfile called ascii_reader.m&lt;br /&gt;
&lt;br /&gt;
 function [dem, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = ascii_reader (filename) &lt;br /&gt;
 &lt;br /&gt;
 % This function reads arc .asc files&lt;br /&gt;
 % requires filename string as input&lt;br /&gt;
 &lt;br /&gt;
 % j neal&lt;br /&gt;
 % 18/6/07&lt;br /&gt;
 %% read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 dem = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 dem = dem';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
You can view the imported file using the command:&lt;br /&gt;
&lt;br /&gt;
 imagesc(dem);&lt;br /&gt;
&lt;br /&gt;
===Exporting ascii raster files===&lt;br /&gt;
&lt;br /&gt;
This function will create an ascii raster file called filename from the 2D matrix DEM.  To use it, copy and past text into a textfile called ascii_write.m&lt;br /&gt;
&lt;br /&gt;
 function ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 &lt;br /&gt;
 % ascii_write (filename, DEM, xllcorner, yllcorner, cellsize, nodata)&lt;br /&gt;
 % only filename (string) and DEM (2D matrix) are essential&lt;br /&gt;
 % this function writes ascii raster files for arc&lt;br /&gt;
 % j neal&lt;br /&gt;
 % 6/3/2008&lt;br /&gt;
 &lt;br /&gt;
 if nargin &amp;lt; 2, &lt;br /&gt;
     error('Requires at least two input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 4, &lt;br /&gt;
     xllcorner = 0;&lt;br /&gt;
     yllcorner = 0;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 5,&lt;br /&gt;
     cellsize = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 6&lt;br /&gt;
     nodata = -9999;&lt;br /&gt;
 end&lt;br /&gt;
 A = size(DEM);&lt;br /&gt;
 fout = fopen (filename,'w');&lt;br /&gt;
 fprintf(fout, 'ncols         %.0f\n', A(2));  &lt;br /&gt;
 fprintf(fout, 'nrows         %.0f\n', A(1));&lt;br /&gt;
 fprintf(fout, 'xllcorner     %f\n', xllcorner);&lt;br /&gt;
 fprintf(fout, 'yllcorner     %f\n', yllcorner);&lt;br /&gt;
 fprintf(fout, 'cellsize      %f\n', cellsize);&lt;br /&gt;
 fprintf(fout, 'NODATA_value  %f\n', nodata); &lt;br /&gt;
 for ii = 1:A(1)&lt;br /&gt;
     B = DEM(ii,:);&lt;br /&gt;
     fprintf(fout, '%1.3f ', B);&lt;br /&gt;
     fprintf(fout, '\n');&lt;br /&gt;
 end&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
===Writing parameter files===&lt;br /&gt;
&lt;br /&gt;
This function can be used to write many LISFLOOD-FP parameter files with ''N'' different channel and floodplain roughness, using your own ''N-by-''2 matrix called roughness. You will need to edit the code for your application by commenting unwanted lines with a percentage symbol.&lt;br /&gt;
&lt;br /&gt;
 function prm_writer (roughness) &lt;br /&gt;
 &lt;br /&gt;
 % This function writes LISFLOOD-FP parameter files numbered 1 to n using&lt;br /&gt;
 % the roughness values in the n-by-2 matrix roughness. yuo will need to&lt;br /&gt;
 % edit the code for your application.&lt;br /&gt;
 &lt;br /&gt;
 [num_sims] = size(roughness);&lt;br /&gt;
 for i = 1:num_sims(1)&lt;br /&gt;
 a = ['mymodel', num2str(i),'.par']; b = num2str(i);&lt;br /&gt;
 fout = fopen(a,'w');&lt;br /&gt;
 fprintf(fout,'DEMfile                  mydem.dem.ascii\n');&lt;br /&gt;
 fprintf(fout,'resroot                  myres%s\n',b);&lt;br /&gt;
 fprintf(fout,'dirroot                  mydir\n');&lt;br /&gt;
 fprintf(fout,'sim_time                 245000.0\n');&lt;br /&gt;
 fprintf(fout,'initial_tstep            10.0\n');&lt;br /&gt;
 fprintf(fout,'massint                  300.0\n');&lt;br /&gt;
 fprintf(fout,'saveint                  10000.0\n');&lt;br /&gt;
 %fprintf(fout,'overpass                 135000.0\n');&lt;br /&gt;
 fprintf(fout,'fpfric                   %1.3f\n',roughness(i,2));&lt;br /&gt;
 fprintf(fout,'nch                      %1.3f\n',roughness(i,1));&lt;br /&gt;
 %fprintf(fout,'manningfile              mymanfile%s.n.ascii\n',b);&lt;br /&gt;
 fprintf(fout,'riverfile                myriver.river\n');&lt;br /&gt;
 fprintf(fout,'bdyfile                  mybdy.bdy\n');&lt;br /&gt;
 fprintf(fout,'stagefile                mystage.stage\n');&lt;br /&gt;
 fprintf(fout,'bcifile                  mybci.bci\n');&lt;br /&gt;
 %fprintf(fout,'startfile                mystart.old\n');&lt;br /&gt;
 %fprintf(fout,'checkpoint               2\n');&lt;br /&gt;
 %fprintf(fout,'checkfile                mycheck.chkpnt\n');&lt;br /&gt;
 fprintf(fout,'elevoff\n');&lt;br /&gt;
 fprintf(fout,'qoutput\n');&lt;br /&gt;
 fprintf(fout,'diffusive\n');&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Plotting flow vectors from .Qx and .Qy files==&lt;br /&gt;
&lt;br /&gt;
This function will plot flow vectors from a .Qx and .Qy over a dem using the matlab functions image and quiver  &lt;br /&gt;
&lt;br /&gt;
 function lisflood_flow_plotter (qxfile, qyfile, demfile, north, east, south, west, scaling)&lt;br /&gt;
 &lt;br /&gt;
 % This function plots flow vectors from LISFLOOD_FP Qx and QY files&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile);&lt;br /&gt;
 %&lt;br /&gt;
 % these input variables are strings containing the relative of full&lt;br /&gt;
 % pathnames of the .Qx .Qy and ascii dem files to be plotted.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W);&lt;br /&gt;
 %&lt;br /&gt;
 % N, E, W and S are optional they specify the northernmost, southeernmost&lt;br /&gt;
 % ect cell to be displayed. this can be used to crop the domain.&lt;br /&gt;
 %&lt;br /&gt;
 % lisflood_flow_plotter (qxfile, qyfile, demfile, N, E, S, W, scaling);&lt;br /&gt;
 % &lt;br /&gt;
 % scaling is an optional term used to manually scale the vector lengthes&lt;br /&gt;
 % drawn by quiver (the arrow plotting function).&lt;br /&gt;
 %&lt;br /&gt;
 % J Neal&lt;br /&gt;
 % 20/02/2008 &lt;br /&gt;
 &lt;br /&gt;
 %% decide if crop is required and give imput error message&lt;br /&gt;
 if nargin &amp;lt; 3, &lt;br /&gt;
     error('Requires at least three input arguments'); &lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7, &lt;br /&gt;
     crop = 0;&lt;br /&gt;
 else&lt;br /&gt;
     crop = 1;&lt;br /&gt;
 end&lt;br /&gt;
 if nargin &amp;lt; 7,&lt;br /&gt;
     scaling = 1;&lt;br /&gt;
 end &lt;br /&gt;
 % Note don't do this for large areas ?&lt;br /&gt;
 %% Task 1: read ascii files&lt;br /&gt;
 % read Qx file&lt;br /&gt;
 [QX, ncolsqx, nrowsqx, xllcornerqx, yllcornerqx, cellsizeqx] = read_file (qxfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read Qy file&lt;br /&gt;
 [QY, ncolsqy, nrowsqy, xllcornerqy, yllcornerqy, cellsizeqy] = read_file (qyfile); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % read DEM&lt;br /&gt;
 [DEM, ncolsdem, nrowsdem, xllcornerdem, yllcornerdem, cellsizedem] = read_file (demfile);&lt;br /&gt;
 %% crop data if required&lt;br /&gt;
 if crop == 1;&lt;br /&gt;
     DEM = DEM(north:south,west:east);&lt;br /&gt;
     QX = QX(north:south,west:east+1);&lt;br /&gt;
     QY = QY(north:south+1,west:east);&lt;br /&gt;
     xllcornerdem = xllcornerdem + west*cellsizedem - cellsizedem;&lt;br /&gt;
     yllcornerdem = yllcornerdem + (nrowsdem - south) * cellsizedem;&lt;br /&gt;
     [nrowsqx, ncolsqx] = size(QX); [nrowsqy, ncolsqy] = size(QY); [nrowsdem, ncolsdem] = size(DEM);&lt;br /&gt;
 end&lt;br /&gt;
 %% Taks 2: Plot dem and generate figure&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap('gray');&lt;br /&gt;
 % Create axes&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcornerdem + nrowsdem*cellsizedem ,yllcornerdem},...&lt;br /&gt;
     'YTick',[0.5,nrowsdem+0.5],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcornerdem,xllcornerdem+ncolsdem*cellsizedem},...&lt;br /&gt;
     'XTick',[0.5, ncolsdem + 0.5],...&lt;br /&gt;
     'Layer','top',...&lt;br /&gt;
     'DataAspectRatio',[1 1 1]...&lt;br /&gt;
     %,'Clim',[13 30]... % uncomment to set colourmap limits manually&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM,'Parent',axes1,'CDataMapping','scaled');&lt;br /&gt;
 axis('image');&lt;br /&gt;
 xlabel('Easting (m)');&lt;br /&gt;
 ylabel('Northing (m)');&lt;br /&gt;
 %% Task 3: calculate flow vectors&lt;br /&gt;
 % pre allocate memory for loop... it will run faster this way&lt;br /&gt;
 xlocs = zeros(ncolsqx*nrowsqx+ncolsqy*nrowsqy,1);&lt;br /&gt;
 ylocs = xlocs;&lt;br /&gt;
 U = xlocs;&lt;br /&gt;
 V = xlocs;&lt;br /&gt;
 %work out X and Y locations&lt;br /&gt;
 for i = 1:nrowsqx&lt;br /&gt;
     for j = 1:ncolsqx&lt;br /&gt;
         xlocs((i-1)*ncolsqx+j,1) = j - 0.5;&lt;br /&gt;
         ylocs((i-1)*ncolsqx+j,1) = i;&lt;br /&gt;
         U((i-1)*ncolsqx+j,1) = QX(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 for i = 1:nrowsqy&lt;br /&gt;
     for j = 1:ncolsqy&lt;br /&gt;
         xlocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = j;&lt;br /&gt;
         ylocs(ncolsqx*nrowsqx + (i-1)*ncolsqy +j,1) = i - 0.5;&lt;br /&gt;
         V(ncolsqx*nrowsqx+(i-1)*ncolsqy+j,1) = QY(i,j);&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % work out number of nonzeros elements&lt;br /&gt;
 num_flows = nnz(U+V);&lt;br /&gt;
 xlocs2 = zeros(num_flows,1);&lt;br /&gt;
 ylocs2 = xlocs2;&lt;br /&gt;
 U2 = xlocs2;&lt;br /&gt;
 V2 = xlocs2;&lt;br /&gt;
 % remover zero flow locations&lt;br /&gt;
 k = 1;&lt;br /&gt;
 for i = 1:ncolsqx*nrowsqx+ncolsqy*nrowsqy&lt;br /&gt;
     if (U(i,1) == 0) &amp;amp;&amp;amp; (V(i,1) == 0)&lt;br /&gt;
         % do nothing&lt;br /&gt;
     else&lt;br /&gt;
         xlocs2(k,1) = xlocs(i,1);&lt;br /&gt;
         ylocs2(k,1) = ylocs(i,1);&lt;br /&gt;
         U2(k,1) = U(i,1);&lt;br /&gt;
         V2(k,1) = V(i,1);&lt;br /&gt;
         k = k+1;&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % check numbers are correct&lt;br /&gt;
 if k == num_flows + 1&lt;br /&gt;
     % all is ok&lt;br /&gt;
 else&lt;br /&gt;
     disp('Problem with flows');&lt;br /&gt;
 end&lt;br /&gt;
 %% Task 4: overlay flow vectors&lt;br /&gt;
 disp('Plotting data... if this is taking a long time you may need fewer locations');&lt;br /&gt;
 quiver (xlocs2,ylocs2,U2,V2, scaling);&lt;br /&gt;
 % quiver (xloc2,yloc2,U2,V2,'Parent',figure1);&lt;br /&gt;
 disp('Done');&lt;br /&gt;
 %% function to read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
&lt;br /&gt;
==Making movies from .wd files==&lt;br /&gt;
&lt;br /&gt;
This function will convert a series of .wd .Qx or .Qy file into a .avi movie with the same filename&lt;br /&gt;
&lt;br /&gt;
 function LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ) &lt;br /&gt;
 &lt;br /&gt;
 % LISFLOOD_mov generates movies of LISFLOOD-FP output&lt;br /&gt;
 %&lt;br /&gt;
 % LISFLOOD_mov (resroot,fileex,vartype,num_snaps,snapint,dem,demCS,depthCS,framesPS,movQ)&lt;br /&gt;
 % &lt;br /&gt;
 % where &lt;br /&gt;
 % resroot is the LISFLOOD resroot (relative to m file or absolute)(string)&lt;br /&gt;
 % fileex is the file extension '.wd' (can be chaned to plot WSE and flows)&lt;br /&gt;
 % vartype is the name of the variable being plotted e.g. 'Depth'&lt;br /&gt;
 % num_snaps is the number of snapshot times&lt;br /&gt;
 % snapint is the time interval between each LISFLOOD-FP snapshot (seconds)&lt;br /&gt;
 % dem is the name of the demfile (relative or absolute)&lt;br /&gt;
 % demCS is the range of dem hights to be plotted e.g. demCS = [0,20];&lt;br /&gt;
 % depthCS is the range of depth values to be plotted e.g. depthCS = [0,10];&lt;br /&gt;
 % framesPS number of frames per second (each plot is a simgle frame)&lt;br /&gt;
 % movQ is the movie quality between 1 and 100 (100 is best)&lt;br /&gt;
 % &lt;br /&gt;
 % 8/11/2007. J Neal.&lt;br /&gt;
 %&lt;br /&gt;
 % EXAMPLE:&lt;br /&gt;
 % LISFLOOD_mov ('C:\Experiment1\res22','.wd','Water depth',24,10000,...&lt;br /&gt;
 % 'C:\Experiment1\dem10m.dem.ascii',[0,60], [0,10],1,100);&lt;br /&gt;
 %% Movie maker&lt;br /&gt;
 % read dem filenam is filename and 1 specifies the 0.00 should not be NaN's&lt;br /&gt;
 [DEM, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (dem); %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 % A = [resroot,'.avi'];&lt;br /&gt;
 % mov = avifile(A);&lt;br /&gt;
 % loop through snapshots&lt;br /&gt;
 for i = 1:num_snaps&lt;br /&gt;
     if i &amp;lt; 10&lt;br /&gt;
         resfile = [resroot,'-000',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 100&lt;br /&gt;
         resfile = [resroot,'-00',num2str(i),fileex];&lt;br /&gt;
     elseif i &amp;lt; 1000&lt;br /&gt;
         resfile = [resroot,'-0',num2str(i),fileex];&lt;br /&gt;
     else&lt;br /&gt;
         resfile = [resroot,'-',num2str(i),fileex];&lt;br /&gt;
     end&lt;br /&gt;
     % read in deoth file for resfile i (2 specifies the 0.00 should be NaN&lt;br /&gt;
     [DEPTH, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (resfile);&lt;br /&gt;
     % plot data as figure 1&lt;br /&gt;
     plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype);&lt;br /&gt;
     % get movie frame&lt;br /&gt;
     M(i) = getframe(gcf); %#ok&amp;lt;AGROW&amp;gt;&lt;br /&gt;
     hold off;&lt;br /&gt;
 %     mov = addframe(mov,M(i));&lt;br /&gt;
     % close the figure&lt;br /&gt;
     close all&lt;br /&gt;
 end &lt;br /&gt;
 % % close .avi file&lt;br /&gt;
 % mov = close(mov);&lt;br /&gt;
 % generate empty .avi file&lt;br /&gt;
 disp('Generating .avi movie file');&lt;br /&gt;
 A = [resroot,fileex,'.avi'];&lt;br /&gt;
 movie2avi(M,A,'fps',framesPS,'quality',movQ);&lt;br /&gt;
 disp(A);&lt;br /&gt;
 %% Read LISFLOOD ascii files using filename&lt;br /&gt;
 function [OUT, ncols, nrows, xllcorner, yllcorner, cellsize] = read_file (filename)&lt;br /&gt;
 % read an ascii file&lt;br /&gt;
 fin = fopen(filename,'r');&lt;br /&gt;
 A = fscanf(fin,'%s',1); ncols = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nrows = fscanf(fin,'%f',1);           %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); xllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); yllcorner = fscanf(fin,'%f',1);       %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); cellsize = fscanf(fin,'%f',1);        %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 A = fscanf(fin,'%s',1); nodata = fscanf(fin,'%f',1);          %#ok&amp;lt;NASGU&amp;gt;&lt;br /&gt;
 OUT = fscanf(fin,'%f',[ncols, nrows]);&lt;br /&gt;
 OUT = OUT';&lt;br /&gt;
 fclose('all');&lt;br /&gt;
 % convert nodata to NaN;&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if OUT(ii,jj) == nodata&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         elseif OUT(ii,jj) == -99.000&lt;br /&gt;
             % lisflood uses -99.000 as nodat so will also remove these&lt;br /&gt;
             OUT(ii,jj) = NaN;&lt;br /&gt;
         else&lt;br /&gt;
             % do nothing&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 %% Plotter data for movie slide&lt;br /&gt;
 function plotter (DEPTH, DEM, nrows, ncols, cellsize, xllcorner, yllcorner,demCS,depthCS,snapint,i,vartype)&lt;br /&gt;
 % number of colors in colormap&lt;br /&gt;
 num_colors = 64;&lt;br /&gt;
 % DEM and variable color map&lt;br /&gt;
 cmap = [gray(num_colors); jet(num_colors)];&lt;br /&gt;
 % scale DEM and DEPTH data to fit with new colormap&lt;br /&gt;
 demCS2 = demCS(2)-demCS(1);&lt;br /&gt;
 dem_scalar = num_colors/demCS2;&lt;br /&gt;
 DEM2 = DEM*dem_scalar;&lt;br /&gt;
 depthCS2 = depthCS(2)-depthCS(1);&lt;br /&gt;
 depth_scalar = num_colors/depthCS2;&lt;br /&gt;
 DEPTH2 = (DEPTH*depth_scalar)+num_colors+1;&lt;br /&gt;
 %Plot the DEM&lt;br /&gt;
 figure1 = figure('PaperSize',[20.98 29.68],'Color',[1 1 1]);&lt;br /&gt;
 colormap(cmap);&lt;br /&gt;
 axes1 = axes('Parent',figure1,'YTickLabel',{yllcorner+(nrows*cellsize),yllcorner+cellsize},...&lt;br /&gt;
     'YTick', [1,nrows],...&lt;br /&gt;
     'YDir','reverse',...&lt;br /&gt;
     'XTickLabel',{xllcorner,xllcorner+(ncols*cellsize)-cellsize},...&lt;br /&gt;
     'XTick',[1,ncols],...&lt;br /&gt;
     'Layer','top');&lt;br /&gt;
 box('on');&lt;br /&gt;
 hold('all');&lt;br /&gt;
 image(DEM2,'Parent',axes1);&lt;br /&gt;
 axis('equal');axis('tight');&lt;br /&gt;
 % Overlay the water depth (or other variable)&lt;br /&gt;
 H = image(DEPTH2);&lt;br /&gt;
 % code to make depth plot layer transparent&lt;br /&gt;
 OP = ones(nrows,ncols);&lt;br /&gt;
 for ii = 1:nrows&lt;br /&gt;
     for jj = 1:ncols&lt;br /&gt;
         if DEPTH(ii,jj) &amp;gt; 0&lt;br /&gt;
         else&lt;br /&gt;
             OP(ii,jj) = 0;&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
 % make transparent. depth layer must be H&lt;br /&gt;
 set(H,'AlphaData',OP);&lt;br /&gt;
 % label colourbar&lt;br /&gt;
 color_breaks = 5;&lt;br /&gt;
 colorbreak = num_colors/color_breaks;&lt;br /&gt;
 SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 SCALE(1) = 0.0001;&lt;br /&gt;
 for j = 1:color_breaks*2&lt;br /&gt;
     SCALE(j+1) = colorbreak*j;&lt;br /&gt;
 end&lt;br /&gt;
 SCALE(color_breaks+1) = num_colors+1;&lt;br /&gt;
 VIS_SCALE = zeros(color_breaks*2,1);&lt;br /&gt;
 VIS_SCALE(1) = demCS(1);&lt;br /&gt;
 for j = 1:color_breaks-1&lt;br /&gt;
     VIS_SCALE(j+1) = ((demCS2/color_breaks)*j)+demCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 VIS_SCALE(color_breaks+1) = depthCS(1);&lt;br /&gt;
 for j = 1:color_breaks&lt;br /&gt;
     VIS_SCALE(j+1+color_breaks) = ((depthCS2/color_breaks)*j)+depthCS(1);&lt;br /&gt;
 end&lt;br /&gt;
 colorbar('YTick',SCALE,'YTickLabel',VIS_SCALE);&lt;br /&gt;
 % Label axis&lt;br /&gt;
 xlabel('BNG easting (m)');&lt;br /&gt;
 ylabel('BNG northing (m)');&lt;br /&gt;
 A = [vartype,' over DEM at time ',num2str((i*snapint)),'s'];&lt;br /&gt;
 title(A);&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5042</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5042"/>
		<updated>2008-03-18T16:06:39Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [http://source.ggy.bris.ac.uk/wiki/Lisflood_in_matlab:file File import and export]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5041</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5041"/>
		<updated>2008-03-18T16:03:14Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Functions for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [http://source.ggy.bris.ac.uk/wiki/Lisflood_in_matlab MATLAB Functions]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5040</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5040"/>
		<updated>2008-03-18T16:02:54Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Function for LISFLOOD-FP==&lt;br /&gt;
Here is a repository of useful snippets of code for LISFLOOD-FP users in MATLAB:&lt;br /&gt;
# [http://source.ggy.bris.ac.uk/wiki/Lisflood_in_matlab MATLAB Functions]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5039</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=5039"/>
		<updated>2008-03-18T16:01:56Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;br /&gt;
&lt;br /&gt;
==MATLAB Function for LISFLOOD-FP==&lt;br /&gt;
[http://source.ggy.bris.ac.uk/wiki/Lisflood_in_matlab MATLAB Functions]&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4459</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4459"/>
		<updated>2007-12-13T12:25:10Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4458</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4458"/>
		<updated>2007-12-13T12:25:00Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
[[rss url=&amp;quot;http://feeds.feedburner.com/wikispaces&amp;quot; number=&amp;quot;3&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4453</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4453"/>
		<updated>2007-12-12T16:23:42Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
# The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
# The qloutput option may not function fully at the corner cells of the domain. Qlim domain fluxes appear to be calculated so it is purely a variable storage problem. Be wary of using qloutput to derive flows out of the domain as a result of this. The toutput option does not appear to suffer from the same problem although care should be taken when analysing these values at the domain edges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4452</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4452"/>
		<updated>2007-12-12T11:49:27Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood LISFLOOD-FP] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4451</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4451"/>
		<updated>2007-12-12T11:48:15Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood Lisflood] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4450</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4450"/>
		<updated>2007-12-12T11:47:27Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood Lisflood] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
===File Output===&lt;br /&gt;
The qoutput, toutput and qloutput file output options are not compatible with the alternative ascii header option. This is because the timestep and flux outputs are calculated at the boundary and the output grid is offset by 0.5*dx for simplified display in GIS packages. It is therefore, not possible to assume anything about the coordinate system used in the alternative ascii header and change the grid offset accordingly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh&amp;lt;br/&amp;gt; &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4449</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4449"/>
		<updated>2007-12-11T17:02:51Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood Lisflood] model developers.&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh&amp;lt;br/&amp;gt; &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4448</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4448"/>
		<updated>2007-12-11T17:02:21Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood Lisflood] model developers.&lt;br /&gt;
&lt;br /&gt;
[[rss url=&amp;quot;http://source.ggy.bris.ac.uk/wiki/Lisflood&amp;quot; title=&amp;quot;LISFLOOD-FP Wiki Page&amp;quot; number=&amp;quot;5&amp;quot; description=&amp;quot;true&amp;quot; date=&amp;quot;true&amp;quot; author=&amp;quot;true&amp;quot; length=&amp;quot;80&amp;quot; enclosure=&amp;quot;true&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh&amp;lt;br/&amp;gt; &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4447</id>
		<title>LISFLOOD-FP</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=LISFLOOD-FP&amp;diff=4447"/>
		<updated>2007-12-11T17:02:05Z</updated>

		<summary type="html">&lt;p&gt;Tim-fewtrell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
&lt;br /&gt;
This page contains information for the [http://www.ggy.bris.ac.uk/research/hydrology/models/lisflood Lisflood] model developers.&lt;br /&gt;
&lt;br /&gt;
[[rss url=&amp;quot;http://source.ggy.bris.ac.uk/mediawiki/index.php?title=Lisflood&amp;quot; title=&amp;quot;LISFLOOD-FP Wiki Page&amp;quot; number=&amp;quot;5&amp;quot; description=&amp;quot;true&amp;quot; date=&amp;quot;true&amp;quot; author=&amp;quot;true&amp;quot; length=&amp;quot;80&amp;quot; enclosure=&amp;quot;true&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
==Usage Notes==&lt;br /&gt;
&lt;br /&gt;
===Channel Specification===&lt;br /&gt;
# The river depth assigned in the channel solver is set as an elevation relative to the same datum as the DEM. However, using LiDAR or SRTM data often returns a value for the water surface, however spurious this value may be. Furthermore, channel information is often supplied as a depth rather than a channel bed elevation. Therefore, it is best to assign the channel elevation in the DEM as the bankfull height and specify the bed elevation in the .river file as your channel depth below the bankful height (elevation).&lt;br /&gt;
&lt;br /&gt;
===Boundary Conditions===&lt;br /&gt;
# When calculating the boundary flux on the floodplain (flux from xsz/ysz-out) in FREE mode, LISFLOOD-FP uses the slope between DEM[xsz-1] and DEM[xsz]. Therefore, it is important that the penultimate slope is indicative of the overall floodplain slope. This becomes particularly important in urban areas where buildings near the domain edge will create a large, artificial slope causing more water to leave the domain than should in reality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Latest compiler information==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
; Microsoft C++ (Windows): Bristol University have a site [http://www.eduserv.org.uk/chest CHEST] licence for this, so no costs to install. This compiler can be used from a stand alone command line or using the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio MS Visual Studio 2005] debugging environment. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\&lt;br /&gt;
   Visual Studio 2005 Command Prompt”&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;cl your_code.cpp /O2&lt;br /&gt;
; Intel C++ v9.1 (Windows): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. This compiler requires the [http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx Microsoft C++ windows compiler] to be installed, but you can also use it on its own as a command line compiler. It is also integrated into the [http://en.wikipedia.org/wiki/Microsoft_Visual_Studio Visual Studio 2005] environment if you wish to use it that way. To use the command line, go to the start menu and find:&lt;br /&gt;
 “\Start Menu\Programs\Intel(R) Software Development Tools\&lt;br /&gt;
   Intel(R) C++ Compiler 9.1\Build Environment for IA-32 applications”.&lt;br /&gt;
This will setup the paths and links to libraries the compiler needs and open a command line window. Change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /fast&lt;br /&gt;
Note: the &amp;lt;tt&amp;gt;/fast&amp;lt;/tt&amp;gt; option may not generate a working executable for older processor architectures.  In this case you can use:&lt;br /&gt;
 &amp;gt;icl your_code.cpp /O3&lt;br /&gt;
which generates an executable that is almost as quick.&lt;br /&gt;
&lt;br /&gt;
So far we've found that the Intel compiler gives a speed up of about 5x over our our previous Borland Builder-compiled version of the model.&lt;br /&gt;
===Linux===&lt;br /&gt;
; g++ (free): This compiler can be used by logging into the linux machines dylan or brian through SSH secure shell. To use it, change directory to where your source code is and type:&lt;br /&gt;
 &amp;gt;g++ your_code.cpp –O3 –o your_code&lt;br /&gt;
; Intel C++ v9.1 (linux): Academic licence costs £61 per seat through [http://www.polyhedron.com/ Polyhedron]. Log into the linux machine dylan through SSH secure shell, change directory to where the source code is and type&lt;br /&gt;
 &amp;gt;source /opt/intel/cc/10.0.023/bin/iccvars.csh&amp;lt;br/&amp;gt; &lt;br /&gt;
Then compile the code using&lt;br /&gt;
 &amp;gt;icpc lisflood.cpp -O3 -static -o lisflood&lt;br /&gt;
Our tests show that on a linux box the Intel compiler is about 1.5-2x faster than g++.&lt;/div&gt;</summary>
		<author><name>Tim-fewtrell</name></author>
	</entry>
</feed>