modelKPmethod
Extends from Icons.Method (Methods/functions icon).
Information
This is a well-balanced second order scheme, which is a Reimann problem solver free scheme (central scheme) while at the same time it takes the advantage of the upwind scheme by utilizing the local, one side speed of propagation (given by the eigenvalues of the Jacobian matrix) during the calculation of the flux at the cell interfaces.
Method description
The central-upwind numerical scheme is presented for one dimensional case.
The semi-discrete (time dependent ODEs) central-upwind scheme can be then written in the following from:
Here, in this function, the right hand side of the previous equation for the solution of KP07 scheme is calculated and returns as a output.
The central upwind numerical fluxes at the cell interfaces are given by:
For calculating the numerical fluxes Hi±½(t) and the values of Ui±½ are needed. These can be calculated as the end points of a piecewise linearly reconstructed function:
The slope si of the reconstructed function in each cell is computed using a limiter function to obtain a non-oscillatory nature of the reconstruction. The KP07 scheme utilizes the generalized minmod limiter as:
The ghost cells that are needed for thiese calculations can be defined in the following way:
Also the one-sided local speed of propagations can be estimated as the largest and the smallest eigen values of the Jacobian of the system as:
Parameters/variables description
This function needs the following input variables:
- vector:
U[2N,1] - number of segments:
N - step change of length:
Δx - parameter:
θ - matrix:
F(U±i±½)[2N,4] - vector:
S(U)[2N,1] - matrix of eigenvalues:
λ1,2(U±i±½)[N,4]; - vector B which is additional for defining ghost cells and can be used for, e.g., an open channel
(state
z=h+B). In this case the input state vectorUshould includeh, but the piecewise linear reconstruction of states will be done withz - information about boundary conditions, as a matrix [2,2] of booleans true/false - depend on, which variable should be used
- matrix with values for boundary conditions [2,2]
In order to calculate matrix F and eigenvalues, it is possible to take out of the
function the piecewise linear reconstruction of states matrix U±i±½.
This matrix consists of following vectors U±i±½
= [U-i+½ U+i+½
U-i-½ U+i-½].
Examples of using this scheme are presented in KP07.TestKPpde.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | N | Number of segments |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Real[2*N] | U | State vector | |
| Real | dx | Length step | |
| Real | theta | 1.3 | Parameter for slope limiter |
| Real[2*N] | S_ | Source term vector S | |
| Real[2*N,4] | F_ | Vector F | |
| Real[N,4] | lam1 | Matrix of eigenvalues '+' | |
| Real[N,4] | lam2 | Matrix of eigenvalues '-' | |
| Real[N + 4] | B | zeros(N + 4) | Additional for open channel |
| Real[2,2] | boundary | Values for boundary conditions | |
| Boolean[2,2] | boundaryCon | Boundary conditions consideration | |
| Real[2*N] | diff_eq | Right hand side for KP solution | |
| Real[8,N] | U_ | Matrix with boundary state values. Can be extracted | |
| KPfunctions.PieceWiseU | pieceWiseU | Use function for defining the piece wise linear reconstruction of vector U | |
| KPfunctions.SpeedPropagationApipe | speedA | Use function for defining the one-side local speeds propagation | |
| KPfunctions.FluxesH | fluxesH | Use function for defining the central upwind numerical fluxes |