modelUpwindFirstOrder
Information
This model expresses the first derivative by finite differences being a first order accuracy. The scheme used is uwpind. It means that the knowledge of the sign of the velocity is required. Therefore, the equations can not be written using conservative forms. The boundaries of the control volume do not match the face of the mesh and boundaries flux are reconstruced
For an upwind scheme, the reconstruction of u at the borders of the control volume derives:
- ui+1/2 = ui for velocity ≥ 0 and ui+1 otherwise
- ui-1/2 = ui-1 for velocity ≥ 0 and ui otherwise
- xi+1/2 = 1/2 * ( xi+1 + xi )
- xi-1/2 = 1/2 * ( xi + xi-1 )
Whatever the direction of the flow, the space derivative of u at node 'i' derives:
To get the equation bellow, the following hypotheses derives:
- The velocity is independant from the space. it is supposed an uncompressible and unexpandable flow (zero divergence of velocity).
To deals with reversal transport, the scheme has to change with the sign of the velocity. Use a conditionnal form could lead to chattering for an oscillating velocity and a suppressions of events using 'noEvent' could lead to numerical discrepansies in case of overtaking of the conditionnal expression. Therefore it has been prefered to use the following continous expression.
As the time derivative and numerical solving are taken in charge by the modelica's solver, the numerical stability is not be guarranteed because Courant-Friedrich-Lewy (CFL) number is not monitored and it is unknows where the solving uses implicit, explicit or hybrid method.
This model do not establish any equations for the boundary point (the red ones on the scheme above).
It is the responsability of the user to sypply these equations when model is inherited.
The model requires as input:
- The N parameter: it the number of discrete layers. its value have to be ≥ 2
- The CoeffTimeDer value: it is the coefficient for the time derivative (usually one for a transport).
- The CoeffSpaceDer value: it is the coefficient for the space derivative (usually the velocity for the transport).
- The sourceTerm value: it is an array of the source therm with the same size of the number of nodes being 'N+1' (usually zero for transport).
- The x value: it is an array with the same size of the number of nodes being 'N+1' (usually zero for transport).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | N | 3 | Number of discrete layers |
| Integer | N_quantity | 1 | Number of quantity transported |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Real | CoeffTimeDer | 1 | Coefficient for time derivative |
| Real | CoeffSpaceDer | Coefficient for space derivative | |
| Real[N] | SourceTerm | Source term in the right hand side | |
| Modelica.SIunits.Position[N + 1] | x | Position array | |
| Real | u | transported variables | |
| Real | u_ghost_left | left boundary value | |
| Real | u_ghost_right | right boundary value |