Skip to content

Commit

Permalink
historical changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmacgilchrist committed Oct 7, 2024
1 parent ad01834 commit 2525f79
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2510,13 +2510,13 @@ subroutine set_regrid_params( CS, boundary_extrapolation, min_thickness, old_gri
if (associated(CS%rho_CS) .and. (present(interp_scheme) .or. present(boundary_extrapolation))) &
call set_rho_params(CS%rho_CS, interp_CS=CS%interp_CS)
case (REGRIDDING_SCALAR)
if (present(min_thickness)) call set_rho_params(CS%scalar_CS, min_thickness=min_thickness)
if (present(ref_pressure)) call set_rho_params(CS%scalar_CS, ref_pressure=ref_pressure)
if (present(histogram_extensive_diags)) call set_rho_params(CS%scalar_CS, histogram_extensive_diags=histogram_extensive_diags)
if (present(min_thickness)) call set_scalar_params(CS%scalar_CS, min_thickness=min_thickness)
if (present(ref_pressure)) call set_scalar_params(CS%scalar_CS, ref_pressure=ref_pressure)
if (present(histogram_extensive_diags)) call set_scalar_params(CS%scalar_CS, histogram_extensive_diags=histogram_extensive_diags)
if (present(integrate_downward_for_e)) &
call set_rho_params(CS%scalar_CS, integrate_downward_for_e=integrate_downward_for_e)
call set_scalar_params(CS%scalar_CS, integrate_downward_for_e=integrate_downward_for_e)
if (associated(CS%scalar_CS) .and. (present(interp_scheme) .or. present(boundary_extrapolation))) &
call set_rho_params(CS%scalar_CS, interp_CS=CS%interp_CS)
call set_scalar_params(CS%scalar_CS, interp_CS=CS%interp_CS)
case (REGRIDDING_HYCOM1)
if (associated(CS%hycom_CS) .and. (present(interp_scheme) .or. present(boundary_extrapolation))) &
call set_hycom_params(CS%hycom_CS, interp_CS=CS%interp_CS)
Expand Down
31 changes: 29 additions & 2 deletions src/ALE/regrid_interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ subroutine build_histogram_weights(CS, densities, n0, h0, target_values, &
degree, h_neglect, h_neglect_edge)
call get_histogram_weights(n0, ppoly0_E, ppoly0_C, target_values, degree, &
n1, histogram_weights, answer_date=CS%answer_date)

end subroutine build_histogram_weights

!> Given a target value, find corresponding coordinate for given polynomial
Expand Down Expand Up @@ -638,11 +639,17 @@ function get_interface_indices( N, edge_values, ppoly_coefs, &
!!! Now do the rest of the column

do k = 2,N
if ( target_value <= edge_values(k,1) ) then
if ( ( target_value < edge_values(k,1) ) .AND. ( target_value < edge_values(k,2) ) ) then
! target less than whole cell
interfaces(k) = -1
elseif (target_value >= edge_values(k,2) ) then
elseif ( (target_value > edge_values(k,1) ) .AND. (target_value > edge_values(k,1) ) ) then
! target greater than whole cell
interfaces(k) = 2
elseif ( ( target_value >= edge_values(k-1,2) ) .AND. ( target_value <= edge_values(k,1) ) ) then
! target greater than cell above but less than current cell
interfaces(k) = 0
elseif ( ( target_value <= edge_values(k-1,2) ) .AND. ( target_value >= edge_values(k,1) ) ) then
! target less than cell above but greater than current cell
interfaces(k) = 0
else
! Interface is within cell, so use Newton-Raphson iterations to find it
Expand Down Expand Up @@ -703,6 +710,11 @@ function get_interface_indices( N, edge_values, ppoly_coefs, &
endif
enddo

! print *, "target_value", target_value
! print *, "edge_values(:,1)", edge_values(:,1)
! print *, "edge_values(:,2)", edge_values(:,2)
! print *, "interfaces", interfaces

end function get_interface_indices

!> Given target values (e.g., density), build new grid based on polynomial
Expand Down Expand Up @@ -734,6 +746,7 @@ subroutine get_histogram_weights( n0, ppoly0_E, ppoly0_coefs, &
integer :: k1 ! loop index
real :: tl ! current interface target density [A]
real :: tu ! dummy variable for interface target value above t
real, dimension(n0) :: weightsum ! dummy array for checking whether all of a bin is accounted for

do k1=1,n1
tl = target_values(k1)
Expand Down Expand Up @@ -787,8 +800,22 @@ subroutine get_histogram_weights( n0, ppoly0_E, ppoly0_coefs, &
endif
endif
enddo

! print *, "tl", tl
! print *, "tu", tu
! print *, "iindices_l", iindices_l
! print *, "iindices_u", iindices_u
! print *, "histogram_weights", histogram_weights(:,k1)

enddo

! weightsum=0.0
! do k1 = 1,n1
! weightsum(:) = weightsum(:) + histogram_weights(:,k1)
! enddo

! print *, "weightsum", weightsum

end subroutine get_histogram_weights

!> Numeric value of interpolation_scheme corresponding to scheme name
Expand Down

0 comments on commit 2525f79

Please sign in to comment.