# Creating cumulative friction map

I am looking at bottom friction (Manning's n) values in relation to storm surge as large volumes of water flow over a surface.

In order to calculate total head loss occurring as water passes from the original water's edge to the final flooding extent, I must somehow figure out a way to account for cumulative losses. Is there a way I can create a raster map containing the cumulative (or average) Manning's n values over which the water has traveled?

In other words, with the accumulation of friction starting from the original water's edge, the first cell would contain its own Manning's n value (I will call this n1). Moving away from the water's edge, the next cell will be n1+n2. The next cell away from the water will be n1+n2+n3 and so on.

Below is a script I have created for making a cumulative Manning's n map for a small (121-cell) sample raster of Manning's values. The sample raster is named manningWithWater and this is done using r.buffer. The buffer starts from the raster called falseWater, which is artificial water values I have added to the Manning's raster. The script works but is inefficient; this took 22 seconds on my tiny sample raster and would use up quite a bit of memory while processing a regularly-sized raster.

``````import grass.script as grass

def main():
x = range(100,700,50)
numString = ""
for num in x:
numString = numString + str(num) + ","
numString = numString[:-1]
grass.run_command('r.buffer',
overwrite=True,
input="falseWater@PERMANENT",
output="falseWaterBuffer",
distances=numString,
units="feet")
totalBuffers=grass.read_command('r.describe',
map="falseWaterBuffer")
maxBuffer=int(totalBuffers.split("-")[-1])
finalExpression=""
for n in range(2,maxBuffer+1):
grass.mapcalc(
"\$output=if(\$buffer==\$bandNumber,\$manningWithWater,null())",
overwrite=True,
buffer="falseWaterBuffer@PERMANENT",
output="band"+str(n),
bandNumber=n,
manningWithWater="manningWithWater@PERMANENT")
grass.run_command('r.grow.distance',
overwrite=True,
input="band{0}@PERMANENT".format(n),
value="band{0}Grown".format(n))
grass.mapcalc(
"\$output=if(\$buffer>=\$bandNumber,\$bandGrown,0)",
overwrite=True,
output="band{0}Add".format(n),
buffer="falseWaterBuffer@PERMANENT",
bandNumber=n,
bandGrown="band{0}Grown@PERMANENT".format(n))
finalExpression=finalExpression+"band{0}Add@PERMANENT+".format(n)
finalExpression=finalExpression[:-1]
grass.mapcalc(
"cumulativeN={0}".format(finalExpression),
overwrite=True)

if __name__ == '__main__':
main()
``````
• How are your Manning's coefficients determined? Are you at all familiar with HEC-RAS or flowpath modeling? I would start thinking about raster-based spatial statistics (Manning n) along flowpath lines and/or flow accumulations. A hydrologist might be inclined to model the reach historically/empirically and arrive at Manning #s that way. – CrystallineEntity Jun 18 at 3:54
• Assigning Manning values is still far from calculating cumulative losses. The Mannning value has a meaning only within the hydraulic equations that use it to estimate the head losses. From a hydraulic point of view, there is no interest in having a cumulative Manning's n value (n1+n2+n3) – Marco Jun 18 at 7:00
• @CrystallineEntity I am using Manning's coefficients from the USGS National Land Cover Database. I am not very familiar with HEC-RAS and I am somewhat familiar with flowpath modeling. However I am working on creating a novel storm surge model for use with ADCIRC so I don't believe I will be able to utilize HEC-RAS. I have considered looking at flowpath lines but I have been unable to think of a way to do this efficiently for storm surge since most of these flowpath operations in GRASS seem to concern rainwater runoff. – Carter Rucker Jun 18 at 15:26
• @Marco I agree that cumulative Manning's n values by themselves don't have hydraulic meaning. However I am working on a real-time storm surge model which needs to operate quickly based on input data from ADCIRC. This cumulative map will allow me to pre-compute as much as possible and later apply averaging techniques which will keep the model's run time to a minimum. – Carter Rucker Jun 18 at 15:32