Example Programs for CVODES v2.1.0
Year: 2004
Type: article
Abstract: cvdemk is a demonstration program for cvodes with the Krylov linear solver. This program solves a stiff ODE system that arises from a system of partial differential equations. The PDE system is a six-species food web population model, with predatorprey interaction and diffusion on the unit square in two dimensions. The ODE system is solved using Newton iteration and the cvspgmr linear solver (scaled preconditioned GMRES). The preconditioner matrix used is the product of two matrices: (1) a matrix, only implicitly defined, based on a fixed number of Gauss-Seidel iterations using the diffusion terms only; and (2) a block-diagonal matrix based on the partial derivatives of the interaction terms only, using block-grouping. Four different runs are made for this problem. The product preconditoner is applied on the left and on the right. In each case, both the modified and classical Gram-Schmidt options are tested.• cvfdx solves a chemical kinetics problem consisting of three rate equations.cvodes computes both its solution and solution sensitivities with respect to the three reaction rate constants appearing in the model. This program solves the problem with the BDF method, Newton iteration with the cvdense linear solver, and a usersupplied Jacobian routine.• cvfkx solves the semi-discrete form of a two-species diurnal kinetics advection-diffusion PDE system in 2-D space.cvodes computes both its solution and solution sensitivities with respect to two parameters affecting the kinetic rate terms. The problem is solved with the BDF/GMRES method (i.e. using the cvspgmr linear solver) and the block-diagonal part of the Newton matrix as a left preconditioner.• cvfnx solves the semi-discrete form of an advection-diffusion equation in 1-D.cvodes computes both its solution and solution sensitivities with respect to the advection and diffusion coefficients. This program solves the problem with the option for nonstiff systems, i.e.Adams method and functional iteration.• cvabx solves the semi-discrete form of an advection-diffusion equation in 2-D.The adjoint capability of cvodes is used to compute gradients of the average (over both time and space) of the solution with respect to the initial conditions. This program solves both the forward and backward problems with the BDF method, Newton iteration with the cvband linear solver, and user-supplied Jacobian routines.• cvadx solves a chemical kinetics problem consisting of three rate equations. The adjoint capability of cvodes is used to compute gradients of a functional of the solution with respect to the three reaction rate constants appearing in the model. This program solves both the forward and backward problems with the BDF method, Newton iteration with the cvdense linear solver, and user-supplied Jacobian routines.• cvakx solves a stiff ODE system that arises from a system of partial differential equations. The PDE system is a six-species food web population model, with predatorprey interaction and diffusion on the unit square in two dimensions.* on the interval from t = 0.0 to t = 4.e10, with initial * conditions y1 = 1.0, y2 = y3 = 0. The reaction rates are: p1=0.04,* p2=1e4, and p3=3e7.The problem is stiff.* This program solves the problem with the BDF method, Newton * iteration with the CVODES dense linear solver, and a * user-supplied Jacobian routine.* It uses a scalar relative tolerance and a vector absolute * tolerance.* Output is printed in decades from t = .4to t = 4.e10.* Run statistics (optional outputs) are printed at the end.* * Optionally, CVODES can compute sensitivities with respect to the * problem parameters p1, p2, and p3.* The sensitivity right hand side is given analytically through the * user routine fS (of type SensRhs1Fn).* Any of three sensitivity methods (SIMULTANEOUS, STAGGERED, and * STAGGERED1) can be used and sensitivities may be included in the * error test or not (error control set on TRUE or FALSE, * respectively).* * Execution: * * If no sensitivities are desired: * % cvsdx -nosensi * If sensitivities are to be computed: * % cvsdx -sensi sensi_meth err_con * where sensi_meth is one of {sim, stg, stg1} and err_con is one of * {t, f}. * -----------------------------------------------------------------*/ #include <stdio.h>#include <stdlib.h>#include <string.h>#include "sundialstypes.h"/* def. of type realtype */ #include "cvodes.h"/* prototypes for CVODES functions and constants */
Authors: A.C. Hindmarsh, Radu Serban
Language: English
Subfield: Numerical Analysis
Field: Mathematics
Domain: Physical Sciences
Keywords: stiff ordinary differential equations, preconditioned GMRES, Newton's method, predator-prey interactions, reaction kinetics, sensitivity analysis, adjoint method, advection-diffusion equation, block diagonal preconditioner, Gram-Schmidt orthogonalization, backward differentiation formula, functional iteration, parameter estimation, parameter identifiability
Open Access status: green
OpenAlex ID: W2012594481
