Skip to content

Commit

Permalink
Generalize optimality criteria.
Browse files Browse the repository at this point in the history
  • Loading branch information
raback committed Dec 12, 2024
1 parent 007ac00 commit d3d9e32
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fem/src/modules/TopoOpt.F90
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ SUBROUTINE UpdateDensities(x,dc,dv,g)
REAL(KIND=dp) :: g

REAL(KIND=dp), ALLOCATABLE :: xnew(:)
REAL(KIND=dp) :: Vi, l1, l2, lmid, move, err, tol, V0
REAL(KIND=dp) :: Vi, l1, l2, lmid, move, err, tol, V0, damp
INTEGER :: k
LOGICAL :: Visited = .FALSE.

Expand All @@ -518,6 +518,9 @@ SUBROUTINE UpdateDensities(x,dc,dv,g)

tol = ListGetCReal(Params,'Bisection search tolerance',Found )
IF(.NOT. Found) tol = 1.0e-6

damp = ListGetCReal(Params,'Bisection search damping exponent',Found )
IF(.NOT. Found) damp = 0.5_dp

! Desired total volume
V0 = volFrac * SUM(dv)
Expand All @@ -531,7 +534,7 @@ SUBROUTINE UpdateDensities(x,dc,dv,g)

! Note: xnew in [0,1]
! Suggested new density
xnew = x*SQRT(-dc/(dv*lmid))
xnew = x*(MAX(1.0e-10,-dc/(dv*lmid)))**damp

! Regulators and limiters
xnew = MAX(0.0_dp,MAX(x-move,MIN(1.0_dp,MIN(x+move,xnew))))
Expand All @@ -547,11 +550,11 @@ SUBROUTINE UpdateDensities(x,dc,dv,g)
END IF

err = (l2-l1)/(l1+l2)
IF( err < tol ) EXIT

IF( InfoActive(20)) THEN
PRINT *,'Bisection:',k,Vi,l1,l2,err
END IF

IF( err < tol ) EXIT
END DO

x = xnew
Expand Down

0 comments on commit d3d9e32

Please sign in to comment.