Skip to content

Commit

Permalink
Made a number of requested changes, will push the rest tomorrow.
Browse files Browse the repository at this point in the history
  • Loading branch information
danmm16 committed Jul 18, 2023
1 parent 430db54 commit 15417b7
Show file tree
Hide file tree
Showing 33 changed files with 142 additions and 216 deletions.
29 changes: 16 additions & 13 deletions examples/arkode/F2003_parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ---------------------------------------------------------------
# Programmer(s): David J. Gardner @ LLNL
# modified by Daniel M. Margolis @ SMU
# ---------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2023, Lawrence Livermore National Security
Expand All @@ -16,19 +17,21 @@

# Example lists are tuples "name\;nodes\;tasks\;type" where the
# type is develop for examples excluded from 'make test' in releases
if(SUNDIALS_LOGGING_ENABLE_MPI)
set(FARKODE_examples
"ark_brusselator1D_task_local_nls_f2003\;--monitor\;1\;4\;develop\;2"
"ark_brusselator1D_task_local_nls_f2003\;--monitor --global-nls\;1\;4\;develop\;2"
"ark_brusselator1D_task_local_nls_f2003\;--monitor --explicit --tf 3\;1\;4\;develop\;2"
"ark_diag_kry_bbd_f2003\;\;1\;4\;develop\;2"
"ark_diag_non_f2003\;\;1\;4\;develop\;2"
"ark_heat2D_f2003\;\;1\;4\;develop\;2")
else()
set(FARKODE_examples
"ark_diag_kry_bbd_f2003\;\;1\;4\;develop\;2"
"ark_diag_non_f2003\;\;1\;4\;develop\;2"
"ark_heat2D_f2003\;\;1\;4\;develop\;2")
if(MPI_ENABLED)
if(SUNDIALS_LOGGING_ENABLE_MPI)
set(FARKODE_examples
"ark_brusselator1D_task_local_nls_f2003\;--monitor\;1\;4\;develop\;2"
"ark_brusselator1D_task_local_nls_f2003\;--monitor --global-nls\;1\;4\;develop\;2"
"ark_brusselator1D_task_local_nls_f2003\;--monitor --explicit --tf 3\;1\;4\;develop\;2"
"ark_diag_kry_bbd_f2003\;\;1\;4\;develop\;2"
"ark_diag_non_f2003\;\;1\;4\;develop\;2"
"ark_heat2D_f2003\;\;1\;4\;develop\;2")
else()
set(FARKODE_examples
"ark_diag_kry_bbd_f2003\;\;1\;4\;develop\;2"
"ark_diag_non_f2003\;\;1\;4\;develop\;2"
"ark_heat2D_f2003\;\;1\;4\;develop\;2")
endif()
endif()


Expand Down
4 changes: 2 additions & 2 deletions examples/arkode/F2003_parallel/ark_diag_kry_bbd_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ end function firhs
!-----------------------------------------------------------------

!-----------------------------------------------------------------
! ODE RHS function f(t,y) (implicit).
! Local g function for BBD preconditioner (calls ODE RHS function).
!-----------------------------------------------------------------
integer(c_int) function LocalgFn(nnlocal, t, sunvec_y, sunvec_g, user_data) &
result(retval) bind(C)
Expand Down Expand Up @@ -141,7 +141,7 @@ end function LocalgFn
!-----------------------------------------------------------------

!-----------------------------------------------------------------
! ODE RHS function f(t,y) (implicit).
! Communication function for BBD preconditioner (Empty).
!-----------------------------------------------------------------
integer(c_int) function CommFn(nnlocal, t, sunvec_y, user_data) &
result(retval) bind(C)
Expand Down
5 changes: 3 additions & 2 deletions examples/arkode/F2003_parallel/ark_diag_non_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ program driver
call MPI_Abort(comm, 1, ierr)
end if

! Main time-stepping loop: calls ARKode to perform the integration, then
! prints results. Stops when the final time has been reached
! Main time-stepping loop: calls FERKStepEvolve to perform the
! integration, then prints results. Stops when the final time
! has been reached.
t(1) = T0
dTout = 0.1d0
tout = T0+dTout
Expand Down
1 change: 1 addition & 0 deletions examples/arkode/F2003_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ---------------------------------------------------------------
# Programmer(s): Cody J. Balos @ LLNL
# modified by Daniel M. Margolis @ SMU
# ---------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2023, Lawrence Livermore National Security
Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/F2003_serial/README
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ List of serial ARKODE F2003 examples

ark_roberts_dns_f2003 : robertson chemical kinetics ODE with rootfinding (DIRK/DENSE)

ark_roberts_dnsL_f2003 : robertson chemical kinetics ODE with rootfinding using LAPack (DIRK/DENSE)
ark_roberts_dnsL_f2003 : robertson chemical kinetics ODE with rootfinding using LAPACK (DIRK/DENSE)

test_ark_butcher_f2003 : smoke tests for the Fortran 2003 interface to the ARKodeButcherTable API

Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/F2003_serial/ark_bruss_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ program main
stop 1
end if

! Open output stream for results, output comment line
! Open output stream for results, output comment line
open(100, file='solution.txt')
write(100,*) '# t u v w'

Expand Down
3 changes: 1 addition & 2 deletions examples/arkode/F2003_serial/ark_diurnal_kry_bp_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,14 @@ end program main
! ----------------------------------------------------------------
! ARKStepStats
!
! Print ARKODE statstics to stdandard out
! Print ARKODE statstics to standard out
! ----------------------------------------------------------------
subroutine ARKStepStats(arkode_mem)

!======= Inclusions ===========
use iso_c_binding
use farkode_mod
use farkode_arkstep_mod
!use farkode_bandpre_mod

!======= Declarations =========
implicit none
Expand Down
4 changes: 2 additions & 2 deletions examples/arkode/F2003_serial/ark_roberts_dnsL_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module dnsL_mod
contains

! ----------------------------------------------------------------
! fcnirob: The implicit RSH operator function
! fcnirob: The implicit RHS operator function
!
! Return values:
! 0 = success,
Expand Down Expand Up @@ -476,7 +476,7 @@ subroutine PrintHeader(rtol, avtol, y)
print *, "Linear solver: LAPACK DENSE, with user-supplied Jacobian."
print '(a,f6.4,a,3(es7.0,1x))', "Tolerance parameters: rtol = ",rtol," atol = ", avtol
print '(a,3(f5.2,1x),a)', "Initial conditions y0 = (",y,")"
print *, "Constraints and id not used."
print *, "Constraints not used."
print *, " "
print *, "----------------------------------------------------------------------"
print *, " t y1 y2 y3 | nst h"
Expand Down
6 changes: 3 additions & 3 deletions examples/arkode/F2003_serial/ark_roberts_dns_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module dns_mod
contains

! ----------------------------------------------------------------
! fcnirob: The implicit RSH operator function
! fcnirob: The implicit RHS operator function
!
! Return values:
! 0 = success,
Expand Down Expand Up @@ -476,7 +476,7 @@ subroutine PrintHeader(rtol, avtol, y)
print *, "Linear solver: DENSE, with user-supplied Jacobian."
print '(a,f6.4,a,3(es7.0,1x))', "Tolerance parameters: rtol = ",rtol," atol = ", avtol
print '(a,3(f5.2,1x),a)', "Initial conditions y0 = (",y,")"
print *, "Constraints and id not used."
print *, "Constraints not used."
print *, " "
print *, "----------------------------------------------------------------------"
print *, " t y1 y2 y3 | nst h"
Expand Down Expand Up @@ -532,7 +532,7 @@ end subroutine PrintOutput
! ----------------------------------------------------------------
! PrintFinalStats
!
! Print ARKSOL statstics to standard out
! Print ARKStep statstics to standard out
! ----------------------------------------------------------------
subroutine PrintFinalStats(arkode_mem)

Expand Down
7 changes: 1 addition & 6 deletions examples/cvode/F2003_parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@

# Example lists are tuples "name\;nodes\;tasks\;type" where the
# type is develop for examples excluded from 'make test' in releases
if(SUNDIALS_LOGGING_ENABLE_MPI)
set(FCVODE_examples
"cv_diag_kry_bbd_f2003\;\;1\;4\;develop\;2"
"cv_diag_kry_f2003\;\;1\;4\;develop\;2"
"cv_diag_non_f2003\;\;1\;4\;develop\;2")
else()
if(MPI_ENABLED)
set(FCVODE_examples
"cv_diag_kry_bbd_f2003\;\;1\;4\;develop\;2"
"cv_diag_kry_f2003\;\;1\;4\;develop\;2"
Expand Down
35 changes: 5 additions & 30 deletions examples/cvode/F2003_parallel/cv_diag_kry_bbd_f2003.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!-----------------------------------------------------------------
! Programmer(s): Daniel R. Reynolds @ SMU
! modified by Daniel M. Margolis @ SMU
! Programmer(s): Daniel M. Margolis @ SMU
! modified from previous ARKODE examples
!-----------------------------------------------------------------
! SUNDIALS Copyright Start
! Copyright (c) 2002-2023, Lawrence Livermore National Security
Expand Down Expand Up @@ -94,7 +94,7 @@ integer(c_int) function firhs(t, sunvec_y, sunvec_ydot, user_data) &
! Initialize ydot to zero
ydot = 0.d0

! Fill ydot with ERP rhs function
! Fill ydot with rhs function
do i = 1,nlocal
ydot(i) = -alpha * (myid * nlocal + i) * y(i)
end do
Expand All @@ -105,7 +105,7 @@ end function firhs
!-----------------------------------------------------------------

!-----------------------------------------------------------------
! ODE RHS function f(t,y) (implicit).
! ODE RHS function used for BBD preconditioner.
!-----------------------------------------------------------------
integer(c_int) function LocalgFn(nnlocal, t, sunvec_y, sunvec_g, user_data) &
result(retval) bind(C)
Expand Down Expand Up @@ -138,31 +138,6 @@ integer(c_int) function LocalgFn(nnlocal, t, sunvec_y, sunvec_g, user_data) &
end function LocalgFn
!-----------------------------------------------------------------

!-----------------------------------------------------------------
! ODE RHS function f(t,y) (implicit).
!-----------------------------------------------------------------
integer(c_int) function CommFn(nnlocal, t, sunvec_y, user_data) &
result(retval) bind(C)

!======= Inclusions ===========
use, intrinsic :: iso_c_binding
use fsundials_nvector_mod

!======= Declarations =========
implicit none

! calling variables
real(c_double), value :: t ! current time
integer(c_long) :: nnlocal ! local space
type(N_Vector) :: sunvec_y ! solution N_Vector
type(N_Vector) :: sunvec_ydot ! rhs N_Vector
type(c_ptr) :: user_data ! user-defined data

retval = 0 ! Return with success
return
end function CommFn
!-----------------------------------------------------------------

end module DiagkrybbdData
!-----------------------------------------------------------------

Expand Down Expand Up @@ -331,7 +306,7 @@ program driver
mudq = 0
mldq = 0
retval = FCVBBDPrecInit(cvode_mem, nlocal, mudq, mldq, mu, ml, 0.d0, &
c_funloc(LocalgFn), c_funloc(CommFn))
c_funloc(LocalgFn), c_null_ptr)
if (retval /= 0) then
print *, "Error: FCVBBDPrecInit returned ", retval
call MPI_Abort(comm, 1, ierr)
Expand Down
36 changes: 4 additions & 32 deletions examples/cvode/F2003_parallel/cv_diag_kry_f2003.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!-----------------------------------------------------------------
! Programmer(s): Daniel R. Reynolds @ SMU
! modified by Daniel M. Margolis @ SMU
! Programmer(s): Daniel M. Margolis @ SMU
! modified from previous ARKODE examples
!-----------------------------------------------------------------
! SUNDIALS Copyright Start
! Copyright (c) 2002-2023, Lawrence Livermore National Security
Expand Down Expand Up @@ -94,7 +94,7 @@ integer(c_int) function firhs(t, sunvec_y, sunvec_ydot, user_data) &
! Initialize ydot to zero
ydot = 0.d0

! Fill ydot with ERP rhs function
! Fill ydot with rhs function
do i = 1,nlocal
ydot(i) = -alpha * (myid * nlocal + i) * y(i)
end do
Expand All @@ -104,33 +104,6 @@ integer(c_int) function firhs(t, sunvec_y, sunvec_ydot, user_data) &
end function firhs
!-----------------------------------------------------------------

!-----------------------------------------------------------------
! Trivial preconditioner setup function.
!-----------------------------------------------------------------
integer(c_int) function Psetup(t, sunvec_y, sunvec_f, jok, jcur, &
gamma, user_data) result(retval) bind(C)

!======= Inclusions ===========
use, intrinsic :: iso_c_binding
use fsundials_nvector_mod

!======= Declarations =========
implicit none

! calling variables
real(c_double), value :: t ! current time
type(N_Vector) :: sunvec_y ! solution N_Vector
type(N_Vector) :: sunvec_f ! rhs N_Vector
integer(c_int), value :: jok
integer(c_int) :: jcur
real(c_double), value :: gamma
type(c_ptr) :: user_data ! user-defined data

retval = 0 ! Return with success
return
end function Psetup
!-----------------------------------------------------------------

!-----------------------------------------------------------------
! Routine to solve preconditioner linear system
! This routine uses a diagonal preconditioner P = I - gamma*J,
Expand Down Expand Up @@ -211,7 +184,6 @@ program driver
use fsundials_linearsolver_mod ! Fortran interface to generic SUNLinearSolver
use fsunlinsol_spgmr_mod ! Fortran interface to spgmr SUNLinearSolver
use fsundials_context_mod ! Access sundials context

use DiagkryData

!======= Declarations =========
Expand Down Expand Up @@ -351,7 +323,7 @@ program driver
call MPI_Abort(comm, 1, ierr)
end if

retval = FCVodeSetPreconditioner(cvode_mem, c_funloc(Psetup), c_funloc(Psolve))
retval = FCVodeSetPreconditioner(cvode_mem, c_null_ptr, c_funloc(Psolve))
if (retval /= 0) then
print *, "Error: FCVodeSetPreconditioner returned ", retval
call MPI_Abort(comm, 1, ierr)
Expand Down
8 changes: 4 additions & 4 deletions examples/cvode/F2003_parallel/cv_diag_non_f2003.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!-----------------------------------------------------------------
! Programmer(s): Daniel R. Reynolds @ SMU
! modified by Daniel M. Margolis @ SMU
! Programmer(s): Daniel M. Margolis @ SMU
! modified from previous ARKODE examples
!-----------------------------------------------------------------
! SUNDIALS Copyright Start
! Copyright (c) 2002-2023, Lawrence Livermore National Security
Expand Down Expand Up @@ -89,7 +89,7 @@ integer(c_int) function frhs(t, sunvec_y, sunvec_ydot, user_data) &
! Initialize ydot to zero
ydot = 0.d0

! Fill ydot with ERP rhs function
! Fill ydot with rhs function
do i = 1,nlocal
ydot(i) = -alpha * (myid * nlocal + i) * y(i)
end do
Expand Down Expand Up @@ -196,7 +196,7 @@ program driver
write(6,'(A,es9.2)') " atol = ", atol
write(6,'(A,es9.2)') " alpha = ", alpha
write(6,*) " ydot_i = -alpha*i * y_i (i = 1,...,neq)"
write(6,*) " Method is ADAMS/FIXED-POINT/SPGMR"
write(6,*) " Method is ADAMS/FIXED-POINT"
write(6,*) " "
endif

Expand Down
4 changes: 2 additions & 2 deletions examples/cvode/F2003_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ---------------------------------------------------------------
# Programmer(s): Cody J. Balos @ LLNL
# modified by Daniel M. Margolis @ SMU
# ---------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2023, Lawrence Livermore National Security
Expand Down Expand Up @@ -28,12 +29,11 @@ set(FCVODE_examples
"cv_diurnal_kry_bp_f2003\;develop"
"cv_roberts_dns_constraints_f2003\;develop"
"cv_roberts_dns_f2003\;develop"
#"cv_roberts_dnsL_f2003\;develop"
)

# Examples using LAPACK linear solvers
set(FCVODE_examples_BL
)
"cv_roberts_dnsL_f2003\;develop")

# Add sparse solvers examples for 64-bit indextype configurations only,
# not compatible with 32-bit indextype
Expand Down
2 changes: 1 addition & 1 deletion examples/cvode/F2003_serial/README
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ List of serial CVODE F2003 examples

cv_roberts_dns_f2003.f90 : robertson problem from chemical kinetics (newton, dense, user-supplied jacobian)

cv_roberts_dnsL_f2003.f90 : robertson problem from chemical kinetics using LAPack (newton, dense, user-supplied jacobian)
cv_roberts_dnsL_f2003.f90 : robertson problem from chemical kinetics using LAPACK (newton, dense, user-supplied jacobian)

cv_roberts_klu_f2003.f90 : robertson problem from chemical kinetics using KLU solver (newton, sparse, user-supplied jacobian)

Expand Down
8 changes: 2 additions & 6 deletions examples/cvode/F2003_serial/cv_advdiff_bnd_f2003.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
! ------------------------------------------------------------------
! Programmer(s): Daniel M. Margolis @ SMU
! based off the previous Fortran-77 example program,
! cvode/fcmix_serial/fcvAdvDiff_bnd.f
! ------------------------------------------------------------------
! SUNDIALS Copyright Start
! Copyright (c) 2002-2023, Lawrence Livermore National Security
Expand Down Expand Up @@ -306,12 +308,6 @@ program main
stop 1
end if

! ierr = FCVodeSetMaxNumSteps(cvode_mem, mxsteps)
! if (ierr /= 0) then
! print *, 'Error in FCVodeSetMaxNumSteps'
! stop 1
! end if

! Start time stepping
print *, ' '
print *, 'Band example problem:'
Expand Down
1 change: 0 additions & 1 deletion examples/cvode/F2003_serial/cv_analytic_sys_klu_f2003.f90
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ program main
use fsundials_linearsolver_mod ! Fortran interface to generic SUNLinearSolver
use fsundials_matrix_mod ! Fortran interface to generic SUNMatrix
use fsundials_nvector_mod ! Fortran interface to generic N_Vector
! use fsundials_linearsolver_mod ! Fortran interface to generic SUNLinearSolver
use ode_mod ! ODE functions

!======= Declarations =========
Expand Down
Loading

0 comments on commit 15417b7

Please sign in to comment.