ode

package
v0.0.0-...-1b5bcbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2016 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Modified-Euler 2(1), order=2, error_est_order=2, nstages=2
	ME2_a = [][]float64{{0.0, 0.0},
		{1.0, 0.0}}
	ME2_b  = []float64{1.0, 0.0}
	ME2_be = []float64{0.5, 0.5}
	ME2_c  = []float64{0.0, 1.0}

	// Dormand-Prince 5(4), order=5, error_est_order=4, nstages=7
	DP5_a = [][]float64{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
		{1.0 / 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
		{3.0 / 40.0, 9.0 / 40.0, 0.0, 0.0, 0.0, 0.0, 0.0},
		{44.0 / 45.0, -56.0 / 15.0, 32.0 / 9.0, 0.0, 0.0, 0.0, 0.0},
		{19372.0 / 6561.0, -25360.0 / 2187.0, 64448.0 / 6561.0, -212.0 / 729.0, 0.0, 0.0, 0.0},
		{9017.0 / 3168.0, -355.0 / 33.0, 46732.0 / 5247.0, 49.0 / 176.0, -5103.0 / 18656.0, 0.0, 0.0},
		{35.0 / 384.0, 0.0, 500.0 / 1113.0, 125.0 / 192.0, -2187.0 / 6784.0, 11.0 / 84.0, 0.0}}
	DP5_b  = []float64{35.0 / 384.0, 0.0, 500.0 / 1113.0, 125.0 / 192.0, -2187.0 / 6784.0, 11.0 / 84.0, 0.0}
	DP5_be = []float64{5179.0 / 57600.0, 0.0, 7571.0 / 16695.0, 393.0 / 640.0, -92097.0 / 339200.0, 187.0 / 2100.0, 1.0 / 40.0}
	DP5_c  = []float64{0.0, 1.0 / 5.0, 3.0 / 10.0, 4.0 / 5.0, 8.0 / 9.0, 1.0, 1.0}
)

constants

Functions

func Plot

func Plot(dirout, fn string, res *Results, yfcn Cb_ycorr, xa, xb float64, argsAna, argsNum string, extra func())

Plot plot results

func SimpleOutput

func SimpleOutput(first bool, dx, x float64, y []float64, args ...interface{}) (err error)

SimpleOutput implements a simple output function

func WcAnalysis

func WcAnalysis(dirout, fnkey, method string, fcn Cb_fcn, jac Cb_jac, M *la.Triplet, ycfcn Cb_ycorr, ya []float64, xa, xb float64,
	orders []float64, show bool)

work/correctness analysis

Types

type Cb_fcn

type Cb_fcn func(f []float64, h, x float64, y []float64, args ...interface{}) error // function

callbacks

type Cb_jac

type Cb_jac func(dfdy *la.Triplet, h, x float64, y []float64, args ...interface{}) error // Jacobian (must have at least all diagonal elements set)

type Cb_out

type Cb_out func(first bool, h, x float64, y []float64, args ...interface{}) error // output

type Cb_ycorr

type Cb_ycorr func(y []float64, x float64, args ...interface{}) // y(x) correct

callbacks

type ERKdat

type ERKdat struct {
	// contains filtered or unexported fields
}

type R5cte

type R5cte struct {
	T  [][]float64 // T matrix
	Ti [][]float64 // inv(T) matrix
	// contains filtered or unexported fields
}

type Results

type Results struct {
	Method string      // method name
	Dx     []float64   // step sizes [Noutput]
	X      []float64   // x values [Noutput]
	Y      [][]float64 // y values [ndim][Noutput]
}

Results structure to hold numerical results

type Solver

type Solver struct {
	ZeroTrial bool    // always start iterations with zero trial values (instead of collocation interpolation)
	Atol      float64 // absolute tolerance
	Rtol      float64 // relative tolerance
	IniH      float64 // initial H
	NmaxIt    int     // max num iterations (allowed)
	NmaxSS    int     // max num substeps
	Mmin      float64 // min step multiplier
	Mmax      float64 // max step multiplier
	Mfac      float64 // step multiplier factor
	PredCtrl  bool    // use Gustafsson's predictive controller

	C1h        float64 // c1 of HW-VII p124 => min ratio to retain previous h
	C2h        float64 // c2 of HW-VII p124 => max ratio to retain previous h
	LerrStrat  int     // strategy to select local error computation method
	Pll        bool    // parallel (threaded) execution
	CteTg      bool    // use constant tangent (Jacobian) in BwEuler
	UseRmsNorm bool    // use RMS norm instead of Euclidian in BwEuler
	Verbose    bool    // be more verbose, e.g. during iterations

	// derived variables
	Distr bool // MPI distributed execution. automatically set ON in Init if mpi is on and there are more then one processor.
	// contains filtered or unexported fields
}

Solver implements an ODE solver

Note: Distr is automatically set ON by Init if mpi is on and there are more then one processor.
      However, it can be set OFF after calling Init.

func (*Solver) GetStat

func (o *Solver) GetStat() (s string)

func (*Solver) Init

func (o *Solver) Init(method string, ndim int, fcn Cb_fcn, jac Cb_jac, M *la.Triplet, out Cb_out, silent bool)

Init initialises ODE structure with default values and allocate slices

func (*Solver) SetTol

func (o *Solver) SetTol(atol, rtol float64)

SetTol sets tolerances according to Hairer and Wanner suggestions. This routine also checks for consistent values and only considers the case of scalars Atol and Rtol.

func (*Solver) Solve

func (o *Solver) Solve(y []float64, x, xb, Δx float64, fixstp bool, args ...interface{}) (err error)

Solve solves from (xa,ya) to (xb,yb) => find yb (stored in y)

func (*Solver) Stat

func (o *Solver) Stat()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL