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

This module contains the IMS linear accelerator subroutines. More...

Functions/Subroutines

subroutine ims_base_cg (icnvg, itmax, innerit, neq, nja, niapc, njapc, ipc, icnvgopt, north, iscl, rscale, hscale, dvclose, rclose, l2norm0, epfact, ia0, ja0, a0, iapc, japc, apc, x, b, d, p, q, z, njlu, iw, jlu, nconv, convnmod, convmodstart, caccel, summary)
 Preconditioned Conjugate Gradient linear accelerator.
subroutine ims_base_bcgs (icnvg, itmax, innerit, neq, nja, niapc, njapc, ipc, icnvgopt, north, iscl, rscale, hscale, dvclose, rclose, l2norm0, epfact, ia0, ja0, a0, iapc, japc, apc, x, b, d, p, q, t, v, dhat, phat, qhat, njlu, iw, jlu, nconv, convnmod, convmodstart, caccel, summary)
 Preconditioned BiConjugate Gradient Stabilized linear accelerator.
subroutine ims_base_calc_order (iord, neq, nja, ia, ja, lorder, iorder)
 Calculate LORDER AND IORDER.
subroutine ims_base_scale (iopt, iscl, neq, nja, ia, ja, amat, x, b, dscale, dscale2)
 Scale the coefficient matrix.
subroutine ims_base_cnvg_scale (neq, iord, dscale, dscale2, lorder, rscale, hscale)
 Set the factors that return the residual and head change to model units, in the order of the reordered system.
subroutine ims_base_pcu (iout, nja, neq, niapc, njapc, ipc, relax, amat, ia, ja, apc, iapc, japc, iw, w, level, droptol, njlu, njw, nwlu, jlu, jw, wlu)
 Update the preconditioner.
subroutine ims_base_pcjac (nja, neq, amat, apc, ia, ja)
 Jacobi preconditioner.
subroutine ims_base_jaca (neq, a, d1, d2)
 Apply the Jacobi preconditioner.
subroutine ims_base_pcilu0 (nja, neq, amat, ia, ja, apc, iapc, japc, iw, w, relax, ipcflag, delta)
 Update the ILU0 preconditioner.
subroutine ims_base_ilu0a (nja, neq, apc, iapc, japc, r, d)
 Apply the ILU0 and MILU0 preconditioners.
subroutine ims_base_testcnvg (icnvgopt, icnvg, iiter, dvmax, rmax, rmax0, epfact, dvclose, rclose)
 Test for solver convergence.
subroutine ims_calc_pcdims (neq, nja, ia, level, ipc, niapc, njapc, njlu, njw, nwlu)
subroutine ims_base_pccrs (neq, nja, ia, ja, iapc, japc)
 Generate CRS pointers for the preconditioner.
subroutine ims_base_isort (nval, iarray)
 In-place sorting for an integer array.
subroutine ims_base_residual (neq, nja, x, b, d, a, ia, ja)
 Calculate residual.
real(dp) function ims_base_epfact (icnvgopt, kstp)
 Function returning EPFACT.

Variables

type(blockparsertype), private parser

Detailed Description

This module contains the IMS linear accelerator subroutines used by a MODFLOW 6 solution.

Function/Subroutine Documentation

◆ ims_base_bcgs()

subroutine imslinearbasemodule::ims_base_bcgs ( integer(i4b), intent(inout) icnvg,
integer(i4b), intent(in) itmax,
integer(i4b), intent(inout) innerit,
integer(i4b), intent(in) neq,
integer(i4b), intent(in) nja,
integer(i4b), intent(in) niapc,
integer(i4b), intent(in) njapc,
integer(i4b), intent(in) ipc,
integer(i4b), intent(in) icnvgopt,
integer(i4b), intent(in) north,
integer(i4b), intent(in) iscl,
real(dp), dimension(*), intent(in) rscale,
real(dp), dimension(*), intent(in) hscale,
real(dp), intent(in) dvclose,
real(dp), intent(in) rclose,
real(dp), intent(in) l2norm0,
real(dp), intent(in) epfact,
integer(i4b), dimension(neq + 1), intent(in) ia0,
integer(i4b), dimension(nja), intent(in) ja0,
real(dp), dimension(nja), intent(in) a0,
integer(i4b), dimension(niapc + 1), intent(in) iapc,
integer(i4b), dimension(njapc), intent(in) japc,
real(dp), dimension(njapc), intent(in) apc,
real(dp), dimension(neq), intent(inout) x,
real(dp), dimension(neq), intent(in) b,
real(dp), dimension(neq), intent(inout) d,
real(dp), dimension(neq), intent(inout) p,
real(dp), dimension(neq), intent(inout) q,
real(dp), dimension(neq), intent(inout) t,
real(dp), dimension(neq), intent(inout) v,
real(dp), dimension(neq), intent(inout) dhat,
real(dp), dimension(neq), intent(inout) phat,
real(dp), dimension(neq), intent(inout) qhat,
integer(i4b), intent(in) njlu,
integer(i4b), dimension(niapc), intent(in) iw,
integer(i4b), dimension(njlu), intent(in) jlu,
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 )

Apply the Preconditioned BiConjugate Gradient Stabilized linear accelerator to the current coefficient matrix, right-hand side, using the currentdependent-variable.

Parameters
[in,out]icnvgconvergence flag (1) non-convergence (0)
[in]itmaxmaximum number of inner iterations
[in,out]inneritinner iteration count
[in]neqnumber of equations
[in]njanumber of non-zero entries
[in]niapcpreconditioner number of rows
[in]njapcpreconditioner number of non-zero entries
[in]ipcpreconditioner option
[in]icnvgoptflow convergence criteria option
[in]northorthogonalization frequency
[in]isclscaling option
[in]rscalefactor returning the residual to model units
[in]hscalefactor returning the head change to model units
[in]dvclosedependent-variable closure criteria
[in]rcloseflow closure criteria
[in]l2norm0initial L-2 norm for system of equations
[in]epfactfactor for decreasing flow convergence criteria for subsequent Picard iterations
[in]ia0CRS row pointers
[in]ja0CRS column pointers
[in]a0coefficient matrix
[in]iapcpreconditioner CRS row pointers
[in]japcpreconditioner CRS column pointers
[in]apcpreconditioner matrix
[in,out]xdependent-variable vector
[in]bright-hand side vector
[in,out]dpreconditioner working vector
[in,out]ppreconditioner working vector
[in,out]qpreconditioner working vector
[in,out]tpreconditioner working vector
[in,out]vpreconditioner working vector
[in,out]dhatBCGS preconditioner working vector
[in,out]phatBCGS preconditioner working vector
[in,out]qhatBCGS preconditioner working vector
[in]njlupreconditioner length of JLU vector
[in]iwpreconditioner integer working vector
[in]jlupreconditioner JLU working vector
[in]nconvmaximum number of inner iterations in a time step (maxiter * maxinner)
[in]convnmodnumber of models in the solution
[in,out]convmodstartpointer to the start of each model in the convmod* arrays
[in,out]caccelconvergence string
[in]summaryConvergence summary report

Definition at line 255 of file ImsLinearBase.f90.

265 ! -- dummy variables
266 integer(I4B), INTENT(INOUT) :: ICNVG !< convergence flag (1) non-convergence (0)
267 integer(I4B), INTENT(IN) :: ITMAX !< maximum number of inner iterations
268 integer(I4B), INTENT(INOUT) :: INNERIT !< inner iteration count
269 integer(I4B), INTENT(IN) :: NEQ !< number of equations
270 integer(I4B), INTENT(IN) :: NJA !< number of non-zero entries
271 integer(I4B), INTENT(IN) :: NIAPC !< preconditioner number of rows
272 integer(I4B), INTENT(IN) :: NJAPC !< preconditioner number of non-zero entries
273 integer(I4B), INTENT(IN) :: IPC !< preconditioner option
274 integer(I4B), INTENT(IN) :: ICNVGOPT !< flow convergence criteria option
275 integer(I4B), INTENT(IN) :: NORTH !< orthogonalization frequency
276 integer(I4B), INTENT(IN) :: ISCL !< scaling option
277 real(DP), DIMENSION(*), INTENT(IN) :: RSCALE !< factor returning the residual to model units
278 real(DP), DIMENSION(*), INTENT(IN) :: HSCALE !< factor returning the head change to model units
279 real(DP), INTENT(IN) :: DVCLOSE !< dependent-variable closure criteria
280 real(DP), INTENT(IN) :: RCLOSE !< flow closure criteria
281 real(DP), INTENT(IN) :: L2NORM0 !< initial L-2 norm for system of equations
282 real(DP), INTENT(IN) :: EPFACT !< factor for decreasing flow convergence criteria for subsequent Picard iterations
283 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA0 !< CRS row pointers
284 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA0 !< CRS column pointers
285 real(DP), DIMENSION(NJA), INTENT(IN) :: A0 !< coefficient matrix
286 integer(I4B), DIMENSION(NIAPC + 1), INTENT(IN) :: IAPC !< preconditioner CRS row pointers
287 integer(I4B), DIMENSION(NJAPC), INTENT(IN) :: JAPC !< preconditioner CRS column pointers
288 real(DP), DIMENSION(NJAPC), INTENT(IN) :: APC !< preconditioner matrix
289 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: X !< dependent-variable vector
290 real(DP), DIMENSION(NEQ), INTENT(IN) :: B !< right-hand side vector
291 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: D !< preconditioner working vector
292 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: P !< preconditioner working vector
293 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: Q !< preconditioner working vector
294 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: T !< preconditioner working vector
295 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: V !< preconditioner working vector
296 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: DHAT !< BCGS preconditioner working vector
297 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: PHAT !< BCGS preconditioner working vector
298 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: QHAT !< BCGS preconditioner working vector
299 ! -- ILUT dummy variables
300 integer(I4B), INTENT(IN) :: NJLU !< preconditioner length of JLU vector
301 integer(I4B), DIMENSION(NIAPC), INTENT(IN) :: IW !< preconditioner integer working vector
302 integer(I4B), DIMENSION(NJLU), INTENT(IN) :: JLU !< preconditioner JLU working vector
303 ! -- convergence information dummy variables
304 integer(I4B), INTENT(IN) :: NCONV !< maximum number of inner iterations in a time step (maxiter * maxinner)
305 integer(I4B), INTENT(IN) :: CONVNMOD !< number of models in the solution
306 integer(I4B), DIMENSION(CONVNMOD + 1), INTENT(INOUT) :: CONVMODSTART !< pointer to the start of each model in the convmod* arrays
307 character(len=31), DIMENSION(NCONV), INTENT(INOUT) :: CACCEL !< convergence string
308 type(ConvergenceSummaryType), pointer, intent(in) :: summary !< Convergence summary report
309 ! -- local variables
310 LOGICAL :: LORTH
311 logical :: lsame
312 character(len=15) :: cval1, cval2
313 integer(I4B) :: n
314 integer(I4B) :: iiter
315 integer(I4B) :: xloc, rloc
316 integer(I4B) :: im, im0, im1
317 real(DP) :: ddot
318 real(DP) :: tv
319 real(DP) :: deltax
320 real(DP) :: rmax
321 real(DP) :: l2norm
322 real(DP) :: rcnvg
323 real(DP) :: alpha, alpha0
324 real(DP) :: beta
325 real(DP) :: rho, rho0
326 real(DP) :: omega, omega0
327 real(DP) :: numerator, denominator
328 !
329 ! -- initialize local variables
330 innerit = 0
331 alpha = dzero
332 alpha0 = dzero
333 beta = dzero
334 rho = dzero
335 rho0 = dzero
336 omega = dzero
337 omega0 = dzero
338 !
339 ! -- SAVE INITIAL RESIDUAL
340 DO n = 1, neq
341 dhat(n) = d(n)
342 END DO
343 !
344 ! -- INNER ITERATION
345 inner: DO iiter = 1, itmax
346 innerit = innerit + 1
347 summary%iter_cnt = summary%iter_cnt + 1
348 !
349 ! -- CALCULATE rho
350 rho = ddot(neq, dhat, 1, d, 1)
351 !
352 ! -- COMPUTE DIRECTIONAL VECTORS
353 IF (iiter == 1) THEN
354 DO n = 1, neq
355 p(n) = d(n)
356 END DO
357 ELSE
358 beta = (rho / rho0) * (alpha0 / omega0)
359 DO n = 1, neq
360 p(n) = d(n) + beta * (p(n) - omega0 * v(n))
361 END DO
362 END IF
363 !
364 ! -- APPLY PRECONDITIONER TO UPDATE PHAT
365 SELECT CASE (ipc)
366 !
367 ! -- ILU0 AND MILU0
368 CASE (ipc_ilu0, ipc_milu0)
369 CALL ims_base_ilu0a(nja, neq, apc, iapc, japc, p, phat)
370 !
371 ! -- ILUT AND MILUT
372 CASE (ipc_ilut, ipc_milut)
373 CALL lusol(neq, p, phat, apc, jlu, iw)
374 END SELECT
375 !
376 ! -- COMPUTE ITERATES
377 !
378 ! -- UPDATE V WITH A AND PHAT
379 call amux(neq, phat, v, a0, ja0, ia0)
380 !
381 ! -- UPDATE alpha WITH DHAT AND V
382 denominator = ddot(neq, dhat, 1, v, 1)
383 denominator = denominator + sign(dprec, denominator)
384 alpha = rho / denominator
385 !
386 ! -- UPDATE Q
387 DO n = 1, neq
388 q(n) = d(n) - alpha * v(n)
389 END DO
390 !
391 ! ! -- CALCULATE INFINITY NORM OF Q - TEST FOR TERMINATION
392 ! ! TERMINATE IF rmax IS LESS THAN MACHINE PRECISION (DPREC)
393 ! rmax = DZERO
394 ! DO n = 1, NEQ
395 ! tv = Q(n)
396 ! IF (ISCL.NE.0 ) tv = tv * RSCALE(n)
397 ! IF (ABS(tv) > ABS(rmax) ) rmax = tv
398 ! END DO
399 ! IF (ABS(rmax).LE.DPREC) THEN
400 ! deltax = DZERO
401 ! DO n = 1, NEQ
402 ! tv = alpha * PHAT(n)
403 ! IF (ISCL.NE.0) THEN
404 ! tv = tv * HSCALE(n)
405 ! END IF
406 ! X(n) = X(n) + tv
407 ! IF (ABS(tv) > ABS(deltax) ) deltax = tv
408 ! END DO
409 ! CALL IMSLINEARSUB_TESTCNVG(ICNVGOPT, ICNVG, INNERIT, &
410 ! deltax, rmax, &
411 ! rmax, EPFACT, DVCLOSE, RCLOSE )
412 ! IF (ICNVG.NE.0 ) EXIT INNER
413 ! END IF
414 !
415 ! -- APPLY PRECONDITIONER TO UPDATE QHAT
416 SELECT CASE (ipc)
417 !
418 ! -- ILU0 AND MILU0
419 CASE (ipc_ilu0, ipc_milu0)
420 CALL ims_base_ilu0a(nja, neq, apc, iapc, japc, q, qhat)
421 !
422 ! -- ILUT AND MILUT
423 CASE (ipc_ilut, ipc_milut)
424 CALL lusol(neq, q, qhat, apc, jlu, iw)
425 END SELECT
426 !
427 ! -- UPDATE T WITH A AND QHAT
428 call amux(neq, qhat, t, a0, ja0, ia0)
429 !
430 ! -- UPDATE omega
431 numerator = ddot(neq, t, 1, q, 1)
432 denominator = ddot(neq, t, 1, t, 1)
433 denominator = denominator + sign(dprec, denominator)
434 omega = numerator / denominator
435 !
436 ! -- UPDATE X AND RESIDUAL
437 deltax = dzero
438 rmax = dzero
439 l2norm = dzero
440 DO im = 1, convnmod
441 summary%dvmax(im) = dzero
442 summary%rmax(im) = dzero
443 END DO
444 im = 1
445 im0 = convmodstart(1)
446 im1 = convmodstart(2)
447 DO n = 1, neq
448 !
449 ! -- determine current model index
450 if (n == im1) then
451 im = im + 1
452 im0 = convmodstart(im)
453 im1 = convmodstart(im + 1)
454 end if
455 !
456 ! -- X AND DX
457 tv = alpha * phat(n) + omega * qhat(n)
458 x(n) = x(n) + tv
459 IF (iscl .NE. 0) THEN
460 tv = tv * hscale(n)
461 END IF
462 IF (abs(tv) > abs(deltax)) THEN
463 deltax = tv
464 xloc = n
465 END IF
466 IF (abs(tv) > abs(summary%dvmax(im))) THEN
467 summary%dvmax(im) = tv
468 summary%locdv(im) = n
469 END IF
470 !
471 ! -- RESIDUAL
472 tv = q(n) - omega * t(n)
473 d(n) = tv
474 IF (iscl .NE. 0) THEN
475 tv = tv * rscale(n)
476 END IF
477 IF (abs(tv) > abs(rmax)) THEN
478 rmax = tv
479 rloc = n
480 END IF
481 IF (abs(tv) > abs(summary%rmax(im))) THEN
482 summary%rmax(im) = tv
483 summary%locr(im) = n
484 END IF
485 l2norm = l2norm + tv * tv
486 END DO
487 l2norm = sqrt(l2norm)
488 !
489 ! -- SAVE SOLVER convergence information dummy variables
490 IF (nconv > 1) THEN !<
491 n = summary%iter_cnt
492 WRITE (cval1, '(g15.7)') alpha
493 WRITE (cval2, '(g15.7)') omega
494 caccel(n) = trim(adjustl(cval1))//','//trim(adjustl(cval2))
495 summary%itinner(n) = iiter
496 DO im = 1, convnmod
497 summary%convdvmax(im, n) = summary%dvmax(im)
498 summary%convlocdv(im, n) = summary%locdv(im)
499 summary%convrmax(im, n) = summary%rmax(im)
500 summary%convlocr(im, n) = summary%locr(im)
501 END DO
502 END IF
503 !
504 ! -- TEST FOR SOLVER CONVERGENCE
505 IF (icnvgopt == 2 .OR. icnvgopt == 3 .OR. icnvgopt == 4) THEN
506 rcnvg = l2norm
507 ELSE
508 rcnvg = rmax
509 END IF
510 CALL ims_base_testcnvg(icnvgopt, icnvg, innerit, &
511 deltax, rcnvg, &
512 l2norm0, epfact, dvclose, rclose)
513 !
514 ! -- CHECK FOR EXACT SOLUTION
515 IF (rcnvg == dzero) icnvg = 1
516 !
517 ! -- CHECK FOR STANDARD CONVERGENCE
518 IF (icnvg .NE. 0) EXIT inner
519 !
520 ! -- CHECK THAT CURRENT AND PREVIOUS rho, alpha, AND omega ARE
521 ! DIFFERENT
522 lsame = is_close(rho, rho0)
523 IF (lsame) THEN
524 EXIT inner
525 END IF
526 lsame = is_close(alpha, alpha0)
527 IF (lsame) THEN
528 EXIT inner
529 END IF
530 lsame = is_close(omega, omega0)
531 IF (lsame) THEN
532 EXIT inner
533 END IF
534 !
535 ! -- RECALCULATE THE RESIDUAL
536 IF (north > 0) THEN
537 lorth = mod(iiter + 1, north) == 0
538 IF (lorth) THEN
539 call ims_base_residual(neq, nja, x, b, d, a0, ia0, ja0)
540 END IF
541 END IF
542 !
543 ! -- exit inner if rho or omega are zero
544 if (rho * omega == dzero) then
545 exit inner
546 end if
547 !
548 ! -- SAVE CURRENT INNER ITERATES
549 rho0 = rho
550 alpha0 = alpha
551 omega0 = omega
552 END DO inner
553 !
554 ! -- RESET ICNVG
555 IF (icnvg < 0) icnvg = 0
real(kind=8) function ddot(n, dx, incx, dy, incy)
Definition blas1_d.f90:296
subroutine lusol(n, y, x, alu, jlu, ju)
Definition ilut.f90:466
subroutine amux(n, x, y, a, ja, ia)
Definition sparsekit.f90:2
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ims_base_calc_order()

subroutine imslinearbasemodule::ims_base_calc_order ( integer(i4b), intent(in) iord,
integer(i4b), intent(in) neq,
integer(i4b), intent(in) nja,
integer(i4b), dimension(neq + 1), intent(in) ia,
integer(i4b), dimension(nja), intent(in) ja,
integer(i4b), dimension(neq), intent(inout) lorder,
integer(i4b), dimension(neq), intent(inout) iorder )

Calculate LORDER and IORDER for reordering.

Parameters
[in]iordreordering option
[in]neqnumber of rows
[in]njanumber of non-zero entries
[in]iarow pointer
[in]jacolumn pointer
[in,out]lorderreorder vector
[in,out]iorderinverse of reorder vector

Definition at line 563 of file ImsLinearBase.f90.

564 ! -- modules
566 ! -- dummy variables
567 integer(I4B), INTENT(IN) :: IORD !< reordering option
568 integer(I4B), INTENT(IN) :: NEQ !< number of rows
569 integer(I4B), INTENT(IN) :: NJA !< number of non-zero entries
570 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA !< row pointer
571 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA !< column pointer
572 integer(I4B), DIMENSION(NEQ), INTENT(INOUT) :: LORDER !< reorder vector
573 integer(I4B), DIMENSION(NEQ), INTENT(INOUT) :: IORDER !< inverse of reorder vector
574 ! -- local variables
575 character(len=LINELENGTH) :: errmsg
576 integer(I4B) :: n
577 integer(I4B) :: nsp
578 integer(I4B), DIMENSION(:), ALLOCATABLE :: iwork0
579 integer(I4B), DIMENSION(:), ALLOCATABLE :: iwork1
580 integer(I4B) :: iflag
581 !
582 ! -- initialize lorder and iorder
583 DO n = 1, neq
584 lorder(n) = izero
585 iorder(n) = izero
586 END DO
587 ! ALLOCATE (iwork0(NEQ))
588 SELECT CASE (iord)
589 CASE (1)
590 CALL genrcm(neq, nja, ia, ja, lorder)
591 CASE (2)
592 nsp = 3 * neq + 4 * nja
593 allocate (iwork0(neq))
594 allocate (iwork1(nsp))
595 CALL ims_odrv(neq, nja, nsp, ia, ja, lorder, iwork0, &
596 iwork1, iflag)
597 IF (iflag .NE. 0) THEN
598 write (errmsg, '(A,1X,A)') &
599 'IMSLINEARSUB_CALC_ORDER error creating minimum degree ', &
600 'order permutation '
601 call store_error(errmsg)
602 END IF
603 !
604 ! -- DEALLOCATE TEMPORARY STORAGE
605 deallocate (iwork0, iwork1)
606 END SELECT
607 !
608 ! -- GENERATE INVERSE OF LORDER
609 DO n = 1, neq
610 iorder(lorder(n)) = n
611 END DO
612 !
613 ! -- terminate if errors occurred
614 if (count_errors() > 0) then
615 call parser%StoreErrorUnit()
616 end if
This module contains simulation methods.
Definition Sim.f90:10
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 genrcm(node_num, adj_num, adj_row, adj, perm)
Definition rcm.f90:1004
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ims_base_cg()

subroutine imslinearbasemodule::ims_base_cg ( integer(i4b), intent(inout) icnvg,
integer(i4b), intent(in) itmax,
integer(i4b), intent(inout) innerit,
integer(i4b), intent(in) neq,
integer(i4b), intent(in) nja,
integer(i4b), intent(in) niapc,
integer(i4b), intent(in) njapc,
integer(i4b), intent(in) ipc,
integer(i4b), intent(in) icnvgopt,
integer(i4b), intent(in) north,
integer(i4b), intent(in) iscl,
real(dp), dimension(*), intent(in) rscale,
real(dp), dimension(*), intent(in) hscale,
real(dp), intent(in) dvclose,
real(dp), intent(in) rclose,
real(dp), intent(in) l2norm0,
real(dp), intent(in) epfact,
integer(i4b), dimension(neq + 1), intent(in) ia0,
integer(i4b), dimension(nja), intent(in) ja0,
real(dp), dimension(nja), intent(in) a0,
integer(i4b), dimension(niapc + 1), intent(in) iapc,
integer(i4b), dimension(njapc), intent(in) japc,
real(dp), dimension(njapc), intent(in) apc,
real(dp), dimension(neq), intent(inout) x,
real(dp), dimension(neq), intent(inout) b,
real(dp), dimension(neq), intent(inout) d,
real(dp), dimension(neq), intent(inout) p,
real(dp), dimension(neq), intent(inout) q,
real(dp), dimension(neq), intent(inout) z,
integer(i4b), intent(in) njlu,
integer(i4b), dimension(niapc), intent(in) iw,
integer(i4b), dimension(njlu), intent(in) jlu,
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 )

Apply the Preconditioned Conjugate Gradient linear accelerator to the current coefficient matrix, right-hand side, using the current dependent-variable.

Parameters
[in,out]icnvgconvergence flag (1) non-convergence (0)
[in]itmaxmaximum number of inner iterations
[in,out]inneritinner iteration count
[in]neqnumber of equations
[in]njanumber of non-zero entries
[in]niapcpreconditioner number of rows
[in]njapcpreconditioner number of non-zero entries
[in]ipcpreconditioner option
[in]icnvgoptflow convergence criteria option
[in]northorthogonalization frequency
[in]isclscaling option
[in]rscalefactor returning the residual to model units
[in]hscalefactor returning the head change to model units
[in]dvclosedependent-variable closure criteria
[in]rcloseflow closure criteria
[in]l2norm0initial L-2 norm for system of equations
[in]epfactfactor for decreasing flow convergence criteria for subsequent Picard iterations
[in]ia0CRS row pointers
[in]ja0CRS column pointers
[in]a0coefficient matrix
[in]iapcpreconditioner CRS row pointers
[in]japcpreconditioner CRS column pointers
[in]apcpreconditioner matrix
[in,out]xdependent-variable vector
[in,out]bright-hand side vector
[in,out]dworking vector
[in,out]pworking vector
[in,out]qworking vector
[in,out]zworking vector
[in]njlupreconditioner length of JLU vector
[in]iwpreconditioner integer working vector
[in]jlupreconditioner JLU working vector
[in]nconvmaximum number of inner iterations in a time step (maxiter * maxinner)
[in]convnmodnumber of models in the solution
[in,out]convmodstartpointer to the start of each model in the convmod* arrays
[in,out]caccelconvergence string
[in]summaryConvergence summary report

Definition at line 31 of file ImsLinearBase.f90.

40 ! -- dummy variables
41 integer(I4B), INTENT(INOUT) :: ICNVG !< convergence flag (1) non-convergence (0)
42 integer(I4B), INTENT(IN) :: ITMAX !< maximum number of inner iterations
43 integer(I4B), INTENT(INOUT) :: INNERIT !< inner iteration count
44 integer(I4B), INTENT(IN) :: NEQ !< number of equations
45 integer(I4B), INTENT(IN) :: NJA !< number of non-zero entries
46 integer(I4B), INTENT(IN) :: NIAPC !< preconditioner number of rows
47 integer(I4B), INTENT(IN) :: NJAPC !< preconditioner number of non-zero entries
48 integer(I4B), INTENT(IN) :: IPC !< preconditioner option
49 integer(I4B), INTENT(IN) :: ICNVGOPT !< flow convergence criteria option
50 integer(I4B), INTENT(IN) :: NORTH !< orthogonalization frequency
51 integer(I4B), INTENT(IN) :: ISCL !< scaling option
52 real(DP), DIMENSION(*), INTENT(IN) :: RSCALE !< factor returning the residual to model units
53 real(DP), DIMENSION(*), INTENT(IN) :: HSCALE !< factor returning the head change to model units
54 real(DP), INTENT(IN) :: DVCLOSE !< dependent-variable closure criteria
55 real(DP), INTENT(IN) :: RCLOSE !< flow closure criteria
56 real(DP), INTENT(IN) :: L2NORM0 !< initial L-2 norm for system of equations
57 real(DP), INTENT(IN) :: EPFACT !< factor for decreasing flow convergence criteria for subsequent Picard iterations
58 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA0 !< CRS row pointers
59 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA0 !< CRS column pointers
60 real(DP), DIMENSION(NJA), INTENT(IN) :: A0 !< coefficient matrix
61 integer(I4B), DIMENSION(NIAPC + 1), INTENT(IN) :: IAPC !< preconditioner CRS row pointers
62 integer(I4B), DIMENSION(NJAPC), INTENT(IN) :: JAPC !< preconditioner CRS column pointers
63 real(DP), DIMENSION(NJAPC), INTENT(IN) :: APC !< preconditioner matrix
64 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: X !< dependent-variable vector
65 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: B !< right-hand side vector
66 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: D !< working vector
67 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: P !< working vector
68 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: Q !< working vector
69 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: Z !< working vector
70 ! -- ILUT dummy variables
71 integer(I4B), INTENT(IN) :: NJLU !< preconditioner length of JLU vector
72 integer(I4B), DIMENSION(NIAPC), INTENT(IN) :: IW !< preconditioner integer working vector
73 integer(I4B), DIMENSION(NJLU), INTENT(IN) :: JLU !< preconditioner JLU working vector
74 ! -- convergence information dummy variables dummy variables
75 integer(I4B), INTENT(IN) :: NCONV !< maximum number of inner iterations in a time step (maxiter * maxinner)
76 integer(I4B), INTENT(IN) :: CONVNMOD !< number of models in the solution
77 integer(I4B), DIMENSION(CONVNMOD + 1), INTENT(INOUT) :: CONVMODSTART !< pointer to the start of each model in the convmod* arrays
78 character(len=31), DIMENSION(NCONV), INTENT(INOUT) :: CACCEL !< convergence string
79 type(ConvergenceSummaryType), pointer, intent(in) :: summary !< Convergence summary report
80 ! -- local variables
81 LOGICAL :: lorth
82 logical :: lsame
83 character(len=31) :: cval
84 integer(I4B) :: n
85 integer(I4B) :: iiter
86 integer(I4B) :: xloc, rloc
87 integer(I4B) :: im, im0, im1
88 real(DP) :: ddot
89 real(DP) :: tv
90 real(DP) :: deltax
91 real(DP) :: rmax
92 real(DP) :: l2norm
93 real(DP) :: rcnvg
94 real(DP) :: denominator
95 real(DP) :: alpha, beta
96 real(DP) :: rho, rho0
97 !
98 ! -- initialize local variables
99 rho0 = dzero
100 rho = dzero
101 innerit = 0
102 !
103 ! -- INNER ITERATION
104 inner: DO iiter = 1, itmax
105 innerit = innerit + 1
106 summary%iter_cnt = summary%iter_cnt + 1
107 !
108 ! -- APPLY PRECONDITIONER
109 SELECT CASE (ipc)
110 !
111 ! -- ILU0 AND MILU0
112 CASE (ipc_ilu0, ipc_milu0)
113 CALL ims_base_ilu0a(nja, neq, apc, iapc, japc, d, z)
114 !
115 ! -- ILUT AND MILUT
116 CASE (ipc_ilut, ipc_milut)
117 CALL lusol(neq, d, z, apc, jlu, iw)
118 END SELECT
119 rho = ddot(neq, d, 1, z, 1)
120 !
121 ! -- COMPUTE DIRECTIONAL VECTORS
122 IF (iiter == 1) THEN
123 DO n = 1, neq
124 p(n) = z(n)
125 END DO
126 ELSE
127 beta = rho / rho0
128 DO n = 1, neq
129 p(n) = z(n) + beta * p(n)
130 END DO
131 END IF
132 !
133 ! -- COMPUTE ITERATES
134 !
135 ! -- UPDATE Q
136 call amux(neq, p, q, a0, ja0, ia0)
137 denominator = ddot(neq, p, 1, q, 1)
138 denominator = denominator + sign(dprec, denominator)
139 alpha = rho / denominator
140 !
141 ! -- UPDATE X AND RESIDUAL
142 deltax = dzero
143 rmax = dzero
144 l2norm = dzero
145 DO im = 1, convnmod
146 summary%locdv(im) = 0
147 summary%dvmax(im) = dzero
148 summary%locr(im) = 0
149 summary%rmax(im) = dzero
150 END DO
151 im = 1
152 im0 = convmodstart(1)
153 im1 = convmodstart(2)
154 DO n = 1, neq
155 !
156 ! -- determine current model index
157 if (n == im1) then
158 im = im + 1
159 im0 = convmodstart(im)
160 im1 = convmodstart(im + 1)
161 end if
162 !
163 ! -- identify deltax and rmax
164 tv = alpha * p(n)
165 x(n) = x(n) + tv
166 IF (iscl /= 0) tv = tv * hscale(n)
167 IF (abs(tv) > abs(deltax)) THEN
168 deltax = tv
169 xloc = n
170 END IF
171 IF (abs(tv) > abs(summary%dvmax(im))) THEN
172 summary%dvmax(im) = tv
173 summary%locdv(im) = n
174 END IF
175 tv = d(n)
176 tv = tv - alpha * q(n)
177 d(n) = tv
178 IF (iscl /= 0) tv = tv * rscale(n)
179 IF (abs(tv) > abs(rmax)) THEN
180 rmax = tv
181 rloc = n
182 END IF
183 IF (abs(tv) > abs(summary%rmax(im))) THEN
184 summary%rmax(im) = tv
185 summary%locr(im) = n
186 END IF
187 l2norm = l2norm + tv * tv
188 END DO
189 l2norm = sqrt(l2norm)
190 !
191 ! -- SAVE SOLVER convergence information dummy variables
192 IF (nconv > 1) THEN !<
193 n = summary%iter_cnt
194 WRITE (cval, '(g15.7)') alpha
195 caccel(n) = cval
196 summary%itinner(n) = iiter
197 DO im = 1, convnmod
198 summary%convlocdv(im, n) = summary%locdv(im)
199 summary%convlocr(im, n) = summary%locr(im)
200 summary%convdvmax(im, n) = summary%dvmax(im)
201 summary%convrmax(im, n) = summary%rmax(im)
202 END DO
203 END IF
204 !
205 ! -- TEST FOR SOLVER CONVERGENCE
206 IF (icnvgopt == 2 .OR. icnvgopt == 3 .OR. icnvgopt == 4) THEN
207 rcnvg = l2norm
208 ELSE
209 rcnvg = rmax
210 END IF
211 CALL ims_base_testcnvg(icnvgopt, icnvg, innerit, &
212 deltax, rcnvg, &
213 l2norm0, epfact, dvclose, rclose)
214 !
215 ! -- CHECK FOR EXACT SOLUTION
216 IF (rcnvg == dzero) icnvg = 1
217 !
218 ! -- CHECK FOR STANDARD CONVERGENCE
219 IF (icnvg .NE. 0) EXIT inner
220 !
221 ! -- CHECK THAT CURRENT AND PREVIOUS rho ARE DIFFERENT
222 lsame = is_close(rho, rho0)
223 IF (lsame) THEN
224 EXIT inner
225 END IF
226 !
227 ! -- RECALCULATE THE RESIDUAL
228 IF (north > 0) THEN
229 lorth = mod(iiter + 1, north) == 0
230 IF (lorth) THEN
231 call ims_base_residual(neq, nja, x, b, d, a0, ia0, ja0)
232 END IF
233 END IF
234 !
235 ! -- exit inner if rho is zero
236 if (rho == dzero) then
237 exit inner
238 end if
239 !
240 ! -- SAVE CURRENT INNER ITERATES
241 rho0 = rho
242 END DO inner
243 !
244 ! -- RESET ICNVG
245 IF (icnvg < 0) icnvg = 0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ims_base_cnvg_scale()

subroutine imslinearbasemodule::ims_base_cnvg_scale ( integer(i4b), intent(in) neq,
integer(i4b), intent(in) iord,
real(dp), dimension(neq), intent(in) dscale,
real(dp), dimension(neq), intent(in) dscale2,
integer(i4b), dimension(*), intent(inout) lorder,
real(dp), dimension(neq), intent(inout) rscale,
real(dp), dimension(neq), intent(inout) hscale )
Parameters
[in]neqnumber of equations
[in]iordreordering option
[in]dscalefirst scaling vector
[in]dscale2second scaling vector
[in,out]lorderreordering mapping
[in,out]rscaleresidual factor
[in,out]hscalehead change factor

Definition at line 766 of file ImsLinearBase.f90.

768 ! -- dummy variables
769 integer(I4B), INTENT(IN) :: NEQ !< number of equations
770 integer(I4B), INTENT(IN) :: IORD !< reordering option
771 real(DP), DIMENSION(NEQ), INTENT(IN) :: DSCALE !< first scaling vector
772 real(DP), DIMENSION(NEQ), INTENT(IN) :: DSCALE2 !< second scaling vector
773 integer(I4B), DIMENSION(*), INTENT(INOUT) :: LORDER !< reordering mapping
774 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: RSCALE !< residual factor
775 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: HSCALE !< head change factor
776 ! -- local variables
777 integer(I4B) :: n
778 !
779 DO n = 1, neq
780 rscale(n) = done / dscale(n)
781 hscale(n) = dscale2(n)
782 END DO
783 IF (iord /= 0) THEN
784 CALL dvperm(neq, rscale, lorder)
785 CALL dvperm(neq, hscale, lorder)
786 END IF
subroutine dvperm(n, x, perm)
Definition sparsekit.f90:62
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ims_base_epfact()

real(dp) function imslinearbasemodule::ims_base_epfact ( integer(i4b) icnvgopt,
integer(i4b) kstp )
Parameters
icnvgoptIMS convergence option
kstptime step number
Returns
factor for decreasing convergence criteria in subsequent Picard iterations

Definition at line 1361 of file ImsLinearBase.f90.

1362 integer(I4B) :: icnvgopt !< IMS convergence option
1363 integer(I4B) :: kstp !< time step number
1364 real(DP) :: epfact !< factor for decreasing convergence criteria in subsequent Picard iterations
1365
1366 if (icnvgopt == 2) then
1367 if (kstp == 1) then
1368 epfact = 0.01
1369 else
1370 epfact = 0.10
1371 end if
1372 else if (icnvgopt == 4) then
1373 epfact = dem4
1374 else
1375 epfact = done
1376 end if
1377
Here is the caller graph for this function:

◆ ims_base_ilu0a()

subroutine imslinearbasemodule::ims_base_ilu0a ( integer(i4b), intent(in) nja,
integer(i4b), intent(in) neq,
real(dp), dimension(nja), intent(in) apc,
integer(i4b), dimension(neq + 1), intent(in) iapc,
integer(i4b), dimension(nja), intent(in) japc,
real(dp), dimension(neq), intent(in) r,
real(dp), dimension(neq), intent(inout) d )

Apply the ILU0 and MILU0 preconditioners to the passed vector (R).

Parameters
[in]njanumber of non-zero entries
[in]neqnumber of equations
[in]apcILU0/MILU0 preconditioner matrix
[in]iapcILU0/MILU0 preconditioner CRS row pointers
[in]japcILU0/MILU0 preconditioner CRS column pointers
[in]rinput vector
[in,out]doutput vector after applying APC to R

Definition at line 1096 of file ImsLinearBase.f90.

1097 ! -- dummy variables
1098 integer(I4B), INTENT(IN) :: NJA !< number of non-zero entries
1099 integer(I4B), INTENT(IN) :: NEQ !< number of equations
1100 real(DP), DIMENSION(NJA), INTENT(IN) :: APC !< ILU0/MILU0 preconditioner matrix
1101 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IAPC !< ILU0/MILU0 preconditioner CRS row pointers
1102 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JAPC !< ILU0/MILU0 preconditioner CRS column pointers
1103 real(DP), DIMENSION(NEQ), INTENT(IN) :: R !< input vector
1104 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: D !< output vector after applying APC to R
1105 ! -- local variables
1106 integer(I4B) :: ic0, ic1
1107 integer(I4B) :: iu
1108 integer(I4B) :: jcol
1109 integer(I4B) :: j, n
1110 real(DP) :: tv
1111 !
1112 ! -- FORWARD SOLVE - APC * D = R
1113 forward: DO n = 1, neq
1114 tv = r(n)
1115 ic0 = iapc(n)
1116 ic1 = iapc(n + 1) - 1
1117 iu = japc(n) - 1
1118 lower: DO j = ic0, iu
1119 jcol = japc(j)
1120 tv = tv - apc(j) * d(jcol)
1121 END DO lower
1122 d(n) = tv
1123 END DO forward
1124 !
1125 ! -- BACKWARD SOLVE - D = D / U, WITH THE NEAREST COLUMN SUBTRACTED
1126 ! LAST TO SHORTEN THE DEPENDENCY CHAIN
1127 backward: DO n = neq, 1, -1
1128 ic1 = iapc(n + 1) - 1
1129 iu = japc(n)
1130 tv = d(n) * apc(n)
1131 upper: DO j = ic1, iu, -1
1132 jcol = japc(j)
1133 tv = tv - apc(j) * d(jcol)
1134 END DO upper
1135 d(n) = tv
1136 END DO backward
Here is the caller graph for this function:

◆ ims_base_isort()

subroutine imslinearbasemodule::ims_base_isort ( integer(i4b), intent(in) nval,
integer(i4b), dimension(nval), intent(inout) iarray )

Subroutine sort an integer array in-place.

Parameters
[in]nvallength of the integer array
[in,out]iarrayinteger array to be sorted

Definition at line 1313 of file ImsLinearBase.f90.

1314 ! -- dummy variables
1315 integer(I4B), INTENT(IN) :: NVAL !< length of the integer array
1316 integer(I4B), DIMENSION(NVAL), INTENT(INOUT) :: IARRAY !< integer array to be sorted
1317 ! -- local variables
1318 integer(I4B) :: i, j, itemp
1319 ! -- code
1320 DO i = 1, nval - 1
1321 DO j = i + 1, nval
1322 if (iarray(i) > iarray(j)) then
1323 itemp = iarray(j)
1324 iarray(j) = iarray(i)
1325 iarray(i) = itemp
1326 END IF
1327 END DO
1328 END DO
Here is the caller graph for this function:

◆ ims_base_jaca()

subroutine imslinearbasemodule::ims_base_jaca ( integer(i4b), intent(in) neq,
real(dp), dimension(neq), intent(in) a,
real(dp), dimension(neq), intent(in) d1,
real(dp), dimension(neq), intent(inout) d2 )

Apply the Jacobi preconditioner and return the resultant vector.

Parameters
[in]neqnumber of equations
[in]aJacobi preconditioner
[in]d1input vector
[in,out]d2resultant vector

Definition at line 945 of file ImsLinearBase.f90.

946 ! -- dummy variables
947 integer(I4B), INTENT(IN) :: NEQ !< number of equations
948 real(DP), DIMENSION(NEQ), INTENT(IN) :: A !< Jacobi preconditioner
949 real(DP), DIMENSION(NEQ), INTENT(IN) :: D1 !< input vector
950 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: D2 !< resultant vector
951 ! -- local variables
952 integer(I4B) :: n
953 real(DP) :: tv
954 ! -- code
955 DO n = 1, neq
956 tv = a(n) * d1(n)
957 d2(n) = tv
958 END DO

◆ ims_base_pccrs()

subroutine imslinearbasemodule::ims_base_pccrs ( integer(i4b), intent(in) neq,
integer(i4b), intent(in) nja,
integer(i4b), dimension(neq + 1), intent(in) ia,
integer(i4b), dimension(nja), intent(in) ja,
integer(i4b), dimension(neq + 1), intent(inout) iapc,
integer(i4b), dimension(nja), intent(inout) japc )

Generate the CRS row and column pointers for the preconditioner. JAPC(1:NEQ) hHas the position of the upper entry for a row, JAPC(NEQ+1:NJA) is the column position for entry, APC(1:NEQ) is the preconditioned inverse of the diagonal, and APC(NEQ+1:NJA) are the preconditioned entries for off diagonals.

Definition at line 1252 of file ImsLinearBase.f90.

1254 ! -- dummy variables
1255 integer(I4B), INTENT(IN) :: NEQ !<
1256 integer(I4B), INTENT(IN) :: NJA !<
1257 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA !<
1258 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA !<
1259 integer(I4B), DIMENSION(NEQ + 1), INTENT(INOUT) :: IAPC !<
1260 integer(I4B), DIMENSION(NJA), INTENT(INOUT) :: JAPC !<
1261 ! -- local variables
1262 integer(I4B) :: n, j
1263 integer(I4B) :: i0, i1
1264 integer(I4B) :: nlen
1265 integer(I4B) :: ic, ip
1266 integer(I4B) :: jcol
1267 integer(I4B), DIMENSION(:), ALLOCATABLE :: iarr
1268 ! -- code
1269 ip = neq + 1
1270 DO n = 1, neq
1271 i0 = ia(n)
1272 i1 = ia(n + 1) - 1
1273 nlen = i1 - i0
1274 ALLOCATE (iarr(nlen))
1275 ic = 0
1276 DO j = i0, i1
1277 jcol = ja(j)
1278 IF (jcol == n) cycle
1279 ic = ic + 1
1280 iarr(ic) = jcol
1281 END DO
1282 CALL ims_base_isort(nlen, iarr)
1283 iapc(n) = ip
1284 DO j = 1, nlen
1285 jcol = iarr(j)
1286 japc(ip) = jcol
1287 ip = ip + 1
1288 END DO
1289 DEALLOCATE (iarr)
1290 END DO
1291 iapc(neq + 1) = nja + 1
1292 !
1293 ! -- POSITION OF THE FIRST UPPER ENTRY FOR ROW
1294 DO n = 1, neq
1295 i0 = iapc(n)
1296 i1 = iapc(n + 1) - 1
1297 japc(n) = iapc(n + 1)
1298 DO j = i0, i1
1299 jcol = japc(j)
1300 IF (jcol > n) THEN
1301 japc(n) = j
1302 EXIT
1303 END IF
1304 END DO
1305 END DO
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ims_base_pcilu0()

subroutine imslinearbasemodule::ims_base_pcilu0 ( integer(i4b), intent(in) nja,
integer(i4b), intent(in) neq,
real(dp), dimension(nja), intent(in) amat,
integer(i4b), dimension(neq + 1), intent(in) ia,
integer(i4b), dimension(nja), intent(in) ja,
real(dp), dimension(nja), intent(inout) apc,
integer(i4b), dimension(neq + 1), intent(inout) iapc,
integer(i4b), dimension(nja), intent(inout) japc,
integer(i4b), dimension(neq), intent(inout) iw,
real(dp), dimension(neq), intent(inout) w,
real(dp), intent(in) relax,
integer(i4b), intent(inout) ipcflag,
real(dp), intent(in) delta )

Update the ILU0 preconditioner using the current coefficient matrix.

Parameters
[in]njanumber of non-zero entries
[in]neqnumber of equations
[in]amatcoefficient matrix
[in]iaCRS row pointers
[in]jaCRS column pointers
[in,out]apcpreconditioned matrix
[in,out]iapcpreconditioner CRS row pointers
[in,out]japcpreconditioner CRS column pointers
[in,out]iwpreconditioner integer work vector
[in,out]wpreconditioner work vector
[in]relaxMILU0 preconditioner relaxation factor
[in,out]ipcflagpreconditioner error flag
[in]deltafactor used to correct non-diagonally dominant matrices

Definition at line 966 of file ImsLinearBase.f90.

969 ! -- dummy variables
970 integer(I4B), INTENT(IN) :: NJA !< number of non-zero entries
971 integer(I4B), INTENT(IN) :: NEQ !< number of equations
972 real(DP), DIMENSION(NJA), INTENT(IN) :: AMAT !< coefficient matrix
973 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA !< CRS row pointers
974 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA !< CRS column pointers
975 real(DP), DIMENSION(NJA), INTENT(INOUT) :: APC !< preconditioned matrix
976 integer(I4B), DIMENSION(NEQ + 1), INTENT(INOUT) :: IAPC !< preconditioner CRS row pointers
977 integer(I4B), DIMENSION(NJA), INTENT(INOUT) :: JAPC !< preconditioner CRS column pointers
978 integer(I4B), DIMENSION(NEQ), INTENT(INOUT) :: IW !< preconditioner integer work vector
979 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: W !< preconditioner work vector
980 real(DP), INTENT(IN) :: RELAX !< MILU0 preconditioner relaxation factor
981 integer(I4B), INTENT(INOUT) :: IPCFLAG !< preconditioner error flag
982 real(DP), INTENT(IN) :: DELTA !< factor used to correct non-diagonally dominant matrices
983 ! -- local variables
984 integer(I4B) :: ic0, ic1
985 integer(I4B) :: iic0, iic1
986 integer(I4B) :: iu, iiu
987 integer(I4B) :: j, n
988 integer(I4B) :: jj
989 integer(I4B) :: jcol, jw
990 integer(I4B) :: jjcol
991 real(DP) :: drelax
992 real(DP) :: sd1
993 real(DP) :: tl
994 real(DP) :: rs
995 real(DP) :: d
996 !
997 ! -- initialize local variables
998 drelax = relax
999 DO n = 1, neq
1000 iw(n) = 0
1001 w(n) = dzero
1002 END DO
1003 main: DO n = 1, neq
1004 ic0 = ia(n)
1005 ic1 = ia(n + 1) - 1
1006 DO j = ic0, ic1
1007 jcol = ja(j)
1008 iw(jcol) = 1
1009 w(jcol) = w(jcol) + amat(j)
1010 END DO
1011 ic0 = iapc(n)
1012 ic1 = iapc(n + 1) - 1
1013 iu = japc(n)
1014 rs = dzero
1015 lower: DO j = ic0, iu - 1
1016 jcol = japc(j)
1017 iic0 = iapc(jcol)
1018 iic1 = iapc(jcol + 1) - 1
1019 iiu = japc(jcol)
1020 tl = w(jcol) * apc(jcol)
1021 w(jcol) = tl
1022 DO jj = iiu, iic1
1023 jjcol = japc(jj)
1024 jw = iw(jjcol)
1025 IF (jw .NE. 0) THEN
1026 w(jjcol) = w(jjcol) - tl * apc(jj)
1027 ELSE
1028 rs = rs + tl * apc(jj)
1029 END IF
1030 END DO
1031 END DO lower
1032 !
1033 ! -- DIAGONAL - CALCULATE INVERSE OF DIAGONAL FOR SOLUTION
1034 d = w(n)
1035 tl = (done + delta) * d - (drelax * rs)
1036 !
1037 ! -- ENSURE THAT THE SIGN OF THE DIAGONAL HAS NOT CHANGED AND IS
1038 sd1 = sign(d, tl)
1039 IF (sd1 .NE. d) THEN
1040 !
1041 ! -- USE SMALL VALUE IF DIAGONAL SCALING IS NOT EFFECTIVE FOR
1042 ! PIVOTS THAT CHANGE THE SIGN OF THE DIAGONAL
1043 IF (ipcflag > 1) THEN
1044 tl = sign(dem6, d)
1045 !
1046 ! -- DIAGONAL SCALING CONTINUES TO BE EFFECTIVE
1047 ELSE
1048 ipcflag = 1
1049 EXIT main
1050 END IF
1051 END IF
1052 IF (abs(tl) == dzero) THEN
1053 !
1054 ! -- USE SMALL VALUE IF DIAGONAL SCALING IS NOT EFFECTIVE FOR
1055 ! ZERO PIVOTS
1056 IF (ipcflag > 1) THEN
1057 tl = sign(dem6, d)
1058 !
1059 ! -- DIAGONAL SCALING CONTINUES TO BE EFFECTIVE FOR ELIMINATING
1060 ELSE
1061 ipcflag = 1
1062 EXIT main
1063 END IF
1064 END IF
1065 apc(n) = done / tl
1066 !
1067 ! -- RESET POINTER FOR IW TO ZERO
1068 iw(n) = 0
1069 w(n) = dzero
1070 DO j = ic0, ic1
1071 jcol = japc(j)
1072 apc(j) = w(jcol)
1073 iw(jcol) = 0
1074 w(jcol) = dzero
1075 END DO
1076 END DO main
1077 !
1078 ! -- AFTER SUCCESSFUL COMPLETION OF MAIN, WHICH LEAVES n = NEQ + 1, SCALE
1079 ! THE UPPER ENTRIES BY THE INVERSE OF THE DIAGONAL AND RESET IPCFLAG;
1080 ! AFTER EXIT MAIN IPCFLAG STAYS 1 SO THE CALLER RETRIES
1081 IF (n > neq) THEN
1082 DO n = 1, neq
1083 DO j = japc(n), iapc(n + 1) - 1
1084 apc(j) = apc(j) * apc(n)
1085 END DO
1086 END DO
1087 ipcflag = 0
1088 END IF
Here is the caller graph for this function:

◆ ims_base_pcjac()

subroutine imslinearbasemodule::ims_base_pcjac ( integer(i4b), intent(in) nja,
integer(i4b), intent(in) neq,
real(dp), dimension(nja), intent(in) amat,
real(dp), dimension(neq), intent(inout) apc,
integer(i4b), dimension(neq + 1), intent(in) ia,
integer(i4b), dimension(nja), intent(in) ja )

Calculate the Jacobi preconditioner (inverse of the diagonal) using the current coefficient matrix.

Parameters
[in]njanumber of non-zero entries
[in]neqnumber of equations
[in]amatcoefficient matrix
[in,out]apcpreconditioner matrix
[in]iaCRS row pointers
[in]jaCRS column pointers

Definition at line 910 of file ImsLinearBase.f90.

911 ! -- dummy variables
912 integer(I4B), INTENT(IN) :: NJA !< number of non-zero entries
913 integer(I4B), INTENT(IN) :: NEQ !< number of equations
914 real(DP), DIMENSION(NJA), INTENT(IN) :: AMAT !< coefficient matrix
915 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: APC !< preconditioner matrix
916 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA !< CRS row pointers
917 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA !< CRS column pointers
918 ! -- local variables
919 integer(I4B) :: i, n
920 integer(I4B) :: ic0, ic1
921 integer(I4B) :: id
922 real(DP) :: tv
923 ! -- code
924 DO n = 1, neq
925 ic0 = ia(n)
926 ic1 = ia(n + 1) - 1
927 id = ia(n)
928 DO i = ic0, ic1
929 IF (ja(i) == n) THEN
930 id = i
931 EXIT
932 END IF
933 END DO
934 tv = amat(id)
935 IF (abs(tv) > dzero) tv = done / tv
936 apc(n) = tv
937 END DO

◆ ims_base_pcu()

subroutine imslinearbasemodule::ims_base_pcu ( integer(i4b), intent(in) iout,
integer(i4b), intent(in) nja,
integer(i4b), intent(in) neq,
integer(i4b), intent(in) niapc,
integer(i4b), intent(in) njapc,
integer(i4b), intent(in) ipc,
real(dp), intent(in) relax,
real(dp), dimension(nja), intent(in) amat,
integer(i4b), dimension(neq + 1), intent(in) ia,
integer(i4b), dimension(nja), intent(in) ja,
real(dp), dimension(njapc), intent(inout) apc,
integer(i4b), dimension(niapc + 1), intent(inout) iapc,
integer(i4b), dimension(njapc), intent(inout) japc,
integer(i4b), dimension(niapc), intent(inout) iw,
real(dp), dimension(niapc), intent(inout) w,
integer(i4b), intent(in) level,
real(dp), intent(in) droptol,
integer(i4b), intent(in) njlu,
integer(i4b), intent(in) njw,
integer(i4b), intent(in) nwlu,
integer(i4b), dimension(njlu), intent(inout) jlu,
integer(i4b), dimension(njw), intent(inout) jw,
real(dp), dimension(nwlu), intent(inout) wlu )

Update the preconditioner using the current coefficient matrix.

Parameters
[in]ioutsimulation listing file unit
[in]njanumber of non-zero entries
[in]neqnumber of equations
[in]niapcpreconditioner number of rows
[in]njapcpreconditioner number of non-zero entries
[in]ipcpreconditioner (1) ILU0 (2) MILU0 (3) ILUT (4) MILUT
[in]relaxpreconditioner relaxation factor for MILU0 and MILUT
[in]amatcoefficient matrix
[in]iaCRS row pointers
[in]jaCRS column pointers
[in,out]apcpreconditioner matrix
[in,out]iapcpreconditioner CRS row pointers
[in,out]japcpreconditioner CRS column pointers
[in,out]iwpreconditioner integer work vector
[in,out]wpreconditioner work vector
[in]levelnumber of levels of fill for ILUT and MILUT
[in]droptoldrop tolerance
[in]njlulength of JLU working vector
[in]njwlength of JW working vector
[in]nwlulength of WLU working vector
[in,out]jluILUT/MILUT JLU working vector
[in,out]jwILUT/MILUT JW working vector
[in,out]wluILUT/MILUT WLU working vector

Definition at line 794 of file ImsLinearBase.f90.

797 ! -- modules
799 ! -- dummy variables
800 integer(I4B), INTENT(IN) :: IOUT !< simulation listing file unit
801 integer(I4B), INTENT(IN) :: NJA !< number of non-zero entries
802 integer(I4B), INTENT(IN) :: NEQ !< number of equations
803 integer(I4B), INTENT(IN) :: NIAPC !< preconditioner number of rows
804 integer(I4B), INTENT(IN) :: NJAPC !< preconditioner number of non-zero entries
805 integer(I4B), INTENT(IN) :: IPC !< preconditioner (1) ILU0 (2) MILU0 (3) ILUT (4) MILUT
806 real(DP), INTENT(IN) :: RELAX !< preconditioner relaxation factor for MILU0 and MILUT
807 real(DP), DIMENSION(NJA), INTENT(IN) :: AMAT !< coefficient matrix
808 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA !< CRS row pointers
809 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA !< CRS column pointers
810 real(DP), DIMENSION(NJAPC), INTENT(INOUT) :: APC !< preconditioner matrix
811 integer(I4B), DIMENSION(NIAPC + 1), INTENT(INOUT) :: IAPC !< preconditioner CRS row pointers
812 integer(I4B), DIMENSION(NJAPC), INTENT(INOUT) :: JAPC !< preconditioner CRS column pointers
813 integer(I4B), DIMENSION(NIAPC), INTENT(INOUT) :: IW !< preconditioner integer work vector
814 real(DP), DIMENSION(NIAPC), INTENT(INOUT) :: W !< preconditioner work vector
815 ! -- ILUT dummy variables
816 integer(I4B), INTENT(IN) :: LEVEL !< number of levels of fill for ILUT and MILUT
817 real(DP), INTENT(IN) :: DROPTOL !< drop tolerance
818 integer(I4B), INTENT(IN) :: NJLU !< length of JLU working vector
819 integer(I4B), INTENT(IN) :: NJW !< length of JW working vector
820 integer(I4B), INTENT(IN) :: NWLU !< length of WLU working vector
821 integer(I4B), DIMENSION(NJLU), INTENT(INOUT) :: JLU !< ILUT/MILUT JLU working vector
822 integer(I4B), DIMENSION(NJW), INTENT(INOUT) :: JW !< ILUT/MILUT JW working vector
823 real(DP), DIMENSION(NWLU), INTENT(INOUT) :: WLU !< ILUT/MILUT WLU working vector
824 ! -- local variables
825 character(len=LINELENGTH) :: errmsg
826 character(len=100), dimension(5), parameter :: cerr = &
827 ["Elimination process has generated a row in L or U whose length is > n.", &
828 &"The matrix L overflows the array al. ", &
829 &"The matrix U overflows the array alu. ", &
830 &"Illegal value for lfil. ", &
831 &"Zero row encountered. "]
832 integer(i4b) :: ipcflag
833 integer(I4B) :: icount
834 integer(I4B) :: ierr
835 real(DP) :: delta
836 ! -- formats
8372000 FORMAT(/, ' MATRIX IS SEVERELY NON-DIAGONALLY DOMINANT.', &
838 /, ' ADDED SMALL VALUE TO PIVOT ', i0, ' TIMES IN', &
839 ' IMSLINEARSUB_PCU.')
840 !
841 ! -- initialize local variables
842 ipcflag = 0
843 icount = 0
844 delta = dzero
845 pcscale: DO
846 SELECT CASE (ipc)
847 !
848 ! -- ILU0 AND MILU0
849 CASE (ipc_ilu0, ipc_milu0)
850 CALL ims_base_pcilu0(nja, neq, amat, ia, ja, &
851 apc, iapc, japc, iw, w, &
852 relax, ipcflag, delta)
853 !
854 ! -- ILUT AND MILUT
855 CASE (ipc_ilut, ipc_milut)
856 ierr = 0
857 CALL ilut(neq, amat, ja, ia, level, droptol, &
858 apc, jlu, iw, njapc, wlu, jw, ierr, &
859 relax, ipcflag, delta)
860 if (ierr /= 0) then
861 if (ierr > 0) then
862 write (errmsg, '(a,1x,i0,1x,a)') &
863 'ILUT: zero pivot encountered at step number', ierr, '.'
864 else
865 write (errmsg, '(a,1x,a)') 'ILUT:', cerr(-ierr)
866 end if
867 call store_error(errmsg)
868 call parser%StoreErrorUnit()
869 end if
870 !
871 ! -- ADDITIONAL PRECONDITIONERS
872 CASE DEFAULT
873 ipcflag = 0
874 END SELECT
875 IF (ipcflag < 1) THEN
876 EXIT pcscale
877 END IF
878 delta = 1.5d0 * delta + dem3
879 ipcflag = 0
880 IF (delta > dhalf) THEN
881 delta = dhalf
882 ipcflag = 2
883 END IF
884 icount = icount + 1
885 !
886 ! -- replace bad pivots on the last attempt so it completes
887 if (icount == 10) then
888 ipcflag = 2
889 end if
890 !
891 ! -- terminate pcscale loop if not making progress
892 if (icount > 10) then
893 exit pcscale
894 end if
895
896 END DO pcscale
897 !
898 ! -- write error message if small value added to pivot
899 if (icount > 0) then
900 write (iout, 2000) icount
901 end if
subroutine ilut(n, a, ja, ia, lfil, droptol, alu, jlu, ju, iwk, w, jw, ierr, relax, izero, delta)
Definition ilut.f90:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ims_base_residual()

subroutine imslinearbasemodule::ims_base_residual ( integer(i4b), intent(in) neq,
integer(i4b), intent(in) nja,
real(dp), dimension(neq), intent(in) x,
real(dp), dimension(neq), intent(in) b,
real(dp), dimension(neq), intent(inout) d,
real(dp), dimension(nja), intent(in) a,
integer(i4b), dimension(neq + 1), intent(in) ia,
integer(i4b), dimension(nja), intent(in) ja )

Subroutine to calculate the residual.

Parameters
[in]neqlength of vectors
[in]njalength of coefficient matrix
[in]xdependent variable
[in]bright-hand side
[in,out]dresidual
[in]acoefficient matrix
[in]iaCRS row pointers
[in]jaCRS column pointers

Definition at line 1336 of file ImsLinearBase.f90.

1337 ! -- dummy variables
1338 integer(I4B), INTENT(IN) :: NEQ !< length of vectors
1339 integer(I4B), INTENT(IN) :: NJA !< length of coefficient matrix
1340 real(DP), DIMENSION(NEQ), INTENT(IN) :: X !< dependent variable
1341 real(DP), DIMENSION(NEQ), INTENT(IN) :: B !< right-hand side
1342 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: D !< residual
1343 real(DP), DIMENSION(NJA), INTENT(IN) :: A !< coefficient matrix
1344 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA !< CRS row pointers
1345 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA !< CRS column pointers
1346 ! -- local variables
1347 integer(I4B) :: n
1348 ! -- code
1349 !
1350 ! -- calculate matrix-vector product
1351 call amux(neq, x, d, a, ja, ia)
1352 !
1353 ! -- subtract matrix-vector product from right-hand side
1354 DO n = 1, neq
1355 d(n) = b(n) - d(n)
1356 END DO
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ims_base_scale()

subroutine imslinearbasemodule::ims_base_scale ( integer(i4b), intent(in) iopt,
integer(i4b), intent(in) iscl,
integer(i4b), intent(in) neq,
integer(i4b), intent(in) nja,
integer(i4b), dimension(neq + 1), intent(in) ia,
integer(i4b), dimension(nja), intent(in) ja,
real(dp), dimension(nja), intent(inout) amat,
real(dp), dimension(neq), intent(inout) x,
real(dp), dimension(neq), intent(inout) b,
real(dp), dimension(neq), intent(inout) dscale,
real(dp), dimension(neq), intent(inout) dscale2 )

Scale the coefficient matrix (AMAT), the right-hand side (B), and the estimate of the dependent variable (X).

Parameters
[in]ioptflag to scale (0) or unscale the system of equations
[in]isclscaling option (1) symmetric (2) L-2 norm
[in]neqnumber of equations
[in]njanumber of non-zero entries
[in]iaCRS row pointer
[in]jaCRS column pointer
[in,out]amatcoefficient matrix
[in,out]xdependent variable
[in,out]bright-hand side
[in,out]dscalefirst scaling vector
[in,out]dscale2second scaling vector

Definition at line 626 of file ImsLinearBase.f90.

628 ! -- dummy variables
629 integer(I4B), INTENT(IN) :: IOPT !< flag to scale (0) or unscale the system of equations
630 integer(I4B), INTENT(IN) :: ISCL !< scaling option (1) symmetric (2) L-2 norm
631 integer(I4B), INTENT(IN) :: NEQ !< number of equations
632 integer(I4B), INTENT(IN) :: NJA !< number of non-zero entries
633 integer(I4B), DIMENSION(NEQ + 1), INTENT(IN) :: IA !< CRS row pointer
634 integer(I4B), DIMENSION(NJA), INTENT(IN) :: JA !< CRS column pointer
635 real(DP), DIMENSION(NJA), INTENT(INOUT) :: AMAT !< coefficient matrix
636 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: X !< dependent variable
637 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: B !< right-hand side
638 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: DSCALE !< first scaling vector
639 real(DP), DIMENSION(NEQ), INTENT(INOUT) :: DSCALE2 !< second scaling vector
640 ! -- local variables
641 integer(I4B) :: i, n
642 integer(I4B) :: id, jc
643 integer(I4B) :: i0, i1
644 real(DP) :: v, c1, c2
645 !
646 ! -- SCALE SCALE AMAT, X, AND B
647 IF (iopt == 0) THEN
648 !
649 ! -- SYMMETRIC SCALING
650 SELECT CASE (iscl)
651 CASE (1)
652 DO n = 1, neq
653 id = ia(n)
654 v = amat(id)
655 c1 = done / sqrt(abs(v))
656 dscale(n) = c1
657 dscale2(n) = c1
658 END DO
659 !
660 ! -- SCALE AMAT -- AMAT = DSCALE(row) * AMAT(i) * DSCALE2(col)
661 DO n = 1, neq
662 c1 = dscale(n)
663 i0 = ia(n)
664 i1 = ia(n + 1) - 1
665 DO i = i0, i1
666 jc = ja(i)
667 c2 = dscale2(jc)
668 amat(i) = c1 * amat(i) * c2
669 END DO
670 END DO
671 !
672 ! -- L-2 NORM SCALING
673 CASE (2)
674 !
675 ! -- SCALE EACH ROW SO THAT THE L-2 NORM IS 1
676 DO n = 1, neq
677 c1 = dzero
678 i0 = ia(n)
679 i1 = ia(n + 1) - 1
680 DO i = i0, i1
681 c1 = c1 + amat(i) * amat(i)
682 END DO
683 c1 = sqrt(c1)
684 IF (c1 == dzero) THEN
685 c1 = done
686 ELSE
687 c1 = done / c1
688 END IF
689 dscale(n) = c1
690 !
691 ! -- INITIAL SCALING OF AMAT -- AMAT = DSCALE(row) * AMAT(i)
692 DO i = i0, i1
693 amat(i) = c1 * amat(i)
694 END DO
695 END DO
696 !
697 ! -- SCALE EACH COLUMN SO THAT THE L-2 NORM IS 1
698 DO n = 1, neq
699 dscale2(n) = dzero
700 END DO
701 c2 = dzero
702 DO n = 1, neq
703 i0 = ia(n)
704 i1 = ia(n + 1) - 1
705 DO i = i0, i1
706 jc = ja(i)
707 c2 = amat(i)
708 dscale2(jc) = dscale2(jc) + c2 * c2
709 END DO
710 END DO
711 DO n = 1, neq
712 c2 = dscale2(n)
713 IF (c2 == dzero) THEN
714 c2 = done
715 ELSE
716 c2 = done / sqrt(c2)
717 END IF
718 dscale2(n) = c2
719 END DO
720 !
721 ! -- FINAL SCALING OF AMAT -- AMAT = DSCALE2(col) * AMAT(i)
722 DO n = 1, neq
723 i0 = ia(n)
724 i1 = ia(n + 1) - 1
725 DO i = i0, i1
726 jc = ja(i)
727 c2 = dscale2(jc)
728 amat(i) = c2 * amat(i)
729 END DO
730 END DO
731 END SELECT
732 !
733 ! -- SCALE X AND B
734 DO n = 1, neq
735 c1 = dscale(n)
736 c2 = dscale2(n)
737 x(n) = x(n) / c2
738 b(n) = b(n) * c1
739 END DO
740 !
741 ! -- UNSCALE SCALE AMAT, X, AND B
742 ELSE
743 DO n = 1, neq
744 c1 = dscale(n)
745 i0 = ia(n)
746 i1 = ia(n + 1) - 1
747 !
748 ! -- UNSCALE AMAT
749 DO i = i0, i1
750 jc = ja(i)
751 c2 = dscale2(jc)
752 amat(i) = (done / c1) * amat(i) * (done / c2)
753 END DO
754 !
755 ! -- UNSCALE X AND B
756 c2 = dscale2(n)
757 x(n) = x(n) * c2
758 b(n) = b(n) / c1
759 END DO
760 END IF
Here is the caller graph for this function:

◆ ims_base_testcnvg()

subroutine imslinearbasemodule::ims_base_testcnvg ( integer(i4b), intent(in) icnvgopt,
integer(i4b), intent(inout) icnvg,
integer(i4b), intent(in) iiter,
real(dp), intent(in) dvmax,
real(dp), intent(in) rmax,
real(dp), intent(in) rmax0,
real(dp), intent(in) epfact,
real(dp), intent(in) dvclose,
real(dp), intent(in) rclose )

General routine for testing for solver convergence based on the user-specified convergence option (Icnvgopt).

Parameters
[in]icnvgoptconvergence option - see documentation for option
[in,out]icnvgflag indicating if convergence achieved (1) or not (0)
[in]iiterinner iteration number (used for strict convergence option)
[in]dvmaxmaximum dependent-variable change
[in]rmaxmaximum flow change
[in]rmax0initial flow change (initial L2-norm)
[in]epfactfactor for reducing convergence criteria in subsequent Picard iterations
[in]dvcloseMaximum depenendent-variable change allowed
[in]rcloseMaximum flow change allowed

Definition at line 1146 of file ImsLinearBase.f90.

1149 ! -- dummy variables
1150 integer(I4B), INTENT(IN) :: Icnvgopt !< convergence option - see documentation for option
1151 integer(I4B), INTENT(INOUT) :: Icnvg !< flag indicating if convergence achieved (1) or not (0)
1152 integer(I4B), INTENT(IN) :: Iiter !< inner iteration number (used for strict convergence option)
1153 real(DP), INTENT(IN) :: Dvmax !< maximum dependent-variable change
1154 real(DP), INTENT(IN) :: Rmax !< maximum flow change
1155 real(DP), INTENT(IN) :: Rmax0 !< initial flow change (initial L2-norm)
1156 real(DP), INTENT(IN) :: Epfact !< factor for reducing convergence criteria in subsequent Picard iterations
1157 real(DP), INTENT(IN) :: Dvclose !< Maximum depenendent-variable change allowed
1158 real(DP), INTENT(IN) :: Rclose !< Maximum flow change allowed
1159 ! -- code
1160 IF (icnvgopt == 0) THEN
1161 IF (abs(dvmax) <= dvclose .AND. abs(rmax) <= rclose) THEN
1162 icnvg = 1
1163 END IF
1164 ELSE IF (icnvgopt == 1) THEN
1165 IF (abs(dvmax) <= dvclose .AND. abs(rmax) <= rclose) THEN
1166 IF (iiter == 1) THEN
1167 icnvg = 1
1168 ELSE
1169 icnvg = -1
1170 END IF
1171 END IF
1172 ELSE IF (icnvgopt == 2) THEN
1173 IF (abs(dvmax) <= dvclose .OR. rmax <= rclose) THEN
1174 icnvg = 1
1175 ELSE IF (rmax <= rmax0 * epfact) THEN
1176 icnvg = -1
1177 END IF
1178 ELSE IF (icnvgopt == 3) THEN
1179 IF (abs(dvmax) <= dvclose) THEN
1180 icnvg = 1
1181 ELSE IF (rmax <= rmax0 * rclose) THEN
1182 icnvg = -1
1183 END IF
1184 ELSE IF (icnvgopt == 4) THEN
1185 IF (abs(dvmax) <= dvclose .AND. rmax <= rclose) THEN
1186 icnvg = 1
1187 ELSE IF (rmax <= rmax0 * epfact) THEN
1188 icnvg = -1
1189 END IF
1190 END IF
Here is the caller graph for this function:

◆ ims_calc_pcdims()

subroutine imslinearbasemodule::ims_calc_pcdims ( integer(i4b), intent(in) neq,
integer(i4b), intent(in) nja,
integer(i4b), dimension(:), intent(in) ia,
integer(i4b), intent(in) level,
integer(i4b), intent(in) ipc,
integer(i4b), intent(inout) niapc,
integer(i4b), intent(inout) njapc,
integer(i4b), intent(inout) njlu,
integer(i4b), intent(inout) njw,
integer(i4b), intent(inout) nwlu )
Parameters
[in]neqnr. of rows A
[in]njanr. of nonzeros A
[in]iaCSR row pointers A
[in]levelfill level ILU
[in]ipcIMS preconditioner type
[in,out]niapcwork array size
[in,out]njapcwork array size
[in,out]njluwork array size
[in,out]njwwork array size
[in,out]nwluwork array size

Definition at line 1193 of file ImsLinearBase.f90.

1195 integer(I4B), intent(in) :: neq !< nr. of rows A
1196 integer(I4B), intent(in) :: nja !< nr. of nonzeros A
1197 integer(I4B), dimension(:), intent(in) :: ia !< CSR row pointers A
1198 integer(I4B), intent(in) :: level !< fill level ILU
1199 integer(I4B), intent(in) :: ipc !< IMS preconditioner type
1200 integer(I4B), intent(inout) :: niapc !< work array size
1201 integer(I4B), intent(inout) :: njapc !< work array size
1202 integer(I4B), intent(inout) :: njlu !< work array size
1203 integer(I4B), intent(inout) :: njw !< work array size
1204 integer(I4B), intent(inout) :: nwlu !< work array size
1205 ! local
1206 integer(I4B) :: n, i
1207 integer(I4B) :: ijlu, ijw, iwlu, iwk
1208
1209 ijlu = 1
1210 ijw = 1
1211 iwlu = 1
1212
1213 ! ILU0 and MILU0
1214 niapc = neq
1215 njapc = nja
1216
1217 ! ILUT and MILUT
1218 if (ipc == 3 .or. ipc == 4) then
1219 niapc = neq
1220 if (level > 0) then
1221 iwk = neq * (level * 2 + 1)
1222 else
1223 iwk = 0
1224 do n = 1, neq
1225 i = ia(n + 1) - ia(n)
1226 if (i > iwk) then
1227 iwk = i
1228 end if
1229 end do
1230 iwk = neq * iwk
1231 end if
1232 njapc = iwk
1233 ijlu = iwk
1234 ijw = 2 * neq
1235 iwlu = neq + 1
1236 end if
1237
1238 njlu = ijlu
1239 njw = ijw
1240 nwlu = iwlu
1241
Here is the caller graph for this function:

Variable Documentation

◆ parser

type(blockparsertype), private imslinearbasemodule::parser
private

Definition at line 20 of file ImsLinearBase.f90.

20 type(BlockParserType), private :: parser