Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in advec_52 and advec_5th #37

Closed
fjansson opened this issue Aug 6, 2018 · 3 comments
Closed

bug in advec_52 and advec_5th #37

fjansson opened this issue Aug 6, 2018 · 3 comments

Comments

@fjansson
Copy link
Contributor

fjansson commented Aug 6, 2018

There is a typo in advec_52.f90 and advec_5th.f90, in the advecv routines.

-   -sign(1.,(v0(i,j+1,k)+v0(i,j,k)))*(v0(i,j+1,k)+v0(i,j+1,k))/60.&  
+   -sign(1.,(v0(i,j+1,k)+v0(i,j,k)))*(v0(i,j+1,k)+v0(i,j,k))/60.&  

The sign(1,x)*x construction is for calculating abs(x). In this particular place, the final term has j+1 where it should be j. This line is present twice in each of the files advec_52.f90 and advec_5th.f90. In advec_5th, only the top and bottom boundaries are affected, not the bulk.

I plan to replace the sign() constructions by abs() for readability. I will patch this expression first as a separate commit, as documentation of why the results change.

@Chiil
Copy link
Contributor

Chiil commented Aug 6, 2018 via email

fjansson pushed a commit to CloudResolvingClimateModeling/dales that referenced this issue Aug 6, 2018
@fjansson
Copy link
Contributor Author

fjansson commented Aug 7, 2018

Indeed abs() seems slower for advec_5th. For advec_52, I couldn't measure any significant difference.
I find this surprising, but I will leave the sign construction as it is for now. I get exactly identical output with abs() and the sign construction, after fixing the typo above.
I'll make a pull request for inclusion in 4.2 soon.

@fjansson
Copy link
Contributor Author

fjansson commented Jun 5, 2019

Fix merged in version 4.2.

@fjansson fjansson closed this as completed Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants