=PDEVAL(col1, exprn, stamp, opr, pt, [options])
Use PDEVAL
to compute a single value from a solution array obtained by any of the partial differential equations solvers.
PDEVAL
computes the value using a specified calculus operation including interpolation, differentiation or integration.
In a dynamical optimization problem, PDEVAL
can be used to define dynamic constraints on the solution array of the partial differential equations solver.
A constraint formula is typically defined as the difference between the computed value by PDEVAL
and a target value. The constraint formulas are input to
NLSOLVE
.
col1
a reference to the first column in the solution array. This defines the time or spatial range for the calculus operation.
You may select a sub range of column 1 although this reduces the accuracy of the calculus operation.
exprn
a reference to the operand for the calculus operation.
The reference may be to single variable or a formula implicating mulutiple variables. If your operand is a single variable, just pass its name in this argument.
stamp
the time or spatial point value that identifies the target block within the solution array.
The stamp must be selected from the available output points in the first row of the solution array.
See Output Format section for PDSOLVE
OR PDASOLVE
.
opr
a string value specifying the calculus operation to perform. Supported values are
INTERP, DERIV, and INTEG.
pt
defines the point of interpolation or differentiation for the calculus operation.
Not required if the calculus operation is INTEG.
order
controls the calculus operation as described in below:
If opr
is INTERP or INTEG
Enter 1 to use linear splines, or 3 to use cubic splines. Default is 3.
If opr
is DERIV
Enter the derivative order: 1, 2 or 3. Default is 1.
Consider the array result shown in Table 1 and obtained by PDSOLVE for heat transfer problem. The results are in the default format which gives you a snapshot of the system variables spatial distribution at selected temporal values. The first row specifies the time points (in this example 0, 0.5 and 1), and the first column specifies the spatial points.
M | N | O | P | Q | R | S | |
8 | t | 0 | 0 | 0.5 | 0.5 | 1 | 1 |
9 | x | u | ux | u | ux | u | ux |
10 | 0 | 0 | 0 | 100 | -58.2477 | 100 | -16.9646 |
11 | 0.071429 | 0 | 0 | 95.8481 | -57.8812 | 98.7907 | -16.8578 |
12 | 0.142857 | 0 | 0 | 91.7486 | -56.7862 | 97.5967 | -16.5387 |
13 | 0.214286 | 0 | 0 | 87.7528 | -54.9767 | 96.4330 | -16.0114 |
14 | 0.285714 | 0 | 0 | 83.9112 | -52.4755 | 95.3142 | -15.2825 |
15 | 0.357143 | 0 | 0 | 80.2720 | -49.3144 | 94.2544 | -14.3614 |
16 | 0.428571 | 0 | 0 | 76.8811 | -45.5333 | 93.2669 | -13.2597 |
17 | 0.5 | 0 | 0 | 73.7809 | -41.1799 | 92.3641 | -11.9914 |
18 | 0.571429 | 0 | 0 | 71.0105 | -36.3092 | 91.5574 | -10.5726 |
19 | 0.642857 | 0 | 0 | 68.6047 | -30.9823 | 90.8569 | -9.0212 |
20 | 0.714286 | 0 | 0 | 66.5937 | -25.2663 | 90.2713 | -7.3566 |
21 | 0.785714 | 0 | 0 | 65.0028 | -19.2329 | 89.8081 | -5.5998 |
22 | 0.857143 | 0 | 0 | 63.8519 | -12.9578 | 89.4730 | -3.7727 |
23 | 0.928571 | 0 | 0 | 63.1556 | -6.5198 | 89.2703 | -1.8983 |
24 | 1 | 0 | 0 | 62.9225 | 0 | 89.2024 | 0 |
You can use PDEVAL to extract or compute values of interest from the simulation result:
Objective | Formula | Result |
Find derivative of u(x, t=0.5) at x=0.5. Note that it matches the value of ux(x=0.5,t=0.5), cell Q17 of Table 1. |
=PDEVAL(A13:A27,u,0.5,"deriv",0.5) |
-41.18 |
Integrate u(x, t=0.5) from x=0 to 1. | =PDEVAL(A13:A27,u,0.5,"integ") |
76.39494 |
Interpolate u(x,t=0.5) at x = 0.75. | =PDEVAL(A13:A27,u,0.5,"interp",0.75) |
65.74446 |
Integrate the square of u(x, t=0.5) from x=0 to 1. | =PDEVAL(A13:A27,M21,0.5,"integ") |
5966.39 |
M21 | =u^2 |
When solving a parametrized dynamical optimization problem, PDEVAL is used to define constraints on the dynamical system solution typically as the difference between a computed value by PDEVAL and a target value. You can then use the nonlinear solver NLSOLVE to find optimal values for the design parameters that will minimize the differences in your defined constraints.