I have added rivers into my domain. The bathymetry was created using SeaGrid. I have checked several times to make sure that my river source points are in the correct locations and they are. I am running the code with both salinity and temperature. Both are showing unrealistic values.
The background salinity is 35 and the rivers have a salinity of 30. The maximum final surface salinity is 59.
If you could point me in the proper direction to a solution I would be forever grateful.
ana_psource:
Code: Select all
SUBROUTINE ana_psource (ng, tile, model)
!
!! svn $Id: ana_psource.h 585 2012-01-03 18:44:28Z arango $
!!======================================================================
!! Copyright (c) 2002-2012 The ROMS/TOMS Group !
!! Licensed under a MIT/X style license !
!! See License_ROMS.txt !
!=======================================================================
! !
! This subroutine sets analytical tracer and mass point Sources !
! and/or Sinks. River runoff can be consider as a point source. !
! !
!=======================================================================
!
USE mod_param
USE mod_grid
USE mod_ncparam
USE mod_ocean
USE mod_sources
USE mod_stepping
!
integer, intent(in) :: ng, tile, model
#include "tile.h"
!
CALL ana_psource_tile (ng, tile, model, &
& LBi, UBi, LBj, UBj, &
& IminS, ImaxS, JminS, JmaxS, &
& nnew(ng), knew(ng), Msrc(ng), Nsrc(ng), &
& OCEAN(ng) % zeta, &
& OCEAN(ng) % ubar, &
& OCEAN(ng) % vbar, &
#ifdef SOLVE3D
& OCEAN(ng) % u, &
& OCEAN(ng) % v, &
& GRID(ng) % z_w, &
#endif
& GRID(ng) % h, &
& GRID(ng) % on_u, &
& GRID(ng) % om_v, &
& SOURCES(ng) % Isrc, &
& SOURCES(ng) % Jsrc, &
& SOURCES(ng) % Dsrc, &
#ifdef SOLVE3D
# if defined UV_PSOURCE || defined Q_PSOURCE
& SOURCES(ng) % Qshape, &
& SOURCES(ng) % Qsrc, &
# endif
# ifdef TS_PSOURCE
& SOURCES(ng) % Tsrc, &
# endif
#endif
& SOURCES(ng) % Qbar)
!
! Set analytical header file name used.
!
#ifdef DISTRIBUTE
IF (Lanafile) THEN
#else
IF (Lanafile.and.(tile.eq.0)) THEN
#endif
ANANAME(20)=__FILE__
END IF
RETURN
END SUBROUTINE ana_psource
!
!***********************************************************************
SUBROUTINE ana_psource_tile (ng, tile, model, &
& LBi, UBi, LBj, UBj, &
& IminS, ImaxS, JminS, JmaxS, &
& nnew, knew, Msrc, Nsrc, &
& zeta, ubar, vbar, &
#ifdef SOLVE3D
& u, v, z_w, &
#endif
& h, on_u, om_v, &
& Isrc, Jsrc, Dsrc, &
#ifdef SOLVE3D
# if defined UV_PSOURCE || defined Q_PSOURCE
& Qshape, Qsrc, &
# endif
# ifdef TS_PSOURCE
& Tsrc, &
# endif
#endif
& Qbar)
!***********************************************************************
!
USE mod_param
USE mod_parallel
USE mod_scalars
#ifdef SEDIMENT
USE mod_sediment
#endif
#ifdef DISTRIBUTE
!
USE distribute_mod, ONLY : mp_bcastf, mp_bcasti
USE distribute_mod, ONLY : mp_collect, mp_reduce
#endif
!
! Imported variable declarations.
!
integer, intent(in) :: ng, tile, model
integer, intent(in) :: LBi, UBi, LBj, UBj
integer, intent(in) :: IminS, ImaxS, JminS, JmaxS
integer, intent(in) :: nnew, knew
integer, intent(in) :: Msrc
integer, intent(out) :: Nsrc
!
#ifdef ASSUMED_SHAPE
integer, intent(inout) :: Isrc(:)
integer, intent(inout) :: Jsrc(:)
real(r8), intent(in) :: zeta(LBi:,LBj:,:)
real(r8), intent(in) :: ubar(LBi:,LBj:,:)
real(r8), intent(in) :: vbar(LBi:,LBj:,:)
# ifdef SOLVE3D
real(r8), intent(in) :: u(LBi:,LBj:,:,:)
real(r8), intent(in) :: v(LBi:,LBj:,:,:)
real(r8), intent(in) :: z_w(LBi:,LBj:,0:)
# endif
real(r8), intent(in) :: h(LBi:,LBj:)
real(r8), intent(in) :: on_u(LBi:,LBj:)
real(r8), intent(in) :: om_v(LBi:,LBj:)
real(r8), intent(inout) :: Dsrc(:)
real(r8), intent(inout) :: Qbar(:)
# ifdef SOLVE3D
# if defined UV_PSOURCE || defined Q_PSOURCE
real(r8), intent(inout) :: Qshape(:,:)
real(r8), intent(inout) :: Qsrc(:,:)
# endif
# ifdef TS_PSOURCE
real(r8), intent(inout) :: Tsrc(:,:,:)
# endif
# endif
#else
integer, intent(inout) :: Isrc(Msrc)
integer, intent(inout) :: Jsrc(Msrc)
real(r8), intent(in) :: zeta(LBi:UBi,LBj:UBj,3)
real(r8), intent(in) :: ubar(LBi:UBi,LBj:UBj,3)
real(r8), intent(in) :: vbar(LBi:UBi,LBj:UBj,3)
# ifdef SOLVE3D
real(r8), intent(in) :: u(LBi:UBi,LBj:UBj,N(ng),2)
real(r8), intent(in) :: v(LBi:UBi,LBj:UBj,N(ng),2)
real(r8), intent(in) :: z_w(LBi:UBi,LBj:UBj,0:N(ng))
# endif
real(r8), intent(in) :: h(LBi:UBi,LBj:UBj)
real(r8), intent(in) :: on_u(LBi:UBi,LBj:UBj)
real(r8), intent(in) :: om_v(LBi:UBi,LBj:UBj)
real(r8), intent(inout) :: Dsrc(Msrc)
real(r8), intent(inout) :: Qbar(Msrc)
# ifdef SOLVE3D
# if defined UV_PSOURCE || defined Q_PSOURCE
real(r8), intent(inout) :: Qshape(Msrc,N(ng))
real(r8), intent(inout) :: Qsrc(Msrc,N(ng))
# endif
# ifdef TS_PSOURCE
real(r8), intent(inout) :: Tsrc(Msrc,N(ng),NT(ng))
# endif
# endif
#endif
!
! Local variable declarations.
!
integer :: Npts, NSUB, is, i, j, k, ised
real(r8) :: Pspv = 0.0_r8
real(r8), save :: area_east, area_west
real(r8) :: cff, fac, my_area_east, my_area_west
#if defined DISTRIBUTE && defined SOLVE3D
real(r8), dimension(Msrc*N(ng)) :: Pwrk
#endif
#if defined DISTRIBUTE
real(r8), dimension(2) :: buffer
character (len=3), dimension(2) :: io_handle
#endif
#include "set_bounds.h"
!
!-----------------------------------------------------------------------
! Set tracer and/or mass point sources and/or sink.
!-----------------------------------------------------------------------
!
IF (iic(ng).eq.ntstart(ng)) THEN
!
! Set-up point Sources/Sink number (Nsrc), direction (Dsrc), I- and
! J-grid locations (Isrc,Jsrc). Currently, the direction can be along
! XI-direction (Dsrc = 0) or along ETA-direction (Dsrc > 0). The
! mass sources are located at U- or V-points so the grid locations
! should range from 1 =< Isrc =< L and 1 =< Jsrc =< M.
!
#if defined MINE
Nsrc=2
Dsrc(1)=1.0_r8
Isrc(1)=76
Jsrc(1)=64
Dsrc(2)=0.0_r8
Isrc(2)=95
Jsrc(2)=63
#else
ana_psource.h: No values provided for Nsrc, Dsrc, Isrc, Jsrc.
#endif
#ifdef DISTRIBUTE
!
! Broadcast point sources/sinks information to all nodes.
!
CALL mp_bcasti (ng, iNLM, Nsrc)
CALL mp_bcasti (ng, iNLM, Isrc)
CALL mp_bcasti (ng, iNLM, Jsrc)
CALL mp_bcastf (ng, iNLM, Dsrc)
#endif
END IF
#if defined UV_PSOURCE || defined Q_PSOURCE
# ifdef SOLVE3D
!
! If appropriate, set-up nondimensional shape function to distribute
! mass point sources/sinks vertically. It must add to unity!!.
!
# ifdef DISTRIBUTE
Qshape=Pspv
# endif
Npts=Msrc*N(ng)
# if defined SED_TEST1
DO k=1,N(ng)
DO is=1,Nsrc
i=Isrc(is)
j=Jsrc(is)
IF (((IstrR.le.i).and.(i.le.IendR)).and. &
& ((JstrR.le.j).and.(j.le.JendR))) THEN
IF (ubar(i,j,knew).ne.0.0_r8) THEN
cff=ABS(u(i,j,k,nnew)/ubar(i,j,knew))
ELSE
cff=1.0_r8
END IF
Qshape(is,k)=cff* &
& (z_w(i-1,j,k )-z_w(i-1,j,k-1)+ &
& z_w(i ,j,k )-z_w(i ,j,k-1))/ &
& (z_w(i-1,j,N(ng))-z_w(i-1,j,0 )+ &
& z_w(i ,j,N(ng))-z_w(i ,j,0 ))
END IF
END DO
END DO
# ifdef DISTRIBUTE
Pwrk=RESHAPE(Qshape,(/Npts/))
CALL mp_collect (ng, iNLM, Npts, Pspv, Pwrk)
Qshape=RESHAPE(Pwrk,(/Msrc,N(ng)/))
# endif
# elif defined MINE
DO is=1,Nsrc
DO k=1,N(ng)
IF (k.le.14) THEN
Qshape(is,k)=0.0_r8
ELSE IF (k.gt.19) THEN
Qshape(is,k)=1.0_r8
ELSE
Qshape(is,k)=-0.0222_r8 *k*k+k-10.0_r8
END IF
END DO
END DO
# else
!!
!! Notice that there is not need for distributed-memory communications
!! here since the computation below does not have a parallel tile
!! dependency. All the nodes are computing this simple statement.
!!
IF (DOMAIN(ng)%NorthEast_Test(tile)) THEN
DO k=1,N(ng)
DO is=1,Nsrc
Qshape(is,k)=1.0_r8/REAL(N(ng),r8)
END DO
END DO
END IF
# endif
# endif
# endif
!
! Set-up vertically integrated mass transport (m3/s) of point
! Sources/Sinks (positive in the positive U- or V-direction and
! viceversa).
!
# ifdef DISTRIBUTE
Qbar=Pspv
# endif
# if defined MINE
fac=1.0_r8
is=1
Qbar(is)=fac*50.0_r8
is=2
Qbar(is)=fac*100.0_r8*(-1.0_r8)
# ifdef DISTRIBUTE
CALL mp_collect (ng, iNLM, Msrc, Pspv, Qbar)
# endif
# else
ana_psource.h: No values provided for Qbar.
# endif
# ifdef SOLVE3D
!
! Set-up mass transport profile (m3/s) of point Sources/Sinks.
!
IF (DOMAIN(ng)%NorthEast_Test(tile)) THEN
DO k=1,N(ng)
DO is=1,Nsrc
Qsrc(is,k)=Qbar(is)*Qshape(is,k)
END DO
END DO
END IF
# endif
#if defined TS_PSOURCE && defined SOLVE3D
!
! Set-up tracer (tracer units) point Sources/Sinks.
!
# if defined MINE
IF (DOMAIN(ng)%NorthEast_Test(tile)) THEN
DO k=1,N(ng)
DO is=1,Nsrc
Tsrc(is,k,itemp)=20.0_r8
Tsrc(is,k,isalt)=30.0_r8
END DO
END DO
END IF
# else
ana_psource.h: No values provided for Tsrc.
# endif
#endif
RETURN
END SUBROUTINE ana_psource_tile
Code: Select all
/*
** svn $Id: mine.h 585 2012-01-03 18:44:28Z arango $
*******************************************************************************
** Copyright (c) 2002-2012 The ROMS/TOMS Group **
** Licensed under a MIT/X style license **
** See License_ROMS.txt **
*******************************************************************************
**
** Options for Upwelling Test.
**
** Application flag: MINE
** Input script: ocean_mine.in
*/
#define UV_ADV
#define UV_COR
#define UV_LDRAG
#define UV_VIS2
#undef MIX_GEO_UV
#define MIX_S_UV
#define TS_U3HADVECTION
#define TS_C4VADVECTION
#undef TS_MPDATA
#define DJ_GRADPS
#define TS_DIF2
#undef TS_DIF4
#undef MIX_GEO_TS
#define MIX_S_TS
#define SALINITY
#define SOLVE3D
#define WET_DRY
#define MASKING
#define SPLINES
#define AVERAGES
#define DIAGNOSTICS_TS
#define DIAGNOSTICS_UV
#define T_PASSIVE
#define TS_PSOURCE
#define UV_PSOURCE
#define DEBUGGING
#define ANA_INITIAL
#define ANA_STFLUX
#define ANA_SSFLUX
#define ANA_SMFLUX
#define ANA_SPFLUX
#define ANA_BTFLUX
#define ANA_BSFLUX
#define ANA_BPFLUX
#define ANA_PASSIVE
#define ANA_PSOURCE
#ifdef BULK_FLUXES
# define ANA_WINDS
# define ANA_SRFLUX
# define ANA_TAIR
# define ANA_HUMID
# define ANA_PAIR
# define LONGWAVE /* use Berliand relation */
#endif
#if defined GLS_MIXING || defined MY25_MIXING
# define KANTHA_CLAYSON
# define N2S2_HORAVG
#else
# define ANA_VMIX
#endif
#if defined BIO_FENNEL || defined ECOSIM || \
defined NPZD_POWELL || defined NEMURO
# define ANA_BIOLOGY
# define ANA_SPFLUX
# define ANA_BPFLUX
# define ANA_SRFLUX
#endif
#if defined NEMURO
# define HOLLING_GRAZING
# undef IVLEV_EXPLICIT
#endif
#ifdef BIO_FENNEL
# define CARBON
# define DENITRIFICATION
# define BIO_SEDIMENT
# define DIAGNOSTICS_BIO
#endif
#ifdef PERFECT_RESTART
# undef AVERAGES
# undef DIAGNOSTICS_BIO
# undef DIAGNOSTICS_TS
# undef DIAGNOSTICS_UV
# define OUT_DOUBLE
#endif