MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
imslinearmisc Module Reference

Functions/Subroutines

subroutine, public ims_misc_dvscale (iopt, neq, dscale, x, b)
 Scale X and RHS.

Function/Subroutine Documentation

◆ ims_misc_dvscale()

subroutine, public imslinearmisc::ims_misc_dvscale ( integer(i4b), intent(in) iopt,
integer(i4b), intent(in) neq,
real(dp), intent(inout) dscale,
real(dp), dimension(neq), intent(inout) x,
real(dp), dimension(neq), intent(inout) b )

Scale X and B to avoid big or small values. Scaling value is the maximum ABS(X).

Parameters
[in]ioptflag to scale (0) or unscale the system of equations
[in]neqnumber of equations
[in,out]dscalescaling value
[in,out]xdependent variable
[in,out]bright-hand side

Definition at line 17 of file ImsLinearMisc.f90.

18 ! -- dummy variables
19 integer(I4B), INTENT(IN) :: IOPT !< flag to scale (0) or unscale the system of equations
20 integer(I4B), INTENT(IN) :: NEQ !< number of equations
21 real(DP), INTENT(INOUT) :: DSCALE !< scaling value
22 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: X !< dependent variable
23 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: B !< right-hand side
24 ! -- local variables
25 integer(I4B) :: n
26 !
27 ! -- SCALE SCALE AMAT, X, AND B
28 IF (iopt == 0) THEN
29 dscale = abs(dscale)
30 if (dscale < dem30) then
31 dscale = done
32 end if
33 DO n = 1, neq
34 b(n) = b(n) / dscale
35 x(n) = x(n) / dscale
36 END DO
37 !
38 ! -- UNSCALE X, AND B
39 ELSE
40 DO n = 1, neq
41 b(n) = b(n) * dscale
42 x(n) = x(n) * dscale
43 END DO
44 END IF
Here is the caller graph for this function: