River forcing LtracerSrc and setting temp to 0 ?!

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
jivica
Posts: 127
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

River forcing LtracerSrc and setting temp to 0 ?!

#1 Post by jivica » Sun May 20, 2018 3:06 am

Think there is a "feature" introduced in the recent ROMS related to river source temperature set to 0C even you chose not the alter ocean ambient temperature.
What I am doing is simulating only fresh water inflow using river forcing and setting source salinity but do not want to change ocean temperature.

If you set in the ocean.in that you have only 2 active tracers (temp, salt) NAT = 2 and no passive tracer NPT = 0 and then later in activate this:
LuvSrc == T
and
LtracerSrc == F T ! just use salinity and not temperature

It is still setting tracer temperature to ini_value which is 0 and introducing cold water into the ocean.

To be sure I am not outdated just svn to the latest version 904, recompiled and got the same thing/problem.
From INFO I can see it is NOT reading river_temp from the river.nc forcing file as I would expect, so that is fine.
Later in the code it sets it to 0 which it shouldn't.

Then I pulled back my old workhorse version 3.4 and changed .h *bry definition inside* and ocean.in,
used the same setup and bingo, it is just using salinity as should and not changing ambient temperature in the ocean.

Does anybody else bumped on the same bug?

Cheers
Ivica

User avatar
kate
Posts: 3718
Joined: Wed Jul 02, 2003 5:29 pm
Location: IMS/UAF, USA

Re: River forcing LtracerSrc and setting temp to 0 ?!

#2 Post by kate » Sun May 20, 2018 3:41 am

No, but I know that if you ask for inflow without providing tracer values, you can get an unstable downwind advection scheme. My last battle with this went for six months before blowing up - I had accidentally turned off all my bio tracer river sources.

User avatar
jivica
Posts: 127
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

Re: River forcing LtracerSrc and setting temp to 0 ?!

#3 Post by jivica » Sun May 20, 2018 4:17 am

Hi Kate
I am using MPDATA in old 3.4 and the latest code
And with old all is as should be... looking into the code
to figure what/when went wrong
Cheers Ivica

User avatar
jivica
Posts: 127
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

Re: River forcing LtracerSrc and setting temp to 0 ?!

#4 Post by jivica » Mon May 21, 2018 7:02 am

I think I've fixed it.
It is working now as I would expect (MP_DATA) and the problem was in step3d_t.F and pre_step3d.F
(note that "_original" is current version in roms trunk)
Shortly, indexing was (I think) wrong in the step3d_t.F and in pre_step3d.F part with source direction == 1 was missing etc..

Code: Select all

diff step3d_t.F step3d_t.F_original 
527,528c527,528
<                 IF (((IstrUm2.le.Isrc).and.(Isrc.le.Iendp2)).and.       &
<      &              ((JstrVm2.le.Jsrc).and.(Jsrc.le.Jendp2))) THEN
---
>                 IF (((IstrUm2.le.Isrc).and.(Isrc.le.Iendp3)).and.       &
>      &              ((JstrVm2.le.Jsrc).and.(Jsrc.le.Jendp2i))) THEN
552,553c552,553
<                 IF (((IstrUm2.le.Isrc).and.(Isrc.le.Iendp2)).and.      &
<      &              ((JstrVm2.le.Jsrc).and.(Jsrc.le.Jendp2))) THEN
---
>                 IF (((IstrUm2.le.Isrc).and.(Isrc.le.Iendp2i)).and.      &
>      &              ((JstrVm2.le.Jsrc).and.(Jsrc.le.Jendp3))) THEN

Code: Select all

diff pre_step3d.F pre_step3d.F_original 
369,370c369,370
<           DO j=JstrVm2,Jendp2i
<             DO i=IstrUm2,Iendp3
---
>           DO j=Jstr,Jend
>             DO i=Istr,Iend+1
377,378c377,378
<           DO j=JstrVm2,Jendp3
<             DO i=IstrUm2,Iendp2i
---
>           DO j=Jstr,Jend+1
>             DO i=Istr,Iend
525,563c525,537
<               IF (INT(SOURCES(ng)%Dsrc(is)).eq.0) THEN
<                 IF (((IstrUm2.le.Isrc).and.(Isrc.le.Iendp2)).and.       &
<      &              ((JstrVm2.le.Jsrc).and.(Jsrc.le.Jendp2))) THEN
<                   IF (LtracerSrc(itrc,ng)) THEN
<                     FX(Isrc,Jsrc)=Huon(Isrc,Jsrc,k)*                    &
<      &                            SOURCES(ng)%Tsrc(is,k,itrc)
<                   ELSE
<                     IF ((rmask(Isrc  ,Jsrc).eq.0.0_r8).and.             &
<      &                  (rmask(Isrc-1,Jsrc).eq.1.0_r8)) THEN
<                       FX(Isrc,Jsrc)=Huon(Isrc,Jsrc,k)*                  &
<      &                              t(Isrc-1,Jsrc,k,3,itrc)
<                     ELSE IF ((rmask(Isrc  ,Jsrc).eq.1.0_r8).and.        &
<      &                       (rmask(Isrc-1,Jsrc).eq.0.0_r8)) THEN
<                       FX(Isrc,Jsrc)=Huon(Isrc,Jsrc,k)*                  &
<      &                              t(Isrc  ,Jsrc,k,3,itrc)
<                     END IF
<                   END IF  
<                 END IF    
<               ELSE IF (INT(SOURCES(ng)%Dsrc(is)).eq.1) THEN
<                 IF (((IstrUm2.le.Isrc).and.(Isrc.le.Iendp2)).and.      &
<      &              ((JstrVm2.le.Jsrc).and.(Jsrc.le.Jendp2))) THEN
<                   IF (LtracerSrc(itrc,ng)) THEN
<                     FE(Isrc,Jsrc)=Hvom(Isrc,Jsrc,k)*                    &
<      &                            SOURCES(ng)%Tsrc(is,k,itrc)
<                   ELSE
<                     IF ((rmask(Isrc,Jsrc  ).eq.0.0_r8).and.             &
<      &                  (rmask(Isrc,Jsrc-1).eq.1.0_r8)) THEN
<                       FE(Isrc,Jsrc)=Hvom(Isrc,Jsrc,k)*                  &
<      &                              t(Isrc,Jsrc-1,k,3,itrc)
<                     ELSE IF ((rmask(Isrc,Jsrc  ).eq.1.0_r8).and.        &
<      &                       (rmask(Isrc,Jsrc-1).eq.0.0_r8)) THEN
<                       FE(Isrc,Jsrc)=Hvom(Isrc,Jsrc,k)*                  &
<      &                              t(Isrc,Jsrc  ,k,3,itrc)
<                     END IF
<                   END IF  
<                 END IF    
<               END IF      
<             END DO        
<           END IF          
---
>               IF (LtracerSrc(itrc,ng).and.                              &
>      &            ((Istr.le.Isrc).and.(Isrc.le.Iend+1)).and.            &
>      &            ((Jstr.le.Jsrc).and.(Jsrc.le.Jend+1))) THEN
>                 IF (INT(SOURCES(ng)%Dsrc(is)).eq.0) THEN
>                   FX(Isrc,Jsrc)=Huon(Isrc,Jsrc,k)*                      &
>      &                          SOURCES(ng)%Tsrc(is,k,itrc)
>                 ELSE
>                   FE(Isrc,Jsrc)=Hvom(Isrc,Jsrc,k)*                      &
>      &                          SOURCES(ng)%Tsrc(is,k,itrc)
>                 END IF
>               END IF
>             END DO
>           END IF

Post Reply