naginterfaces.library.pde.dim1_parab_convdiff_remesh¶
- naginterfaces.library.pde.dim1_parab_convdiff_remesh(npde, ts, tout, numflx, bndary, uvinit, u, x, nv, xi, rtol, atol, itol, norm, laopt, algopt, remesh, xfix, nrmesh, dxmesh, trmesh, ipminf, comm, itask, itrace, ind, pdedef=None, odedef=None, xratio=1.5, con=None, monitf=None, lrsave_estim=0, lisave_estim=0, data=None, io_manager=None, spiked_sorder='C')[source]¶
dim1_parab_convdiff_remesh
integrates a system of linear or nonlinear convection-diffusion equations in one space dimension, with optional source terms and scope for coupled ordinary differential equations (ODEs). The system must be posed in conservative form. This function also includes the option of automatic adaptive spatial remeshing. Convection terms are discretized using a sophisticated upwind scheme involving a user-supplied numerical flux function based on the solution of a Riemann problem at each mesh point. The method of lines is employed to reduce the partial differential equations (PDEs) to a system of ODEs, and the resulting system is solved using a backward differentiation formula (BDF) method or a Theta method.For full information please refer to the NAG Library document for d03ps
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/d03/d03psf.html
- Parameters
- npdeint
The number of PDEs to be solved.
- tsfloat
The initial value of the independent variable .
- toutfloat
The final value of to which the integration is to be carried out.
- numflxcallable (flux, ires) = numflx(t, x, v, uleft, uright, ires, data=None)
must supply the numerical flux for each PDE given the left and right values of the solution vector . is called approximately midway between each pair of mesh points in turn by
dim1_parab_convdiff_remesh
.- Parameters
- tfloat
The current value of the independent variable .
- xfloat
The current value of the space variable .
- vfloat, ndarray, shape
If , contains the value of the component , for .
- uleftfloat, ndarray, shape
contains the left value of the component , for .
- urightfloat, ndarray, shape
contains the right value of the component , for .
- iresint
Set to or .
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- fluxfloat, array-like, shape
must be set to the numerical flux , 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_convdiff_remesh
returns to the calling function with the error indicator set to = 4.
- bndarycallable (g, ires) = bndary(t, x, u, v, vdot, ibnd, ires, data=None)
must evaluate the functions and which describe the physical and numerical boundary conditions, as given by (9) and (0).
- Parameters
- tfloat
The current value of the independent variable .
- xfloat, ndarray, shape
The mesh points in the spatial direction. corresponds to the left-hand boundary, , and corresponds to the right-hand boundary, .
- ufloat, ndarray, shape
contains the value of the component at , for , for .
Note: if banded matrix algebra is to be used then the functions and may depend on the value of at the boundary point and the two adjacent points only.
- 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 and , for .
- ibndint
Specifies which boundary conditions are to be evaluated.
must evaluate the left-hand boundary condition at .
must evaluate the right-hand boundary condition at .
- iresint
Set to or .
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- gfloat, array-like, shape
must contain the th component of either or in (9) and (0), depending on 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_convdiff_remesh
returns to the calling function with the error indicator set to = 4.
- uvinitcallable (u, v) = uvinit(npde, x, xi, nv, data=None)
must supply the initial values of and for all values of in the interval .
- Parameters
- npdeint
The number of PDEs in the system.
- xfloat, ndarray, shape
The current mesh. contains the value of , for .
- xifloat, ndarray, shape
If , contains the ODE/PDE coupling point, , for .
- 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
If , must contain the value of component , for .
- ufloat, array-like, shape
If the value of must be unchanged from the previous call.
- xfloat, array-like, shape
The mesh points in the space direction. must specify the left-hand boundary, , and must specify the right-hand boundary, .
- nvint
The number of coupled ODE components.
- xifloat, array-like, shape
If , , for , must be set to the ODE/PDE coupling points.
- 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. If is the estimated local error for , for , and , denotes the norm, the error test to be satisfied is . indicates to
dim1_parab_convdiff_remesh
whether to interpret either or both of and as a vector or scalar in the formation of the weights used in the calculation of the norm (see the description of ):1
scalar
scalar
2
scalar
vector
3
vector
scalar
4
vector
vector
- normstr, length 1
The type of norm to be used.
Averaged norm.
Averaged norm.
If denotes the norm of the vector of length , then for the averaged norm
and for the averaged 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 (). Also, the banded option should not be used if the boundary conditions involve solution components at points other than the boundary and the immediately adjacent two points.
- 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 is .
If , then , 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, i.e., .
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 the range then the default value is used. If the functions regard the Jacobian matrix as numerically singular, increasing towards may help, but at the cost of increased fill-in. The default value is .
Used as the relative pivot threshold during subsequent Jacobian decompositions (see ) below which an internal error is invoked. must be greater than zero, otherwise the default value is used. If is greater than no check is made on the pivot size, and this may be a necessary option if the Jacobian matrix is found to be numerically singular (see ). The default value is .
- remeshbool
Indicates whether or not spatial remeshing should be performed.
Indicates that spatial remeshing should be performed as specified.
Indicates that spatial remeshing should be suppressed.
Note: should not be changed between consecutive calls to
dim1_parab_convdiff_remesh
. Remeshing can be switched off or on at specified times by using appropriate values for the arguments and at each call.- xfixfloat, array-like, shape
, for , must contain the value of the coordinate at the th fixed mesh point.
- nrmeshint
Specifies the spatial remeshing frequency and criteria for the calculation and adoption of a new mesh.
Indicates that a new mesh is adopted according to the argument . The mesh is tested every timesteps.
Indicates that remeshing should take place just once at the end of the first time step reached when .
Indicates that remeshing will take place every time steps, with no testing using .
Note: may be changed between consecutive calls to
dim1_parab_convdiff_remesh
to give greater flexibility over the times of remeshing.- dxmeshfloat
Determines whether a new mesh is adopted when is set less than zero. A possible new mesh is calculated at the end of every time steps, but is adopted only if
or
thus imposes a lower limit on the difference between one mesh and the next.
- trmeshfloat
Specifies when remeshing will take place when is set to zero. Remeshing will occur just once at the end of the first time step reached when is greater than .
Note: may be changed between consecutive calls to
dim1_parab_convdiff_remesh
to force remeshing at several specified times.- ipminfint
The level of trace information regarding the adaptive remeshing. Details are directed to the file object associated with the advisory I/O unit (see
FileObjManager
).No trace information.
Brief summary of mesh characteristics.
More detailed information, including old and new mesh points, mesh sizes and monitor function values.
- 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
The task to be performed by the ODE integrator.
Normal computation of output values at (by overshooting and interpolating).
Take one step in the time direction 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_convdiff_remesh
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 arguments , and may be reset between calls to
dim1_parab_convdiff_remesh
.- pdedefNone or callable (p, c, d, s, ires) = pdedef(t, x, u, ux, v, vdot, ires, data=None), optional
Note: if this argument is None then a NAG-supplied facility will be used.
must evaluate the functions , , and which partially define the system of PDEs. and may depend on , , and ; may depend on , , , and ; and may depend on , , , and linearly on . is called approximately midway between each pair of mesh points in turn by
dim1_parab_convdiff_remesh
. None may be used for for problems in the form (2).- 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 .
- 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 , for , for .
- cfloat, array-like, shape
must be set to the value of , for .
- dfloat, array-like, shape
must be set to the value of , for .
- sfloat, 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_convdiff_remesh
returns to the calling function with the error indicator set to = 4.
- odedefNone or callable (r, ires) = odedef(t, v, vdot, xi, ucp, ucpx, ucpt, 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 (4).
If you wish to compute the solution of a system of PDEs only (i.e., ), 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 point, , 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 .
- ucptfloat, ndarray, shape
If , contains the value of at the coupling point , for , for .
- iresint
The form of that must be returned in the array .
Equation (1) must be used.
Equation (2) must be used.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- rfloat, array-like, shape
must contain the th component of , for , where is defined as
or
The definition of is determined 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_convdiff_remesh
returns to the calling function with the error indicator set to = 4.
- xratiofloat, optional
An input bound on the adjacent mesh ratio (greater than and typically in the range to ). The remeshing functions will attempt to ensure that
- conNone or float, optional
Note: if this argument is None then a default value will be used, determined as follows: .
An input bound on the sub-integral of the monitor function over each space step. The remeshing functions will attempt to ensure that
(see Furzeland (1984)). gives you more control over the mesh distribution, e.g., decreasing allows more clustering. A typical value is , but you are encouraged to experiment with different values. Its value is not critical and the mesh should be qualitatively correct for all values in the range given below.
- monitfNone or callable fmon = monitf(t, x, u, data=None), optional
Note: if this argument is None then a NAG-supplied facility will be used.
must supply and evaluate a remesh monitor function to indicate the solution behaviour of interest.
If you specify , i.e., no remeshing, will not be called and may be None.
- Parameters
- tfloat
The current value of the independent variable .
- xfloat, ndarray, shape
The current mesh. contains the value of , for .
- ufloat, ndarray, shape
contains the value of at and time , for , for .
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- fmonfloat, array-like, shape
must contain the value of the monitor function at mesh point .
- 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 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 final values of the mesh points.
- 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, the point does not coincide with any : and .
- (errno )
On entry, , and .
Constraint: .
- (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, , .
Constraint: .
- (errno )
On entry, , .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, , .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: when .
- (errno )
On entry, and .
Constraint: when .
- (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: .
- (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 a call to functions , , 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 )
The functions , , or appear to depend on time derivatives.
- (errno )
has been changed between calls to
dim1_parab_convdiff_remesh
.- (errno )
is negative at one or more mesh points, or zero mesh spacing has been obtained due to a poor monitor function.
- 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 functions , , 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_convdiff_remesh
integrates the system of convection-diffusion equations in conservative form:or the hyperbolic convection-only system:
for , , , where the vector is the set of PDE solution values
The optional coupled ODEs are of the general form
where the vector is the set of ODE solution values
denotes its derivative with respect to time, and is the spatial derivative of .
In (2), , and depend on , , and ; depends on , , , and ; and depends on , , , and linearly on . Note that , , and must not depend on any space derivatives, and , , and must not depend on any time derivatives. In terms of conservation laws, , and are the convective flux, diffusion and source terms respectively.
In (3), 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 PDE spatial mesh points. , and are the functions , and evaluated at these coupling points. Each may depend only linearly on time derivatives. Hence (3) 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 only need to 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 points of a user-defined mesh defined initially by you and (possibly) adapted automatically during the integration according to user-specified criteria.
The initial values of the functions and must be specified in . Note that will be called again following any initial remeshing, and so should be specified for all values of in the interval , and not just the initial mesh points.
The PDEs are approximated by a system of ODEs in time for the values of at mesh points using a spatial discretization method similar to the central-difference scheme used in
dim1_parab_fd()
,dim1_parab_dae_fd()
anddim1_parab_remesh_fd()
, but with the flux replaced by a numerical flux, which is a representation of the flux taking into account the direction of the flow of information at that point (i.e., the direction of the characteristics). Simple central differencing of the numerical flux then becomes a sophisticated upwind scheme in which the correct direction of upwinding is automatically achieved.The numerical flux, say, must be calculated by you in terms of the left and right values of the solution vector (denoted by and respectively), at each mid-point of the mesh , for . The left and right values are calculated by
dim1_parab_convdiff_remesh
from two adjacent mesh points using a standard upwind technique combined with a Van Leer slope-limiter (see LeVeque (1990)). The physically correct value for is derived from the solution of the Riemann problem given bywhere , i.e., corresponds to , with discontinuous initial values for and for , using an approximate Riemann solver. This applies for either of the systems (1) and (2); the numerical flux is independent of the functions , , and . A description of several approximate Riemann solvers can be found in LeVeque (1990) and Berzins et al. (1989). Roe’s scheme (see Roe (1981)) is perhaps the easiest to understand and use, and a brief summary follows. Consider the system of PDEs or equivalently . Provided the system is linear in , i.e., the Jacobian matrix does not depend on , the numerical flux is given by
where () is the flux calculated at the left (right) value of , denoted by (); the are the eigenvalues of ; the are the right eigenvectors of ; and the are defined by
Examples are given in the documents for
dim1_parab_convdiff()
anddim1_parab_convdiff_dae()
.If the system is nonlinear, Roe’s scheme requires that a linearized Jacobian is found (see Roe (1981)).
The functions , , and (but not ) must be specified in . The numerical flux must be supplied in . For problems in the form (2), None may be used for . This sets the matrix with entries to the identity matrix, and the functions , and to zero.
For second-order problems, i.e., diffusion terms are present, a boundary condition is required for each PDE at both boundaries for the problem to be well-posed. If there are no diffusion terms present, then the continuous PDE problem generally requires exactly one boundary condition for each PDE, that is boundary conditions in total. However, in common with most discretization schemes for first-order problems, a numerical boundary condition is required at the other boundary for each PDE. In order to be consistent with the characteristic directions of the PDE system, the numerical boundary conditions must be derived from the solution inside the domain in some manner (see below). You must supply both types of boundary conditions, i.e., a total of conditions at each boundary point.
The position of each boundary condition should be chosen with care. In simple terms, if information is flowing into the domain then a physical boundary condition is required at that boundary, and a numerical boundary condition is required at the other boundary. In many cases the boundary conditions are simple, e.g., for the linear advection equation. In general you should calculate the characteristics of the PDE system and specify a physical boundary condition for each of the characteristic variables associated with incoming characteristics, and a numerical boundary condition for each outgoing characteristic.
A common way of providing numerical boundary conditions is to extrapolate the characteristic variables from the inside of the domain (note that when using banded matrix algebra the fixed bandwidth means that only linear extrapolation is allowed, i.e., using information at just two interior points adjacent to the boundary). For problems in which the solution is known to be uniform (in space) towards a boundary during the period of integration then extrapolation is unnecessary; the numerical boundary condition can be supplied as the known solution at the boundary. Another method of supplying numerical boundary conditions involves the solution of the characteristic equations associated with the outgoing characteristics. Examples of both methods can be found in the documents for
dim1_parab_convdiff()
anddim1_parab_convdiff_dae()
.The boundary conditions must be specified in in the form
at the left-hand boundary, and
at the right-hand boundary.
Note that spatial derivatives at the boundary are not passed explicitly to , but they can be calculated using values of at and adjacent to the boundaries if required. However, it should be noted that instabilities may occur if such one-sided differencing opposes the characteristic direction at the boundary.
The algebraic-differential equation system which is defined by the functions must be specified in . You must also specify the coupling points (if any) in the array .
In total there are ODEs in the time direction. This system is then integrated forwards in time using a BDF or Theta method, optionally switching between Newton’s method and functional iteration (see Berzins et al. (1989) and the references therein).
The adaptive space remeshing can be used to generate meshes that automatically follow the changing time-dependent nature of the solution, generally resulting in a more efficient and accurate solution using fewer mesh points than may be necessary with a fixed uniform or non-uniform mesh. Problems with travelling wavefronts or variable-width boundary layers for example will benefit from using a moving adaptive mesh. The discrete time-step method used here (developed by Furzeland (1984)) automatically creates a new mesh based on the current solution profile at certain time-steps, and the solution is then interpolated onto the new mesh and the integration continues.
The method requires you to supply a which specifies in an analytical or numerical form the particular aspect of the solution behaviour you wish to track. This so-called monitor function is used by the function to choose a mesh which equally distributes the integral of the monitor function over the domain. A typical choice of monitor function is the second space derivative of the solution value at each point (or some combination of the second space derivatives if there is more than one solution component), which results in refinement in regions where the solution gradient is changing most rapidly.
You must specify the frequency of mesh updates together with certain other criteria such as adjacent mesh ratios. Remeshing can be expensive and you are encouraged to experiment with the different options in order to achieve an efficient solution which adequately tracks the desired features of the solution.
Note that unless the monitor function for the initial solution values is zero at all user-specified initial mesh points, a new initial mesh is calculated and adopted according to the user-specified remeshing criteria. will then be called again to determine the initial solution values at the new mesh points (there is no interpolation at this stage) and the integration proceeds.
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 ;
, , and must not depend on any space derivatives; and , , and must not depend on any time derivatives;
, so that integration is in the forward direction;
The evaluation of the terms , , and is done by calling the at a point approximately midway between each pair of mesh points in turn. Any discontinuities in these functions must, therefore, be at one or more of the fixed mesh points specified by ;
At least one of the functions must be nonzero so that there is a time derivative present in the PDE problem.
For further details of the scheme, see Pennington and Berzins (1994) and the references therein.
- References
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
Furzeland, R M, 1984, The construction of adaptive space meshes, TNER.85.022, Thornton Research Centre, Chester
Hirsch, C, 1990, Numerical Computation of Internal and External Flows, Volume 2: Computational Methods for Inviscid and Viscous Flows, John Wiley
LeVeque, R J, 1990, Numerical Methods for Conservation Laws, Birkhäuser Verlag
Pennington, S V and Berzins, M, 1994, New NAG Library software for first-order partial differential equations, ACM Trans. Math. Softw. (20), 63–99
Roe, P L, 1981, Approximate Riemann solvers, parameter vectors, and difference schemes, J. Comput. Phys. (43), 357–372