Skip to content

Commit

Permalink
bring this in just for integration work
Browse files Browse the repository at this point in the history
  • Loading branch information
ambrad committed Oct 27, 2019
1 parent 464d1a6 commit 7cd8eae
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion components/homme/src/share/vertremap_base.F90
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ subroutine remap1(Qdp,nx,qsize,dp1,dp2)
call remap1_nofilter(qdp,nx,qsize,dp1,dp2)
return
endif
if (vert_remap_q_alg == 1 .or. vert_remap_q_alg == 2 .or. vert_remap_q_alg == 3) then
if (vert_remap_q_alg == 1 .or. vert_remap_q_alg == 2 .or. vert_remap_q_alg == 3 .or. vert_remap_q_alg == 10) then
call remap_Q_ppm(qdp,nx,qsize,dp1,dp2)
return
endif
Expand Down Expand Up @@ -616,6 +616,11 @@ subroutine remap_Q_ppm(Qdp,nx,qsize,dp1,dp2)
ao(nlev+k) = ao(nlev+1-k)
endif
enddo
if (vert_remap_q_alg == 10) then
call linextrap(dpo(2), dpo(1), dpo(0), dpo(-1), ao(2), ao(1),ao(0), ao(-1))
call linextrap(dpo(nlev-1), dpo(nlev), dpo(nlev+1), dpo(nlev+2),&
ao(nlev-1), ao(nlev), ao(nlev+1), ao(nlev+2))
end if
!Compute monotonic and conservative PPM reconstruction over every cell
coefs(:,:) = compute_ppm( ao , ppmdx )
!Compute tracer values on the new grid by integrating from the old cell bottom to the new
Expand Down Expand Up @@ -765,6 +770,27 @@ subroutine binary_search(pio, pivot, k)
k = lo
end subroutine binary_search


subroutine linextrap(dx1,dx2,dx3,dx4,y1,y2,y3,y4)
real(kind=real_kind), intent(in) :: dx1,dx2,dx3,dx4,y1,y2
real(kind=real_kind), intent(out) :: y3,y4

real(kind=real_kind), parameter :: half = 0.5d0

real(kind=real_kind) :: x1,x2,x3,x4,a

x1 = half*dx1
x2 = x1 + half*(dx1 + dx2)
x3 = x2 + half*(dx2 + dx3)
x4 = x3 + half*(dx3 + dx4)

a = (x3-x1)/(x2-x1)
y3 = (1-a)*y1 + a*y2
a = (x4-x1)/(x2-x1)
y4 = (1-a)*y1 + a*y2
end subroutine linextrap


end module vertremap_base


Expand Down

0 comments on commit 7cd8eae

Please sign in to comment.