naginterfaces.library.pde.dim1_parab_keller¶
- naginterfaces.library.pde.dim1_parab_keller(ts, tout, pdedef, bndary, u, x, nleft, acc, comm, itask, itrace, ind, data=None, io_manager=None)[source]¶
dim1_parab_keller
integrates a system of linear or nonlinear, first-order, time-dependent partial differential equations (PDEs) in one space variable. The spatial discretization is performed using the Keller box scheme 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 (BDF) method.For full information please refer to the NAG Library document for d03pe
https://www.nag.com/numeric/nl/nagdoc_27.3/flhtml/d03/d03pef.html
- Parameters
- tsfloat
The initial value of the independent variable .
- toutfloat
The final value of to which the integration is to be carried out.
- pdedefcallable (res, ires) = pdedef(t, x, u, ut, ux, ires, data=None)
must compute the functions which define the system of PDEs. is called approximately midway between each pair of mesh points in turn by
dim1_parab_keller
.- 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 .
- utfloat, ndarray, shape
contains the value of the component , for .
- uxfloat, ndarray, shape
contains the value of the component , for .
- iresint
The form of that must be returned in the array .
Equation (8) must be used.
Equation (9) must be used.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- resfloat, array-like, shape
must contain the th component of , for , where is defined as
i.e., only terms depending explicitly on time derivatives, or
i.e., all terms in equation (2).
The definition of is determined by the input value of .
- iresint
Should usually remain unchanged. However, you may set to force the integration function to take certain actions, as described below:
- bndarycallable (res, ires) = bndary(t, ibnd, nobc, u, ut, ires, data=None)
must compute the functions and which define the boundary conditions as in equations (4) and (5).
- Parameters
- tfloat
The current value of the independent variable .
- ibndint
Determines the position of the boundary conditions.
must compute the left-hand boundary condition at .
Indicates that must compute the right-hand boundary condition at .
- nobcint
Specifies the number of boundary conditions at the boundary specified by .
- ufloat, ndarray, shape
contains the value of the component at the boundary specified by , for .
- utfloat, ndarray, shape
contains the value of the component at the boundary specified by , for .
- iresint
The form (or ) that must be returned in the array .
Equation (0) must be used.
Equation (1) must be used.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- resfloat, array-like, shape
must contain the th component of or , depending on the value of , for , where is defined as
i.e., only terms depending explicitly on time derivatives, or
i.e., all terms in equation (6), and similarly for .
The definitions of and are determined by the input value of .
- 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_keller
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, .
- nleftint
The number of boundary conditions at the left-hand mesh point .
- 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.
- itaskint
Specifies the task to be performed by the ODE integrator.
Normal computation of output values at .
Take one step and return.
Stop at the first internal integration point at or beyond .
- itraceint
The level of trace information required from
dim1_parab_keller
and the underlying ODE solver as follows: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.
Output from the underlying ODE solver is similar to that produced when , except that the advisory messages are given in greater detail.
Output from the underlying ODE solver is similar to that produced when , except that the advisory messages are given in greater detail.
You are advised to set .
- 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_keller
.- dataarbitrary, optional
User-communication data for callback functions.
- io_managerFileObjManager, optional
Manager for I/O in this routine.
- 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, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (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.
- 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_keller
integrates the system of first-order PDEsIn particular the functions must have the general form
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 mesh should be chosen in accordance with the expected behaviour of the solution.
The PDE system which is defined by the functions must be specified in .
The initial values of the functions must be given at . For a first-order system of PDEs, only one boundary condition is required for each PDE component . The boundary conditions are separated into at the left-hand boundary , and at the right-hand boundary , such that . The position of the boundary condition for each component should be chosen with care; the general rule is that if the characteristic direction of at the left-hand boundary (say) points into the interior of the solution domain, then the boundary condition for should be specified at the left-hand boundary. Incorrect positioning of boundary conditions generally results in initialization or integration difficulties in the underlying time integration functions.
The boundary conditions have the form:
at the left-hand boundary, and
at the right-hand boundary.
Note that the functions and must not depend on , since spatial derivatives are not determined explicitly in the Keller box scheme (see Keller (1970)). If the problem involves derivative (Neumann) boundary conditions then it is generally possible to restate such boundary conditions in terms of permissible variables. Also note that and must be linear with respect to time derivatives, so that the boundary conditions have the general form
at the left-hand boundary, and
at the right-hand boundary, where , , , and depend on , and only.
The boundary conditions must be specified in .
The problem is subject to the following restrictions:
, so that integration is in the forward direction;
and must not depend on any time derivatives;
The evaluation of the function is done at the mid-points of the mesh intervals by calling the for each mid-point in turn. Any discontinuities in the function must, therefore, be at one or more of the mesh points ;
At least one of the functions must be nonzero so that there is a time derivative present in the problem.
In this method of lines approach the Keller box scheme (see Keller (1970)) is applied to each PDE in the space variable only, resulting in a system of ODEs in time for the values of at each mesh point. In total there are ODEs in the time direction. This system is then integrated forwards in time using a BDF 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
Keller, H B, 1970, A new difference scheme for parabolic problems, Numerical Solutions of Partial Differential Equations, (ed J Bramble) (2), 327–350, Academic Press
Pennington, S V and Berzins, M, 1994, New NAG Library software for first-order partial differential equations, ACM Trans. Math. Softw. (20), 63–99