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