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

More volume projection fixes #51

Merged
merged 3 commits into from
Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/projections.F90
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,26 @@ subroutine point_volume(x0, tu, tv, tw, ku, kv, kw, coef, nctlu, nctlv, nctlw, n
! Calculate the Hessian
do j = 1, 3
do i = 1, 3
hessian(i, j) = dot_product(deriv(:, i), deriv(:, j)) + &
dot_product(R, deriv2(:, i, j))
! TODO clean up this routine
! 3 ways of doing the hessian. Second term causes problems, so we either:
! omit it, only add the diagonal, keep adding it. Needs further investigation
! just not adding them at all seems to be the most robust...

hessian(i, j) = dot_product(deriv(:, i), deriv(:, j))

! if (i .eq. j) then
! hessian(i, j) = hessian(i, j) + dot_product(R, deriv2(:, i, j))
! end if

! hessian(i, j) = dot_product(deriv(:, i), deriv(:, j)) + &
! dot_product(R, deriv2(:, i, j))

! The hessian gets terribly ill conditioned when the second derivatives are included.
! In one case, this shows up as a 2x2 sub block getting almost zero determinant.
! This is solving an optimization problem, so check if there are any features that
! would cause the optimization problem to be non-convex!

! write(*,*) i, j, dot_product(deriv(:, i), deriv(:, j)), dot_product(R, deriv2(:, i, j))
end do
end do

Expand Down