clawpack / geoclaw

Version of Clawpack for geophysical waves and flows
http://www.clawpack.org/geoclaw
BSD 3-Clause "New" or "Revised" License
76 stars 87 forks source link

Applying River Discharge #551

Open sadaf-mahmoudi96 opened 1 year ago

sadaf-mahmoudi96 commented 1 year ago

Does anyone know how to apply river discharge (time series or single value) at upstream of a domain? I tried to use set_eta_init.f90, however, the results did not change in comparison with the time I applied no river discharge.

mandli commented 1 year ago

I would ask this on claw-users or at least in GeoClaw raise the issue. As such I am going to close this issue.

rjleveque commented 1 year ago

Sorry for the late reply. It's true that this should eventually be documented in the docs, and it's something I've been meaning to create an example for in GeoClaw first. I'm going to transfer this issue to GeoClaw to remind me to do so soon.

rjleveque commented 1 year ago

I will try to create a small working example soon, but the basic idea is pretty easy to implement:

Copy the library file

$CLAW/geoclaw/src/shallow/src2.f90

to your application directory and modify the Makefile to use it, by listing it under

SOURCES = \

See https://www.clawpack.org/makefiles_library.html

Then add to your version of src2.f90 the local variables

real(kind=8) :: x1rs,x2rs,y1rs,y2rs,area,discharge_cfs,discharge,rs

and some code like the following after the declarations (before the other executable code for the friction source term):

x1rs = -123.743d0
x2rs = -123.740d0
y1rs = 46.956d0
y2rs = 46.958d0

area = (x2rs-x1rs)*(y2rs-y1rs)*(111d3)**2 * cos(y1rs*DEG2RAD) ! m**2
discharge_cfs = 20000d0  ! cubic feet / second
discharge = discharge_cfs *(0.3048)**3  ! m**3 / second
rs = discharge/area  ! m/sec needed in source area

do i=1,mx
    x = xlower + (i-0.5d0)*dx
    do j=1,my
        y = ylower + (j-0.5d0)*dy
        if ((x >= x1rs) .and. (x <= x2rs) .and. &
            (y >= y1rs) .and. (y <= y2rs)) then
            q(1,i,j) = q(1,i,j) + dt*rs
          endif
        enddo
    enddo

The rectangle [x1rs,x2rs,y1rs,y2rs] should be roughly in the river upstream from where you are modeling, and discharge_cfs should be set to the discharge rate in cubic feet per second.

What this does is to add a bit of water everywhere in the specified rectangle in every time step, at the rate specified. If you start doing this at time 0 they you may have to let it run for a while in order for the river to reach a steady state, but with luck it will soon reach a state that looks reasonable.

If not, you might have to adjust the discharge, and/or make sure you have good topography data for the river bed far enough upstream from your study area.