Ocean Modeling Discussion


Search for:
It is currently Sat Jul 20, 2019 8:08 pm

Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Author Message
PostPosted: Tue Dec 18, 2007 4:38 pm 

Joined: Tue Aug 28, 2007 8:31 pm
Posts: 27
Location: CICESE
How can I include a river discharge in my model?
I have found the options TS_PSOURCE and UV_SOURCE, but it is not clear how the format of the input must be.

Reply with quote  
 Post subject:
PostPosted: Wed Dec 19, 2007 9:16 am 
User avatar

Joined: Thu Jul 03, 2003 3:39 pm
Posts: 79
Location: TAMU,USA
The first thing to do is take a look in the analytical section of the code (now, Functionals/ana_psource.h). All of the variables that are described there need to be set. It will be more clear what each variable does when you see how it is specified in the analytical code.

Perhaps the least clear flag is the 'river_flag', which is explained in Modules/mod_sources thusly:

!  Fsrc       Point Source/Sinks identification flag:                  !
!               Fsrc(:) = 0,  All Tracer source/sink are off.          !
!               Fsrc(:) = 1,  Only temperature is on.                  !
!               Fsrc(:) = 2,  Only salinity is on.                     !
!               Fsrc(:) = 3,  Both temperature and salinity are on.    !
!               Fsrc(:) = 4,  Both nitrate and salinity are on.        !
!               Fsrc(:) = ... And other combinations.                  !
!                             (We need a more robust logic here)       !

Of course, you can also specify the river flow in a forcing file. here is an example of an idealized river discharge with eight points. The code is in python, but it should be straightforward to translate it in to MATLAB, or Pascal, or whatever you use...

def make_frc(Qo, rootdir):
    # Find where the river enters and create flow
    ridx = arange(1,9)
    Nsrc = len(ridx)
    river_temp = 10.0
    t = arange(0, 21.05, 0.05)   # river time in days
    Qbar = Qo - Qo * exp(-t/0.05) # ramp flow over about 1 hour.
    ### write river file
    nc = netCDF4.Dataset(os.path.join(rootdir, 'near_frc.nc'), 'w', format='NETCDF3_CLASSIC')
    nc.Description = 'River forcing for ideal plume'
    nc.Author = 'Rob Hetland'
    nc.Created = datetime.now().isoformat()
    nc.type = 'ROMS FRC file'
    nc.createDimension('river', len(ridx))
    nc.createDimension('river_time', len(t))
    nc.createDimension('xi_rho', 64)
    nc.createDimension('eta_rho', 64)
    nc.createDimension('s_rho', 10)
    def write_nc_var(var, name, dimensions, units=None):
        nc.createVariable(name, 'f8', dimensions)
        if units is not None:
            nc.variables[name].units = units
        nc.variables[name][:] = var
    write_nc_var(arange(Nsrc)+1, 'river', ('river', ))
    write_nc_var(ones(Nsrc), 'river_Xposition', ('river', ))
    write_nc_var(ridx.astype('d'), 'river_Eposition', ('river', ))
    write_nc_var(zeros(Nsrc), 'river_direction', ('river', ))
    Vshape = zeros(10)
    Vshape[:] = arange(1,11)
    Vshape /= Vshape.sum()
    write_nc_var(Vshape[:, newaxis] * ones((10, Nsrc)), 'river_Vshape', ('s_rho', 'river'))
    write_nc_var(t, 'river_time', ('river_time', ), 'days')
    write_nc_var(Qbar[:, newaxis]*ones((len(t), Nsrc))/float(Nsrc), 'river_transport',
                 ('river_time', 'river'), 'm3 s-1')
    write_nc_var(river_temp*ones((len(t), 10, Nsrc)), 'river_temp',
                 ('river_time', 's_rho', 'river'))
    write_nc_var(zeros((len(t), 10, Nsrc)), 'river_salt', ('river_time', 's_rho', 'river'))
    write_nc_var(3.0*ones(Nsrc), 'river_flag', ('river', ))

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group