# naginterfaces.library.pde.dim1_​parab_​fd¶

naginterfaces.library.pde.dim1_parab_fd(m, ts, tout, pdedef, bndary, u, x, acc, comm, itask, itrace, ind, data=None, io_manager=None, spiked_sorder='C')[source]

dim1_parab_fd integrates a system of linear or nonlinear parabolic partial differential equations (PDEs) in one space variable. The spatial discretization is performed using finite differences, and the method of lines is employed to reduce the PDEs to a system of ordinary differential equations (ODEs). The resulting system is solved using a backward differentiation formula method.

For full information please refer to the NAG Library document for d03pc

https://www.nag.com/numeric/nl/nagdoc_29.2/flhtml/d03/d03pcf.html

Parameters
mint

The coordinate system used:

Indicates Cartesian coordinates.

Indicates cylindrical polar coordinates.

Indicates spherical polar coordinates.

tsfloat

The initial value of the independent variable .

toutfloat

The final value of to which the integration is to be carried out.

pdedefcallable (p, q, r, ires) = pdedef(t, x, u, ux, ires, data=None)

must compute the functions , and which define the system of PDEs. is called approximately midway between each pair of mesh points in turn by dim1_parab_fd.

Parameters
tfloat

The current value of the independent variable .

xfloat

The current value of the space variable .

ufloat, ndarray, shape

contains the value of the component , for .

uxfloat, ndarray, shape

contains the value of the component , for .

iresint

Set to or .

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
pfloat, array-like, shape

must be set to the value of , for , for .

qfloat, array-like, shape

must be set to the value of , for .

rfloat, array-like, shape

must be set to the value of , for .

iresint

Should usually remain unchanged. However, you may set to force the integration function to take certain actions as described below:

Indicates to the integrator that control should be passed back immediately to the calling function with the error indicator set to = 6.

Indicates to the integrator that the current time step should be abandoned and a smaller time step used instead. You may wish to set when a physically meaningless input or output value has been generated. If you consecutively set , dim1_parab_fd returns to the calling function with the error indicator set to = 4.

bndarycallable (beta, gamma, ires) = bndary(t, u, ux, ibnd, ires, data=None)

must compute the functions and which define the boundary conditions as in equation (3).

Parameters
tfloat

The current value of the independent variable .

ufloat, ndarray, shape

contains the value of the component at the boundary specified by , for .

uxfloat, ndarray, shape

contains the value of the component at the boundary specified by , for .

ibndint

Determines the position of the boundary conditions.

must set up the coefficients of the left-hand boundary, .

Indicates that must set up the coefficients of the right-hand boundary, .

iresint

Set to or .

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
betafloat, array-like, shape

must be set to the value of at the boundary specified by , for .

gammafloat, array-like, shape

must be set to the value of at the boundary specified by , for .

iresint

Should usually remain unchanged. However, you may set to force the integration function to take certain actions as described below:

Indicates to the integrator that control should be passed back immediately to the calling function with the error indicator set to = 6.

Indicates to the integrator that the current time step should be abandoned and a smaller time step used instead. You may wish to set when a physically meaningless input or output value has been generated. If you consecutively set , dim1_parab_fd returns to the calling function with the error indicator set to = 4.

ufloat, array-like, shape

The initial values of at and the mesh points , for .

xfloat, array-like, shape

The mesh points in the spatial direction. must specify the left-hand boundary, , and must specify the right-hand boundary, .

accfloat

A positive quantity for controlling the local error estimate in the time integration. If is the estimated error for at the th mesh point, the error test is:

commdict, communication object, modified in place

Communication structure.

On initial entry: need not be set.

Specifies the task to be performed by the ODE integrator.

Normal computation of output values at .

One step and return.

Stop at first internal integration point at or beyond .

itraceint

The level of trace information required from dim1_parab_fd and the underlying ODE solver. may take the value , , , or .

No output is generated.

Only warning messages from the PDE solver are printed.

Output from the underlying ODE solver is printed. This output contains details of Jacobian entries, the nonlinear iteration and the time integration during the computation of the ODE system.

If , is assumed and similarly if , is assumed.

The advisory messages are given in greater detail as increases. You are advised to set , unless you are experienced with submodule ode.

indint

Indicates whether this is a continuation call or a new integration.

Starts or restarts the integration in time.

Continues the integration after an earlier exit from the function. In this case, only the argument should be reset between calls to dim1_parab_fd.

dataarbitrary, optional

User-communication data for callback functions.

io_managerFileObjManager, optional

Manager for I/O in this routine.

spiked_sorderstr, optional

If is spiked (i.e., has unit extent in all but one dimension, or has size ), selects the storage order to associate with it in the NAG Engine:

spiked_sorder =

row-major storage will be used;

spiked_sorder =

column-major storage will be used.

Two-dimensional arrays returned from callback functions in this routine must then use the same storage order.

Returns
tsfloat

The value of corresponding to the solution values in . Normally .

ufloat, ndarray, shape

will contain the computed solution at .

indint

.

Raises
NagValueError
(errno )

On entry, on initial entry .

Constraint: on initial entry .

(errno )

On entry, .

Constraint: or .

(errno )

On entry, , , and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: or

(errno )

On entry, .

Constraint: , or .

(errno )

On entry, .

Constraint: , or .

(errno )

On entry, is too small: and .

(errno )

On entry, and .

Constraint: .

(errno )

In setting up the ODE system an internal auxiliary was unable to initialize the derivative. This could be due to your setting in or .

(errno )

Singular Jacobian of ODE system. Check problem formulation.

(errno )

was too small to start integration: .

(errno )

set to an invalid value in call to or .

(errno )

Serious error in internal call to an auxiliary. Increase for further details.

(errno )

Error during Jacobian formulation for ODE system. Increase for further details.

(errno )

Flux function appears to depend on time derivatives.

Warns
NagAlgorithmicWarning
(errno )

Underlying ODE solver cannot make further progress from the point with the supplied value of . , .

(errno )

Repeated errors in an attempted step of underlying ODE solver. Integration was successful as far as : .

(errno )

In evaluating residual of ODE system, has been set in or . Integration is successful as far as : .

(errno )

Integration completed, but a small change in is unlikely to result in a changed solution. .

Notes

dim1_parab_fd integrates the system of parabolic equations:

where , and depend on , , , and the vector is the set of solution values

and the vector is its partial derivative with respect to . Note that , and must not depend on .

The integration in time is from to , over the space interval , where and are the leftmost and rightmost points of a user-defined mesh . The coordinate system in space is defined by the value of ; for Cartesian coordinates, for cylindrical polar coordinates and for spherical polar coordinates. The mesh should be chosen in accordance with the expected behaviour of the solution.

The system is defined by the functions , and which must be specified in .

The initial values of the functions must be given at . The functions , for , which may be thought of as fluxes, are also used in the definition of the boundary conditions for each equation. The boundary conditions must have the form

where or .

The boundary conditions must be specified in .

The problem is subject to the following restrictions:

1. , so that integration is in the forward direction;

2. , and the flux must not depend on any time derivatives;

3. the evaluation of the functions , and is done at the mid-points of the mesh intervals by calling the for each mid-point in turn. Any discontinuities in these functions must, therefore, be at one or more of the mesh points ;

4. at least one of the functions must be nonzero so that there is a time derivative present in the problem; and

5. if and , which is the left boundary point, then it must be ensured that the PDE solution is bounded at this point. This can be done by either specifying the solution at or by specifying a zero flux there, that is and . See also Further Comments.

The parabolic equations are approximated by a system of ODEs in time for the values of at mesh points. For simple problems in Cartesian coordinates, this system is obtained by replacing the space derivatives by the usual central, three-point finite difference formula. However, for polar and spherical problems, or problems with nonlinear coefficients, the space derivatives are replaced by a modified three-point formula which maintains second-order accuracy. In total there are ODEs in the time direction. This system is then integrated forwards in time using a backward differentiation formula method.

References

Berzins, M, 1990, Developments in the NAG Library software for parabolic equations, Scientific Software Systems, (eds J C Mason and M G Cox), 59–72, Chapman and Hall

Berzins, M, Dew, P M and Furzeland, R M, 1989, Developing software for time-dependent problems using the method of lines and differential-algebraic integrators, Appl. Numer. Math. (5), 375–397

Dew, P M and Walsh, J, 1981, A set of library routines for solving parabolic equations in one space variable, ACM Trans. Math. Software (7), 295–314

Pennington, S V and Berzins, M, 1994, New NAG Library software for first-order partial differential equations, ACM Trans. Math. Softw. (20), 63–99

Skeel, R D and Berzins, M, 1990, A method for the spatial discretization of parabolic equations in one space variable, SIAM J. Sci. Statist. Comput. (11(1)), 1–32