Index: /anuga_work/development/classroom/spell-your-name-with-water_finished.py
===================================================================
--- /anuga_work/development/classroom/spell-your-name-with-water_finished.py	(revision 7591)
+++ /anuga_work/development/classroom/spell-your-name-with-water_finished.py	(revision 7591)
@@ -0,0 +1,607 @@
+"""Simple water flow example using ANUGA
+
+This program can be used to write some text and water it become covered by water!
+"""
+######################THIS IS THE SECTION TO PUT YOUR TEXT INTO########################################################
+
+letter_number = 5 #the number of letters in the text you wish to spell with water (include spaces as letters when counting)
+
+your_text = ['A','N','U','G','A'] #put your text in here following the format shown use 'space' to put in a space
+
+#---------------------------------------------------------------------------------------------------------------------------------------------------------------
+##########Parameters - These values are intended to be experimented with to produce different results###########################################################
+#---------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+depth = -50 #the elevation of the channel cut by the letters (negative number gives channels cutting into the surface,
+            #positive gives peaks rising up from the surface). Channels generally look better.
+
+letter_height = 80 #the height of each letter
+letter_width = 80 #the width of each letter
+letter_thickness = 7 #the thickness of each letter
+
+slope = -0.1        #the slope of the surface (negative number gives a downslope, positive gives an upslope)
+
+inflow_amount = 25 #controls the volume of water which flows into the model
+outflow_amount = -50 #controls the volume of water which flows out of the model
+
+amplitude = 50 #amplitude of wave (wave height m) if you want to use a wave change a boundary to Bt
+period = 10      #wave period (sec) if you want to use a wave change a boundary to Bt
+
+left_boundary = 'Bi'    #Sets up the boundary conditions for the model, Bt calls a wave input (use it to see a series of waves wash across the model)
+right_boundary = 'Bo'    # Bi calls a constant inflow amount (defined above) while Bo calls a constant outflow amount 
+top_boundary = 'Br'      # Br causes any flow that contacts the boundary to be reflected back from it (the reflected flows momentum has equal magnitude but opposite direction to the incident flow)
+bottom_boundary = 'Br'
+
+simulation_speed = 1 #smaller number gives a slower, more precise simulation.
+                    #Very low numbers e.g. 0.1 will make the animation appear to run in slow motion
+simulation_length = 18*letter_number #the number of seconds that the simulation runs for
+
+#--------------------------------------------------------------------------------------------------------------------------------------------------------
+#########################################################################################################################################################
+#Please ensure that you understand what the program is doing and what you are changing before changing any of the values below this point################
+#########################################################################################################################################################
+#--------------------------------------------------------------------------------------------------------------------------------------------------------
+
+# Standard modules
+import os
+import time
+import sys
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+from anuga.abstract_2d_finite_volumes.mesh_factory import *
+from anuga.abstract_2d_finite_volumes.domain import *
+from anuga.shallow_water import *
+from anuga.shallow_water.shallow_water_domain import *
+from anuga.shallow_water.data_manager import *
+from math import *
+from numpy import *
+from numpy import sin, cos, pi
+#--------------------------------------------------------------------------------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+length = (letter_width)*(letter_number) +0.2*letter_width    
+width = (letter_height)*1.3
+dx = dy = 5           # Resolution: Length of subdivisions on both axes
+
+points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
+                                               len1=length, len2=width)
+domain = Domain(points, vertices, boundary)
+domain.set_name('Spell_Your_Name_With_Water')# Output name
+domain.set_datadir('.')         #store sww output here
+
+#------------------------------------------------------------------------------
+# Setup initial conditions
+#------------------------------------------------------------------------------
+def topography(x,y):
+    """Complex topography defined by a function of vectors x and y."""
+
+    #general slope and buildings
+    z = slope*x + 0.1*(cos(x)+cos(y))+ 5
+    return z
+
+#BUILD TOPOGRAPHY from functions defining letters (above)############################
+domain.set_quantity('elevation', topography)           # elevation is a function
+
+N = len(your_text)                                      #the number of letters in the word to be spelt
+print "the length of the text is", N, "letters"
+
+print your_text
+
+for k in range(N):
+    current_letter = your_text[k]                       #the letter that is currently being plotted
+    print "the current letter is", current_letter
+    
+    #brute force approach
+    def A(x,y):
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = ((letter_height)/((letter_width)/2))*(x[i]- (k)*letter_width)
+            ymax = ((letter_height)/((letter_width)/2))*(x[i]- (k)*letter_width) + letter_thickness
+            xmin = 0
+            xmax = 0.5*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = ((-letter_height)/((letter_width)/2))*(x[i]-(0.5*letter_width+ (k)*letter_width)) + letter_height
+            ymax = ((-letter_height)/((letter_width)/2))*(x[i]-(0.5*letter_width+ (k)*letter_width)) + letter_height + letter_thickness
+            xmin = 0.5*letter_width
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = letter_height/2 - 0.5*letter_thickness
+            ymax = letter_height/2 + 0.5*letter_thickness
+            xmin = (letter_height/2)/((letter_height)/((letter_width)/2))
+            xmax = ((letter_height/2)- letter_height)/((-letter_height)/((letter_width)/2)) + 0.5*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        
+        return z
+
+    def B(x,y):         
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = 0
+            ymax = letter_height
+            xmin = 0.5*letter_thickness
+            xmax = 2*letter_thickness
+            if ymin < y[i] < ymax and xmin + (k+0.05)*letter_width< x[i] < xmax+ (k+0.05)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            if (x[i]-((letter_width/2)-10+ (k+0.05)*letter_width))**2+(y[i]-(0.25*letter_height))**2<((letter_height/4))**2 and letter_thickness + (k+0.05)*letter_width< x[i]:
+                z[i] += depth
+            if (x[i]-((letter_width/2)-10+ (k-0.05)*letter_width))**2+(y[i]-(0.25*letter_height))**2<(((letter_height/4)-0.6*letter_thickness))**2 and letter_thickness + (k-0.1)*letter_width< x[i]:
+                z[i] += -1*depth
+            if (x[i]-((letter_width/2)-10+ (k+0.05)*letter_width))**2+(y[i]-(0.75*letter_height))**2<((letter_height/4))**2 and letter_thickness + (k+0.05)*letter_width< x[i]:
+                z[i] += depth
+            if (x[i]-((letter_width/2)-10+ (k-0.05)*letter_width))**2+(y[i]-(0.75*letter_height))**2<(((letter_height/4)-0.6*letter_thickness))**2 and letter_thickness + (k-0.1)*letter_width< x[i]:
+                z[i] += -1*depth
+        for i in range(N):
+            ymin = (letter_height/2)-5
+            ymax = (letter_height/2)+5
+            xmin = 0.5*letter_thickness
+            xmax = 0.3*letter_width
+            if ymin < y[i] < ymax and xmin+ (k+0.05)*letter_width < x[i] < xmax+ (k+0.05)*letter_width:
+                z[i] += depth   
+        return z
+
+    def C(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if (x[i]-(letter_width/2 + (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*(letter_height/2))**2 and 0 + (k)*letter_width < x[i] < 0.80*letter_width + (k)*letter_width:
+                z[i] += depth
+            if (x[i]-(letter_width/2 + (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*((letter_height/2)-letter_thickness))**2 and 0 + (k)*letter_width < x[i] < 0.80*letter_width + (k)*letter_width:
+                z[i] += -1*depth
+        return z
+
+    def D(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = 0
+            ymax = letter_height
+            xmin = 0.5*letter_thickness
+            xmax = 3*letter_thickness
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax + (k)*letter_width:
+                z[i] += depth
+            if (x[i]-((letter_width/2)+ (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*(letter_height/2))**2 and 1.9*letter_thickness + (k)*letter_width < x[i] :
+                z[i] += depth
+            if (x[i]-((letter_width/2)+ (k-0.15)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*((letter_height/2)-1.3*letter_thickness))**2 and 1.9*letter_thickness + (k)*letter_width < x[i]:
+                z[i] += -1*depth
+        return z
+
+    def E(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < letter_height and 0.5*letter_thickness + (k)*letter_width < x[i] < 2*letter_thickness+ (k)*letter_width:
+                z[i] += depth
+            if (1-0.01*letter_thickness)*letter_height < y[i] < letter_height and 1.9*letter_thickness + (k)*letter_width < x[i] < 0.8*letter_width+ (k)*letter_width:
+                z[i] += depth
+            if (0.5-0.005*letter_thickness)*letter_height < y[i] < (0.5+0.005*letter_thickness)*letter_height and 1.9*letter_thickness + (k)*letter_width< x[i] < 0.8*letter_width+ (k)*letter_width:
+                z[i] += depth
+            if 0 < y[i] < 0.01*letter_thickness*letter_height and 1.9*letter_thickness + (k)*letter_width< x[i] < 0.8*letter_width+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def F(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < letter_height and 0.5*letter_thickness + (k)*letter_width< x[i] < 2*letter_thickness+ (k)*letter_width:
+                z[i] += depth
+            if (1-0.01*letter_thickness)*letter_height < y[i] < letter_height and 1.9*letter_thickness + (k)*letter_width< x[i] < 0.8*letter_width+ (k)*letter_width:
+                z[i] += depth
+            if (0.5-0.005*letter_thickness)*letter_height < y[i] < (0.5+0.005*letter_thickness)*letter_height and 1.9*letter_thickness + (k)*letter_width< x[i] < 0.8*letter_width+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def G(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if (x[i]-(letter_width/2+ (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*(letter_height/2))**2 and 0 + (k)*letter_width< x[i] < 0.80*letter_width+ (k)*letter_width:
+                z[i] += depth
+            if (x[i]-(letter_width/2+ (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*((letter_height/2)-letter_thickness))**2 and 0 + (k)*letter_width< x[i] < 0.80*letter_width+ (k)*letter_width:
+                z[i] += -1*depth
+            if (0.4-0.005*letter_thickness)*letter_height < y[i] < (0.4+0.005*letter_thickness)*letter_height  and 0.5*letter_width + (k)*letter_width< x[i] < 0.95*letter_width+ (k)*letter_width:
+                z[i] += depth
+            if 0 < y[i] < 0.4*letter_height and (0.8-0.01*letter_thickness)*letter_width + (k)*letter_width< x[i] < 0.8*letter_width+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def H(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < letter_height and 0.5*letter_thickness + (k)*letter_width< x[i] < 2*letter_thickness+ (k)*letter_width:
+                z[i] += depth
+            if 0 < y[i] < letter_height and (letter_width - 2*letter_thickness) + (k)*letter_width< x[i] < (letter_width -0.5*letter_thickness)+ (k)*letter_width:
+                z[i] += depth
+            if (0.5-0.005*letter_thickness)*letter_height < y[i] < (0.5+0.005*letter_thickness)*letter_height and 1.9*letter_thickness + (k)*letter_width< x[i] < (letter_width-1.9*letter_thickness)+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def I(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < letter_height and (0.5-0.01*letter_thickness)*letter_width + (k)*letter_width< x[i] < (0.5+0.01*letter_thickness)*letter_width+ (k)*letter_width:
+                z[i] += depth
+            if (letter_height - 0.85*letter_thickness) < y[i] < letter_height and 0.3*letter_width + (k)*letter_width< x[i] < 0.7*letter_width+ (k)*letter_width:
+                z[i] += depth
+            if 0 < y[i] < 0.85*letter_thickness and 0.3*letter_width + (k)*letter_width< x[i] < 0.7*letter_width+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def J(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if y[i]< -(((0.9*(letter_height/2))**2 - (x[i]- (0.5*letter_width+ (k)*letter_width))**2)**0.5)+ 0.6*letter_height and 0<y[i]<0.3*letter_height:
+                z[i] += depth
+            if y[i]< -(((0.9*(letter_height/2))**2 - (x[i]- (0.5*letter_width+ (k)*letter_width))**2)**0.5)+ 0.5*letter_height and 0<y[i]<0.3*letter_height:
+                z[i] += -depth
+            if 0.2*letter_height < y[i] < letter_height and (0.83-0.01*letter_thickness)*letter_width + (k)*letter_width< x[i] < (0.83+0.01*letter_thickness)*letter_width+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def K(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < letter_height and 0.5*letter_thickness + (k+0.2)*letter_width < x[i] < 2*letter_thickness + (k+0.2)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = ((0.5*letter_height)/((letter_width)))*(x[i]-(1.9*letter_thickness+ (k+0.2)*letter_width)) + 0.5*letter_height
+            ymax = ((0.5*letter_height)/((letter_width)))*(x[i]-(1.9*letter_thickness+ (k+0.2)*letter_width)) + 0.5*letter_height + letter_thickness
+            xmin = 1.9*letter_thickness
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k+0.2)*letter_width< x[i] < xmax+ (k+0.2)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = (-(0.5*letter_height)/((letter_width)))*(x[i]-(1.9*letter_thickness+ (k+0.2)*letter_width)) + 0.5*letter_height - letter_thickness
+            ymax = (-(0.5*letter_height)/((letter_width)))*(x[i]-(1.9*letter_thickness+ (k+0.2)*letter_width)) + 0.5*letter_height 
+            xmin = 1.9*letter_thickness
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k+0.2)*letter_width< x[i] < xmax+ (k+0.2)*letter_width:
+                z[i] += depth    
+        return z
+
+    def L(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < letter_height and 0.5*letter_thickness + (k)*letter_width < x[i] < 2*letter_thickness+ (k)*letter_width:
+                z[i] += depth
+            if 0 < y[i] < 0.01*letter_thickness*letter_height and 1.9*letter_thickness + (k)*letter_width < x[i] < 0.95*letter_width+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def M(x,y):
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < letter_height and 0.5*letter_thickness + (k)*letter_width < x[i] < 2*letter_thickness+ (k)*letter_width:
+                z[i] += depth
+            if 0 < y[i] < letter_height and (letter_width - 2*letter_thickness)+ (k)*letter_width < x[i] < (letter_width -0.5*letter_thickness) + (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = (-(0.7*letter_height)/((0.5*letter_width)))*(x[i]-(1.9*letter_thickness+ (k)*letter_width)) + letter_height - 2*letter_thickness
+            ymax = (-(0.7*letter_height)/((0.5*letter_width)))*(x[i]-(1.9*letter_thickness+ (k)*letter_width)) + letter_height
+            xmin = 1.9*letter_thickness
+            xmax = 0.5*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = (0.7*(letter_height)/(0.5*(letter_width)))*(x[i]-(0.5*letter_width+ (k)*letter_width)) + (-(0.7*letter_height)/((0.5*letter_width)))*((0.5*letter_width)-(1.9*letter_thickness)) + letter_height - 2*letter_thickness
+            ymax = (0.7*(letter_height)/(0.5*(letter_width)))*(x[i]-(0.5*letter_width+ (k)*letter_width)) + (-(0.7*letter_height)/((0.5*letter_width)))*((0.5*letter_width)-(1.9*letter_thickness)) + letter_height
+            xmin = 0.5*letter_width
+            xmax = letter_width - 1.9*letter_thickness
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax+ (k)*letter_width:
+                z[i] += depth    
+        return z
+
+    def N(x,y):
+        z = 0*x
+        p = len(x)
+        for i in range(p):
+            if 0 < y[i] < letter_height and 0.5*letter_thickness + (k)*letter_width< x[i] < 2*letter_thickness+ (k)*letter_width:
+                z[i] += depth
+            if 0 < y[i] < letter_height and (letter_width - 2*letter_thickness)+ (k)*letter_width < x[i] < (letter_width - 0.5*letter_thickness)+ (k)*letter_width:
+                z[i] += depth
+        for i in range(p):
+            ymin = (-(letter_height)/((letter_width)-1.9*letter_thickness))*(x[i]-(1.9*letter_thickness+ (k)*letter_width)) + letter_height - 2*letter_thickness
+            ymax = (-(letter_height)/((letter_width)-1.9*letter_thickness))*(x[i]-(1.9*letter_thickness+ (k)*letter_width)) + letter_height
+            xmin = 1.9*letter_thickness
+            xmax = letter_width - 1.9*letter_thickness
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def O(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if (x[i]-(letter_width/2+ (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*(letter_height/2))**2 and 0+ (k)*letter_width < x[i] < letter_width+ (k)*letter_width:
+                z[i] += depth
+            if (x[i]-(letter_width/2+ (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*((letter_height/2)-letter_thickness))**2 and 0+ (k)*letter_width < x[i] < letter_width+ (k)*letter_width:
+                z[i] += -1*depth
+        return z
+
+    def P(x,y):         
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = 0
+            ymax = letter_height
+            xmin = 0.5*letter_thickness
+            xmax = 2*letter_thickness
+            if ymin < y[i] < ymax and xmin + (k+0.2)*letter_width< x[i] < xmax+ (k+0.2)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            if (x[i]-((letter_width/2)-10+ (k+0.2)*letter_width))**2+(y[i]-(0.75*letter_height))**2<((letter_height/4))**2 and letter_thickness + (k+0.2)*letter_width< x[i]:
+                z[i] += depth
+            if (x[i]-((letter_width/2)-10+ (k+0.2)*letter_width))**2+(y[i]-(0.75*letter_height))**2<(((letter_height/4)-letter_thickness))**2 and letter_thickness + (k+0.2)*letter_width< x[i]:
+                z[i] += -1*depth
+        for i in range(N):
+            ymin = (letter_height/2)-5
+            ymax = (letter_height/2)+5
+            xmin = 0
+            xmax = 0.3*letter_width
+            if ymin < y[i] < ymax and xmin + (k+0.2)*letter_width< x[i] < xmax+ (k+0.2)*letter_width:
+                z[i] += depth   
+        return z
+
+    def Q(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if (x[i]-(letter_width/2+ (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*(letter_height/2))**2 and 0 + (k)*letter_width< x[i] < letter_width+ (k)*letter_width:
+                z[i] += depth
+            if (x[i]-(letter_width/2+ (k)*letter_width))**2+(y[i]-(letter_height/2))**2<(0.9*((letter_height/2)-letter_thickness))**2 and 0 + (k)*letter_width< x[i] < letter_width+ (k)*letter_width:
+                z[i] += -1*depth
+        for i in range(N):
+            ymin = (-(letter_height)/((letter_width)-1.9*letter_thickness))*(x[i]-(1.9*letter_thickness+ (k)*letter_width)) + letter_height - 2*letter_thickness
+            ymax = (-(letter_height)/((letter_width)-1.9*letter_thickness))*(x[i]-(1.9*letter_thickness+ (k)*letter_width)) + letter_height
+            xmin = 0.55*letter_width
+            xmax = 0.95*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax + (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def R(x,y):         
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = 0
+            ymax = letter_height
+            xmin = 0.5*letter_thickness
+            xmax = 2*letter_thickness
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            if (x[i]-((letter_width/2)-10+ (k)*letter_width))**2+(y[i]-(0.75*letter_height))**2<((letter_height/4))**2 and letter_thickness + (k)*letter_width< x[i]:
+                z[i] += depth
+            if (x[i]-((letter_width/2)-10+ (k)*letter_width))**2+(y[i]-(0.75*letter_height))**2<(((letter_height/4)-letter_thickness))**2 and letter_thickness + (k)*letter_width < x[i]:
+                z[i] += -1*depth
+        for i in range(N):
+            ymin = (letter_height/2)-5
+            ymax = (letter_height/2)+5
+            xmin = 0.5*letter_thickness
+            xmax = 0.3*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = (-(letter_height)/((letter_width)))*(x[i]-(1*letter_thickness+ (k)*letter_width)) + letter_height - 2*letter_thickness
+            ymax = (-(letter_height)/((letter_width)))*(x[i]-(1*letter_thickness+ (k)*letter_width)) + letter_height
+            xmin = 0.5*letter_width
+            xmax = 0.95*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax + (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def S(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0.3*letter_width*sin((2*pi*y[i]/(0.7*letter_height))-0.1*letter_height) +0.5*letter_width+ (k)*letter_width< x[i] < 0.3*letter_width*sin((2*pi*y[i]/(0.7*letter_height))-0.1*letter_height)+(0.5*letter_width+2*letter_thickness)+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def T(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < letter_height and (0.5-0.005*letter_thickness)*letter_width + (k)*letter_width < x[i] < (0.5+0.005*letter_thickness)*letter_width + (k)*letter_width:
+                z[i] += depth
+            if letter_height - letter_thickness < y[i] < letter_height and 0.08*letter_width + (k)*letter_width < x[i] < 0.95*letter_width + (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def U(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if y[i]< -(((0.9*(letter_height/2))**2 - (x[i]- (0.5*letter_width+ (k)*letter_width))**2)**0.5)+ 0.6*letter_height and 0<y[i]<0.3*letter_height:
+                z[i] += depth
+            if y[i]< -(((0.9*(letter_height/2))**2 - (x[i]- (0.5*letter_width+ (k)*letter_width))**2)**0.5)+ 0.5*letter_height and 0<y[i]<0.3*letter_height:
+                z[i] += -depth
+            if 0.2*letter_height < y[i] < letter_height and (0.83-0.01*letter_thickness)*letter_width + (k)*letter_width< x[i] < (0.83+0.01*letter_thickness)*letter_width+ (k)*letter_width:
+                z[i] += depth
+            if 0.2*letter_height < y[i] < letter_height and (0.18-0.01*letter_thickness)*letter_width + (k)*letter_width< x[i] < (0.18+0.01*letter_thickness)*letter_width+ (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def V(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = (-(letter_height)/((0.5*letter_width)))*(x[i]- (k)*letter_width) + (letter_height)
+            ymax = (-(letter_height)/((0.5*letter_width)))*(x[i]- (k)*letter_width) + (letter_height + 2*letter_thickness)
+            xmin = 0
+            xmax = 0.5*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = ((letter_height)/((0.5*letter_width)))*(x[i]-(0.5*letter_width+ (k)*letter_width)) 
+            ymax = ((letter_height)/((0.5*letter_width)))*(x[i]-(0.5*letter_width+ (k)*letter_width))+ 2*letter_thickness
+            xmin = 0.5*letter_width
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth    
+        return z
+
+    def W(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = (-(letter_height)/((0.25*letter_width)))*(x[i]- (k)*letter_width) + (letter_height-letter_thickness)
+            ymax = (-(letter_height)/((0.25*letter_width)))*(x[i]- (k)*letter_width) + (letter_height + 2*letter_thickness)
+            xmin = 0
+            xmax = 0.25*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = ((0.5*letter_height)/((0.25*letter_width)))*(x[i]-(0.25*letter_width+ (k)*letter_width)) 
+            ymax = ((0.5*letter_height)/((0.25*letter_width)))*(x[i]-(0.25*letter_width+ (k)*letter_width))+ 2*letter_thickness
+            xmin = 0.25*letter_width
+            xmax = 0.5*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = (-(0.5*letter_height)/((0.25*letter_width)))*(x[i]-(0.5*letter_width+ (k)*letter_width)) + (0.5*letter_height)
+            ymax = (-(0.5*letter_height)/((0.25*letter_width)))*(x[i]-(0.5*letter_width+ (k)*letter_width)) + (0.5*letter_height + 2*letter_thickness)
+            xmin = 0.5*letter_width
+            xmax = 0.75*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = ((letter_height)/((0.25*letter_width)))*(x[i]-(0.75*letter_width+ (k)*letter_width)) -letter_thickness
+            ymax = ((letter_height)/((0.25*letter_width)))*(x[i]-(0.75*letter_width+ (k)*letter_width))+ 2*letter_thickness
+            xmin = 0.75*letter_width
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width< x[i] < xmax+ (k)*letter_width:
+                z[i] += depth    
+        return z
+
+    def X(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = (-(letter_height)/((letter_width)))*(x[i]- (k+0.2)*letter_width) + (letter_height-letter_thickness)
+            ymax = (-(letter_height)/((letter_width)))*(x[i]- (k+0.2)*letter_width) + (letter_height + letter_thickness)
+            xmin = 0
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k+0.2)*letter_width< x[i] < xmax+ (k+0.2)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = ((letter_height)/((letter_width)))*(x[i]- (k+0.2)*letter_width) -letter_thickness
+            ymax = ((letter_height)/((letter_width)))*(x[i]- (k+0.2)*letter_width)+ letter_thickness
+            xmin = 0
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k+0.2)*letter_width< x[i] < xmax+ (k+0.2)*letter_width:
+                z[i] += depth    
+        return z
+
+    def Y(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            if 0 < y[i] < 0.5*letter_height and (0.5-0.005*letter_thickness)*letter_width + (k)*letter_width < x[i] < (0.5+0.005*letter_thickness)*letter_width + (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = (-(letter_height)/((letter_width)))*(x[i]- (k)*letter_width) + (letter_height-0.6*letter_thickness)
+            ymax = (-(letter_height)/((letter_width)))*(x[i]- (k)*letter_width) + (letter_height + 0.6*letter_thickness)
+            xmin = 0
+            xmax = 0.5*letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax + (k)*letter_width:
+                z[i] += depth
+        for i in range(N):
+            ymin = ((letter_height)/((letter_width)))*(x[i]- (k)*letter_width) -0.6*letter_thickness
+            ymax = ((letter_height)/((letter_width)))*(x[i]- (k)*letter_width)+ 0.6*letter_thickness
+            xmin = 0.5*letter_width
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax + (k)*letter_width:
+                z[i] += depth    
+        return z
+
+    def Z(x,y):        
+        z = 0*x
+        N = len(x)
+        for i in range(N):
+            ymin = ((letter_height)/((letter_width)))*(x[i]- (k)*letter_width) -0.6*letter_thickness
+            ymax = ((letter_height)/((letter_width)))*(x[i]- (k)*letter_width)+ 0.6*letter_thickness
+            xmin = 0
+            xmax = letter_width
+            if ymin < y[i] < ymax and xmin + (k)*letter_width < x[i] < xmax + (k)*letter_width:
+                z[i] += depth
+            if letter_height - letter_thickness < y[i] < letter_height and 0 + (k)*letter_width < x[i] < letter_width + (k)*letter_width:
+                z[i] += depth
+            if 0 < y[i] < letter_thickness and 0 + (k)*letter_width < x[i] < letter_width + (k)*letter_width:
+                z[i] += depth
+        return z
+
+    def space(x,y):
+        z=0*x
+        return z
+
+    def translation(x,y):                               #shifts each letter along one place so they are not plotted on top of each other
+        x = x + (i-1)*letter_width
+        return x
+        y = y
+        return y
+        z = 50*sin(x)
+        
+    current_letter_function = eval(current_letter)      #function of vectors x and y whose output forms the shape of a letter
+    domain.add_quantity('elevation', current_letter_function)               #which is input here to be used as elevation.
+
+###############################################################################################################################################
+
+domain.set_quantity('friction', 0.01)                  # Constant friction
+domain.set_quantity('stage', expression='elevation')   # Dry initial condition
+domain.add_quantity('stage', -1000)
+
+
+#thunderstorm = Rainfall(domain,rate=100,center=(50,50),radius=5)       #remove comments to add rainfall input to a specified position on the grid
+#domain.forcing_terms.append(thunderstorm)
+
+
+#------------------------------------------------------------------------------
+# Setup boundary conditions
+#------------------------------------------------------------------------------
+Bi = Dirichlet_boundary([inflow_amount, 0, 0])          # Inflow
+Br = Reflective_boundary(domain)              # Solid reflective wall
+Bo = Dirichlet_boundary([outflow_amount, 0, 0])           # Outflow
+
+def wave(t):
+
+    A = amplitude # Amplitude [m] (Wave height)
+    T = period  # Wave period [s]
+
+    if t < 3000:
+        return [A*sin(2*pi*t/T) + 1, 0, 0] 
+    else:
+        return [0.0, 0, 0]
+
+Bt = Time_boundary(domain, f=wave)
+
+left_b = eval(left_boundary)
+right_b = eval(right_boundary)
+top_b = eval(top_boundary)
+bottom_b = eval(bottom_boundary)
+
+domain.set_boundary({'left': left_b, 'right': right_b, 'top': top_b, 'bottom': bottom_b})
+
+#------------------------------------------------------------------------------
+# Evolve system through time
+#------------------------------------------------------------------------------
+t0 = time.time()
+for t in domain.evolve(yieldstep=simulation_speed, finaltime=simulation_length):
+    print domain.timestepping_statistics()
+print 'Computation took %.2f seconds' % (time.time()-t0)
+    
