Skip to content

Commit cc9abe3

Browse files
committed
docstrings and minor cleanups
1 parent 1563597 commit cc9abe3

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

src/nlesolver_module.F90

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
! * http://projecteuclid.org/download/pdf_1/euclid.pjm/1102995080
1414
! * http://help.agi.com/stk/index.htm#gator/eq-diffcorr.htm
1515
! * http://gmat.sourceforge.net/doc/R2015a/html/DifferentialCorrector.html
16+
! * https://openmdao.org/newdocs/versions/latest/features/building_blocks/solvers/bounds_enforce.html
1617
!
1718
!### Author
1819
! * Jacob Williams
@@ -67,19 +68,19 @@ module nlesolver_module
6768
real(wp),parameter :: big = huge(one)
6869

6970
! options for sparsity_mode
70-
integer,parameter,public :: NLESOLVER_SPARSITY_DENSE = 1 !! assume dense (use dense solver).
71-
integer,parameter,public :: NLESOLVER_SPARSITY_LSQR = 2 !! assume sparse (use LSQR sparse solver).
72-
integer,parameter,public :: NLESOLVER_SPARSITY_LUSOL = 3 !! assume sparse (use LUSOL sparse solver).
73-
integer,parameter,public :: NLESOLVER_SPARSITY_LSMR = 4 !! assume sparse (use LSMR sparse solver).
74-
integer,parameter,public :: NLESOLVER_SPARSITY_CUSTOM_SPARSE = 5 !! assume sparse (use a user provided sparse solver).
75-
!integer,parameter,public :: NLESOLVER_SPARSITY_CUSTOM_DENSE = 6 !! assume dense (use a user provided dense solver).
71+
integer,parameter,public :: NLESOLVER_SPARSITY_DENSE = 1 !! [[nlesolver_type:sparsity_mode]] : assume dense (use dense solver).
72+
integer,parameter,public :: NLESOLVER_SPARSITY_LSQR = 2 !! [[nlesolver_type:sparsity_mode]] : assume sparse (use LSQR sparse solver).
73+
integer,parameter,public :: NLESOLVER_SPARSITY_LUSOL = 3 !! [[nlesolver_type:sparsity_mode]] : assume sparse (use LUSOL sparse solver).
74+
integer,parameter,public :: NLESOLVER_SPARSITY_LSMR = 4 !! [[nlesolver_type:sparsity_mode]] : assume sparse (use LSMR sparse solver).
75+
integer,parameter,public :: NLESOLVER_SPARSITY_CUSTOM_SPARSE = 5 !! [[nlesolver_type:sparsity_mode]] : assume sparse (use a user provided sparse solver).
76+
!integer,parameter,public :: NLESOLVER_SPARSITY_CUSTOM_DENSE = 6 !! [[nlesolver_type:sparsity_mode]] : assume dense (use a user provided dense solver). [not available]
7677
! if add will have to update code below where sparsity_modes /= 1 is assumed sparse
7778

78-
! bounds model parameters:
79-
integer,parameter,public :: NLESOLVER_IGNORE_BOUNDS = 0
80-
integer,parameter,public :: NLESOLVER_SCALAR_BOUNDS = 1
81-
integer,parameter,public :: NLESOLVER_VECTOR_BOUNDS = 2
82-
integer,parameter,public :: NLESOLVER_WALL_BOUNDS = 3
79+
! bounds model options:
80+
integer,parameter,public :: NLESOLVER_IGNORE_BOUNDS = 0 !! [[nlesolver_type:bounds_mode]] : ignore bounds
81+
integer,parameter,public :: NLESOLVER_SCALAR_BOUNDS = 1 !! [[nlesolver_type:bounds_mode]] : scalar mode
82+
integer,parameter,public :: NLESOLVER_VECTOR_BOUNDS = 2 !! [[nlesolver_type:bounds_mode]] : vector mode
83+
integer,parameter,public :: NLESOLVER_WALL_BOUNDS = 3 !! [[nlesolver_type:bounds_mode]] : wall mode
8384

8485
!*********************************************************
8586
type,public :: nlesolver_type
@@ -495,6 +496,8 @@ subroutine initialize_nlesolver_variables(me,&
495496
!! * 1 = scalar mode
496497
!! * 2 = vector mode
497498
!! * 3 = wall mode
499+
!!
500+
!! See [[nlesolver_type:bounds_mode]] for full descriptions.
498501
real(wp),dimension(n),intent(in),optional :: xlow !! lower bounds for `x` (size is `n`). only used if `bounds_mode>0` and
499502
!! both `xlow` and `xupp` are specified.
500503
real(wp),dimension(n),intent(in),optional :: xupp !! upper bounds for `x` (size is `n`). only used if `bounds_mode>0` and
@@ -1032,24 +1035,20 @@ end subroutine adjust_x_for_bounds
10321035

10331036
!*****************************************************************************************
10341037
!>
1035-
! if necessary, adjust the search direction vector so that bounds are not violated.
1038+
! if necessary, adjust the search direction vector `p` so that bounds are not violated.
10361039
!
10371040
!### Reference
10381041
! * https://openmdao.org/newdocs/versions/latest/features/building_blocks/solvers/bounds_enforce.html
10391042

1040-
! TODO: for the 'wall' mode, flag the ones that were violated, and use
1041-
! that to set the alpha=0 for those vars during the line search.
1042-
! --> where (adjusted) xnew = x
1043-
10441043
subroutine adjust_search_direction(me,x,p,pnew,modified)
10451044

10461045
implicit none
10471046

10481047
class(nlesolver_type),intent(inout) :: me
1049-
real(wp),dimension(me%n),intent(in) :: x !! initial `x`
1048+
real(wp),dimension(me%n),intent(in) :: x !! initial `x`. it is assumed that this does not violate any bounds.
10501049
real(wp),dimension(me%n),intent(in) :: p !! search direction `p = xnew - x`
10511050
real(wp),dimension(me%n),intent(out) :: pnew !! new search direction
1052-
logical,dimension(me%n),intent(out) :: modified !! indicates the elements of p that were modified
1051+
logical,dimension(me%n),intent(out) :: modified !! indicates the elements of `p` that were modified
10531052

10541053
integer :: i !! counter
10551054
real(wp),dimension(:),allocatable :: xnew !! `x + pnew`

0 commit comments

Comments
 (0)