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

Rename scaled itv bounds #3557

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions process/optimiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def run(self):
# Trim maximum size arrays down to actually used size
n = numerics.nvar
x = numerics.xcm[:n]
bndl = numerics.bondl[:n]
bndu = numerics.bondu[:n]
bndl = numerics.itv_scaled_lower_bounds[:n]
bndu = numerics.itv_scaled_upper_bounds[:n]

# Define total number of constraints and equality constraints
m = numerics.neqns + numerics.nineqns
Expand Down
13 changes: 8 additions & 5 deletions process/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ def post_optimise(self, ifail: int):
name = f2py_compatible_to_string(numerics.lablxc[numerics.ixc[i] - 1])
solution_vector_table.append([name, numerics.xcs[i], numerics.xcm[i]])

xminn = 1.01 * numerics.bondl[i]
xmaxx = 0.99 * numerics.bondu[i]
xminn = 1.01 * numerics.itv_scaled_lower_bounds[i]
xmaxx = 0.99 * numerics.itv_scaled_upper_bounds[i]

if numerics.xcm[i] < xminn or numerics.xcm[i] > xmaxx:
if not written_warning:
Expand All @@ -359,7 +359,7 @@ def post_optimise(self, ifail: int):
process_output.write(
constants.nout,
f" {name:<30}= {xcval} is at or {location} its {bound} bound:"
f" {numerics.bondu[i] * numerics.scafc[i]}",
f" {numerics.itv_scaled_upper_bounds[i] * numerics.scafc[i]}",
)

process_output.ovarre(
Expand All @@ -374,8 +374,11 @@ def post_optimise(self, ifail: int):
else:
xnorm = min(
max(
(numerics.xcm[i] - numerics.bondl[i])
/ (numerics.bondu[i] - numerics.bondl[i]),
(numerics.xcm[i] - numerics.itv_scaled_lower_bounds[i])
/ (
numerics.itv_scaled_upper_bounds[i]
- numerics.itv_scaled_lower_bounds[i]
),
0.0,
),
1.0,
Expand Down
6 changes: 3 additions & 3 deletions source/fortran/iteration_variables.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4424,7 +4424,7 @@ subroutine boundxc
!! !
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

use numerics, only: nvar, bondl, bondu, scale, ixc, boundl, boundu
use numerics, only: nvar, itv_scaled_lower_bounds, itv_scaled_upper_bounds, scale, ixc, boundl, boundu

implicit none

Expand All @@ -4435,8 +4435,8 @@ subroutine boundxc
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

do i = 1,nvar
bondl(i) = boundl(ixc(i))*scale(i)
bondu(i) = boundu(ixc(i))*scale(i)
itv_scaled_lower_bounds(i) = boundl(ixc(i))*scale(i)
itv_scaled_upper_bounds(i) = boundu(ixc(i))*scale(i)
end do

end subroutine boundxc
Expand Down
18 changes: 14 additions & 4 deletions source/fortran/numerics.f90
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,22 @@ module numerics
real(dp), dimension(ipnvars) :: boundu
! !! boundu(ipnvars) /../ : upper bounds used on ixc variables

real(dp), dimension(ipnvars) :: bondl
real(dp), dimension(ipnvars) :: bondu
real(dp), dimension(ipnvars) :: itv_scaled_lower_bounds
!! Lower bound of the ixc variables scaled to (divided by)
!! the initial value of the corresponding ixc

real(dp), dimension(ipnvars) :: itv_scaled_upper_bounds
!! Upper bound of the ixc variables scaled to (divided by)
!! the initial value of the corresponding ixc

real(dp), dimension(ipnvars) :: rcm
real(dp), dimension(ipnvars) :: resdl
real(dp), dimension(ipnvars) :: scafc
!! The initial value of each ixc variable

real(dp), dimension(ipnvars) :: scale
!! The reciprocal of the initial value of each ixc variable

real(dp), dimension(ipnvars) :: xcm
real(dp), dimension(ipnvars) :: xcs
real(dp), dimension(ipvlam) :: vlam
Expand Down Expand Up @@ -575,8 +585,8 @@ subroutine init_numerics()
! Issue #287 These bounds now defined in initial.f90
boundu = 9.d99

bondl = 0.0D0
bondu = 0.0D0
itv_scaled_lower_bounds = 0.0D0
itv_scaled_upper_bounds = 0.0D0
rcm = 0.0D0
resdl = 0.0D0
scafc = 0.0D0
Expand Down
Loading