naginterfaces.library.pde.dim1_parab_dae_coll¶
- naginterfaces.library.pde.dim1_parab_dae_coll(npde, m, ts, tout, pdedef, bndary, u, xbkpts, npoly, npts, nv, xi, uvinit, rtol, atol, itol, norm, laopt, algopt, comm, itask, itrace, ind, odedef=None, lrsave_estim=0, lisave_estim=0, data=None, io_manager=None, spiked_sorder='C')[source]¶
dim1_parab_dae_coll
integrates a system of linear or nonlinear parabolic partial differential equations (PDEs), in one space variable with scope for coupled ordinary differential equations (ODEs). The spatial discretization is performed using a Chebyshev collocation method, and the method of lines is employed to reduce the PDEs to a system of ODEs. The resulting system is solved using a backward differentiation formula (BDF) method or a Theta method (switching between Newton’s method and functional iteration).For full information please refer to the NAG Library document for d03pj
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/d03/d03pjf.html
- Parameters
- npdeint
The number of PDEs to be solved.
- 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, v, vdot, ires, data=None)
must compute the functions , and which define the system of PDEs.
The functions may depend on , , , and ; may depend linearly on .
The functions must be evaluated at a set of points.
- Parameters
- tfloat
The current value of the independent variable .
- xfloat, ndarray, shape
Contains a set of mesh points at which , and are to be evaluated. and contain successive user-supplied break-points and the elements of the array will satisfy .
- ufloat, ndarray, shape
contains the value of the component where , for , for .
- uxfloat, ndarray, shape
contains the value of the component where , for , for .
- vfloat, ndarray, shape
If , contains the value of the component , for .
- vdotfloat, ndarray, shape
If , contains the value of component , for .
Note: , for , may only appear linearly in , 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 where , for , for , for .
- qfloat, array-like, shape
must be set to the value of where , for , for .
- rfloat, array-like, shape
must be set to the value of where , for , 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_dae_coll
returns to the calling function with the error indicator set to = 4.
- bndarycallable (beta, gamma, ires) = bndary(t, u, ux, v, vdot, ibnd, ires, data=None)
must compute the functions and which define the boundary conditions as in equation (4).
- 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 .
- vfloat, ndarray, shape
If , contains the value of the component , for .
- vdotfloat, ndarray, shape
If , contains the value of component , for .
Note: , for , may only appear linearly in , for .
- ibndint
Specifies which boundary conditions are to be evaluated.
must set up the coefficients of the left-hand boundary, .
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_dae_coll
returns to the calling function with the error indicator set to = 4.
- ufloat, array-like, shape
If the value of must be unchanged from the previous call.
- xbkptsfloat, array-like, shape
The values of the break-points in the space direction. must specify the left-hand boundary, , and must specify the right-hand boundary, .
- npolyint
The degree of the Chebyshev polynomial to be used in approximating the PDE solution between each pair of break-points.
- nptsint
The number of mesh points in the interval .
- nvint
The number of coupled ODE components.
- xifloat, array-like, shape
, for , must be set to the ODE/PDE coupling points.
- uvinitcallable (u, v) = uvinit(npde, x, nv, data=None)
must compute the initial values of the PDE and the ODE components , for , for , and , for .
- Parameters
- npdeint
The number of PDEs in the system.
- xfloat, ndarray, shape
, for , contains the current values of the space variable .
- nvint
The number of coupled ODEs in the system.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- ufloat, array-like, shape
contains the value of the component , for , for .
- vfloat, array-like, shape
contains the value of component , for .
- rtolfloat, array-like, shape
Note: the required length for this argument is determined as follows: if : ; if : ; otherwise: .
The relative local error tolerance.
- atolfloat, array-like, shape
Note: the required length for this argument is determined as follows: if : ; if : ; otherwise: .
The absolute local error tolerance.
- itolint
A value to indicate the form of the local error test. indicates to
dim1_parab_dae_coll
whether to interpret either or both of or as a vector or scalar. The error test to be satisfied is , where is defined as follows:1
scalar
scalar
2
scalar
vector
3
vector
scalar
4
vector
vector
In the above, denotes the estimated local error for the th component of the coupled PDE/ODE system in time, , for .
The choice of norm used is defined by the argument .
- normstr, length 1
The type of norm to be used.
Maximum norm.
Averaged norm.
If denotes the norm of the vector of length , then for the averaged norm
while for the maximum norm
See the description of for the formulation of the weight vector .
- laoptstr, length 1
The type of matrix algebra required.
Full matrix methods to be used.
Banded matrix methods to be used.
Sparse matrix methods to be used.
Note: you are recommended to use the banded option when no coupled ODEs are present (i.e., ).
- algoptfloat, array-like, shape
May be set to control various options available in the integrator. If you wish to employ all the default options, should be set to . Default values will also be used for any other elements of set to zero. The permissible values, default values, and meanings are as follows:
Selects the ODE integration method to be used. If , a BDF method is used and if , a Theta method is used. The default value is .
If , , for are not used.
Specifies the maximum order of the BDF integration formula to be used. may be , , , or . The default value is .
Specifies what method is to be used to solve the system of nonlinear equations arising on each step of the BDF method. If a modified Newton iteration is used and if a functional iteration method is used. If functional iteration is selected and the integrator encounters difficulty, there is an automatic switch to the modified Newton iteration. The default value is .
Specifies whether or not the Petzold error test is to be employed. The Petzold error test results in extra overhead but is more suitable when algebraic equations are present, such as , for , for some or when there is no dependence in the coupled ODE system. If , the Petzold test is used. If , the Petzold test is not used. The default value is .
If , , for , are not used.
Specifies the value of Theta to be used in the Theta integration method. . The default value is .
Specifies what method is to be used to solve the system of nonlinear equations arising on each step of the Theta method. If , a modified Newton iteration is used and if , a functional iteration method is used. The default value is .
Specifies whether or not the integrator is allowed to switch automatically between modified Newton and functional iteration methods in order to be more efficient. If , switching is allowed and if , switching is not allowed. The default value is .
Specifies a point in the time direction, , beyond which integration must not be attempted. The use of is described under the argument . If , a value of for , say, should be specified even if subsequently specifies that will not be used.
Specifies the minimum absolute step size to be allowed in the time integration. If this option is not required, should be set to .
Specifies the maximum absolute step size to be allowed in the time integration. If this option is not required, should be set to .
Specifies the initial step size to be attempted by the integrator. If , the initial step size is calculated internally.
Specifies the maximum number of steps to be attempted by the integrator in any one call. If , no limit is imposed.
Specifies what method is to be used to solve the nonlinear equations at the initial point to initialize the values of , , and . If , a modified Newton iteration is used and if , functional iteration is used. The default value is .
and are used only for the sparse matrix algebra option, .
Governs the choice of pivots during the decomposition of the first Jacobian matrix. It should lie in the range , with smaller values biasing the algorithm towards maintaining sparsity at the expense of numerical stability. If lies outside this range then the default value is used. If the functions regard the Jacobian matrix as numerically singular then increasing towards may help, but at the cost of increased fill-in. The default value is .
Is used as a relative pivot threshold during subsequent Jacobian decompositions (see ) below which an internal error is invoked. If is greater than no check is made on the pivot size, and this may be a necessary option if the Jacobian is found to be numerically singular (see ). The default value is .
- commdict, communication object, modified in place
Note: this argument will be (re-)initialized when it is an empty
dict
or under the following condition: .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 .
One step and return.
Stop at first internal integration point at or beyond .
Normal computation of output values at but without overshooting where is described under the argument .
Take one step in the time direction and return, without passing , where is described under the argument .
- itraceint
The level of trace information required from
dim1_parab_dae_coll
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_dae_coll
.- odedefNone or callable (f, ires) = odedef(t, v, vdot, xi, ucp, ucpx, rcp, ucpt, ucptx, ires, data=None), optional
Note: if this argument is None then a NAG-supplied facility will be used.
must evaluate the functions , which define the system of ODEs, as given in (3).
If you wish to compute the solution of a system of PDEs only (), must be None.
- Parameters
- tfloat
The current value of the independent variable .
- vfloat, ndarray, shape
If , contains the value of the component , for .
- vdotfloat, ndarray, shape
If , contains the value of component , for .
- xifloat, ndarray, shape
If , contains the ODE/PDE coupling points, , for .
- ucpfloat, ndarray, shape
If , contains the value of at the coupling point , for , for .
- ucpxfloat, ndarray, shape
If , contains the value of at the coupling point , for , for .
- rcpfloat, ndarray, shape
contains the value of the flux at the coupling point , for , for .
- ucptfloat, ndarray, shape
If , contains the value of at the coupling point , for , for .
- ucptxfloat, ndarray, shape
contains the value of at the coupling point , for , for .
- iresint
The form of that must be returned in the array .
Equation (5) must be used.
Equation (6) must be used.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- ffloat, array-like, shape
On exit, must contain the th component of as specified by the input value of .
- iresint
Should usually remain unchanged. However, you may reset 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_dae_coll
returns to the calling function with the error indicator set to = 4.
- lrsave_estimint, optional
When performing a new integration, the size to use for the communication array [‘rsave’].
Otherwise, the value has no effect.
An initial estimate for an adequate is computed by the function.
If your supplied is too small, the estimated value will be used instead.
In some cases the estimated value will be sufficient for continuation calls to the function.
When , even the function’s initial estimated value of may be too small.
If so, the function returns with = 15.
You are advised to call the function again with and set to at least the lower-bound value returned in , then make the desired subsequent calls with , then repeat the process if necessary.
- lisave_estimint, optional
When performing a new integration, the size to use for the communication array [‘isave’].
Otherwise, the value has no effect.
An initial estimate for an adequate is computed by the function.
If your supplied is too small, the estimated value will be used instead.
In some cases the estimated value will be sufficient for continuation calls to the function.
When , even the function’s initial estimated value of may be too small.
If so, the function returns with = 15.
You are advised to call the function again with and set to at least the lower-bound value returned in , then make the desired subsequent calls with , then repeat the process if necessary.
- dataarbitrary, optional
User-communication data for callback functions.
- io_managerFileObjManager, optional
Manager for I/O in this routine.
- spiked_sorderstr, optional
If in and in or in are spiked (i.e., have unit extent in all but one dimension, or have size ), selects the storage order to associate with them in the NAG Engine:
- spiked_sorder =
row-major storage will be used;
- spiked_sorder =
column-major storage will be used.
- Returns
- tsfloat
The value of corresponding to the solution values in . Normally .
- ufloat, ndarray, shape
The computed solution , for , for , and , for , evaluated at , as follows:
contain , for , for , and
contain , for .
- xfloat, ndarray, shape
The mesh points chosen by
dim1_parab_dae_coll
in the spatial direction. The values of will satisfy .- indint
.
- lrsave_minint
A lower bound on the sufficient size for [‘rsave’].
- lisave_minint
A lower bound on the sufficient size for [‘isave’].
- Raises
- NagValueError
- (errno )
On entry, on initial entry .
Constraint: on initial entry .
- (errno )
On entry, at least one point in lies outside : and .
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, and .
Constraint: corresponding elements and cannot both be .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: , , or .
- (errno )
On entry, , , and .
Constraint: .
- (errno )
On entry, , , and .
Constraint: .
- (errno )
On entry, and .
Constraint: when .
- (errno )
On entry, and .
Constraint: when .
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: or
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: or .
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: or .
- (errno )
On entry, .
Constraint: , , , or .
- (errno )
On entry, .
Constraint: .
- (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 )
and were 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 )
In solving ODE system, the maximum number of steps has been exceeded. .
- (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 values of and . .
- (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 small changes in or are unlikely to result in a changed solution.
- (errno )
Zero error weights encountered during time integration.
- (errno )
When using the sparse option, or is too small: , .
- Notes
dim1_parab_dae_coll
integrates the system of parabolic-elliptic equations and coupled ODEswhere (1) defines the PDE part and (2) generalizes the coupled ODE part of the problem.
In (1), and depend on , , , , and ; depends on , , , , and linearly on . The vector is the set of PDE solution values
and the vector is the partial derivative with respect to . Note that , and must not depend on . The vector is the set of ODE solution values
and denotes its derivative with respect to time.
In (2), represents a vector of spatial coupling points at which the ODEs are coupled to the PDEs. These points may or may not be equal to some of the PDE spatial mesh points. , , , and are the functions , , , and evaluated at these coupling points. Each may only depend linearly on time derivatives. Hence the equation (2) may be written more precisely as
where , is a vector of length , is an by matrix, is an by matrix and the entries in , and may depend on , , , and . In practice you need only supply a vector of information to define the ODEs and not the matrices and . (See Parameters for the specification of .)
The integration in time is from to , over the space interval , where and are the leftmost and rightmost of a user-defined set of break-points . The coordinate system in space is defined by the value of ; for Cartesian coordinates, for cylindrical polar coordinates and for spherical polar coordinates.
The PDE system which is defined by the functions , and must be specified in .
The initial values of the functions and must be given at . These values are calculated in .
The functions which may be thought of as fluxes, are also used in the definition of the boundary conditions. The boundary conditions must have the form
where or . The functions may only depend linearly on .
The boundary conditions must be specified in .
The algebraic-differential equation system which is defined by the functions must be specified in . You must also specify the coupling points in the array . Thus, the problem is subject to the following restrictions:
in (1), , for , may only appear linearly in the functions , for , with a similar restriction for ;
and the flux must not depend on any time derivatives;
, so that integration is in the forward direction;
the evaluation of the functions , and is done at both the break-points and internally selected points for each element in turn, that is , and are evaluated twice at each break-point. Any discontinuities in these functions 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 PDE problem;
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 either by specifying the solution at or by specifying a zero flux there, that is and .
The parabolic equations are approximated by a system of ODEs in time for the values of at the mesh points. This ODE system is obtained by approximating the PDE solution between each pair of break-points by a Chebyshev polynomial of degree . The interval between each pair of break-points is treated by
dim1_parab_dae_coll
as an element, and on this element, a polynomial and its space and time derivatives are made to satisfy the system of PDEs at spatial points, which are chosen internally by the code and the break-points. The user-defined break-points and the internally selected points together define the mesh. The smallest value that can take is one, in which case, the solution is approximated by piecewise linear polynomials between consecutive break-points and the method is similar to an ordinary finite element method.In total there are mesh points in the spatial direction, and ODEs in the time direction; one ODE at each break-point for each PDE component, ODEs for each PDE component between each pair of break-points, and coupled ODEs. The system is then integrated forwards in time using a Backward Differentiation Formula (BDF) method or a Theta 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 and Dew, P M, 1991, Algorithm 690: Chebyshev polynomial software for elliptic-parabolic systems of PDEs, ACM Trans. Math. Software (17), 178–206
Berzins, M, Dew, P M and Furzeland, R M, 1988, Software tools for time-dependent equations in simulation and optimization of large systems, Proc. IMA Conf. Simulation and Optimization, (ed A J Osiadcz), 35–50, Clarendon Press, Oxford
Berzins, M and Furzeland, R M, 1992, An adaptive theta method for the solution of stiff and nonstiff differential equations, Appl. Numer. Math. (9), 1–19
Zaturska, N B, Drazin, P G and Banks, W H H, 1988, On the flow of a viscous fluid driven along a channel by a suction at porous walls, Fluid Dynamics Research (4)