Skip to content

Commit

Permalink
various fixes in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
balos1 committed Feb 26, 2024
1 parent 7a89ea6 commit 89b9f35
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 19 deletions.
25 changes: 16 additions & 9 deletions examples/arkode/F2003_serial/ark_kpr_mri_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,13 @@
! at the end.
!--------------------------------------------------------------------

module ode_mod
module ark_kpr_mri_mod

use, intrinsic :: iso_c_binding
use fsundials_core_mod
use farkode_mod
use farkode_arkstep_mod
use farkode_mristep_mod
use fnvector_serial_mod
use fsunmatrix_dense_mod
use fsunlinsol_dense_mod

Expand Down Expand Up @@ -556,9 +555,17 @@ integer(c_int) function Ytrue(t, y) &

program main

use ode_mod
implicit none
use, intrinsic :: iso_c_binding
use fsundials_core_mod
use farkode_mod
use farkode_arkstep_mod
use farkode_mristep_mod
use fnvector_serial_mod
use fsunmatrix_dense_mod
use fsunlinsol_dense_mod
use ark_kpr_mri_mod

implicit none

! general problem variables
type(c_ptr) sunctx ! SUNDIALS simulation context
Expand Down Expand Up @@ -666,14 +673,14 @@ program main
print *, " solver: none/exp-3 (no slow, explicit fast)"
case (2)
reltol = max(hs*hs*hs, real(1e-10,8))
abstol = 1e-11
abstol = real(1e-11,8)
print *, " solver: none/dirk-3 (no slow, dirk fast)"
print '(A,E12.4,A,E12.4)', " reltol: ", reltol, " abstol: ", abstol
case (3)
print *, " solver: exp-3/none (explicit slow, no fast)"
case (4)
reltol = max(hs*hs, real(1e-10,8))
abstol = 1e-11
abstol = real(1e-11,8)
print *, " solver: dirk-2/none (dirk slow, no fast)"
print '(A,E12.4,A,E12.4)', " reltol: ", reltol, " abstol: ", abstol
case (5)
Expand All @@ -682,17 +689,17 @@ program main
print *, " solver: exp-4/exp-3 (MRI-GARK-ERK45a / ERK-3-3)"
case (7)
reltol = max(hs*hs*hs, real(1e-10,8))
abstol = 1e-11
abstol = real(1e-11,8)
print *, " solver: dirk-3/exp-3 (MRI-GARK-ESDIRK34a / ERK-3-3) -- solve decoupled"
print '(A,E12.4,A,E12.4)', " reltol: ", reltol, " abstol: ", abstol
case (8)
reltol = max(hs*hs*hs, real(1e-10,8))
abstol = 1e-11
abstol = real(1e-11,8)
print *, " solver: ars343/exp-3 (IMEX-MRI3b / ERK-3-3) -- solve decoupled"
print '(A,E12.4,A,E12.4)', " reltol: ", reltol, " abstol: ", abstol
case (9)
reltol = max(hs*hs*hs*hs, real(1e-14,8))
abstol = 1e-14
abstol = real(1e-14,8)
print *, " solver: imexark4/exp-4 (IMEX-MRI4 / ERK-4-4) -- solve decoupled"
print '(A,E12.4,A,E12.4)', " reltol: ", reltol, " abstol: ", abstol
end select
Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/F2003_serial/test_ark_butcher_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ integer function smoke_tests() result(ret)
implicit none
type(c_ptr) :: ERK, DIRK
integer(c_int) :: ierr, q(1), p(1)
integer(c_long_long) :: liw(1), lrw(1)
integer(c_long) :: liw(1), lrw(1)
real(c_double) :: b(2), c(2), d(2), A(4)

!===== Setup ====
Expand Down
2 changes: 1 addition & 1 deletion examples/idas/F2003_serial/idasAkzoNob_ASAi_dns_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ program main
retval = FIDASStolerancesB(mem, indexB(1), RTOLB, ATOLB)
call check_retval(retval, "FIDASStolerancesB")

retval = FIDASetMaxNumStepsB(mem, indexB(1), 1000_8)
retval = FIDASetMaxNumStepsB(mem, indexB(1), 1000)
call check_retval(retval, "FIDASetMaxNumStepsB")

! Create dense SUNMatrix for use in linear solves
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/test_sunlinsol.f90
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ integer(C_INT) function Test_FSUNLinSolSpace(S, myid) result(failure)

type(SUNLinearSolver), pointer :: S
integer(C_INT) :: myid
integer(c_int64_t) :: lenrw(1), leniw(1)
integer(C_LONG) :: lenrw(1), leniw(1)

failure = 0

Expand Down
2 changes: 1 addition & 1 deletion examples/sunmatrix/band/test_fsunmatrix_band_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ integer(C_INT) function smoke_tests() result(fails)
type(SUNMatrix), pointer :: A, B ! SUNMatrix
type(N_Vector), pointer :: x, y ! NVectors
real(C_DOUBLE), pointer :: matdat(:) ! matrix data pointer
integer(c_int64_t) :: lenrw(1), leniw(1) ! matrix real and int work space size
integer(C_LONG) :: lenrw(1), leniw(1) ! matrix real and int work space size
integer(c_int64_t) :: val
type(C_PTR), pointer :: cptr

Expand Down
4 changes: 2 additions & 2 deletions examples/sunmatrix/dense/test_fsunmatrix_dense_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ integer(C_INT) function smoke_tests() result(fails)
type(SUNMatrix), pointer :: A, B ! SUNMatrix
type(N_Vector), pointer :: x, y ! NVectors
real(C_DOUBLE), pointer :: matdat(:) ! matrix data pointer
integer(c_int64_t) :: lenrw(1), leniw(1) ! matrix real and int work space size
integer(c_int64_t) :: val
integer(C_LONG) :: lenrw(1), leniw(1) ! matrix real and int work space size
integer(c_int64_t) :: val

fails = 0

Expand Down
2 changes: 1 addition & 1 deletion examples/sunmatrix/sparse/test_fsunmatrix_sparse_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ integer(C_INT) function smoke_tests() result(fails)
type(N_Vector), pointer :: x, y
real(C_DOUBLE), pointer :: matdat(:) ! matrix data pointer
integer(c_int64_t), pointer :: inddat(:) ! indices data pointer
integer(c_int64_t) :: lenrw(1), leniw(1) ! matrix real and int work space size
integer(C_LONG) :: lenrw(1), leniw(1) ! matrix real and int work space size

integer(c_int64_t) :: tmp1
integer(C_INT) :: tmp2
Expand Down
2 changes: 1 addition & 1 deletion examples/sunmatrix/test_sunmatrix.f90
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ integer(C_INT) function Test_FSUNMatSpace(A, myid) result(failure)

integer(C_INT) :: myid
type(SUNMatrix) :: A
integer(c_int64_t) :: lenrw(1), leniw(1)
integer(C_LONG) :: lenrw(1), leniw(1)

failure = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ integer(C_INT) function unit_tests() result(retval)
type(SUNNonlinearSolver), pointer :: NLS ! test nonlinear solver
type(N_Vector), pointer :: x, y0, y, w ! test vectors
real(C_DOUBLE), pointer :: ydata(:)
integer(c_int64_t) :: niters(1)
integer(C_LONG) :: niters(1)
integer(C_INT) :: tmp

x => FN_VNew_Serial(NEQ, sunctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ integer(C_INT) function unit_tests() result(retval)

type(SUNNonlinearSolver), pointer :: NLS ! test nonlinear solver
real(C_DOUBLE), pointer :: ydata(:)
integer(c_int64_t) :: niters(1)
integer(C_LONG) :: niters(1)
integer(C_INT) :: tmp
type(IntegratorMem), pointer :: Imem

Expand Down

0 comments on commit 89b9f35

Please sign in to comment.