[MITgcm-support] Sample pTracer using flt package

钱钰坤 qianyk at mail3.sysu.edu.cn
Thu Jun 14 09:16:42 EDT 2018


Hi Martin,


Thanks for your help.  I've compiled and run these codes successfully.  However, I get all zeros after the run.


1) You have suggested to modify the Lagrangian sampling code as (see previous email below):
CALL FLT_BILINEAR  (ix,jy,ss, pTracer(1-Olx,1-Oly,1,1,1, iTracer),  kp,0,bi,bj,myThid)
I just wonder why this line is not like:
CALL FLT_BILINEAR  (ix,jy,ss, pTracer(1-Olx,1-Oly,1,bi,bj, iTracer),  kp,0,bi,bj,myThid)
The index of 1 rather than bi/bj seems to works fine for sampling the tracer field.


2) the predefined subroutines GAD_GRAD_X/Y in GAD package return tracer gradient much
larger than expected.  I looked into the code and found that these subroutines calculate the
product of gradient and face area of grid cell.  So I may need to divide the face area to get
the right values of gradient.  Is this correct?  If so, I cannot just modify the subroutines because
they may be called in other places.


3) Subroutines GAD_GRAD_X/Y return non-zero values at the end of ptracer_integrate.F (this is
verified by outputting pTrGrdx/y after calling GAD_GRAD_X/Y subroutines), however,
in flt_traj.F, pTrGrdx/y becomes all zeros (this is verified by outputting pTrGrdx/y before calling
FLT_BILINEAR).  Therefore, Lagrangian sampling gives all zero results.  Does this related to any
execution sequence? Or any other possible reasons I cannot tell.


Many thanks.

------------------
 Best regards 
 
Yu-Kun Qian (钱钰坤) 
Center for Monsoon and Environment Research 
 Department of Atmospheric Sciences
School of Environmental Science and Engineering 
 Sun Yat-sen University 
No. 135 Xingang West Road, Haizhu District 
Guangzhou, 510275, P.R. China 
Tel; 020-84115227 
Email: qianyk at mail3.sysu.edu.cn      


 
 
 
------------------ 原始邮件 ------------------
发件人: "Martin Losch"<Martin.Losch at awi.de>;
发送时间: 2018年6月14日(星期四) 晚上7:38
收件人: "MITgcm Support"<mitgcm-support at mitgcm.org>; 

主题: Re: [MITgcm-support] Sample pTracer using flt package

 
Looks good to me.

M.

> On 14. Jun 2018, at 05:23, 钱钰坤 <qianyk at mail3.sysu.edu.cn> wrote:
> 
> Hi all,
> 
> Still along this line, I want to sample pTracer along Lagrangian trajectory using flt
> package.  Now I'm able to sample pTracer itself and I want to sample its gradient
> too.
> 
> I add two arrays to store the gradient (vector) of pTracer in PTRACER_FIELDS.h:
> _RL  pTrGrdx (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
> _RL  pTrGrdy (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
> 
> Then I add the following lines at the end of ptracer_integrate.F to calculate the
> gradient of the ninth tracer, which makes use of the predefined subroutines of
> GAD_GRAD_X and GAD_GRAD_Y in GAD package:
>      IF (iTracer .EQ. 9) THEN
>        CALL GAD_GRAD_X(
>   I            bi,bj,k,xA,pTracer(1-Olx,1-Oly,1,bi,bj,9),
>   O            pTrGrdx(1-Olx,1-Oly,1,bi,bj),
>   I            myThid)
>        CALL GAD_GRAD_Y(
>   I            bi,bj,k,yA,pTracer(1-Olx,1-Oly,1,bi,bj,9),
>  O            pTrGrdy(1-Olx,1-Oly,1,bi,bj),
>   I            myThid)
>      ENDIF
> 
> Finally, I modify the Lagrangian sampling code in flt_traj.F as:
>        CALL FLT_BILINEAR  (ix,jy,uu,pTrGrdx(1-Olx,1-Oly,1,1,1),
>   I               kp,1,bi,bj,myThid)
>        CALL FLT_BILINEAR  (ix,jy,vv,pTrGrdy(1-Olx,1-Oly,1,1,1),
>   I               kp,2,bi,bj,myThid)
> so that the gradients are stored in the u/v samples of particles.
> 
> I just want to make sure that this is OK.  I am aware of that gradX is defined
> at u-point and gradY is defined at v-point.  So I guess this should be the best
> way to get online sampled tracer gradient.
> 
> 
> ------------------
> Best regards 
> 
> Yu-Kun Qian (钱钰坤) 
> Center for Monsoon and Environment Research
> Department of Atmospheric Sciences
> School of Environmental Science and Engineering 
> Sun Yat-sen University 
> No. 135 Xingang West Road, Haizhu District 
> Guangzhou, 510275, P.R. China 
> Tel; 020-84115227 
> Email: qianyk at mail3.sysu.edu.cn
>  
>  
>  
>  
> ------------------ 原始邮件 ------------------
> 发件人: "qianyk"<qianyk at mail3.sysu.edu.cn>;
> 发送时间: 2018年6月2日(星期六) 晚上7:12
> 收件人: "mitgcm-support"<mitgcm-support at mitgcm.org>;
> 主题: 回复: [MITgcm-support] Sample pTracer using flt package
>  
> Hi Martin,
> 
> Thanks very much for your suggestions.  I can sample the value of ptracer online now.
> 
> However, there are considerable differences between online-sampled and offline-sampled
> values.  I've doubted about the results of my offline-sampling program and that is why I
> insist to get the online results to verify that.  Since I have to also sample the gradient of
> the tracer, there are more questions follow this line.
> 
> For a quick solution, I hope to compute the tracer gradient online and then sample the
> gradient field exactly the same way as I sample the tracer field (just passing the pointer
> of the gradient to the subroutine FLT_BILINEAR).  However, I've no idea how and where
> to do this.  I've found many diagnostics in available_diagnostics.log related to the tracer
> itself (UTRAC01, ADVrTr01, ...) which could be modified slightly to be the tracer gradient.
> I just wonder if this is the best way to do get Lagrangian sampling of tracer gradient.
> 
> From a fundamental way, I just want to figure out the differences in the programs.  The
> tracer field is output as MDSIO format.  As MITgcm uses C-grid, should the position of the
> lower-left-corner value of the tracer be exactly zero, or be DXC (DYC), or be DXC/2 (DYC/2)?
> I think this tiny differences in position will cause considerable sampled tracer value if the
> gradient is large.
> 
> I also set north and east wall boundaries so the domain is closed (the eastmost Nx and
> northmost Ny grid points are all set to the undefined value of 0).  Could the Lagrangian
> particle get into the cell of these grid points or they just stay within [1 Nx-1]*[1 Ny-1]
> grid points?  More specifically, what are the upper and lower bounds of position for a
> Lagrangian particle?
> 
> Thanks again.
> 
> 
> 
> ------------------
> Best regards 
> 
> Yu-Kun Qian (钱钰坤) 
> Center for Monsoon and Environment Research
> Department of Atmospheric Sciences
> School of Environmental Science and Engineering 
> Sun Yat-sen University 
> No. 135 Xingang West Road, Haizhu District 
> Guangzhou, 510275, P.R. China 
> Tel; 020-84115227 
> Email: qianyk at mail3.sysu.edu.cn
>  
>  
>  
>  
> ------------------ 原始邮件 ------------------
> 发件人: "Martin Losch"<Martin.Losch at awi.de>;
> 发送时间: 2018年6月1日(星期五) 晚上7:25
> 收件人: "MITgcm Support"<mitgcm-support at mitgcm.org>;
> 主题: Re: [MITgcm-support] Sample pTracer using flt package
>  
> Hi Qian,
> 
> I think you can do it that way.
> You need to include the ptracer variables at the beginning of the routine like this:
> #ifdef ALLOW_PTRACERS
> #include "PTRACERS_SIZE.h"
> #include “PTRACERS_FIELDS.h"
> #endif
> 
> and it’s always a good idea to bracket pkg-specific code by CPP-flags:
> #ifdef ALLOW_PTRACERS
>       … your code ...
> #endif
> 
> I think you need to say
> CALL FLT_BILINEAR  (ix,jy,ss, pTracer(1-Olx,1-Oly,1,1,1, iTracer),  kp,0,bi,bj,myThid)
> to pass the approriate pointer to FLT_BILINEAR
> 
> Martin
> > On 1. Jun 2018, at 12:19, 钱钰坤 <qianyk at mail3.sysu.edu.cn> wrote:
> > 
> > Hi all,
> > 
> > I've inserted an passive tracer (using ptracer package) and deployed
> > Lagrangian particles (using flt package) simultaneously into a dynamic flow.
> > I wanted to sample the tracer value along each Lagrangian float but I only
> > found the following five lines of code in flt_traj.F:
> > 
> > CALL FLT_BILINEAR  (ix,jy,uu,uVel,  kp,1,bi,bj,myThid)
> > CALL FLT_BILINEAR  (ix,jy,vv,vVel,  kp,2,bi,bj,myThid)
> > CALL FLT_BILINEAR2D(ix,jy,pp,etaN,     0,bi,bj,myThid)
> > CALL FLT_BILINEAR  (ix,jy,tt,theta, kp,0,bi,bj,myThid)
> > CALL FLT_BILINEAR  (ix,jy,ss,salt,  kp,0,bi,bj,myThid)
> > 
> > which means the flt can only sample the basic flow states (u, v, eta, theta, and salt).
> > 
> > I wonder if there is an easy way to achieve this by modifying the code slightly as:
> > 
> > CALL FLT_BILINEAR  (ix,jy,ss, pTracer(, , , , , iTracer),  kp,0,bi,bj,myThid)
> > 
> > and using the result to replace the salt which I do not care about?
> > 
> > If yes, how to modify the #include or variable declarations at the beginning of flt_traj.F?
> > 
> > Many thanks.
> > 
> > 
> > ------------------
> > Best regards 
> > 
> > Yu-Kun Qian (钱钰坤) 
> > Center for Monsoon and Environment Research
> > Department of Atmospheric Sciences
> > School of Environmental Science and Engineering 
> > Sun Yat-sen University 
> > No. 135 Xingang West Road, Haizhu District 
> > Guangzhou, 510275, P.R. China 
> > Tel; 020-84115227 
> > Email: qianyk at mail3.sysu.edu.cn
> >  
> >  
> > _______________________________________________
> > MITgcm-support mailing list
> > MITgcm-support at mitgcm.org
> > http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
> 
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support

_______________________________________________
MITgcm-support mailing list
MITgcm-support at mitgcm.org
http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20180614/e7068114/attachment-0001.html>


More information about the MITgcm-support mailing list