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

Data Types

type  imslineardatatype

Functions/Subroutines

subroutine imslinear_ar (this, name, iout, iprims, mxiter, neq, matrix, rhs, x, linear_settings)
 Allocate storage and read data.
subroutine imslinear_summary (this, mxiter)
 Write summary of settings.
subroutine allocate_scalars (this)
 Allocate and initialize scalars.
subroutine imslinear_da (this)
 Deallocate memory.
subroutine precond_allocate (this)
 Allocate and initialize the preconditioner work arrays.
subroutine precond_destroy (this)
 Deallocate the preconditioner work arrays.
subroutine imslinear_set_input (this, ifdparam)
 Set default settings.
subroutine imslinear_ap (this, icnvg, kstp, kiter, in_iter, nconv, convnmod, convmodstart, caccel, summary)
 Base linear accelerator subroutine.

Function/Subroutine Documentation

◆ allocate_scalars()

subroutine imslinearmodule::allocate_scalars ( class(imslineardatatype), intent(inout) this)
private

Allocate and initialize linear accelerator scalars

Parameters
[in,out]thisImsLinearDataType instance

Definition at line 431 of file ImsLinear.f90.

432 ! -- modules
434 ! -- dummy variables
435 class(ImsLinearDataType), intent(inout) :: this !< ImsLinearDataType instance
436 !
437 ! -- allocate scalars
438 call mem_allocate(this%iout, 'IOUT', this%memoryPath)
439 call mem_allocate(this%ipc, 'IPC', this%memoryPath)
440 call mem_allocate(this%iacpc, 'IACPC', this%memoryPath)
441 call mem_allocate(this%niterc, 'NITERC', this%memoryPath)
442 call mem_allocate(this%niabcgs, 'NIABCGS', this%memoryPath)
443 call mem_allocate(this%niapc, 'NIAPC', this%memoryPath)
444 call mem_allocate(this%njapc, 'NJAPC', this%memoryPath)
445 call mem_allocate(this%epfact, 'EPFACT', this%memoryPath)
446 call mem_allocate(this%l2norm0, 'L2NORM0', this%memoryPath)
447 call mem_allocate(this%njlu, 'NJLU', this%memoryPath)
448 call mem_allocate(this%njw, 'NJW', this%memoryPath)
449 call mem_allocate(this%nwlu, 'NWLU', this%memoryPath)
450 !
451 ! -- initialize scalars
452 this%iout = 0
453 this%ipc = 0
454 this%iacpc = 0
455 this%niterc = 0
456 this%niabcgs = 0
457 this%niapc = 0
458 this%njapc = 0
459 this%epfact = dzero
460 this%l2norm0 = 0
461 this%njlu = 0
462 this%njw = 0
463 this%nwlu = 0

◆ imslinear_ap()

subroutine imslinearmodule::imslinear_ap ( class(imslineardatatype), intent(inout) this,
integer(i4b), intent(inout) icnvg,
integer(i4b), intent(in) kstp,
integer(i4b), intent(in) kiter,
integer(i4b), intent(inout) in_iter,
integer(i4b), intent(in) nconv,
integer(i4b), intent(in) convnmod,
integer(i4b), dimension(convnmod + 1), intent(inout) convmodstart,
character(len=31), dimension(nconv), intent(inout) caccel,
type(convergencesummarytype), intent(in), pointer summary )
private

Base linear accelerator subroutine that scales and reorders the system of equations, if necessary, updates the preconditioner, and calls the appropriate linear accelerator.

Parameters
[in,out]thisImsLinearDataType instance
[in,out]icnvgconvergence flag (1) non-convergence (0)
[in]kstptime step number
[in]kiterouter iteration number
[in,out]in_iterinner iteration number
[in]summaryConvergence summary report

Definition at line 670 of file ImsLinear.f90.

673 ! -- modules
674 USE simmodule
675 ! -- dummy variables
676 CLASS(ImsLinearDataType), INTENT(INOUT) :: this !< ImsLinearDataType instance
677 integer(I4B), INTENT(INOUT) :: ICNVG !< convergence flag (1) non-convergence (0)
678 integer(I4B), INTENT(IN) :: KSTP !< time step number
679 integer(I4B), INTENT(IN) :: KITER !< outer iteration number
680 integer(I4B), INTENT(INOUT) :: IN_ITER !< inner iteration number
681 ! -- convergence information dummy variables
682 integer(I4B), INTENT(IN) :: NCONV !<
683 integer(I4B), INTENT(IN) :: CONVNMOD !<
684 integer(I4B), DIMENSION(CONVNMOD + 1), INTENT(INOUT) :: CONVMODSTART !<
685 character(len=31), DIMENSION(NCONV), INTENT(INOUT) :: CACCEL !<
686 type(ConvergenceSummaryType), pointer, intent(in) :: summary !< Convergence summary report
687 ! -- local variables
688 integer(I4B) :: n
689 integer(I4B) :: innerit
690 integer(I4B) :: irc
691 integer(I4B) :: itmax
692 real(DP) :: dnrm2
693 !
694 ! -- set epfact based on timestep
695 this%EPFACT = ims_base_epfact(this%ICNVGOPT, kstp)
696 !
697 ! -- SCALE PROBLEM
698 IF (this%ISCL .NE. 0) THEN
699 CALL ims_base_scale(0, this%ISCL, &
700 this%NEQ, this%NJA, this%IA, this%JA, &
701 this%AMAT, this%X, this%RHS, &
702 this%DSCALE, this%DSCALE2)
703 END IF
704 !
705 ! -- PERMUTE ROWS, COLUMNS, AND RHS
706 IF (this%IORD /= 0) THEN
707 CALL dperm(this%NEQ, this%AMAT, this%JA, this%IA, &
708 this%ARO, this%JARO, this%IARO, &
709 this%LORDER, this%ID, 1)
710 CALL dvperm(this%NEQ, this%X, this%LORDER)
711 CALL dvperm(this%NEQ, this%RHS, this%LORDER)
712 this%IA0 => this%IARO
713 this%JA0 => this%JARO
714 this%A0 => this%ARO
715 ELSE
716 this%IA0 => this%IA
717 this%JA0 => this%JA
718 this%A0 => this%AMAT
719 END IF
720 !
721 ! -- FACTORS RETURNING THE RESIDUAL AND HEAD CHANGE TO MODEL UNITS
722 IF (this%ISCL /= 0) THEN
723 CALL ims_base_cnvg_scale(this%NEQ, this%IORD, this%DSCALE, &
724 this%DSCALE2, this%LORDER, &
725 this%RSCALE, this%HSCALE)
726 END IF
727 !
728 ! -- UPDATE PRECONDITIONER
729 CALL ims_base_pcu(this%iout, this%NJA, this%NEQ, this%NIAPC, this%NJAPC, &
730 this%IPC, this%RELAX, this%A0, this%IA0, this%JA0, &
731 this%APC, this%IAPC, this%JAPC, this%IW, this%W, &
732 this%LEVEL, this%DROPTOL, this%NJLU, this%NJW, &
733 this%NWLU, this%JLU, this%JW, this%WLU)
734 !
735 ! -- INITIALIZE SOLUTION VARIABLE AND ARRAYS
736 IF (kiter == 1) then
737 this%NITERC = 0
738 summary%iter_cnt = 0
739 end if
740 irc = 1
741 icnvg = 0
742 DO n = 1, this%NEQ
743 this%D(n) = dzero
744 this%P(n) = dzero
745 this%Q(n) = dzero
746 this%Z(n) = dzero
747 END DO
748 !
749 ! -- CALCULATE INITIAL RESIDUAL
750 call ims_base_residual(this%NEQ, this%NJA, this%X, this%RHS, this%D, &
751 this%A0, this%IA0, this%JA0)
752 IF (this%ISCL /= 0) THEN
753 this%L2NORM0 = dzero
754 DO n = 1, this%NEQ
755 this%L2NORM0 = this%L2NORM0 + (this%D(n) * this%RSCALE(n))**2
756 END DO
757 this%L2NORM0 = sqrt(this%L2NORM0)
758 ELSE
759 this%L2NORM0 = dnrm2(this%NEQ, this%D, 1)
760 END IF
761 !
762 ! -- CHECK FOR EXACT SOLUTION
763 itmax = this%ITER1
764 IF (this%L2NORM0 == dzero) THEN
765 itmax = 0
766 icnvg = 1
767 END IF
768 !
769 ! -- SOLUTION BY THE CONJUGATE GRADIENT METHOD
770 IF (this%ILINMETH == 1) THEN
771 CALL ims_base_cg(icnvg, itmax, innerit, &
772 this%NEQ, this%NJA, this%NIAPC, this%NJAPC, &
773 this%IPC, this%ICNVGOPT, this%NORTH, &
774 this%ISCL, this%RSCALE, this%HSCALE, &
775 this%DVCLOSE, this%RCLOSE, this%L2NORM0, &
776 this%EPFACT, this%IA0, this%JA0, this%A0, &
777 this%IAPC, this%JAPC, this%APC, &
778 this%X, this%RHS, this%D, this%P, this%Q, this%Z, &
779 this%NJLU, this%IW, this%JLU, &
780 nconv, convnmod, convmodstart, &
781 caccel, summary)
782 !
783 ! -- SOLUTION BY THE BICONJUGATE GRADIENT STABILIZED METHOD
784 ELSE IF (this%ILINMETH == 2) THEN
785 CALL ims_base_bcgs(icnvg, itmax, innerit, &
786 this%NEQ, this%NJA, this%NIAPC, this%NJAPC, &
787 this%IPC, this%ICNVGOPT, this%NORTH, &
788 this%ISCL, this%RSCALE, this%HSCALE, &
789 this%DVCLOSE, this%RCLOSE, this%L2NORM0, &
790 this%EPFACT, this%IA0, this%JA0, this%A0, &
791 this%IAPC, this%JAPC, this%APC, &
792 this%X, this%RHS, this%D, this%P, this%Q, &
793 this%T, this%V, this%DHAT, this%PHAT, this%QHAT, &
794 this%NJLU, this%IW, this%JLU, &
795 nconv, convnmod, convmodstart, &
796 caccel, summary)
797 END IF
798 !
799 ! -- BACK PERMUTE AMAT, SOLUTION, AND RHS
800 IF (this%IORD /= 0) THEN
801 CALL dperm(this%NEQ, this%A0, this%JA0, this%IA0, &
802 this%AMAT, this%JA, this%IA, &
803 this%IORDER, this%ID, 1)
804 CALL dvperm(this%NEQ, this%X, this%IORDER)
805 CALL dvperm(this%NEQ, this%RHS, this%IORDER)
806 END IF
807 !
808 ! -- UNSCALE PROBLEM
809 IF (this%ISCL .NE. 0) THEN
810 CALL ims_base_scale(1, this%ISCL, &
811 this%NEQ, this%NJA, this%IA, this%JA, &
812 this%AMAT, this%X, this%RHS, &
813 this%DSCALE, this%DSCALE2)
814 END IF
815 !
816 ! -- SET IMS INNER ITERATION NUMBER (IN_ITER) TO NUMBER OF
817 ! IMSLINEAR INNER ITERATIONS (innerit)
818 in_iter = innerit
real(kind=8) function dnrm2(n, x, incx)
Definition blas1_d.f90:388
This module contains simulation methods.
Definition Sim.f90:10
subroutine dvperm(n, x, perm)
Definition sparsekit.f90:62
subroutine dperm(nrow, a, ja, ia, ao, jao, iao, perm, qperm, job)
Here is the call graph for this function:

◆ imslinear_ar()

subroutine imslinearmodule::imslinear_ar ( class(imslineardatatype), intent(inout) this,
character(len=lensolutionname), intent(in) name,
integer(i4b), intent(in) iout,
integer(i4b), intent(in), target iprims,
integer(i4b), intent(in) mxiter,
integer(i4b), intent(in), target neq,
class(matrixbasetype), pointer matrix,
real(dp), dimension(neq), intent(inout), target rhs,
real(dp), dimension(neq), intent(inout), target x,
type(imslinearsettingstype), pointer linear_settings )

Allocate storage for linear accelerators and read data

Parameters
[in,out]thisImsLinearDataType instance
[in]namesolution name
[in]ioutsimulation listing file unit
[in]iprimsprint option
[in]mxitermaximum outer iterations
[in]neqnumber of equations
[in,out]rhsright-hand side
[in,out]xdependent variables
linear_settingsthe settings form the IMS file

Definition at line 114 of file ImsLinear.f90.

116 ! -- modules
119 use simmodule, only: store_error, count_errors, &
121 ! -- dummy variables
122 CLASS(ImsLinearDataType), INTENT(INOUT) :: this !< ImsLinearDataType instance
123 CHARACTER(LEN=LENSOLUTIONNAME), INTENT(IN) :: NAME !< solution name
124 integer(I4B), INTENT(IN) :: IOUT !< simulation listing file unit
125 integer(I4B), TARGET, INTENT(IN) :: IPRIMS !< print option
126 integer(I4B), INTENT(IN) :: MXITER !< maximum outer iterations
127 integer(I4B), TARGET, INTENT(IN) :: NEQ !< number of equations
128 class(MatrixBaseType), pointer :: matrix
129 real(DP), DIMENSION(NEQ), TARGET, INTENT(INOUT) :: RHS !< right-hand side
130 real(DP), DIMENSION(NEQ), TARGET, INTENT(INOUT) :: X !< dependent variables
131 type(ImsLinearSettingsType), pointer :: linear_settings !< the settings form the IMS file
132 ! -- local variables
133 character(len=LINELENGTH) :: errmsg
134 integer(I4B) :: n
135 integer(I4B) :: i0
136 integer(I4B) :: iscllen, iolen
137
138 !
139 ! -- DEFINE NAME
140 this%memoryPath = create_mem_path(name, 'IMSLINEAR')
141 !
142 ! -- SET pointers to IMS settings
143 this%DVCLOSE => linear_settings%dvclose
144 this%RCLOSE => linear_settings%rclose
145 this%ICNVGOPT => linear_settings%icnvgopt
146 this%ITER1 => linear_settings%iter1
147 this%ILINMETH => linear_settings%ilinmeth
148 this%ISCL => linear_settings%iscl
149 this%IORD => linear_settings%iord
150 this%NORTH => linear_settings%north
151 this%RELAX => linear_settings%relax
152 this%LEVEL => linear_settings%level
153 this%DROPTOL => linear_settings%droptol
154 !
155 ! -- SET POINTERS TO SOLUTION STORAGE
156 this%IPRIMS => iprims
157 this%NEQ => neq
158 call matrix%get_aij(this%IA, this%JA, this%AMAT)
159 call mem_allocate(this%NJA, 'NJA', this%memoryPath)
160 this%NJA = size(this%AMAT)
161 this%RHS => rhs
162 this%X => x
163 !
164 ! -- ALLOCATE SCALAR VARIABLES
165 call this%allocate_scalars()
166 !
167 ! -- initialize iout
168 this%iout = iout
169 !
170 ! -- DEFAULT VALUES
171 this%IPC = ipc_unknown
172 !
173 this%IACPC = 0
174 !
175 ! -- PRINT A MESSAGE IDENTIFYING IMSLINEAR SOLVER PACKAGE
176 write (iout, 2000)
17702000 FORMAT(1x, /1x, 'IMSLINEAR -- UNSTRUCTURED LINEAR SOLUTION', &
178 ' PACKAGE, VERSION 8, 04/28/2017')
179 !
180 ! -- DETERMINE PRECONDITIONER
181 this%IPC = resolve_ipc(this%LEVEL, this%RELAX)
182 !
183 ! -- ERROR CHECKING FOR OPTIONS
184 IF (this%ISCL < 0) this%ISCL = 0
185 IF (this%ISCL > 2) THEN
186 WRITE (errmsg, '(A)') 'IMSLINEAR7AR ISCL MUST BE <= 2'
187 call store_error(errmsg)
188 END IF
189 IF (this%IORD < 0) this%IORD = 0
190 IF (this%IORD > 2) THEN
191 WRITE (errmsg, '(A)') 'IMSLINEAR7AR IORD MUST BE <= 2'
192 call store_error(errmsg)
193 END IF
194 IF (this%NORTH < 0) THEN
195 WRITE (errmsg, '(A)') 'IMSLINEAR7AR NORTH MUST >= 0'
196 call store_error(errmsg)
197 END IF
198 IF (this%RCLOSE == dzero) THEN
199 IF (this%ICNVGOPT /= 3) THEN
200 WRITE (errmsg, '(A)') 'IMSLINEAR7AR RCLOSE MUST > 0.0'
201 call store_error(errmsg)
202 END IF
203 END IF
204 IF (this%RELAX < dzero) THEN
205 WRITE (errmsg, '(A)') 'IMSLINEAR7AR RELAX MUST BE >= 0.0'
206 call store_error(errmsg)
207 END IF
208 IF (this%RELAX > done) THEN
209 WRITE (errmsg, '(A)') 'IMSLINEAR7AR RELAX MUST BE <= 1.0'
210 call store_error(errmsg)
211 END IF
212 !
213 ! -- INITIALIZE IMSLINEAR VARIABLES
214 this%NITERC = 0
215 !
216 ! -- ALLOCATE AND INITIALIZE MEMORY FOR IMSLINEAR
217 iscllen = 1
218 IF (this%ISCL .NE. 0) iscllen = neq
219 CALL mem_allocate(this%DSCALE, iscllen, 'DSCALE', trim(this%memoryPath))
220 CALL mem_allocate(this%DSCALE2, iscllen, 'DSCALE2', trim(this%memoryPath))
221 CALL mem_allocate(this%RSCALE, iscllen, 'RSCALE', trim(this%memoryPath))
222 CALL mem_allocate(this%HSCALE, iscllen, 'HSCALE', trim(this%memoryPath))
223 !
224 ! -- allocate and initialize the preconditioner work arrays
225 call precond_allocate(this)
226 !
227 ! -- ALLOCATE SPACE FOR PERMUTATION VECTOR
228 i0 = 1
229 iolen = 1
230 IF (this%IORD .NE. 0) THEN
231 i0 = this%NEQ
232 iolen = this%NJA
233 END IF
234 CALL mem_allocate(this%LORDER, i0, 'LORDER', trim(this%memoryPath))
235 CALL mem_allocate(this%IORDER, i0, 'IORDER', trim(this%memoryPath))
236 CALL mem_allocate(this%IARO, i0 + 1, 'IARO', trim(this%memoryPath))
237 CALL mem_allocate(this%JARO, iolen, 'JARO', trim(this%memoryPath))
238 CALL mem_allocate(this%ARO, iolen, 'ARO', trim(this%memoryPath))
239 !
240 ! -- ALLOCATE WORKING VECTORS FOR IMSLINEAR SOLVER
241 CALL mem_allocate(this%ID, this%NEQ, 'ID', trim(this%memoryPath))
242 CALL mem_allocate(this%D, this%NEQ, 'D', trim(this%memoryPath))
243 CALL mem_allocate(this%P, this%NEQ, 'P', trim(this%memoryPath))
244 CALL mem_allocate(this%Q, this%NEQ, 'Q', trim(this%memoryPath))
245 CALL mem_allocate(this%Z, this%NEQ, 'Z', trim(this%memoryPath))
246 !
247 ! -- ALLOCATE MEMORY FOR BCGS WORKING ARRAYS
248 this%NIABCGS = 1
249 IF (this%ILINMETH == 2) THEN
250 this%NIABCGS = this%NEQ
251 END IF
252 CALL mem_allocate(this%T, this%NIABCGS, 'T', trim(this%memoryPath))
253 CALL mem_allocate(this%V, this%NIABCGS, 'V', trim(this%memoryPath))
254 CALL mem_allocate(this%DHAT, this%NIABCGS, 'DHAT', trim(this%memoryPath))
255 CALL mem_allocate(this%PHAT, this%NIABCGS, 'PHAT', trim(this%memoryPath))
256 CALL mem_allocate(this%QHAT, this%NIABCGS, 'QHAT', trim(this%memoryPath))
257 !
258 ! -- INITIALIZE IMSLINEAR VECTORS
259 DO n = 1, iscllen
260 this%DSCALE(n) = done
261 this%DSCALE2(n) = done
262 this%RSCALE(n) = done
263 this%HSCALE(n) = done
264 END DO
265 !
266 ! -- WORKING VECTORS
267 DO n = 1, this%NEQ
268 this%ID(n) = izero
269 this%D(n) = dzero
270 this%P(n) = dzero
271 this%Q(n) = dzero
272 this%Z(n) = dzero
273 END DO
274 DO n = 1, this%NIAPC
275 this%IW(n) = izero
276 this%W(n) = dzero
277 END DO
278 !
279 ! -- BCGS WORKING VECTORS
280 DO n = 1, this%NIABCGS
281 this%T(n) = dzero
282 this%V(n) = dzero
283 this%DHAT(n) = dzero
284 this%PHAT(n) = dzero
285 this%QHAT(n) = dzero
286 END DO
287 !
288 ! -- ILUT AND MILUT WORKING VECTORS
289 DO n = 1, this%NJLU
290 this%JLU(n) = izero
291 END DO
292 DO n = 1, this%NJW
293 this%JW(n) = izero
294 END DO
295 DO n = 1, this%NWLU
296 this%WLU(n) = dzero
297 END DO
298 !
299 ! -- REORDERING VECTORS
300 DO n = 1, i0 + 1
301 this%IARO(n) = izero
302 END DO
303 DO n = 1, iolen
304 this%JARO(n) = izero
305 this%ARO(n) = dzero
306 END DO
307 !
308 ! -- REVERSE CUTHILL MCKEE AND MINIMUM DEGREE ORDERING
309 IF (this%IORD .NE. 0) THEN
310 CALL ims_base_calc_order(this%IORD, this%NEQ, this%NJA, this%IA, &
311 this%JA, this%LORDER, this%IORDER)
312 END IF
313 !
314 ! -- ALLOCATE MEMORY FOR STORING ITERATION CONVERGENCE DATA
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public store_error(msg, terminate)
Store an error message.
Definition Sim.f90:94
integer(i4b) function, public count_errors()
Return number of errors.
Definition Sim.f90:60
subroutine, public deprecation_warning(cblock, cvar, cver, endmsg, iunit)
Store deprecation warning message.
Definition Sim.f90:261
Here is the call graph for this function:

◆ imslinear_da()

subroutine imslinearmodule::imslinear_da ( class(imslineardatatype), intent(inout) this)
private

Deallocate linear accelerator memory.

Parameters
[in,out]thislinear datatype instance

Definition at line 471 of file ImsLinear.f90.

472 ! -- modules
474 ! -- dummy variables
475 class(ImsLinearDataType), intent(inout) :: this !< linear datatype instance
476 !
477 ! -- arrays
478 call mem_deallocate(this%dscale)
479 call mem_deallocate(this%dscale2)
480 call mem_deallocate(this%rscale)
481 call mem_deallocate(this%hscale)
482 call precond_destroy(this)
483 call mem_deallocate(this%lorder)
484 call mem_deallocate(this%iorder)
485 call mem_deallocate(this%iaro)
486 call mem_deallocate(this%jaro)
487 call mem_deallocate(this%aro)
488 call mem_deallocate(this%id)
489 call mem_deallocate(this%d)
490 call mem_deallocate(this%p)
491 call mem_deallocate(this%q)
492 call mem_deallocate(this%z)
493 call mem_deallocate(this%t)
494 call mem_deallocate(this%v)
495 call mem_deallocate(this%dhat)
496 call mem_deallocate(this%phat)
497 call mem_deallocate(this%qhat)
498 !
499 ! -- scalars
500 call mem_deallocate(this%iout)
501 call mem_deallocate(this%ipc)
502 call mem_deallocate(this%iacpc)
503 call mem_deallocate(this%niterc)
504 call mem_deallocate(this%niabcgs)
505 call mem_deallocate(this%niapc)
506 call mem_deallocate(this%njapc)
507 call mem_deallocate(this%epfact)
508 call mem_deallocate(this%l2norm0)
509 call mem_deallocate(this%njlu)
510 call mem_deallocate(this%njw)
511 call mem_deallocate(this%nwlu)
512 call mem_deallocate(this%NJA)
513 !
514 ! -- nullify pointers
515 nullify (this%iprims)
516 nullify (this%neq)
517 nullify (this%nja)
518 nullify (this%ia)
519 nullify (this%ja)
520 nullify (this%amat)
521 nullify (this%rhs)
522 nullify (this%x)
Here is the call graph for this function:

◆ imslinear_set_input()

subroutine imslinearmodule::imslinear_set_input ( class(imslineardatatype), intent(inout) this,
integer(i4b), intent(in) ifdparam )
private

Set default linear accelerator settings.

Parameters
[in,out]thisImsLinearDataType instance
[in]ifdparamcomplexity option

Definition at line 612 of file ImsLinear.f90.

613 ! -- dummy variables
614 CLASS(ImsLinearDataType), INTENT(INOUT) :: this !< ImsLinearDataType instance
615 integer(I4B), INTENT(IN) :: IFDPARAM !< complexity option
616 ! -- code
617 SELECT CASE (ifdparam)
618 !
619 ! -- Simple option
620 CASE (1)
621 this%ITER1 = 50
622 this%ILINMETH = 1
623 this%IPC = ipc_ilu0
624 this%ISCL = 0
625 this%IORD = 0
626 this%DVCLOSE = dem3
627 this%RCLOSE = dem1
628 this%RELAX = dzero
629 this%LEVEL = 0
630 this%DROPTOL = dzero
631 this%NORTH = 0
632 !
633 ! -- Moderate
634 CASE (2)
635 this%ITER1 = 100
636 this%ILINMETH = 2
637 this%IPC = ipc_milu0
638 this%ISCL = 0
639 this%IORD = 0
640 this%DVCLOSE = dem2
641 this%RCLOSE = dem1
642 this%RELAX = 0.97d0
643 this%LEVEL = 0
644 this%DROPTOL = dzero
645 this%NORTH = 0
646 !
647 ! -- Complex
648 CASE (3)
649 this%ITER1 = 500
650 this%ILINMETH = 2
651 this%IPC = ipc_ilut
652 this%ISCL = 0
653 this%IORD = 0
654 this%DVCLOSE = dem1
655 this%RCLOSE = dem1
656 this%RELAX = dzero
657 this%LEVEL = 5
658 this%DROPTOL = dem4
659 this%NORTH = 2
660 END SELECT

◆ imslinear_summary()

subroutine imslinearmodule::imslinear_summary ( class(imslineardatatype), intent(inout) this,
integer(i4b), intent(in) mxiter )
private

Write summary of linear accelerator settings.

Parameters
[in,out]thisImsLinearDataType instance
[in]mxitermaximum number of outer iterations

Definition at line 322 of file ImsLinear.f90.

323 ! -- dummy variables
324 class(ImsLinearDataType), intent(inout) :: this !< ImsLinearDataType instance
325 integer(I4B), intent(in) :: mxiter !< maximum number of outer iterations
326 ! -- local variables
327 CHARACTER(LEN=10) :: clin(0:2)
328 CHARACTER(LEN=31) :: clintit(0:2)
329 CHARACTER(LEN=20) :: cipc(0:4)
330 CHARACTER(LEN=20) :: cscale(0:2)
331 CHARACTER(LEN=25) :: corder(0:2)
332 CHARACTER(LEN=16), DIMENSION(0:4) :: ccnvgopt
333 CHARACTER(LEN=15) :: clevel
334 CHARACTER(LEN=15) :: cdroptol
335 integer(I4B) :: i
336 integer(I4B) :: j
337 ! -- data
338 DATA clin/'UNKNOWN ', &
339 &'CG ', &
340 &'BCGS '/
341 DATA clintit/' UNKNOWN ', &
342 &' CONJUGATE-GRADIENT ', &
343 &'BICONJUGATE-GRADIENT STABILIZED'/
344 DATA cipc/'UNKNOWN ', &
345 &'INCOMPLETE LU ', &
346 &'MOD. INCOMPLETE LU ', &
347 &'INCOMPLETE LUT ', &
348 &'MOD. INCOMPLETE LUT '/
349 DATA cscale/'NO SCALING ', &
350 &'SYMMETRIC SCALING ', &
351 &'L2 NORM SCALING '/
352 DATA corder/'ORIGINAL ORDERING ', &
353 &'RCM ORDERING ', &
354 &'MINIMUM DEGREE ORDERING '/
355 DATA ccnvgopt/'INFINITY NORM ', &
356 &'INFINITY NORM S ', &
357 &'L2 NORM ', &
358 &'RELATIVE L2NORM ', &
359 &'L2 NORM W. REL. '/
360 ! -- formats
36102010 FORMAT(1x, /, 7x, 'SOLUTION BY THE', 1x, a31, 1x, 'METHOD', &
362 /, 1x, 66('-'), /, &
363 ' MAXIMUM OF ', i0, ' CALLS OF SOLUTION ROUTINE', /, &
364 ' MAXIMUM OF ', i0, &
365 ' INTERNAL ITERATIONS PER CALL TO SOLUTION ROUTINE', /, &
366 ' LINEAR ACCELERATION METHOD =', 1x, a, /, &
367 ' MATRIX PRECONDITIONING TYPE =', 1x, a, /, &
368 ' MATRIX SCALING APPROACH =', 1x, a, /, &
369 ' MATRIX REORDERING APPROACH =', 1x, a, /, &
370 ' NUMBER OF ORTHOGONALIZATIONS =', 1x, i0, /, &
371 ' HEAD CHANGE CRITERION FOR CLOSURE =', e15.5, /, &
372 ' RESIDUAL CHANGE CRITERION FOR CLOSURE =', e15.5, /, &
373 ' RESIDUAL CONVERGENCE OPTION =', 1x, i0, /, &
374 ' RESIDUAL CONVERGENCE NORM =', 1x, a, /, &
375 ' RELAXATION FACTOR =', e15.5)
37602015 FORMAT(' NUMBER OF LEVELS =', a15, /, &
377 ' DROP TOLERANCE =', a15, //)
3782030 FORMAT(1x, a20, 1x, 6(i6, 1x))
3792040 FORMAT(1x, 20('-'), 1x, 6(6('-'), 1x))
3802050 FORMAT(1x, 62('-'),/) !
381! -- -----------------------------------------------------------
382 !
383 ! -- initialize clevel and cdroptol
384 clevel = ''
385 cdroptol = ''
386 !
387 ! -- write common variables to all linear accelerators
388 write (this%iout, 2010) &
389 clintit(this%ILINMETH), mxiter, this%ITER1, &
390 clin(this%ILINMETH), cipc(this%IPC), &
391 cscale(this%ISCL), corder(this%IORD), &
392 this%NORTH, this%DVCLOSE, this%RCLOSE, &
393 this%ICNVGOPT, ccnvgopt(this%ICNVGOPT), &
394 this%RELAX
395 if (this%level > 0) then
396 write (clevel, '(i15)') this%level
397 end if
398 if (this%droptol > dzero) then
399 write (cdroptol, '(e15.5)') this%droptol
400 end if
401 IF (this%level > 0 .or. this%droptol > dzero) THEN
402 write (this%iout, 2015) trim(adjustl(clevel)), &
403 trim(adjustl(cdroptol))
404 ELSE
405 write (this%iout, '(//)')
406 END IF
407
408 if (this%iord /= 0) then
409 !
410 ! -- WRITE SUMMARY OF REORDERING INFORMATION TO LIST FILE
411 if (this%iprims == 2) then
412 DO i = 1, this%neq, 6
413 write (this%iout, 2030) 'ORIGINAL NODE :', &
414 (j, j=i, min(i + 5, this%neq))
415 write (this%iout, 2040)
416 write (this%iout, 2030) 'REORDERED INDEX :', &
417 (this%lorder(j), j=i, min(i + 5, this%neq))
418 write (this%iout, 2030) 'REORDERED NODE :', &
419 (this%iorder(j), j=i, min(i + 5, this%neq))
420 write (this%iout, 2050)
421 END DO
422 END IF
423 end if

◆ precond_allocate()

subroutine imslinearmodule::precond_allocate ( class(imslineardatatype), intent(inout) this)
private

Determines the preconditioner array dimensions from the current NEQ/NJA/LEVEL/IPC and allocates the ILU-family work arrays (IAPC/JAPC/APC/IW/W/JLU/JW/WLU); for ILU0/MILU0 the IAPC/JAPC sparsity is generated. Separated from imslinear_ar so the preconditioner can be (re)allocated at runtime.

Parameters
[in,out]thisImsLinearDataType instance

Definition at line 533 of file ImsLinear.f90.

535 ! -- dummy variables
536 class(ImsLinearDataType), intent(inout) :: this !< ImsLinearDataType instance
537 ! -- local variables
538 integer(I4B) :: n
539 !
540 ! -- release any existing preconditioner arrays so this routine is
541 ! idempotent and can be called again to reallocate at runtime
542 if (associated(this%IAPC)) call precond_destroy(this)
543 !
544 ! -- determine dimensions for preconditioning arrays
545 call ims_calc_pcdims(this%NEQ, this%NJA, this%IA, this%LEVEL, this%IPC, &
546 this%NIAPC, this%NJAPC, this%NJLU, this%NJW, this%NWLU)
547 !
548 ! -- allocate base preconditioner vectors
549 call mem_allocate(this%IAPC, this%NIAPC + 1, 'IAPC', trim(this%memoryPath))
550 call mem_allocate(this%JAPC, this%NJAPC, 'JAPC', trim(this%memoryPath))
551 call mem_allocate(this%APC, this%NJAPC, 'APC', trim(this%memoryPath))
552 !
553 ! -- allocate ILU0/MILU0 non-zero row entry vectors
554 call mem_allocate(this%IW, this%NIAPC, 'IW', trim(this%memoryPath))
555 call mem_allocate(this%W, this%NIAPC, 'W', trim(this%memoryPath))
556 !
557 ! -- allocate ILUT vectors
558 call mem_allocate(this%JLU, this%NJLU, 'JLU', trim(this%memoryPath))
559 call mem_allocate(this%JW, this%NJW, 'JW', trim(this%memoryPath))
560 call mem_allocate(this%WLU, this%NWLU, 'WLU', trim(this%memoryPath))
561 !
562 ! -- generate IAPC and JAPC for ILU0 and MILU0
563 if (this%IPC == ipc_ilu0 .or. this%IPC == ipc_milu0) then
564 call ims_base_pccrs(this%NEQ, this%NJA, this%IA, this%JA, &
565 this%IAPC, this%JAPC)
566 end if
567 !
568 ! -- initialize preconditioner values
569 do n = 1, this%NJAPC
570 this%APC(n) = dzero
571 end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ precond_destroy()

subroutine imslinearmodule::precond_destroy ( class(imslineardatatype), intent(inout) this)
private

Preconditioner-only teardown, separated from imslinear_da so the preconditioner can be destroyed and reallocated at runtime without disturbing the solver work arrays.

Parameters
[in,out]thisImsLinearDataType instance

Definition at line 580 of file ImsLinear.f90.

582 ! -- dummy variables
583 class(ImsLinearDataType), intent(inout) :: this !< ImsLinearDataType instance
584 !
585 ! -- mem_deallocate is a no-op in the memory manager, so releasing the named
586 ! store entries (and nullifying the aliases below) is what actually frees
587 ! these arrays and lets the preconditioner be reallocated at runtime
588 call memorystore_release('IAPC', trim(this%memoryPath))
589 call memorystore_release('JAPC', trim(this%memoryPath))
590 call memorystore_release('APC', trim(this%memoryPath))
591 call memorystore_release('IW', trim(this%memoryPath))
592 call memorystore_release('W', trim(this%memoryPath))
593 call memorystore_release('JLU', trim(this%memoryPath))
594 call memorystore_release('JW', trim(this%memoryPath))
595 call memorystore_release('WLU', trim(this%memoryPath))
596 !
597 nullify (this%IAPC)
598 nullify (this%JAPC)
599 nullify (this%APC)
600 nullify (this%IW)
601 nullify (this%W)
602 nullify (this%JLU)
603 nullify (this%JW)
604 nullify (this%WLU)
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
Here is the call graph for this function:
Here is the caller graph for this function: