3.6. Numerical Control
Last updated
Was this helpful?
Last updated
Was this helpful?
Function: Defining the physical problem time limit, computational time limit and maximum number of cycles.
Function: Defining parameters for controlling the iteration of the pressure Elliptic equation.
The numerical algorithm used in GASFLOW-MPI for solving the coupled fluid mass, momentum, and energy equations includes an implicit pressure iteration phase, which enables the code to simulate compressible flows without the computational time step being limited by the speed of sound. The implicit, iterative calculation is the solution of matrix equations arising from discretization of Poisson-type pressure equations by the linear solvers in PETSc library. The algorithm is constructed such that the true solution is obtained after a finite number of iterations. We have to specify certain error acceptance criteria to terminate the iteration procedure and move on to the next calculation phase.
Note that the matrix solution has to be performed at each time cycle, so it is important to keep the iteration numbers reasonably low for complex, long transient problems.
The accuracy of an iterative solution is indicated by a residual vector r, which would be zero if the solution is exact. In GASFLOW-MPI, the iteration will stop if all the components in r are less than a specified error value.
The code provides the following input variable in NAMELIST group xput:
epsi0 Initial value of ε. Default =1e-5.
the user can specify the maximum number of iterations after which the iteration stops and the calculation continues, regardless of whether the current matrix solution satisfies the convergence criterion. This is done via the following variable in NAMELIST group xput:
itmax Maximum number of iterations (per time cycle) allowed. Default = 1000.
The code prints out iteration and time-step information for each time cycle to a file called cyclinfo.
Where PITER is the number of pressure iterations that have been carried out. DMAX is the largest component in the residual vector r.
Function: Defining parameters for controlling the time step during the calculation. Because GASFLOW-MPI solves the time-dependent conservation equations, a calculation proceeds in finite time steps (also called cycles) until the problem end time or the specified maximum number of cycles has been reached.
The end time and maximum number of cycles are defined by the following input variables (all variables discussed in this section are in NAMELIST group xput):
twfin Time (s) at which the problem is finished. Default = 10.
maxcyc Maximum allowable number of cycles. Default = 10.
How fast a problem can be completed depends on the time-step size Δt chosen. The initial, minimum, and maximum values of Δt to be used are defined with the following input variables:
delt0 Beginning time step size (s). Default = 0.02.
deltmin Minimum time step size (s). Default = 1e–4.
deltmax Maximum time step size (s). Default = 1e30.
cflnum Maximum CFL number for convection
cfldiff Maximum CFL number for diffusion
autot=0 Fixed time steps
autot=1 Automatic Control
itdowdt Increase time step size at lower iterations
itupdt Decrease time step size at upper iterations
The maximum and minimum values are used to define a range within which Δt can be varied during the calculation.
An example is shown here for the maximum time step, deltmax, as it is read in the NAMELIST XPUT:
For this example, the maximum time step is held constant at 0.5 s for (0 <= time < 10000), 0.6 s for (0 <= time < 20000), and so on.
Note that we’ve added a small amount of time, 0.1 seconds, to all the even entries in deltmax. This insures that the maximum time step allowed is updated at the requested time.
The numerical method used in GASFLOW-MPI treats most physical processes implicitly in time, except the advection and diffusion terms. Explicit treatment of these terms leads to the fact that the solution procedure is only stable if the time-step size Δt satisfies both the Courant criterion and the diffusion limit. To ensure numerical stability, the code limits Δt as follows:
In GASFLOW-MPI, we have the option for users to define the maximum CFL number using cflnum and cfldiff for Courant and diffusion limit. The default values of cflnum and cfldiff are 0.25 which is also used in GASFLOW serial version. The user could increase cflnum and cfldiff (< 0.99) to allow a bigger time step.
The change of internal energy in each cell in one time step should not exceed the limit, relde. The default of relde is 0.2 meaning 20% of the internal energy in each cell is allowed to change in one time step.
GASFLOW by default will try to adjust Δt to achieve maximum efficiency while satisfying the stability limits. The code increases or decreases Δt for the next computational cycle according to the number of pressure iterations required for convergence in the current cycle.
If the user wants a fixed time-step size, the following input variable should be specified:
autot Option flag for automatic control of time-step size Δt
1.0 means Δt is adjusted by code during calculation (default);
0.0 means the input delt0 is used for Δt thoughout calculation.
Function: Options for discretize the convective flux term in each conservation equations ∇(ϕ•u), where ϕ is the conserved quantity (mass density, internal energy, or momentum) and u is the velocity vector.
There are two numerical method:
Donor-cell scheme (default): first-order method, simple and fast and does not suffer from the spurious oscillations caused by some higher-order scheme. But, the solution obtained has larger numerical diffusion error then those given by higher-order scheme.
Van Leer scheme: second order method, slope-limiting method that has the monotone property.
This can be done via the following input variable in NAMELIST group xput ifvl.
There are certain input array variables that provide time-dependent control of the maximum time step, deltmax, the maximum CFL number, cflnum, the plotting time, pltdt, the printing time, prtdt, the restart dump and 3D visualization time, tddt, and the plotting time history time, thdt. These variables have been extended to arrays with maximum number of elements equaling 20, and are shown here:
deltmax(1:20) maximum allowed time step (NAMELIST xput).
cflnum(1:20) maximum allowed CFL number (NAMELIST xput).
pltdt(1:20) plotting time interval to file profiles.nc (NAMELIST xput).
prtdt(1:20) printing time interval to file gfout (NAMELIST xput).
tddt(1:20) restart dump and 3D visualization time interval to file gfd*.nc (NAMELIST xput).
thdt(1:20) time-history plotting time interval to file plothist.nc (NAMELIST grafic).
When there is only one entry in the above variable arrays, it is treated as a scalar constant, but when there are multiple entries, they are associated in pairs with the odd elements representing the time interval or time step and the even elements representing the upper time limit for that particular time interval or time step.
If the current time exceeds the last time specified in the array deltmax, the last maximum time step size will be held for the remaining simulation time up to twfin. This holds true for all the other variables list above as well.
Example.
How many dumps will be generated up to 50 seconds? 3 up to 2 seconds (at~0.5 s, ~1.0 s, ~1.5 s) and 4 up to 50(at ~11.5 s, ~21.5 s, ~31.5 s, 41.5 s). Why only three up to 2 s? Because the first output is done at time≥0.5 s. The time step will rarely hit 0.5 seconds exactly. Therefore the first input is somewhat delayed. At times> 2 s, the new interval(10 seconds) is already active.
If the user wants a restart dump at approximately 0.5, 1.0, 1.5, 2,0, 12,0, 22.0, 32.0, and 42.0 s, then the easiest way would be to add a small amount to the interval. In the above case, one could use:
and this would insure that the interval 2.0 is reached before the increment is updated.
Example.
pltdt and prtdt can be controlled in a similar fashion.