time | calls | line |
---|
| | 1 | function [dpdx, dpdy] = Grad2D_P(P, NodeP, dx, dy, idsu, idsv)
|
| | 2 | % function [dpdx, dpdy] = Grad2D_P(P, NodeP, dx, dy, idsu, idsv)
|
| | 3 | % This function takes the gradient of pressure P, i.e. dP/dx and dP/dy,
|
| | 4 | % at the INTERIOR cell centers of u and v, respectively.
|
| | 5 | %
|
| | 6 | % INPUTS:
|
| | 7 | % P: Vector containing values of pressure
|
| | 8 | % NodeP: Reference node numbering matrix for pressure
|
| | 9 | % dx: Mesh spacing in x direction
|
| | 10 | % dy: Mesh spacing in y direction
|
| | 11 | % idsu: Location of active u-velocity cells in interior
|
| | 12 | % idsv: Location of active v-velocity cells in interior
|
| | 13 | %
|
| | 14 | % OUTPUTS:
|
| | 15 | % dpdx: x-derivative of pressure at centers of active u-velocity cells
|
| | 16 | % dpdy: y-derivative of pressure at centers of active v-velocity cells
|
| | 17 | %
|
| | 18 | % Authors: Matt Ueckermann, Pierre Lermusiaux, Pat Haley for MIT course 2.29
|
| | 19 |
|
11.93 | 1640 | 20 | dpdx = (P(NodeP(2:end-1, 3:end-1)) - P(NodeP(2:end-1, 2:end-2)))/dx;
|
12.50 | 1640 | 21 | dpdy = (P(NodeP(2:end-2, 2:end-1)) - P(NodeP(3:end-1, 2:end-1)))/dy;
|
| | 22 |
|
0.40 | 1640 | 23 | dpdx = dpdx(idsu);
|
0.74 | 1640 | 24 | dpdy = dpdy(idsv);
|