passive tracer: decay term added but not working

Suggest improvements/optimizations to the ROMS code.

Moderators: arango, robertson

Post Reply
Message
Author
aakashsane
Posts: 14
Joined: Tue Sep 19, 2017 2:14 pm
Location: Brown University

passive tracer: decay term added but not working

#1 Unread post by aakashsane »

Hello,

I want to add a decay term to the passive tracer equation:

dC/dt = <diffusive terms> - \alpha*C
here, C is concentration of the passive tracer, dC/dt is the material derivative, <diffusive terms> are the diffusive terms, and \alpha*C is the new term I want to add where \alpha is the decay rate.

I am modifying the step3d_t.F file by adding a piece of code in the section titled 'time step vertical diffusion'. This piece of code gets compiled by using 'define TRACER_TEST' in the cppdef.h file.

Code: Select all

# ifdef TRACER_TEST     
     DO k=1,N(ng)
       DO j=Jstr,Jend
         DO i=Istr,Iend
           DO itrc1=1,NPT
            t(i,j,k,nnew,inert(itrc1))=t(i,j,k,nnew,inert(itrc1))* &
      &                                (1-0.1_r8*dt(ng)) ! \alpha is 0.1/sec
           END DO
         END DO
       END DO
     END DO
# endif
Compilation is succesful but when I run ROMS, the tracer does not decay at all! I start with concentration 10 throughout the domain and it does not change.
What I am doing wrong? :cry: :cry: :cry:

I am attaching my step3d_t.F file and cppdef.h file.

Best regards and Happy New Year,
Aakash
Attachments
tracer_reactive.h
(1.68 KiB) Downloaded 451 times
step3d_t.F
(45.21 KiB) Downloaded 443 times

User avatar
wilkin
Posts: 918
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: passive tracer: decay term added but not working

#2 Unread post by wilkin »

Check your step3d_t.f90 in Build.

The first DO and its closing ENDDO begin in column 6 which compilers should interpret as a continuation. But if that were so you would get an error. But check that you got what you intended.

As written, your RHS term is positive and is a source, not a decay (you multiply by something greater than 1).

For overall efficiency, the loop over itrc1 should be outside the others, so the order follows the indexing: itrc then k then j then i
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

aakashsane
Posts: 14
Joined: Tue Sep 19, 2017 2:14 pm
Location: Brown University

Re: passive tracer: decay term added but not working

#3 Unread post by aakashsane »

Hi John,

Thanks for replying.
I checked the step3d_t.f90 in build directory and 'tracer_test' piece is present there.

The rhs term (source or decay) does not seem to work. I ran two cases, one with tracer_test and one without tracer_test and I am getting the exact same output.
my dt(ng) is 15 seconds. I changed the code to this one:

Code: Select all

# ifdef TRACER_TEST     
     DO k=1,N(ng)
       DO j=Jstr,Jend
         DO i=Istr,Iend
           DO itrc1=1,NPT
            t(i,j,k,nnew,inert(itrc1))=t(i,j,k,nnew,inert(itrc1))* &
      &                                (1-0.03_r8*dt(ng))
           END DO
         END DO
       END DO
     END DO
# endif
Notice the term in bracket is ( 1 - 0.03* dt(ng)), which makes it as t(new) = t(old) * 0.55 for inert passive index, so I am guessing the inert passive tracers will decay exponentially but they don't. I am doing something wrong.
Should I make change elsewhere in trunk/ROMS/Nonlinear? Do I need to change step2d_t.F too? Is using nnew the correct way to do it? or should I use nstp?
I am so confused!

Best,
Aakash

Post Reply