59 character(len=LENMEMPATH) :: memory_path
60 character(len=LINELENGTH) :: fname
61 character(len=16) :: solver_mode
64 integer(I4B),
pointer :: id
65 integer(I4B),
pointer :: iu
66 real(dp),
pointer :: ttform
67 real(dp),
pointer :: ttsoln
68 integer(I4B),
pointer :: isymmetric => null()
69 integer(I4B),
pointer :: neq => null()
70 integer(I4B),
pointer :: matrix_offset => null()
75 real(dp),
dimension(:),
pointer,
contiguous :: rhs => null()
76 real(dp),
dimension(:),
pointer,
contiguous :: x => null()
77 integer(I4B),
dimension(:),
pointer,
contiguous :: active => null()
78 real(dp),
dimension(:),
pointer,
contiguous :: xtemp => null()
82 real(dp),
pointer :: theta => null()
83 real(dp),
pointer :: akappa => null()
84 real(dp),
pointer :: gamma => null()
85 real(dp),
pointer :: amomentum => null()
86 real(dp),
pointer :: breduc => null()
87 real(dp),
pointer :: btol => null()
88 real(dp),
pointer :: res_lim => null()
89 real(dp),
pointer :: dvclose => null()
90 real(dp),
pointer :: bigchold => null()
91 real(dp),
pointer :: bigch => null()
92 real(dp),
pointer :: relaxold => null()
93 real(dp),
pointer :: res_prev => null()
94 real(dp),
pointer :: res_new => null()
95 integer(I4B),
pointer :: icnvg => null()
96 integer(I4B),
pointer :: itertot_timestep => null()
97 integer(I4B),
pointer :: iouttot_timestep => null()
98 integer(I4B),
pointer :: itertot_sim => null()
99 integer(I4B),
pointer :: mxiter => null()
100 integer(I4B),
pointer :: linsolver => null()
101 integer(I4B),
pointer :: nonmeth => null()
102 integer(I4B),
pointer :: numtrack => null()
103 integer(I4B),
pointer :: iprims => null()
104 integer(I4B),
pointer :: ibflag => null()
105 integer(I4B),
dimension(:, :),
pointer,
contiguous :: lrch => null()
106 real(dp),
dimension(:),
pointer,
contiguous :: hncg => null()
107 real(dp),
dimension(:),
pointer,
contiguous :: dxold => null()
108 real(dp),
dimension(:),
pointer,
contiguous :: deold => null()
109 real(dp),
dimension(:),
pointer,
contiguous :: wsave => null()
110 real(dp),
dimension(:),
pointer,
contiguous :: hchold => null()
113 character(len=31),
dimension(:),
pointer,
contiguous :: caccel => null()
114 integer(I4B),
pointer :: icsvouterout => null()
115 integer(I4B),
pointer :: icsvinnerout => null()
116 integer(I4B),
pointer :: nitermax => null()
117 integer(I4B),
pointer :: convnmod => null()
118 integer(I4B),
dimension(:),
pointer,
contiguous :: convmodstart => null()
125 integer(I4B),
pointer :: idv_scale => null()
126 real(dp),
pointer :: dscale => null()
129 integer(I4B),
pointer :: iallowptc => null()
130 integer(I4B),
pointer :: iptcopt => null()
131 integer(I4B),
pointer :: iptcout => null()
132 real(dp),
pointer :: l2norm0 => null()
133 real(dp),
pointer :: ptcdel => null()
134 real(dp),
pointer :: ptcdel0 => null()
135 real(dp),
pointer :: ptcexp => null()
138 integer(I4B) :: tmr_prep_solve
139 integer(I4B) :: tmr_solve
140 integer(I4B) :: tmr_final_solve
141 integer(I4B) :: tmr_formulate
142 integer(I4B) :: tmr_linsolve
143 integer(I4B) :: tmr_flows
144 integer(I4B) :: tmr_budgets
145 character(len=24) :: id_postfix
148 real(dp),
pointer :: atsfrac => null()
161 class(*),
pointer :: synchronize_ctx => null()
224 integer(I4B) :: stage
225 class(*),
pointer :: ctx
244 character(len=*),
intent(in) :: filename
245 integer(I4B),
intent(in) :: id
247 integer(I4B) :: inunit
249 character(len=LENSOLUTIONNAME) :: solutionname
253 write (solutionname,
'(a, i0)')
'SLN_', id
255 num_sol%name = solutionname
257 allocate (num_sol%modellist)
258 allocate (num_sol%exchangelist)
260 call num_sol%allocate_scalars()
269 inquire (file=filename, number=inunit)
271 if (inunit < 0) inunit =
getunit()
273 write (
iout,
'(/a,a)')
' Creating solution: ', num_sol%name
277 call num_sol%parser%Initialize(num_sol%iu,
iout)
294 call mem_allocate(this%ttform,
'TTFORM', this%memory_path)
295 call mem_allocate(this%ttsoln,
'TTSOLN', this%memory_path)
296 call mem_allocate(this%isymmetric,
'ISYMMETRIC', this%memory_path)
298 call mem_allocate(this%matrix_offset,
'MATRIX_OFFSET', this%memory_path)
299 call mem_allocate(this%dvclose,
'DVCLOSE', this%memory_path)
300 call mem_allocate(this%bigchold,
'BIGCHOLD', this%memory_path)
301 call mem_allocate(this%bigch,
'BIGCH', this%memory_path)
302 call mem_allocate(this%relaxold,
'RELAXOLD', this%memory_path)
303 call mem_allocate(this%res_prev,
'RES_PREV', this%memory_path)
304 call mem_allocate(this%res_new,
'RES_NEW', this%memory_path)
305 call mem_allocate(this%icnvg,
'ICNVG', this%memory_path)
306 call mem_allocate(this%itertot_timestep,
'ITERTOT_TIMESTEP', this%memory_path)
307 call mem_allocate(this%iouttot_timestep,
'IOUTTOT_TIMESTEP', this%memory_path)
308 call mem_allocate(this%itertot_sim,
'INNERTOT_SIM', this%memory_path)
309 call mem_allocate(this%mxiter,
'MXITER', this%memory_path)
310 call mem_allocate(this%linsolver,
'LINSOLVER', this%memory_path)
311 call mem_allocate(this%nonmeth,
'NONMETH', this%memory_path)
312 call mem_allocate(this%iprims,
'IPRIMS', this%memory_path)
313 call mem_allocate(this%theta,
'THETA', this%memory_path)
314 call mem_allocate(this%akappa,
'AKAPPA', this%memory_path)
315 call mem_allocate(this%gamma,
'GAMMA', this%memory_path)
316 call mem_allocate(this%amomentum,
'AMOMENTUM', this%memory_path)
317 call mem_allocate(this%breduc,
'BREDUC', this%memory_path)
319 call mem_allocate(this%res_lim,
'RES_LIM', this%memory_path)
320 call mem_allocate(this%numtrack,
'NUMTRACK', this%memory_path)
321 call mem_allocate(this%ibflag,
'IBFLAG', this%memory_path)
322 call mem_allocate(this%icsvouterout,
'ICSVOUTEROUT', this%memory_path)
323 call mem_allocate(this%icsvinnerout,
'ICSVINNEROUT', this%memory_path)
324 call mem_allocate(this%nitermax,
'NITERMAX', this%memory_path)
325 call mem_allocate(this%convnmod,
'CONVNMOD', this%memory_path)
326 call mem_allocate(this%iallowptc,
'IALLOWPTC', this%memory_path)
327 call mem_allocate(this%iptcopt,
'IPTCOPT', this%memory_path)
328 call mem_allocate(this%iptcout,
'IPTCOUT', this%memory_path)
329 call mem_allocate(this%l2norm0,
'L2NORM0', this%memory_path)
330 call mem_allocate(this%ptcdel,
'PTCDEL', this%memory_path)
331 call mem_allocate(this%ptcdel0,
'PTCDEL0', this%memory_path)
332 call mem_allocate(this%ptcexp,
'PTCEXP', this%memory_path)
333 call mem_allocate(this%atsfrac,
'ATSFRAC', this%memory_path)
334 call mem_allocate(this%idv_scale,
'IDV_SCALE', this%memory_path)
335 call mem_allocate(this%dscale,
'DSCALE', this%memory_path)
345 this%bigchold =
dzero
347 this%relaxold =
dzero
348 this%res_prev =
dzero
350 this%itertot_timestep = 0
351 this%iouttot_timestep = 0
360 this%amomentum =
dzero
366 this%icsvouterout = 0
367 this%icsvinnerout = 0
398 this%convnmod = this%modellist%Count()
401 call mem_allocate(this%active, this%neq,
'IACTIVE', this%memory_path)
402 call mem_allocate(this%xtemp, this%neq,
'XTEMP', this%memory_path)
403 call mem_allocate(this%dxold, this%neq,
'DXOLD', this%memory_path)
404 call mem_allocate(this%hncg, 0,
'HNCG', this%memory_path)
405 call mem_allocate(this%lrch, 3, 0,
'LRCH', this%memory_path)
406 call mem_allocate(this%wsave, 0,
'WSAVE', this%memory_path)
407 call mem_allocate(this%hchold, 0,
'HCHOLD', this%memory_path)
408 call mem_allocate(this%deold, 0,
'DEOLD', this%memory_path)
409 call mem_allocate(this%convmodstart, this%convnmod + 1,
'CONVMODSTART', &
414 this%xtemp(i) =
dzero
415 this%dxold(i) =
dzero
421 this%convmodstart(1) = ieq
422 do i = 1, this%modellist%Count()
425 this%convmodstart(i + 1) = ieq
447 integer(I4B),
allocatable,
dimension(:) :: rowmaxnnz
448 integer(I4B) :: ncol, irow_start, irow_end
449 integer(I4B) :: mod_offset
452 do i = 1, this%modellist%Count()
454 call mp%set_idsoln(this%id)
455 this%neq = this%neq + mp%neq
460 this%solver_mode =
'PETSC'
462 this%solver_mode =
'IMS'
466 allocate (this%linear_settings)
470 this%system_matrix => this%linear_solver%create_matrix()
471 this%vec_x => this%system_matrix%create_vec_mm(this%neq,
'X', &
473 this%x => this%vec_x%get_array()
474 this%vec_rhs => this%system_matrix%create_vec_mm(this%neq,
'RHS', &
476 this%rhs => this%vec_rhs%get_array()
478 call this%vec_rhs%get_ownership_range(irow_start, irow_end)
479 ncol = this%vec_rhs%get_size()
483 this%matrix_offset = irow_start - 1
484 do i = 1, this%modellist%Count()
491 call this%allocate_arrays()
494 allocate (this%cnvg_summary)
495 call this%cnvg_summary%init(this%modellist%Count(), this%convmodstart, &
499 do i = 1, this%modellist%Count()
501 call mp%set_xptr(this%x, this%matrix_offset,
'X', this%name)
502 call mp%set_rhsptr(this%rhs, this%matrix_offset,
'RHS', this%name)
503 call mp%set_iboundptr(this%active, this%matrix_offset,
'IBOUND', this%name)
507 allocate (rowmaxnnz(this%neq))
511 call this%sparse%init(this%neq, ncol, rowmaxnnz)
512 this%sparse%offset = this%matrix_offset
513 deallocate (rowmaxnnz)
516 call this%sln_connect()
519 write (this%id_postfix,
'(a,i0,a)')
" (", this%id,
")"
520 this%tmr_prep_solve = -1
522 this%tmr_final_solve = -1
523 this%tmr_formulate = -1
524 this%tmr_linsolve = -1
526 this%tmr_budgets = -1
546 character(len=linelength) :: warnmsg
547 character(len=linelength) :: keyword
548 character(len=linelength) :: fname
549 character(len=linelength) :: msg
551 integer(I4B) :: ifdparam, mxvl, npp
553 logical(LGP) :: isfound, endOfBlock
556 character(len=*),
parameter :: fmtcsvout = &
557 "(4x, 'CSV OUTPUT WILL BE SAVED TO FILE: ', a, &
558 &/4x, 'OPENED ON UNIT: ', I7)"
559 character(len=*),
parameter :: fmtptcout = &
560 "(4x, 'PTC OUTPUT WILL BE SAVED TO FILE: ', a, &
561 &/4x, 'OPENED ON UNIT: ', I7)"
562 character(len=*),
parameter :: fmterrasym = &
563 "(a,' **',a,'** PRODUCES AN ASYMMETRIC COEFFICIENT MATRIX, BUT THE &
564 &CONJUGATE GRADIENT METHOD WAS SELECTED. USE BICGSTAB INSTEAD. ')"
567 WRITE (
iout, 1) this%iu
568 00001
FORMAT(1x, /1x,
'IMS -- ITERATIVE MODEL SOLUTION PACKAGE, VERSION 6', &
569 ', 4/28/2017', /, 9x,
'INPUT READ FROM UNIT', i5)
578 call this%parser%GetBlock(
'OPTIONS', isfound, ierr, &
579 supportopenclose=.true., blockrequired=.false.)
583 write (
iout,
'(/1x,a)')
'PROCESSING IMS OPTIONS'
585 call this%parser%GetNextLine(endofblock)
587 call this%parser%GetStringCaps(keyword)
588 select case (keyword)
589 case (
'PRINT_OPTION')
590 call this%parser%GetStringCaps(keyword)
591 if (keyword .eq.
'NONE')
then
593 else if (keyword .eq.
'SUMMARY')
then
595 else if (keyword .eq.
'ALL')
then
598 write (errmsg,
'(3a)') &
599 'Unknown IMS print option (', trim(keyword),
').'
603 call this%parser%GetStringCaps(keyword)
604 if (keyword .eq.
'SIMPLE')
then
607 else if (keyword .eq.
'MODERATE')
then
610 else if (keyword .eq.
'COMPLEX')
then
614 write (errmsg,
'(3a)') &
615 'Unknown IMS COMPLEXITY option (', trim(keyword),
').'
618 case (
'CSV_OUTER_OUTPUT')
619 call this%parser%GetStringCaps(keyword)
620 if (keyword ==
'FILEOUT')
then
621 call this%parser%GetString(fname)
622 if (nr_procs > 1)
then
623 call append_processor_id(fname, proc_id)
626 call openfile(this%icsvouterout,
iout, fname,
'CSV_OUTER_OUTPUT', &
627 filstat_opt=
'REPLACE')
628 write (
iout, fmtcsvout) trim(fname), this%icsvouterout
630 write (errmsg,
'(a)')
'Optional CSV_OUTER_OUTPUT '// &
631 'keyword must be followed by FILEOUT'
634 case (
'CSV_INNER_OUTPUT')
635 call this%parser%GetStringCaps(keyword)
636 if (keyword ==
'FILEOUT')
then
637 call this%parser%GetString(fname)
638 if (nr_procs > 1)
then
639 call append_processor_id(fname, proc_id)
642 call openfile(this%icsvinnerout,
iout, fname,
'CSV_INNER_OUTPUT', &
643 filstat_opt=
'REPLACE')
644 write (
iout, fmtcsvout) trim(fname), this%icsvinnerout
646 write (errmsg,
'(a)')
'Optional CSV_INNER_OUTPUT '// &
647 'keyword must be followed by FILEOUT'
651 call this%parser%GetStringCaps(keyword)
652 select case (keyword)
663 this%iallowptc = ival
664 write (
iout,
'(3x,A)')
'PSEUDO-TRANSIENT CONTINUATION DISABLED FOR'// &
665 ' '//trim(adjustl(msg))//
' STRESS-PERIOD(S)'
666 case (
'ATS_OUTER_MAXIMUM_FRACTION')
667 rval = this%parser%GetDouble()
669 write (errmsg,
'(a,G0)')
'Value for ATS_OUTER_MAXIMUM_FRAC must be &
670 &between 0 and 0.5. Found ', rval
674 write (
iout,
'(3x,A,G0)')
'ADAPTIVE TIME STEP SETTING FOUND. FRACTION &
675 &OF OUTER MAXIMUM USED TO INCREASE OR DECREASE TIME STEP SIZE IS ',&
680 call this%parser%GetStringCaps(keyword)
681 if (keyword ==
'FILEOUT')
then
682 call this%parser%GetString(fname)
684 call openfile(this%icsvouterout,
iout, fname,
'CSV_OUTPUT', &
685 filstat_opt=
'REPLACE')
686 write (
iout, fmtcsvout) trim(fname), this%icsvouterout
689 write (warnmsg,
'(a)') &
690 'OUTER ITERATION INFORMATION WILL BE SAVED TO '//trim(fname)
694 warnmsg, this%parser%GetUnit())
696 write (errmsg,
'(a)')
'Optional CSV_OUTPUT '// &
697 'keyword must be followed by FILEOUT'
706 call this%parser%DevOpt()
708 write (
iout,
'(1x,A)')
'PSEUDO-TRANSIENT CONTINUATION ENABLED'
709 case (
'DEV_PTC_OUTPUT')
710 call this%parser%DevOpt()
712 call this%parser%GetStringCaps(keyword)
713 if (keyword ==
'FILEOUT')
then
714 call this%parser%GetString(fname)
715 if (nr_procs > 1)
then
716 call append_processor_id(fname, proc_id)
720 filstat_opt=
'REPLACE')
721 write (
iout, fmtptcout) trim(fname), this%iptcout
723 write (errmsg,
'(a)') &
724 'Optional PTC_OUTPUT keyword must be followed by FILEOUT'
727 case (
'DEV_PTC_OPTION')
728 call this%parser%DevOpt()
731 write (
iout,
'(1x,A)') &
732 'PSEUDO-TRANSIENT CONTINUATION USES BNORM AND L2NORM TO '// &
734 case (
'DEV_PTC_EXPONENT')
735 call this%parser%DevOpt()
736 rval = this%parser%GetDouble()
737 if (rval <
dzero)
then
738 write (errmsg,
'(a)')
'PTC_EXPONENT must be > 0.'
743 write (
iout,
'(1x,A,1x,g15.7)') &
744 'PSEUDO-TRANSIENT CONTINUATION EXPONENT', this%ptcexp
746 case (
'DEV_PTC_DEL0')
747 call this%parser%DevOpt()
748 rval = this%parser%GetDouble()
749 if (rval <
dzero)
then
750 write (errmsg,
'(a)')
'IMS sln_ar: PTC_DEL0 must be > 0.'
755 write (
iout,
'(1x,A,1x,g15.7)') &
756 'PSEUDO-TRANSIENT CONTINUATION INITIAL TIMESTEP', this%ptcdel0
759 write (errmsg,
'(a,2(1x,a))') &
760 'Unknown IMS option (', trim(keyword),
').'
764 write (
iout,
'(1x,a)')
'END OF IMS OPTIONS'
766 write (
iout,
'(1x,a)')
'NO IMS OPTION BLOCK DETECTED.'
769 00021
FORMAT(1x,
'SIMPLE OPTION:', /, &
770 1x,
'DEFAULT SOLVER INPUT VALUES FOR FAST SOLUTIONS')
771 00023
FORMAT(1x,
'MODERATE OPTION:', /, 1x,
'DEFAULT SOLVER', &
772 ' INPUT VALUES REFLECT MODERATELY NONLINEAR MODEL')
773 00025
FORMAT(1x,
'COMPLEX OPTION:', /, 1x,
'DEFAULT SOLVER', &
774 ' INPUT VALUES REFLECT STRONGLY NONLINEAR MODEL')
778 call this%sln_setouter(ifdparam)
781 call this%parser%GetBlock(
'NONLINEAR', isfound, ierr, &
782 supportopenclose=.true., blockrequired=.false.)
786 write (
iout,
'(/1x,a)')
'PROCESSING IMS NONLINEAR'
788 call this%parser%GetNextLine(endofblock)
790 call this%parser%GetStringCaps(keyword)
792 select case (keyword)
793 case (
'OUTER_DVCLOSE')
794 this%dvclose = this%parser%GetDouble()
795 case (
'OUTER_MAXIMUM')
796 this%mxiter = this%parser%GetInteger()
797 case (
'UNDER_RELAXATION')
798 call this%parser%GetStringCaps(keyword)
800 if (keyword ==
'NONE')
then
802 else if (keyword ==
'SIMPLE')
then
804 else if (keyword ==
'COOLEY')
then
806 else if (keyword ==
'DBD')
then
809 write (errmsg,
'(3a)') &
810 'Unknown UNDER_RELAXATION specified (', trim(keyword),
').'
814 case (
'LINEAR_SOLVER')
815 call this%parser%GetStringCaps(keyword)
817 if (keyword .eq.
'DEFAULT' .or. &
818 keyword .eq.
'LINEAR')
then
821 write (errmsg,
'(3a)') &
822 'Unknown LINEAR_SOLVER specified (', trim(keyword),
').'
825 this%linsolver = ival
826 case (
'UNDER_RELAXATION_THETA')
827 this%theta = this%parser%GetDouble()
828 case (
'UNDER_RELAXATION_KAPPA')
829 this%akappa = this%parser%GetDouble()
830 case (
'UNDER_RELAXATION_GAMMA')
831 this%gamma = this%parser%GetDouble()
832 case (
'UNDER_RELAXATION_MOMENTUM')
833 this%amomentum = this%parser%GetDouble()
834 case (
'BACKTRACKING_NUMBER')
835 this%numtrack = this%parser%GetInteger()
836 IF (this%numtrack > 0) this%ibflag = 1
837 case (
'BACKTRACKING_TOLERANCE')
838 this%btol = this%parser%GetDouble()
839 case (
'BACKTRACKING_REDUCTION_FACTOR')
840 this%breduc = this%parser%GetDouble()
841 case (
'BACKTRACKING_RESIDUAL_LIMIT')
842 this%res_lim = this%parser%GetDouble()
845 case (
'OUTER_HCLOSE')
846 this%dvclose = this%parser%GetDouble()
849 write (warnmsg,
'(a)') &
850 'SETTING OUTER_DVCLOSE TO OUTER_HCLOSE VALUE'
854 warnmsg, this%parser%GetUnit())
855 case (
'OUTER_RCLOSEBND')
858 write (warnmsg,
'(a)') &
859 'OUTER_DVCLOSE IS USED TO EVALUATE PACKAGE CONVERGENCE'
863 warnmsg, this%parser%GetUnit())
865 write (errmsg,
'(3a)') &
866 'Unknown IMS NONLINEAR keyword (', trim(keyword),
').'
870 write (
iout,
'(1x,a)')
'END OF IMS NONLINEAR DATA'
872 if (ifdparam .EQ. 0)
then
873 write (errmsg,
'(a)')
'NO IMS NONLINEAR block detected.'
878 if (this%theta <
dem3)
then
883 if (this%nonmeth < 1)
then
888 if (this%mxiter <= 0)
then
889 write (errmsg,
'(a)')
'Outer iteration number must be > 0.'
894 if (this%nonmeth > 0)
then
895 WRITE (
iout, *)
'**UNDER-RELAXATION WILL BE USED***'
897 elseif (this%nonmeth == 0)
then
898 WRITE (
iout, *)
'***UNDER-RELAXATION WILL NOT BE USED***'
901 WRITE (errmsg,
'(a)') &
902 'Incorrect value for variable NONMETH was specified.'
907 if (this%nonmeth == 1)
then
908 if (this%gamma == 0)
then
909 WRITE (errmsg,
'(a)') &
910 'GAMMA must be greater than zero if SIMPLE under-relaxation is used.'
915 if (this%solver_mode ==
'PETSC')
then
920 call this%linear_settings%init(this%memory_path)
921 call this%linear_settings%preset_config(ifdparam)
922 call this%linear_settings%read_from_file(this%parser,
iout)
923 call this%linear_settings%check_settings()
925 if (this%linear_settings%ilinmeth ==
cg_method)
then
931 if (this%solver_mode ==
"IMS")
then
932 allocate (this%imslinear)
933 WRITE (
iout, *)
'***IMS LINEAR SOLVER WILL BE USED***'
934 call this%imslinear%imslinear_allocate(this%name,
iout, this%iprims, &
935 this%mxiter, this%neq, &
936 this%system_matrix, this%rhs, &
937 this%x, this%linear_settings)
940 else if (this%solver_mode ==
"PETSC")
then
941 call this%linear_solver%initialize(this%system_matrix, &
942 this%linear_settings, &
947 write (errmsg,
'(a)') &
948 'Incorrect value for linear solution method specified.'
953 if (this%isymmetric == 1)
then
954 write (
iout,
'(1x,a,/)')
'A symmetric matrix will be solved'
956 write (
iout,
'(1x,a,/)')
'An asymmetric matrix will be solved'
961 if (this%isymmetric == 1)
then
964 do i = 1, this%modellist%Count()
966 if (mp%get_iasym() /= 0)
then
967 write (errmsg, fmterrasym)
'MODEL', trim(adjustl(mp%name))
973 do i = 1, this%exchangelist%Count()
975 if (cp%get_iasym() /= 0)
then
976 write (errmsg, fmterrasym)
'EXCHANGE', trim(adjustl(cp%name))
985 this%idv_scale = this%sln_get_idvscale()
987 if (this%idv_scale > 0)
then
988 write (
iout,
'(2(1x,a,/),1x,a,/,6x,a,/)') &
989 'X and RHS will be scaled to avoid very large positive or negative', &
990 'dependent variable values in the model IMS package.', &
991 'NOTE: Specified outer and inner DVCLOSE values in the model IMS &
992 &package',
'will be relative closure criteria.'
993 else if (this%idv_scale < 0)
then
994 write (errmsg,
'(2(a,1x))') &
995 'dependent_variable_scaling must be specified for all models in', &
996 'the solution and can only be used with GWT and GWE models. '
1004 WRITE (
iout, 9002) this%dvclose, this%mxiter, &
1005 this%iprims, this%nonmeth, this%linsolver
1008 9002
FORMAT(1x,
'OUTER ITERATION CONVERGENCE CRITERION (DVCLOSE) = ', e15.6, &
1009 /1x,
'MAXIMUM NUMBER OF OUTER ITERATIONS (MXITER) = ', i0, &
1010 /1x,
'SOLVER PRINTOUT INDEX (IPRIMS) = ', i0, &
1011 /1x,
'NONLINEAR ITERATION METHOD (NONLINMETH) = ', i0, &
1012 /1x,
'LINEAR SOLUTION METHOD (LINMETH) = ', i0)
1014 if (this%nonmeth == 1)
then
1015 write (
iout, 9003) this%gamma
1016 else if (this%nonmeth == 2)
then
1017 write (
iout, 9004) this%gamma
1018 else if (this%nonmeth == 3)
then
1019 write (
iout, 9005) this%theta, this%akappa, this%gamma, this%amomentum
1023 if (this%numtrack /= 0)
write (
iout, 9006) this%numtrack, this%btol, &
1024 this%breduc, this%res_lim
1027 9003
FORMAT(1x,
'UNDER-RELAXATION FACTOR (GAMMA) = ', e15.6)
1028 9004
FORMAT(1x,
'UNDER-RELAXATION PREVIOUS HISTORY FACTOR (GAMMA) = ', e15.6)
1029 9005
FORMAT(1x,
'UNDER-RELAXATION WEIGHT REDUCTION FACTOR (THETA) = ', e15.6, &
1030 /1x,
'UNDER-RELAXATION WEIGHT INCREASE INCREMENT (KAPPA) = ', e15.6, &
1031 /1x,
'UNDER-RELAXATION PREVIOUS HISTORY FACTOR (GAMMA) = ', e15.6, &
1032 /1x,
'UNDER-RELAXATION MOMENTUM TERM (AMOMENTUM) = ', e15.6)
1035 9006
FORMAT(1x,
'MAXIMUM NUMBER OF BACKTRACKS (NUMTRACK) = ', i0, &
1036 /1x,
'BACKTRACKING TOLERANCE FACTOR (BTOL) = ', e15.6, &
1037 /1x,
'BACKTRACKING REDUCTION FACTOR (BREDUC) = ', e15.6, &
1038 /1x,
'BACKTRACKING RESIDUAL LIMIT (RES_LIM) = ', e15.6)
1042 call this%imslinear%imslinear_summary(this%mxiter)
1044 call this%linear_solver%print_summary()
1050 call this%parser%StoreErrorUnit()
1055 call mem_reallocate(this%lrch, 3, this%mxiter,
'LRCH', this%name)
1058 if (this%nonmeth == 3)
then
1063 this%wsave(i) =
dzero
1064 this%hchold(i) =
dzero
1065 this%deold(i) =
dzero
1072 if (this%iprims == 2 .or. this%icsvinnerout > 0)
then
1073 this%nitermax = this%linear_settings%iter1 * this%mxiter
1078 allocate (this%caccel(this%nitermax))
1082 call this%cnvg_summary%reinit(this%nitermax)
1087 call this%parser%StoreErrorUnit()
1091 call this%parser%Clear()
1107 integer(I4B) :: idir
1108 real(DP) :: delt_temp
1109 real(DP) :: fact_lower
1110 real(DP) :: fact_upper
1116 if (this%atsfrac > dzero)
then
1118 fact_lower = this%mxiter * this%atsfrac
1119 fact_upper = this%mxiter - fact_lower
1120 if (this%iouttot_timestep < int(fact_lower))
then
1123 else if (this%iouttot_timestep > int(fact_upper))
then
1148 if (
kper == 1 .and.
kstp == 1)
then
1149 call this%writeCSVHeader()
1153 call this%writePTCInfoToFile(
kper)
1157 this%itertot_timestep = 0
1158 this%iouttot_timestep = 0
1185 write (
iout,
'(//1x,a,1x,a,1x,a)') &
1186 'Solution', trim(adjustl(this%name)),
'summary'
1187 write (
iout,
"(1x,70('-'))")
1188 write (
iout,
'(1x,a,1x,g0,1x,a)') &
1189 'Total formulate time: ', this%ttform,
'seconds'
1190 write (
iout,
'(1x,a,1x,g0,1x,a,/)') &
1191 'Total solution time: ', this%ttsoln,
'seconds'
1208 call this%imslinear%imslinear_da()
1209 deallocate (this%imslinear)
1213 call this%modellist%Clear()
1214 call this%exchangelist%Clear()
1215 deallocate (this%modellist)
1216 deallocate (this%exchangelist)
1218 call this%system_matrix%destroy()
1219 deallocate (this%system_matrix)
1220 call this%vec_x%destroy()
1221 deallocate (this%vec_x)
1222 call this%vec_rhs%destroy()
1223 deallocate (this%vec_rhs)
1227 deallocate (this%caccel)
1230 if (
associated(this%innertab))
then
1231 call this%innertab%table_da()
1232 deallocate (this%innertab)
1233 nullify (this%innertab)
1237 if (
associated(this%outertab))
then
1238 call this%outertab%table_da()
1239 deallocate (this%outertab)
1240 nullify (this%outertab)
1255 call this%cnvg_summary%destroy()
1256 deallocate (this%cnvg_summary)
1259 call this%linear_solver%destroy()
1260 deallocate (this%linear_solver)
1263 call this%linear_settings%destroy()
1264 deallocate (this%linear_settings)
1318 subroutine sln_ca(this, isgcnvg, isuppress_output)
1321 integer(I4B),
intent(inout) :: isgcnvg
1322 integer(I4B),
intent(in) :: isuppress_output
1325 character(len=LINELENGTH) :: line
1326 character(len=LINELENGTH) :: fmt
1328 integer(I4B) :: kiter
1331 call this%prepareSolve()
1335 line =
'mode="validation" -- Skipping matrix assembly and solution.'
1337 do im = 1, this%modellist%Count()
1339 call mp%model_message(line, fmt=fmt)
1343 outerloop:
do kiter = 1, this%mxiter
1346 call this%solve(kiter)
1349 if (this%icnvg == 1)
then
1356 call this%finalizeSolve(kiter, isgcnvg, isuppress_output)
1372 if (this%icsvouterout > 0)
then
1373 write (this%icsvouterout,
'(*(G0,:,","))') &
1374 'total_inner_iterations',
'totim',
'kper',
'kstp',
'nouter', &
1375 'inner_iterations',
'solution_outer_dvmax', &
1376 'solution_outer_dvmax_model',
'solution_outer_dvmax_package', &
1377 'solution_outer_dvmax_node'
1381 if (this%icsvinnerout > 0)
then
1382 write (this%icsvinnerout,
'(*(G0,:,","))', advance=
'NO') &
1383 'total_inner_iterations',
'totim',
'kper',
'kstp',
'nouter', &
1384 'ninner',
'solution_inner_dvmax',
'solution_inner_dvmax_model', &
1385 'solution_inner_dvmax_node'
1386 write (this%icsvinnerout,
'(*(G0,:,","))', advance=
'NO') &
1387 '',
'solution_inner_rmax',
'solution_inner_rmax_model', &
1388 'solution_inner_rmax_node'
1391 write (this%icsvinnerout,
'(*(G0,:,","))', advance=
'NO') &
1392 '',
'solution_inner_alpha'
1393 if (this%imslinear%ilinmeth == 2)
then
1394 write (this%icsvinnerout,
'(*(G0,:,","))', advance=
'NO') &
1395 '',
'solution_inner_omega'
1400 do im = 1, this%modellist%Count()
1402 write (this%icsvinnerout,
'(*(G0,:,","))', advance=
'NO') &
1403 '', trim(adjustl(mp%name))//
'_inner_dvmax', &
1404 trim(adjustl(mp%name))//
'_inner_dvmax_node', &
1405 trim(adjustl(mp%name))//
'_inner_rmax', &
1406 trim(adjustl(mp%name))//
'_inner_rmax_node'
1409 write (this%icsvinnerout,
'(a)')
''
1421 integer(I4B),
intent(in) :: kper
1423 integer(I4B) :: n, im, iallowptc, iptc
1428 do im = 1, this%modellist%Count()
1432 if (this%iallowptc < 0)
then
1440 iallowptc = this%iallowptc
1443 if (iallowptc > 0)
then
1445 call mp%model_ptcchk(iptc)
1452 write (
iout,
'(//)')
1455 write (
iout,
'(1x,a,1x,i0,1x,3a)') &
1456 'PSEUDO-TRANSIENT CONTINUATION WILL BE APPLIED TO MODEL', im,
'("', &
1457 trim(adjustl(mp%name)),
'") DURING THIS TIME STEP'
1478 call g_prof%start(
"Prepare solve"//this%id_postfix, this%tmr_prep_solve)
1484 do ic = 1, this%exchangelist%Count()
1490 do im = 1, this%modellist%Count()
1499 call g_prof%stop(this%tmr_prep_solve)
1518 integer(I4B),
intent(in) :: kiter
1522 character(len=LINELENGTH) :: title
1523 character(len=LINELENGTH) :: tag
1524 character(len=LENPAKLOC) :: cmod
1525 character(len=LENPAKLOC) :: cpak
1526 character(len=LENPAKLOC) :: cpakout
1527 character(len=LENPAKLOC) :: strh
1528 character(len=25) :: cval
1529 character(len=7) :: cmsg
1531 integer(I4B) :: im, m_idx, model_id
1532 integer(I4B) :: icsv0
1533 integer(I4B) :: kcsv0
1534 integer(I4B) :: ntabrows
1535 integer(I4B) :: ntabcols
1536 integer(I4B) :: i0, i1
1537 integer(I4B) :: itestmat, n
1538 integer(I4B) :: iter
1539 integer(I4B) :: inewtonur
1540 integer(I4B) :: locmax_nur
1541 integer(I4B) :: iend
1542 integer(I4B) :: icnvgmod
1543 integer(I4B) :: iptc
1544 integer(I4B) :: node_user
1545 integer(I4B) :: ipak
1546 integer(I4B) :: ipos0
1547 integer(I4B) :: ipos1
1548 real(DP) :: dxmax_nur
1549 real(DP) :: dxold_max
1554 real(DP) :: outer_hncg
1557 call g_prof%start(
"Solve"//this%id_postfix, this%tmr_solve)
1561 icsv0 = max(1, this%itertot_sim + 1)
1562 kcsv0 = max(1, this%itertot_timestep + 1)
1565 if (this%iprims > 0)
then
1566 if (.not.
associated(this%outertab))
then
1572 if (this%numtrack > 0)
then
1573 ntabcols = ntabcols + 4
1577 title = trim(this%memory_path)//
' OUTER ITERATION SUMMARY'
1578 call table_cr(this%outertab, this%name, title)
1579 call this%outertab%table_df(ntabrows, ntabcols,
iout, &
1581 tag =
'OUTER ITERATION STEP'
1582 call this%outertab%initialize_column(tag, 25, alignment=
tableft)
1583 tag =
'OUTER ITERATION'
1584 call this%outertab%initialize_column(tag, 10, alignment=
tabright)
1585 tag =
'INNER ITERATION'
1586 call this%outertab%initialize_column(tag, 10, alignment=
tabright)
1587 if (this%numtrack > 0)
then
1588 tag =
'BACKTRACK FLAG'
1589 call this%outertab%initialize_column(tag, 10, alignment=
tabright)
1590 tag =
'BACKTRACK ITERATIONS'
1591 call this%outertab%initialize_column(tag, 10, alignment=
tabright)
1592 tag =
'INCOMING RESIDUAL'
1593 call this%outertab%initialize_column(tag, 15, alignment=
tabright)
1594 tag =
'OUTGOING RESIDUAL'
1595 call this%outertab%initialize_column(tag, 15, alignment=
tabright)
1597 tag =
'MAXIMUM CHANGE'
1598 call this%outertab%initialize_column(tag, 15, alignment=
tabright)
1599 tag =
'STEP SUCCESS'
1600 call this%outertab%initialize_column(tag, 7, alignment=
tabright)
1601 tag =
'MAXIMUM CHANGE MODEL-(CELLID) OR MODEL-PACKAGE-(NUMBER)'
1602 call this%outertab%initialize_column(tag, 34, alignment=
tabright)
1607 if (this%numtrack > 0)
then
1608 call this%sln_backtracking(mp, cp, kiter)
1612 call g_prof%start(
"Formulate", this%tmr_formulate)
1615 call this%sln_buildsystem(kiter, inewton=1)
1618 call this%sln_calc_ptc(iptc, ptcf)
1621 do im = 1, this%modellist%Count()
1623 call mp%model_nr(kiter, this%system_matrix, 1)
1626 call g_prof%stop(this%tmr_formulate)
1629 if (this%idv_scale /= 0)
then
1630 call this%sln_maxval(this%neq, this%x, this%dscale)
1636 call g_prof%start(
"Linear solve", this%tmr_linsolve)
1637 call this%sln_ls(kiter,
kstp,
kper, iter, iptc, ptcf)
1638 call g_prof%stop(this%tmr_linsolve)
1644 this%itertot_timestep = this%itertot_timestep + iter
1645 this%iouttot_timestep = this%iouttot_timestep + 1
1646 this%itertot_sim = this%itertot_sim + iter
1652 if (itestmat /= 0)
then
1653 open (99, file=
'sol_MF6.TXT')
1654 WRITE (99, *)
'MATRIX SOLUTION FOLLOWS'
1655 WRITE (99,
'(10(I8,G15.4))') (n, this%x(n), n=1, this%NEQ)
1662 call this%sln_get_dxmax(this%hncg(kiter), this%lrch(1, kiter))
1663 if (this%icnvg /= 0)
then
1665 if (this%sln_has_converged(this%hncg(kiter)))
then
1671 if (this%icnvg == 0)
then
1679 if (kiter == this%mxiter)
then
1684 if (this%iprims > 0)
then
1686 call this%sln_get_loc(this%lrch(1, kiter), strh)
1689 call this%outertab%add_term(cval)
1690 call this%outertab%add_term(kiter)
1691 call this%outertab%add_term(iter)
1692 if (this%numtrack > 0)
then
1693 call this%outertab%add_term(
' ')
1694 call this%outertab%add_term(
' ')
1695 call this%outertab%add_term(
' ')
1696 call this%outertab%add_term(
' ')
1698 call this%outertab%add_term(this%hncg(kiter))
1699 call this%outertab%add_term(cmsg)
1700 call this%outertab%add_term(trim(strh))
1704 do ic = 1, this%exchangelist%Count()
1706 call cp%exg_cc(this%icnvg)
1710 icnvgmod = this%icnvg
1714 do im = 1, this%modellist%Count()
1716 call mp%get_mcellid(0, cmod)
1717 call mp%model_cc(this%itertot_sim, kiter, iend, icnvgmod, &
1720 ipos0 = index(cpak,
'-', back=.true.)
1721 ipos1 = len_trim(cpak)
1722 write (cpakout,
'(a,a,"-(",i0,")",a)') &
1723 trim(cmod), cpak(1:ipos0 - 1), ipak, cpak(ipos0:ipos1)
1730 if (this%icnvg == 1)
then
1731 this%icnvg = this%sln_package_convergence(dpak, cpakout, iend)
1734 if (this%iprims > 0)
then
1736 if (this%icnvg /= 1)
then
1741 if (len_trim(cpakout) > 0)
then
1744 call this%outertab%add_term(cval)
1745 call this%outertab%add_term(kiter)
1746 call this%outertab%add_term(
' ')
1747 if (this%numtrack > 0)
then
1748 call this%outertab%add_term(
' ')
1749 call this%outertab%add_term(
' ')
1750 call this%outertab%add_term(
' ')
1751 call this%outertab%add_term(
' ')
1753 call this%outertab%add_term(dpak)
1754 call this%outertab%add_term(cmsg)
1755 call this%outertab%add_term(cpakout)
1761 if (this%icnvg /= 1)
then
1762 if (this%nonmeth > 0)
then
1763 call this%sln_underrelax(kiter, this%hncg(kiter), this%neq, &
1764 this%active, this%x, this%xtemp)
1766 call this%sln_calcdx(this%neq, this%active, &
1767 this%x, this%xtemp, this%dxold)
1774 do im = 1, this%modellist%Count()
1776 i0 = mp%moffset + 1 - this%matrix_offset
1777 i1 = i0 + mp%neq - 1
1778 call mp%model_nur(mp%neq, this%x(i0:i1), this%xtemp(i0:i1), &
1779 this%dxold(i0:i1), inewtonur, dxmax_nur, locmax_nur)
1783 inewtonur = this%sln_sync_newtonur_flag(inewtonur)
1786 if (inewtonur /= 0)
then
1790 call this%sln_maxval(this%neq, this%dxold, dxold_max)
1793 if (this%sln_nur_has_converged(dxold_max, this%hncg(kiter)))
then
1799 call this%sln_get_dxmax(this%hncg(kiter), this%lrch(1, kiter))
1803 if (this%iprims > 0)
then
1804 cval =
'Newton under-relaxation'
1806 call this%sln_get_loc(this%lrch(1, kiter), strh)
1809 call this%outertab%add_term(cval)
1810 call this%outertab%add_term(kiter)
1811 call this%outertab%add_term(iter)
1812 if (this%numtrack > 0)
then
1813 call this%outertab%add_term(
' ')
1814 call this%outertab%add_term(
' ')
1815 call this%outertab%add_term(
' ')
1816 call this%outertab%add_term(
' ')
1818 call this%outertab%add_term(this%hncg(kiter))
1819 call this%outertab%add_term(cmsg)
1820 call this%outertab%add_term(trim(strh))
1827 if (this%icsvouterout > 0)
then
1830 outer_hncg = this%hncg(kiter)
1833 if (abs(outer_hncg) > abs(dpak))
then
1836 call this%sln_get_nodeu(this%lrch(1, kiter), m_idx, node_user)
1840 else if (outer_hncg ==
dzero .and. dpak ==
dzero)
then
1850 ipos0 = index(cmod,
'_')
1851 read (cmod(1:ipos0 - 1), *) model_id
1853 ipos0 = index(cpak,
'-', back=.true.)
1854 cpakout = cpak(1:ipos0 - 1)
1857 write (this%icsvouterout,
'(*(G0,:,","))') &
1859 outer_hncg, model_id, trim(cpakout), node_user
1863 if (this%icsvinnerout > 0)
then
1864 call this%csv_convergence_summary(this%icsvinnerout,
totim,
kper,
kstp, &
1865 kiter, iter, icsv0, kcsv0)
1869 if (this%idv_scale /= 0)
then
1874 call g_prof%stop(this%tmr_solve)
1876 end subroutine solve
1888 integer(I4B),
intent(in) :: kiter
1889 integer(I4B),
intent(inout) :: isgcnvg
1890 integer(I4B),
intent(in) :: isuppress_output
1892 integer(I4B) :: ic, im
1896 character(len=*),
parameter :: fmtnocnvg = &
1897 "(1X,'Solution ', i0, ' did not converge for stress period ', i0, &
1898 &' and time step ', i0)"
1899 character(len=*),
parameter :: fmtcnvg = &
1900 "(1X, I0, ' CALLS TO NUMERICAL SOLUTION ', 'IN TIME STEP ', I0, &
1901 &' STRESS PERIOD ',I0,/1X,I0,' TOTAL ITERATIONS')"
1904 call g_prof%start(
"Finalize solve"//this%id_postfix, this%tmr_final_solve)
1908 if (this%iprims > 0)
then
1909 call this%outertab%finalize_table()
1915 if (this%icnvg /= 0)
then
1916 if (this%iprims > 0)
then
1917 write (
iout, fmtcnvg) kiter,
kstp,
kper, this%itertot_timestep
1926 if (this%iprims == 2)
then
1929 do im = 1, this%modellist%Count()
1931 call this%convergence_summary(mp%iout, im, this%itertot_timestep)
1935 call this%convergence_summary(
iout, this%convnmod + 1, &
1936 this%itertot_timestep)
1940 if (this%icnvg == 0) isgcnvg = 0
1942 call g_prof%start(
"Calculate flows", this%tmr_flows)
1946 do im = 1, this%modellist%Count()
1948 call mp%model_cq(this%icnvg, isuppress_output)
1952 do ic = 1, this%exchangelist%Count()
1954 call cp%exg_cq(isgcnvg, isuppress_output, this%id)
1957 call g_prof%stop(this%tmr_flows)
1958 call g_prof%start(
"Calculate budgets", this%tmr_budgets)
1962 do im = 1, this%modellist%Count()
1964 call mp%model_bd(this%icnvg, isuppress_output)
1968 do ic = 1, this%exchangelist%Count()
1970 call cp%exg_bd(isgcnvg, isuppress_output, this%id)
1974 call g_prof%stop(this%tmr_budgets)
1975 call g_prof%stop(this%tmr_final_solve)
1982 integer(I4B),
intent(in) :: kiter
1983 integer(I4B),
intent(in) :: inewton
1985 integer(I4B) :: im, ic
1990 call this%sln_reset()
1993 do im = 1, this%modellist%Count()
1995 call mp%model_reset()
2003 do ic = 1, this%exchangelist%Count()
2005 call cp%exg_cf(kiter)
2009 do im = 1, this%modellist%Count()
2011 call mp%model_cf(kiter)
2019 do ic = 1, this%exchangelist%Count()
2021 call cp%exg_fc(kiter, this%system_matrix, this%rhs, inewton)
2025 do im = 1, this%modellist%Count()
2027 call mp%model_fc(kiter, this%system_matrix, inewton)
2042 integer(I4B),
intent(in) :: iu
2043 integer(I4B),
intent(in) :: im
2044 integer(I4B),
intent(in) :: itertot_timestep
2046 character(len=LINELENGTH) :: title
2047 character(len=LINELENGTH) :: tag
2048 character(len=LENPAKLOC) :: loc_dvmax_str
2049 character(len=LENPAKLOC) :: loc_rmax_str
2050 integer(I4B) :: ntabrows
2051 integer(I4B) :: ntabcols
2052 integer(I4B) :: iinner
2054 integer(I4B) :: iouter
2057 integer(I4B) :: locdv
2058 integer(I4B) :: locdr
2070 if (.not.
associated(this%innertab))
then
2074 ntabrows = itertot_timestep
2078 title = trim(this%memory_path)//
' INNER ITERATION SUMMARY'
2079 call table_cr(this%innertab, this%name, title)
2080 call this%innertab%table_df(ntabrows, ntabcols, iu)
2081 tag =
'TOTAL ITERATION'
2082 call this%innertab%initialize_column(tag, 10, alignment=
tabright)
2083 tag =
'OUTER ITERATION'
2084 call this%innertab%initialize_column(tag, 10, alignment=
tabright)
2085 tag =
'INNER ITERATION'
2086 call this%innertab%initialize_column(tag, 10, alignment=
tabright)
2087 tag =
'MAXIMUM CHANGE'
2088 call this%innertab%initialize_column(tag, 15, alignment=
tabright)
2089 tag =
'MAXIMUM CHANGE MODEL-(CELLID)'
2091 tag =
'MAXIMUM RESIDUAL'
2092 call this%innertab%initialize_column(tag, 15, alignment=
tabright)
2093 tag =
'MAXIMUM RESIDUAL MODEL-(CELLID)'
2098 call this%innertab%set_maxbound(itertot_timestep)
2099 call this%innertab%set_iout(iu)
2104 do k = 1, itertot_timestep
2105 iinner = this%cnvg_summary%itinner(k)
2106 if (iinner <= i0)
then
2109 if (im > this%convnmod)
then
2112 do j = 1, this%convnmod
2113 if (abs(this%cnvg_summary%convdvmax(j, k)) > abs(dv))
then
2114 locdv = this%cnvg_summary%convlocdv(j, k)
2115 dv = this%cnvg_summary%convdvmax(j, k)
2117 if (abs(this%cnvg_summary%convrmax(j, k)) > abs(res))
then
2118 locdr = this%cnvg_summary%convlocr(j, k)
2119 res = this%cnvg_summary%convrmax(j, k)
2123 locdv = this%cnvg_summary%convlocdv(im, k)
2124 locdr = this%cnvg_summary%convlocr(im, k)
2125 dv = this%cnvg_summary%convdvmax(im, k)
2126 res = this%cnvg_summary%convrmax(im, k)
2128 call this%sln_get_loc(locdv, loc_dvmax_str)
2129 call this%sln_get_loc(locdr, loc_rmax_str)
2132 call this%innertab%add_term(k)
2133 call this%innertab%add_term(iouter)
2134 call this%innertab%add_term(iinner)
2135 call this%innertab%add_term(dv)
2136 call this%innertab%add_term(adjustr(trim(loc_dvmax_str)))
2137 call this%innertab%add_term(res)
2138 call this%innertab%add_term(adjustr(trim(loc_rmax_str)))
2151 niter, istart, kstart)
2156 integer(I4B),
intent(in) :: iu
2157 real(DP),
intent(in) :: totim
2158 integer(I4B),
intent(in) :: kper
2159 integer(I4B),
intent(in) :: kstp
2160 integer(I4B),
intent(in) :: kouter
2161 integer(I4B),
intent(in) :: niter
2162 integer(I4B),
intent(in) :: istart
2163 integer(I4B),
intent(in) :: kstart
2165 integer(I4B) :: itot
2166 integer(I4B) :: m_idx, j, k
2167 integer(I4B) :: kpos
2168 integer(I4B) :: loc_dvmax
2169 integer(I4B) :: loc_rmax
2170 integer(I4B) :: model_id, node_user
2180 kpos = kstart + k - 1
2181 write (iu,
'(*(G0,:,","))', advance=
'NO') &
2182 itot, totim, kper, kstp, kouter, k
2187 do j = 1, this%convnmod
2188 if (abs(this%cnvg_summary%convdvmax(j, kpos)) > abs(dvmax))
then
2189 loc_dvmax = this%cnvg_summary%convlocdv(j, kpos)
2190 dvmax = this%cnvg_summary%convdvmax(j, kpos)
2192 if (abs(this%cnvg_summary%convrmax(j, kpos)) > abs(rmax))
then
2193 loc_rmax = this%cnvg_summary%convlocr(j, kpos)
2194 rmax = this%cnvg_summary%convrmax(j, kpos)
2199 if (dvmax ==
dzero) loc_dvmax = 0
2200 if (rmax ==
dzero) loc_rmax = 0
2203 if (loc_dvmax > 0)
then
2204 call this%sln_get_nodeu(loc_dvmax, m_idx, node_user)
2206 model_id = num_mod%id
2211 write (iu,
'(*(G0,:,","))', advance=
'NO')
'', dvmax, model_id, node_user
2214 if (loc_rmax > 0)
then
2215 call this%sln_get_nodeu(loc_rmax, m_idx, node_user)
2217 model_id = num_mod%id
2222 write (iu,
'(*(G0,:,","))', advance=
'NO')
'', rmax, model_id, node_user
2226 write (iu,
'(*(G0,:,","))', advance=
'NO') &
2227 '', trim(adjustl(this%caccel(kpos)))
2232 do j = 1, this%cnvg_summary%convnmod
2233 loc_dvmax = this%cnvg_summary%convlocdv(j, kpos)
2234 dvmax = this%cnvg_summary%convdvmax(j, kpos)
2235 loc_rmax = this%cnvg_summary%convlocr(j, kpos)
2236 rmax = this%cnvg_summary%convrmax(j, kpos)
2239 if (loc_dvmax > 0)
then
2240 call this%sln_get_nodeu(loc_dvmax, m_idx, node_user)
2244 write (iu,
'(*(G0,:,","))', advance=
'NO')
'', dvmax, node_user
2247 if (loc_rmax > 0)
then
2248 call this%sln_get_nodeu(loc_rmax, m_idx, node_user)
2252 write (iu,
'(*(G0,:,","))', advance=
'NO')
'', rmax, node_user
2257 write (iu,
'(a)')
''
2279 character(len=*),
intent(in) :: filename
2281 integer(I4B) :: inunit
2283 select type (spm => this%system_matrix)
2286 open (unit=inunit, file=filename, status=
'unknown')
2287 write (inunit, *)
'ia'
2288 write (inunit, *) spm%ia
2289 write (inunit, *)
'ja'
2290 write (inunit, *) spm%ja
2291 write (inunit, *)
'amat'
2292 write (inunit, *) spm%amat
2293 write (inunit, *)
'rhs'
2294 write (inunit, *) this%rhs
2295 write (inunit, *)
'x'
2296 write (inunit, *) this%x
2332 models => this%modellist
2349 select type (exchange)
2360 type(
listtype),
pointer :: exchanges
2362 exchanges => this%exchangelist
2387 do im = 1, this%modellist%Count()
2389 call mp%model_ac(this%sparse)
2396 do ic = 1, this%exchangelist%Count()
2398 call cp%exg_ac(this%sparse)
2403 call this%sparse%sort()
2404 call this%system_matrix%init(this%sparse, this%name)
2405 call this%sparse%destroy()
2410 do im = 1, this%modellist%Count()
2412 call mp%model_mc(this%system_matrix)
2416 do ic = 1, this%exchangelist%Count()
2418 call cp%exg_mc(this%system_matrix)
2433 call this%system_matrix%zero_entries()
2434 call this%vec_rhs%zero_entries()
2443 subroutine sln_ls(this, kiter, kstp, kper, in_iter, iptc, ptcf)
2446 integer(I4B),
intent(in) :: kiter
2447 integer(I4B),
intent(in) :: kstp
2448 integer(I4B),
intent(in) :: kper
2449 integer(I4B),
intent(inout) :: in_iter
2450 integer(I4B),
intent(inout) :: iptc
2451 real(DP),
intent(in) :: ptcf
2453 logical(LGP) :: lsame
2455 integer(I4B) :: irow_glo
2456 integer(I4B) :: itestmat
2457 integer(I4B) :: ipos
2458 integer(I4B) :: icol_s
2459 integer(I4B) :: icol_e
2460 integer(I4B) :: jcol
2461 integer(I4B) :: iptct
2462 integer(I4B) :: iallowptc
2468 character(len=50) :: fname
2469 character(len=*),
parameter :: fmtfname =
"('mf6mat_', i0, '_', i0, &
2470 &'_', i0, '_', i0, '.txt')"
2473 do ieq = 1, this%neq
2476 irow_glo = ieq + this%matrix_offset
2479 this%xtemp(ieq) = this%x(ieq)
2483 if (this%active(ieq) > 0)
then
2485 adiag = abs(this%system_matrix%get_diag_value(irow_glo))
2486 if (adiag <
dem15)
then
2487 call this%system_matrix%set_diag_value(irow_glo, diagval)
2488 this%rhs(ieq) = this%rhs(ieq) + diagval * this%x(ieq)
2492 call this%system_matrix%set_diag_value(irow_glo,
done)
2493 call this%system_matrix%zero_row_offdiag(irow_glo)
2494 this%rhs(ieq) = this%x(ieq)
2500 do ieq = 1, this%neq
2501 if (this%active(ieq) > 0)
then
2502 icol_s = this%system_matrix%get_first_col_pos(ieq)
2503 icol_e = this%system_matrix%get_last_col_pos(ieq)
2504 do ipos = icol_s, icol_e
2505 jcol = this%system_matrix%get_column(ipos)
2506 if (jcol == ieq) cycle
2507 if (this%active(jcol) < 0)
then
2508 this%rhs(ieq) = this%rhs(ieq) - &
2509 (this%system_matrix%get_value_pos(ipos) * &
2511 call this%system_matrix%set_value_pos(ipos,
dzero)
2523 if (this%iallowptc < 0)
then
2532 iallowptc = this%iallowptc
2536 iptct = iptc * iallowptc
2540 if (iptct /= 0)
then
2541 call this%sln_l2norm(l2norm)
2544 if (kiter == 1)
then
2545 if (kper > 1 .or. kstp > 1)
then
2546 if (l2norm <= this%l2norm0)
then
2551 lsame =
is_close(l2norm, this%l2norm0)
2557 iptct = iptc * iallowptc
2558 if (iptct /= 0)
then
2559 if (kiter == 1)
then
2560 if (this%iptcout > 0)
then
2561 write (this%iptcout,
'(A10,6(1x,A15))')
'OUTER ITER', &
2562 ' PTCDEL',
' L2NORM0',
' L2NORM', &
2563 ' RHSNORM',
' 1/PTCDEL',
' RHSNORM/L2NORM'
2565 if (this%ptcdel0 >
dzero)
then
2566 this%ptcdel = this%ptcdel0
2568 if (this%iptcopt == 0)
then
2571 this%ptcdel =
done / ptcf
2574 do ieq = 1, this%neq
2575 if (this%active(ieq) .gt. 0)
then
2576 bnorm = bnorm + this%rhs(ieq) * this%rhs(ieq)
2580 this%ptcdel = bnorm / l2norm
2584 if (l2norm >
dzero)
then
2585 this%ptcdel = this%ptcdel * (this%l2norm0 / l2norm)**this%ptcexp
2590 if (this%ptcdel >
dzero)
then
2591 ptcval =
done / this%ptcdel
2596 do ieq = 1, this%neq
2597 irow_glo = ieq + this%matrix_offset
2598 if (this%active(ieq) > 0)
then
2599 diagval = abs(this%system_matrix%get_diag_value(irow_glo))
2600 bnorm = bnorm + this%rhs(ieq) * this%rhs(ieq)
2601 call this%system_matrix%add_diag_value(irow_glo, -ptcval)
2602 this%rhs(ieq) = this%rhs(ieq) - ptcval * this%x(ieq)
2606 if (this%iptcout > 0)
then
2607 write (this%iptcout,
'(i10,5(1x,e15.7),1(1x,f15.6))') &
2608 kiter, this%ptcdel, this%l2norm0, l2norm, bnorm, &
2609 ptcval, bnorm / l2norm
2611 this%l2norm0 = l2norm
2618 if (itestmat == 1)
then
2619 write (fname, fmtfname) this%id, kper, kstp, kiter
2620 print *,
'Saving amat to: ', trim(adjustl(fname))
2623 open (itestmat, file=trim(adjustl(fname)))
2624 write (itestmat, *)
'NODE, RHS, AMAT FOLLOW'
2625 do ieq = 1, this%neq
2626 irow_glo = ieq + this%matrix_offset
2627 icol_s = this%system_matrix%get_first_col_pos(irow_glo)
2628 icol_e = this%system_matrix%get_last_col_pos(irow_glo)
2629 write (itestmat,
'(*(G0,:,","))') &
2632 (this%system_matrix%get_column(ipos), ipos=icol_s, icol_e), &
2633 (this%system_matrix%get_value_pos(ipos), ipos=icol_s, icol_e)
2644 call this%imslinear%imslinear_apply(this%icnvg, kstp, kiter, in_iter, &
2645 this%nitermax, this%convnmod, &
2646 this%convmodstart, this%caccel, &
2649 call this%linear_solver%solve(kiter, this%vec_rhs, &
2650 this%vec_x, this%cnvg_summary)
2651 in_iter = this%linear_solver%iteration_number
2652 this%icnvg = this%linear_solver%is_converged
2665 integer(I4B),
intent(in) :: ifdparam
2668 select case (ifdparam)
2676 this%amomentum =
dzero
2680 this%res_lim =
dzero
2688 this%akappa = 0.0001d0
2690 this%amomentum =
dzero
2694 this%res_lim =
dzero
2702 this%akappa = 0.0001d0
2704 this%amomentum =
dzero
2708 this%res_lim = 0.002d0
2724 integer(I4B),
intent(in) :: kiter
2726 character(len=7) :: cmsg
2728 integer(I4B) :: btflag
2729 integer(I4B) :: ibflag
2730 integer(I4B) :: ibtcnt
2738 call this%sln_buildsystem(kiter, inewton=0)
2742 if (kiter == 1)
then
2743 call this%sln_l2norm(this%res_prev)
2744 resin = this%res_prev
2747 call this%sln_l2norm(this%res_new)
2748 resin = this%res_new
2752 if (this%res_new > this%res_prev * this%btol)
then
2755 btloop:
do nb = 1, this%numtrack
2758 call this%sln_backtracking_xupdate(btflag)
2761 if (btflag == 0)
then
2769 call this%sln_buildsystem(kiter, inewton=0)
2773 call this%sln_l2norm(this%res_new)
2776 if (nb == this%numtrack)
then
2780 if (this%res_new < this%res_prev * this%btol)
then
2784 if (this%res_new < this%res_lim)
then
2790 this%res_prev = this%res_new
2794 if (this%iprims > 0)
then
2795 if (ibtcnt > 0)
then
2802 call this%outertab%add_term(
'Backtracking')
2803 call this%outertab%add_term(kiter)
2804 call this%outertab%add_term(
' ')
2805 if (this%numtrack > 0)
then
2806 call this%outertab%add_term(ibflag)
2807 call this%outertab%add_term(ibtcnt)
2808 call this%outertab%add_term(resin)
2809 call this%outertab%add_term(this%res_prev)
2811 call this%outertab%add_term(
' ')
2812 call this%outertab%add_term(cmsg)
2813 call this%outertab%add_term(
' ')
2826 integer(I4B),
intent(inout) :: bt_flag
2828 bt_flag = this%get_backtracking_flag()
2831 if (bt_flag > 0)
then
2832 call this%apply_backtracking()
2841 integer(I4B) :: bt_flag
2846 real(dp) :: dx_abs_max
2854 if (this%active(n) < 1) cycle
2855 dx = this%x(n) - this%xtemp(n)
2857 if (dx_abs > dx_abs_max) dx_abs_max = dx_abs
2861 if (this%breduc * dx_abs_max >= this%dvclose)
then
2871 integer(I4B) :: idv_scale
2877 do i = 1, this%modellist%Count()
2879 if (mp%get_idv_scale() /= 0)
then
2882 if (idv_scale == 1)
then
2899 if (this%active(n) < 1) cycle
2900 delx = this%breduc * (this%x(n) - this%xtemp(n))
2901 this%x(n) = this%xtemp(n) + delx
2924 vec_resid => this%system_matrix%create_vec(this%neq)
2925 call this%sln_calc_residual(vec_resid)
2928 l2norm = vec_resid%norm2()
2931 call vec_resid%destroy()
2932 deallocate (vec_resid)
2943 integer(I4B),
intent(in) :: nsize
2944 real(DP),
dimension(nsize),
intent(in) :: v
2945 real(DP),
intent(inout) :: vmax
2957 if (denom ==
dzero)
then
2962 dnorm = abs(d) / denom
2963 if (dnorm >
done)
then
2977 integer(I4B),
intent(in) :: neq
2978 integer(I4B),
dimension(neq),
intent(in) :: active
2979 real(DP),
dimension(neq),
intent(in) :: x
2980 real(DP),
dimension(neq),
intent(in) :: xtemp
2981 real(DP),
dimension(neq),
intent(inout) :: dx
2988 if (active(n) < 1)
then
2991 dx(n) = x(n) - xtemp(n)
3000 integer(I4B) :: iptc
3011 vec_resid => this%system_matrix%create_vec(this%neq)
3012 call this%sln_calc_residual(vec_resid)
3015 do im = 1, this%modellist%Count()
3017 call mp%model_ptc(vec_resid, iptc, ptcf)
3021 call vec_resid%destroy()
3022 deallocate (vec_resid)
3034 call this%system_matrix%multiply(this%vec_x, vec_resid)
3036 call vec_resid%axpy(-1.0_dp, this%vec_rhs)
3039 if (this%active(n) < 1)
then
3040 call vec_resid%set_value_local(n, 0.0_dp)
3054 integer(I4B),
intent(in) :: kiter
3055 real(DP),
intent(in) :: bigch
3056 integer(I4B),
intent(in) :: neq
3057 integer(I4B),
dimension(neq),
intent(in) :: active
3058 real(DP),
dimension(neq),
intent(inout) :: x
3059 real(DP),
dimension(neq),
intent(in) :: xtemp
3070 if (this%nonmeth == 1)
then
3074 if (active(n) < 1) cycle
3077 delx = x(n) - xtemp(n)
3078 this%dxold(n) = delx
3081 x(n) = xtemp(n) + this%gamma * delx
3085 else if (this%nonmeth == 2)
then
3091 if (kiter == 1)
then
3093 this%relaxold =
done
3094 this%bigchold = bigch
3098 es = this%bigch / (this%bigchold * this%relaxold)
3100 if (es < -
done)
then
3106 this%relaxold = relax
3109 this%bigchold = (
done - this%gamma) * this%bigch + this%gamma * &
3113 if (relax <
done)
then
3117 if (active(n) < 1) cycle
3120 delx = x(n) - xtemp(n)
3121 this%dxold(n) = delx
3122 x(n) = xtemp(n) + relax * delx
3127 else if (this%nonmeth == 3)
then
3131 if (active(n) < 1) cycle
3134 delx = x(n) - xtemp(n)
3137 if (kiter == 1)
then
3138 this%wsave(n) =
done
3139 this%hchold(n) =
dem20
3140 this%deold(n) =
dzero
3147 if (this%deold(n) * delx <
dzero)
then
3148 ww = this%theta * this%wsave(n)
3151 ww = this%wsave(n) + this%akappa
3157 if (kiter == 1)
then
3158 this%hchold(n) = delx
3160 this%hchold(n) = (
done - this%gamma) * delx + &
3161 this%gamma * this%hchold(n)
3165 this%deold(n) = delx
3166 this%dxold(n) = delx
3170 if (kiter > 4) amom = this%amomentum
3171 delx = delx * ww + amom * this%hchold(n)
3172 x(n) = xtemp(n) + delx
3187 real(DP),
intent(inout) :: hncg
3188 integer(I4B),
intent(inout) :: lrch
3202 if (this%active(n) < 1) cycle
3203 hdif = this%x(n) - this%xtemp(n)
3205 if (ahdif > abigch)
then
3220 logical(LGP) :: has_converged
3222 has_converged = .false.
3223 if (abs(max_dvc) <= this%dvclose)
then
3224 has_converged = .true.
3234 real(dp),
intent(in) :: dpak
3235 character(len=LENPAKLOC),
intent(in) :: cpakout
3236 integer(I4B),
intent(in) :: iend
3238 integer(I4B) :: ivalue
3240 if (abs(dpak) > this%dvclose)
then
3245 'PACKAGE (', trim(cpakout),
') CAUSED CONVERGENCE FAILURE'
3257 integer(I4B),
intent(in) :: inewtonur
3259 integer(I4B) :: ivalue
3268 result(has_converged)
3270 real(dp),
intent(in) :: dxold_max
3271 real(dp),
intent(in) :: hncg
3272 logical(LGP) :: has_converged
3274 has_converged = .false.
3275 if (abs(dxold_max) <= this%dvclose .and. &
3276 abs(hncg) <= this%dvclose)
then
3277 has_converged = .true.
3289 integer(I4B),
intent(in) :: nodesln
3290 character(len=*),
intent(inout) :: str
3294 integer(I4B) :: istart
3295 integer(I4B) :: iend
3296 integer(I4B) :: noder
3297 integer(I4B) :: nglo
3306 nglo = nodesln + this%matrix_offset
3309 do i = 1, this%modellist%Count()
3313 call mp%get_mrange(istart, iend)
3314 if (nglo >= istart .and. nglo <= iend)
then
3315 noder = nglo - istart + 1
3316 call mp%get_mcellid(noder, str)
3330 integer(I4B),
intent(in) :: nodesln
3331 integer(I4B),
intent(inout) :: im
3332 integer(I4B),
intent(inout) :: nodeu
3336 integer(I4B) :: istart
3337 integer(I4B) :: iend
3338 integer(I4B) :: noder, nglo
3344 nglo = nodesln + this%matrix_offset
3347 do i = 1, this%modellist%Count()
3351 call mp%get_mrange(istart, iend)
3352 if (nglo >= istart .and. nglo <= iend)
then
3353 noder = nglo - istart + 1
3354 call mp%get_mnodeu(noder, nodeu)
3368 class(*),
pointer,
intent(inout) :: obj
3376 if (.not.
associated(obj))
return
3392 type(
listtype),
intent(inout) :: list
3393 integer(I4B),
intent(in) :: idx
3397 class(*),
pointer :: obj
3399 obj => list%GetItem(idx)
subroutine, public ats_submit_delt(kstp, kper, dt, sloc, idir)
@ brief Allow and external caller to submit preferred time step
subroutine, public addbasesolutiontolist(list, solution)
This module contains block parser methods.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
@ tabright
right justified table column
@ tableft
left justified table column
@ mvalidate
validation mode - do not run time steps
@ mnormal
normal output mode
real(dp), parameter dem20
real constant 1e-20
real(dp), parameter dep3
real constant 1000
integer(i4b), parameter lensolutionname
maximum length of the solution name
real(dp), parameter dep6
real constant 1000000
real(dp), parameter donethird
real constant 1/3
real(dp), parameter dnodata
real no data constant
integer(i4b), parameter lenpakloc
maximum length of a package location
real(dp), parameter dep20
real constant 1e20
real(dp), parameter dem1
real constant 1e-1
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dem3
real constant 1e-3
real(dp), parameter dem4
real constant 1e-4
real(dp), parameter dem6
real constant 1e-6
real(dp), parameter dzero
real constant zero
real(dp), parameter dprec
real constant machine precision
real(dp), parameter dem15
real constant 1e-15
real(dp), parameter dem2
real constant 1e-2
real(dp), parameter dtwo
real constant 2
integer(i4b), parameter lenmempath
maximum length of the memory path
real(dp), parameter dthree
real constant 3
real(dp), parameter done
real constant 1
subroutine pstop(status, message)
Stop the program, optionally specifying an error status code.
subroutine, public ims_misc_dvscale(IOPT, NEQ, DSCALE, X, B)
@ brief Scale X and RHS
subroutine allocate_scalars(this)
@ brief Allocate and initialize scalars
integer(i4b), parameter, public cg_method
This module defines variable data types.
class(linearsolverbasetype) function, pointer, public create_linear_solver(solver_mode, sln_name)
Factory method to create the linear solver object.
type(listtype), public basesolutionlist
pure logical function, public is_close(a, b, rtol, atol, symmetric)
Check if a real value is approximately equal to another.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
Store and issue logging messages to output units.
subroutine, public write_message(text, iunit, fmt, skipbefore, skipafter, advance)
Write a message to an output unit.
class(numericalexchangetype) function, pointer, public getnumericalexchangefromlist(list, idx)
Retrieve a specific numerical exchange from a list.
subroutine, public addnumericalexchangetolist(list, exchange)
Add numerical exchange to a list.
subroutine, public addnumericalmodeltolist(list, model)
class(numericalmodeltype) function, pointer, public getnumericalmodelfromlist(list, idx)
subroutine convergence_summary(this, iu, im, itertot_timestep)
@ brief Solution convergence summary
subroutine sln_get_nodeu(this, nodesln, im, nodeu)
@ brief Get user node number
integer(i4b) function sln_sync_newtonur_flag(this, inewtonur)
Synchronize Newton Under-relaxation flag.
subroutine save(this, filename)
@ brief Save solution data to a file
subroutine sln_backtracking_xupdate(this, bt_flag)
@ brief Backtracking update of the dependent variable
logical(lgp) function sln_nur_has_converged(this, dxold_max, hncg)
Custom convergence check for when Newton UR has been applied.
logical(lgp) function sln_has_converged(this, max_dvc)
integer(i4b), parameter petsc_solver
integer(i4b) function sln_package_convergence(this, dpak, cpakout, iend)
Check package convergence.
type(listtype) function, pointer get_exchanges(this)
Returns a pointer to the list of exchanges in this solution.
subroutine sln_l2norm(this, l2norm)
@ brief Calculate the solution L-2 norm for all active cells using
subroutine sln_connect(this)
@ brief Assign solution connections
subroutine sln_get_loc(this, nodesln, str)
@ brief Get cell location string
subroutine apply_backtracking(this)
Update x with backtracking.
subroutine writecsvheader(this)
@ brief CSV header
integer(i4b) function sln_get_idvscale(this)
Check if dependent variable scalining should be applied for this solution,.
subroutine sln_buildsystem(this, kiter, inewton)
subroutine sln_maxval(this, nsize, v, vmax)
@ brief Get the maximum value from a vector
subroutine sln_calc_residual(this, vec_resid)
Calculate the current residual vector r = A*x - b,.
subroutine sln_backtracking(this, mp, cp, kiter)
@ brief Perform backtracking
subroutine sln_calc_ptc(this, iptc, ptcf)
Calculate pseudo-transient continuation factor.
subroutine sln_underrelax(this, kiter, bigch, neq, active, x, xtemp)
@ brief Under-relaxation
class(numericalsolutiontype) function, pointer, public castasnumericalsolutionclass(obj)
@ brief Cast a object as a Numerical Solution
type(listtype) function, pointer get_models(this)
Get a list of models.
subroutine finalizesolve(this, kiter, isgcnvg, isuppress_output)
@ brief finalize a solution
subroutine sln_setouter(this, ifdparam)
@ brief Set default Picard iteration variables
subroutine sln_ls(this, kiter, kstp, kper, in_iter, iptc, ptcf)
@ brief Solve the linear system of equations
subroutine sln_calcdx(this, neq, active, x, xtemp, dx)
@ brief Calculate dependent-variable change
integer(i4b), parameter ims_solver
subroutine csv_convergence_summary(this, iu, totim, kper, kstp, kouter, niter, istart, kstart)
@ brief Solution convergence CSV summary
subroutine sln_reset(this)
@ brief Reset the solution
class(numericalsolutiontype) function, pointer, public getnumericalsolutionfromlist(list, idx)
@ brief Get a numerical solution
subroutine allocate_arrays(this)
@ brief Allocate arrays
integer(i4b) function get_backtracking_flag(this)
Check if backtracking should be applied for this solution,.
subroutine preparesolve(this)
@ brief prepare to solve
subroutine writeptcinfotofile(this, kper)
@ brief PTC header
subroutine add_exchange(this, exchange)
Add exchange.
subroutine add_model(this, mp)
@ brief Add a model
subroutine, public create_numerical_solution(num_sol, filename, id)
@ brief Create a new solution
subroutine sln_get_dxmax(this, hncg, lrch)
@ brief Determine maximum dependent-variable change
type(profilertype), public g_prof
the global timer object (to reduce trivial lines of code)
subroutine print(this, output_unit)
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public deprecation_warning(cblock, cvar, cver, endmsg, iunit)
Store deprecation warning message.
integer(i4b), parameter, public stg_bfr_exg_ad
before exchange advance (per solution)
integer(i4b), parameter, public stg_bfr_exg_cf
before exchange calculate (per solution)
integer(i4b), parameter, public stg_bfr_exg_fc
before exchange formulate (per solution)
integer(i4b), parameter, public stg_bfr_exg_ac
before exchange add connections (per solution)
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) simulation_mode
integer(i4b) iout
file unit number for simulation output
integer(i4b) isim_mode
simulation mode
subroutine, public table_cr(this, name, title)
real(dp), pointer, public totim
time relative to start of simulation
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
subroutine, public code_timer(it, t1, ts)
Get end time and calculate elapsed time.
This module contains version information.
integer(i4b), parameter idevelopmode
Highest level model type. All models extend this parent type.
This structure stores the generic convergence info for a solution.
Abstract type for linear solver.
A generic heterogeneous doubly-linked list.