# Re: SUBROUTINE DLNEXTRP in uv2dv_cfd

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Apr 29 2013 - 17:23:16 MDT

Hello Wei-Jen

You are correct. The underlying fortran code had an error.
IF (X(ML,NL).EQ.XMSG) THEN
:
IF (NL.EQ.NLAT .AND. ML.EQ.MLON) THEN
:
+ X(ML-1,NL).NE.XMSG) THEN

should be

+ X(ML-2,NL).NE.XMSG) THEN

This has been corrected and a fix has been checked in.

Thank You

On 4/27/13 7:12 PM, Wei-Jen Tseng wrote:
> Dear all,
>
> I feel confused when I read the code about the linear extrapolation used in
> the uv2dv_cfd.
>
> The subroutine shows the way to calculate the divergence of 4 corner points.
> I have two questions.
>
> First, the calculations of 2 points [NL=1&ML=1, NL=1&ML=MLON] look fine
> because they use 4 another points to get the answer.
> But, the others [NL=NLAT&ML=1, NL=NLAT&ML=MLON] only use 3 points to
> calculate the divergence.!?
> Second, the if-statement and the calculation are not consistent in the
> SUBROUTINE DLNEXTRP.
>
> For example, it is the original code in NCL:
>
> IF (NL.EQ.NLAT .AND. ML.EQ.MLON) THEN
> IF (X(ML,NL-1).NE.XMSG .AND.
> + X(ML,NL-2).NE.XMSG .AND.
> + X(ML-1,NL).NE.XMSG .AND.
> + X(ML-1,NL).NE.XMSG) THEN
> X(ML,NL) =
> (2.D0*X(ML,NL-2)-X(ML,NL-2)+2.D0*X(ML-1,NL)-X(ML-2,NL))*0.5D0
> END IF
> END IF
>
> The corrected code maybe look like this….?
>
> IF (NL.EQ.NLAT .AND. ML.EQ.MLON) THEN
> IF (X(ML,NL-1).NE.XMSG .AND.
> + X(ML,NL-2).NE.XMSG .AND.
> + X(ML-1,NL).NE.XMSG .AND.
> + X(ML-2,NL).NE.XMSG) THEN
> X(ML,NL) =
> (2.D0*X(ML,NL-1)-X(ML,NL-2)+2.D0*X(ML-1,NL)-X(ML-2,NL))*0.5D0
> END IF
> END IF
>
> I would like to know just the misunderstanding of the code or it's a bug.
>
> Best regards,
>
> Wei-Jen
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Apr 29 17:23:11 2013

This archive was generated by hypermail 2.1.8 : Thu May 02 2013 - 11:16:45 MDT