Skip to content

Commit

Permalink
Bugfix in physics/m_micro.F90: correct calculation of flipped vertica…
Browse files Browse the repository at this point in the history
…l index
  • Loading branch information
climbfuji committed Apr 29, 2021
1 parent 05bf214 commit 41d34d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion physics/m_micro.F90
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ subroutine m_micro_run( im, lm, flipv, dt_i &
END DO
END DO
DO K=0, LM
ll = lm-k
ll = lm-k+1
DO I = 1,IM
PLE(i,k) = prsi_i(i,ll) * 0.01_kp ! interface pressure in hPa
zet(i,k+1) = phii(i,ll) * onebg
Expand Down

6 comments on commit 41d34d0

@SMoorthi-emc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why this is correct!

@climbfuji
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • PLE is allocated from 0:KM

  • prsi_i is allocated from 1:KM+1

  • we need to flip in the vertical

  • before the bugfix: k runs from 0 to km; ll runs from km to 0, but it needs to run from km+1 to 1 --> out of bounds

  • after the bugfix: k runs from 0 to km; ll runs from km+1 to 1 --> ok

@SMoorthi-emc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see in my code
" real (kind=kind_phys), dimension(im,0:lm),intent(in):: prsi_i, &
& phii"

@climbfuji
Copy link
Collaborator Author

@climbfuji climbfuji commented on 41d34d0 Apr 30, 2021 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SMoorthi-emc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be because of the change to assumed arrays? It makes it sound like the original code had bug.

@climbfuji
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be because of the change to assumed arrays? It makes it sound like the original code had bug.

I think you are correct. I can rephrase the language. There is definitely a bug somewhere in csawmg, because we could not get it to run with GNU in the past (segfaults), and using explicit dimensions prevented us from finding the problem. With these changes, we can revisit the issue in the next weeks, create a DEBUG test and try to run it with GNU.

Please sign in to comment.