Skip to content

Commit

Permalink
changed info subroutine to get more current information
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholaswogan committed Sep 20, 2022
1 parent e16cd7c commit 2983a01
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 39 deletions.
12 changes: 6 additions & 6 deletions src/odepack_common.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module odepack_common
public :: odepack_common_data

type :: DLS001_type
double precision :: reals(218)
double precision :: reals(218) = 0.0d0
! double precision :: ROWNS(209)
! double precision :: CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND
integer :: ints(37)
integer :: ints(37) = 0
! integer :: INIT, MXSTEP, MXHNIL, NHNIL, NSLAST, NYH, IOWNS(6)
! integer :: ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L
! integer :: LYH, LEWT, LACOR, LSAVF, LWM, LIWM, METH, MITER
Expand All @@ -30,9 +30,9 @@ module odepack_common
! 5 MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU

type :: DLSA01_type
double precision :: reals(22)
double precision :: reals(22) = 0.0d0
! double precision :: TSW, ROWNS2(20), PDNORM
integer :: ints(9)
integer :: ints(9) = 0
! integer :: INSUFR, INSUFI, IXPR, IOWNS2(2), JTYP, MUSED, MXORDN, MXORDS
end type

Expand All @@ -42,9 +42,9 @@ module odepack_common
! 1 INSUFR, INSUFI, IXPR, IOWNS2(2), JTYP, MUSED, MXORDN, MXORDS

type :: DLSR01_type
double precision :: reals(5)
double precision :: reals(5) = 0.0d0
! double precision :: ROWNR3(2), T0, TLAST, TOUTC
integer :: ints(9)
integer :: ints(9) = 0
! integer :: LG0, LG1, LGX, IOWNR3(2), IRFND, ITASKC, NGC, NGE
end type

Expand Down
50 changes: 17 additions & 33 deletions src/odepack_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module odepack_mod

!> Derived type that replaces the common blocks in
!> the original ODEPACK
type(odepack_common_data), private :: common_data
type(odepack_common_data) :: common_data

contains
procedure :: initialize => lsoda_initialize
Expand Down Expand Up @@ -538,11 +538,10 @@ subroutine g(neq_, t_, y_, ng_, gout_, ierr_)
end subroutine

!> Get information about the integration.
subroutine lsoda_info(self, hu, hcur, tcur, tolsf, tsw, nst, &
nfe, nje, nqu, nqcur, imxer, mused, mcur)
subroutine lsoda_info(self, h, tcur, tolsf, tsw, nst, &
nfe, nje, nq, imxer, meth)
class(lsoda_class), intent(inout) :: self
real(dp), optional, intent(out) :: hu !! the step size in t last used (successfully).
real(dp), optional, intent(out) :: hcur !! the step size to be attempted on the next step.
real(dp), optional, intent(out) :: h !! the step size currently being attempted
real(dp), optional, intent(out) :: tcur !! the current value of the independent variable
!! which the solver has actually reached, i.e. the
!! current internal mesh point in t. On output, TCUR
Expand All @@ -563,58 +562,43 @@ subroutine lsoda_info(self, hu, hcur, tcur, tolsf, tsw, nst, &
integer, optional, intent(out) :: nfe !! the number of f evaluations for the problem so far.
integer, optional, intent(out) :: nje !! the number of Jacobian evaluations (and of matrix
!! LU decompositions) for the problem so far.
integer, optional, intent(out) :: nqu !! the method order last used (successfully).
integer, optional, intent(out) :: nqcur !! the order to be attempted on the next step.
integer, optional, intent(out) :: nq !! the method order currently being attempted.
integer, optional, intent(out) :: imxer !! the index of the component of largest magnitude in
!! the weighted local error vector ( E(i)/EWT(i) ),
!! on an error return with ISTATE = -4 or -5.
integer, optional, intent(out) :: mused !! the method indicator for the last successful step:
!! 1 means Adams (nonstiff), 2 means BDF (stiff).
integer, optional, intent(out) :: mcur !! the current method indicator:
integer, optional, intent(out) :: meth !! the method indicator for the current step:
!! 1 means Adams (nonstiff), 2 means BDF (stiff).
!! This is the method to be attempted
!! on the next step. Thus it differs from MUSED
!! only if a method switch has just been made.

if (present(hu)) then
hu = self%rwork(11)
endif
if (present(hcur)) then
hcur = self%rwork(12)
if (present(h)) then
h = self%common_data%DLS001%reals(212)
endif
if (present(tcur)) then
tcur = self%rwork(13)
tcur = self%common_data%DLS001%reals(217)
endif
if (present(tolsf)) then
tolsf = self%rwork(14)
endif
if (present(tsw)) then
tsw = self%rwork(15)
tsw = self%common_data%DLSA01%reals(1)
endif

if (present(nst)) then
nst = self%iwork(11)
nst = self%common_data%DLS001%ints(34)
endif
if (present(nfe)) then
nfe = self%iwork(12)
nfe = self%common_data%DLS001%ints(35)
endif
if (present(nje)) then
nje = self%iwork(13)
endif
if (present(nqu)) then
nqu= self%iwork(14)
nje = self%common_data%DLS001%ints(36)
endif
if (present(nqcur)) then
nqcur = self%iwork(15)
if (present(nq)) then
nq = self%common_data%DLS001%ints(33)
endif
if (present(imxer)) then
imxer = self%iwork(16)
endif
if (present(mused)) then
mused = self%iwork(19)
endif
if (present(mcur)) then
mcur = self%iwork(20)
if (present(meth)) then
meth = self%common_data%DLS001%ints(26)
endif

end subroutine
Expand Down

0 comments on commit 2983a01

Please sign in to comment.