# Manipulating Terrain Slope in Idealized Case

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

#### nluchett

##### New member
Hi,

I am attempting simulate thunderstorm interactions with simplistic terrain in the wrf-fire simple_hill idealized framework.

What I would like to do is simply manipulate the slope % of the simple hill (i.e. run simulations with 45% grade, 75%, etc....) however I am struggling with how to go about doing this...

When I look at the module_initialization_fire.F code I see these lines where gradient is being calculated:

! compute the terrain gradient by differencing
do j=jfts,jfte
do i=ifts,ifte
grid%dzdxf(i,j) = (grid%zsf(i+1,j)-grid%zsf(i-1,j))/(2.*fdx)
grid%dzdyf(i,j) = (grid%zsf(i,j+1)-grid%zsf(i,j-1))/(2.*fdy)

enddo
enddo

So it appears the developers use a finite differencing technique to calculate the gradient in the x and y directions...

But the actual gradient calculation appears to happen further down:

mtn_max = 0.
DO j=jfts,jfte
DO i=ifts,ifte
mtn_max = max(mtn_max, grid%zsf(i,j))
ENDDO
ENDDO
write(6, *)' Max terrain height on the fire mesh ',mtn_max

I've attempted to manipulate both of these set of lines in a variety of ways but it doesn't change the slope at all.

Does anyone have a suggestion on how to manipulate these lines for my purposes, or perhaps when the mountain height is created using a COS wave equation:

DO j=jfts,jfte
DO i=ifts,ifte
mtn_x = pi + 2*pi* max(0. , min( (i - mtn_fxs)/(mtn_fxe - mtn_fxs), 1. ))
mtn_y = pi + 2*pi* max(0. , min( (j - mtn_fys)/(mtn_fye - mtn_fys), 1. ))
SELECT CASE(mtn_type)
CASE (1) ! circ/elliptic mountain
mtn_z = mtn_ht * 0.25 * (1. + COS(mtn_x))*(1. + COS(mtn_y))

Can you try to modify the initial mountain shape to get larger grade? Please take a look at the code module_initialize_fire.F, in which you can find the following piece of code:
475 IF(mtn_type .ne. 0)THEN
476
477 ! idealized mountain
478
479 ! atmospheric grid coordinates of the mountain
480 mtn_axs = mtn_xs/grid%dx + ids - 0.5
481 mtn_axe = mtn_xe/grid%dx + ids - 0.5
482 mtn_ays = mtn_ys/grid%dy + jds - 0.5
483 mtn_aye = mtn_ye/grid%dy + jds - 0.5
484
485 ! fire grid coordinates of the mountain
486 mtn_fxs = mtn_xs/fdx + ifds - 0.5
487 mtn_fxe = mtn_xe/fdx + ifds - 0.5
488 mtn_fys = mtn_ys/fdy + jfds - 0.5
489 mtn_fye = mtn_ye/fdy + jfds - 0.5
490
491 write(6,*)' Mountain height ',mtn_ht,' type',mtn_type
492 write(6,*)' Mountain (m) LL=(0,0) ',mtn_xs,':',mtn_xe,' ',mtn_ys,':',mtn_ye
493 write(6,*)' Mountain on atm grid ',mtn_axs,':',mtn_axe,' ',mtn_ays,':',mtn_aye
494 write(6,*)' Mountain on fire grid ',mtn_fxs,':',mtn_fxe,' ',mtn_fys,':',mtn_fye
495
496 mtn_max = 0.
497 DO j=jts,jte
498 DO i=its,ite
499 mtn_x = pi + 2*pi* max(0. , min( (i - mtn_axs)/(mtn_axe - mtn_axs), 1. ))
500 mtn_y = pi + 2*pi* max(0. , min( (j - mtn_ays)/(mtn_aye - mtn_ays), 1. ))
501 SELECT CASE(mtn_type)
502 CASE (1) ! circ/elliptic mountain
503 mtn_z = mtn_ht * 0.25 * (1. + COS(mtn_x))*(1. + COS(mtn_y))

Since you run with the hill_simple option, which corresponds to CASE (1) in the above code (line 502), you can modify mtn_z there to obtain larger grade.

Ming Chen

Hi Ming,

Thanks for the reply. Are you recommending changing the mtn_z cosine equation in some way to change the grade (line 503)? Or changing the x_start,x_end, and y_start,y_end dimensions of the hill in the namelist?

Or are you referring to changing the lines?:

480 mtn_axs = mtn_xs/grid%dx + ids - 0.5
481 mtn_axe = mtn_xe/grid%dx + ids - 0.5
482 mtn_ays = mtn_ys/grid%dy + jds - 0.5
483 mtn_aye = mtn_ye/grid%dy + jds - 0.5

I've tried messing with the cosine wave function (line 503) but can't seem to figure out how to change the slope of the wave without introducing weird terrain features into the model.

I think Ideally, I'd want to keep the (x_start, x_end, y_start, y_end) of the hill the same, and just change the steepness, which I suppose the only way to do that is to amplify the height of the hill right since slope is calculated sqroot(dz/dx ^2 + dz/dy^2).

Any thoughts?

Thanks!

Nick

Nick,

I agree that changing the height of the ideal hill is a better way to obtain various grades. Please try and see how it works.

Ming Chen