ADflow  v1.0
ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
iteration.f90
Go to the documentation of this file.
1 module iteration
2 !
3 ! This module contains the iteration parameters mainly used in
4 ! solver.
5 !
6  use constants, only: inttype, realtype, alwaysrealtype, maxitertypelen
7  implicit none
8 
9  ! groundLevel: Current ground level of the computation. Needed
10  ! to determine what kind of action must be
11  ! undertaken. E.G. On the coarse grids no solution
12  ! will be written.
13  ! currentLevel: MG level at which the compution currently resides.
14  ! rkStage: Current runge kutta stage. Needed to determine
15  ! whether or not the artificial dissipation terms
16  ! must be computed.
17 
18  integer(kind=intType) :: groundlevel, currentlevel
19  integer(kind=intType) :: rkstage, subit
20 
21  ! nStepsCycling: Number of steps in the current cycling strategy
22  ! cycling: The corresponding array defining the multigrid
23  ! cycling strategy.
24 
25  integer(kind=intType) :: nstepscycling
26  integer(kind=intType), dimension(:), allocatable :: cycling
27 
28  ! iterTot: Total number of iterations on the current grid;
29  ! a restart is not included in this count.
30 
31  integer(kind=intType) :: itertot
32 
33  ! rFil : coefficient to control the fraction of the dissipation
34  ! residual of the previous runge-kutta stage.
35 
36  real(kind=realtype) :: rfil, rfilb
37 
38  ! t0Solver: Reference time for the solver.
39 
40  real(kind=realtype) :: t0solver
41 
42  ! converged: Whether or not the solution has been
43  ! converged.
44  ! exchangePressureEarly: Whether or not the pressure must be
45  ! exchanged early, i.e. before the
46  ! boundary conditions are applied.
47  ! This must be done for a correct treatment
48  ! of normal momentum boundary condition,
49  ! but it requires an extra call to the
50  ! halo routines.
51 
52  logical :: converged
54 
55  ! standAloneMode: Whether or not an executable in stand alone
56  ! mode is built.
57  ! changing_Grid: Whether or not the grid changes in time.
58  ! In stand alone mode this only happens when
59  ! moving parts are present. In a
60  ! multi-disciplinary environment more options
61  ! are possible, i.e. deforming meshes.
62  ! deforming_Grid: Whether or not the grid deforms; this can
63  ! only happen for a multi-disciplinary,
64  ! usually aero-elastic problem.
65  ! changingOverset: Whether or not the overset connectivity needs
66  ! to be updated at each time step, due to
67  ! moving or deforming grids.
68 
70  logical :: changingoverset
71 
72  ! nOldSolAvail: Number of available old solutions for
73  ! the time integration.
74  ! nOldLevels: Number of old levels needed in the time
75  ! integration scheme.
76  ! coefTime(0:nOld): The coefficients in the time integrator
77  ! for unsteady applications.
78 
79  integer(kind=intType) :: noldsolavail, noldlevels
80  real(kind=realtype), dimension(:), allocatable :: coeftime
81 
82  ! iterType: The type of iteration performed. Will be one of RK,
83  ! DADI, ANK or NK ( or None on the 0th evaluation)
84  character(len=maxIterTypelen) :: itertype
85 
86  ! approxTotalIts : A rough approximation of the total number of
87  ! function evaluations. An RK or DADI multi grid iteration
88  ! counts as 1. ANK steps count as 1 + number of KSP
89  ! iterations. NK steps count the total number of function
90  ! evalautions either for mat-vecs or during a line search. It
91  ! is this value that is checked again nCycles for doing too
92  ! much work.
93  integer(kind=intType) :: approxtotalits
94 
95  ! Variables for monitoring the current CFL and step depending
96  ! on the type of iteration
97  real(kind=realtype) :: cflmonitor = 0.0
98  real(kind=alwaysrealtype) :: stepmonitor = 1.0
99  real(kind=alwaysrealtype) :: linresmonitor = -1.0
100 
101  ! Added by HDN
102  ! nALEMeshes: Number of ALE levels for intermediate mesh
103  ! between two steps
104  ! nALEsteps: Number of ALE steps at one time step
105  ! coefTimeALE(nALEsteps): The weighting coefficients to average the fluxes
106  ! coefMeshALE(nALEmeshes,2): The coefficients to interpolate the mesh
107  integer(kind=intType) :: nalemeshes, nalesteps
108  real(kind=realtype), dimension(:), allocatable :: coeftimeale
109  real(kind=realtype), dimension(:, :), allocatable :: coefmeshale
110 
111  ! timeSpectralGridsNotWritten: Whether or not grid files have
112  ! already been written in time
113  ! spectral mode. In this way
114  ! it is avoided that files are
115  ! written multiple times.
116  ! oldSolWritten(nOldLevels-1): Logicals to indicate whether
117  ! or not old solution levels
118  ! have been written in
119  ! unsteady mode.
120 
122 
123  logical, dimension(:), allocatable :: oldsolwritten
124 
125  ! Variables for monitoring the residuals
126  real(kind=realtype) :: totalr0, totalrstart, totalrfinal, totalr
127  real(kind=realtype) :: rhores0, rhoresstart, rhoresfinal, rhores
128  real(kind=realtype) :: ordersconverged = 16.0_realtype
129 end module iteration
integer, parameter maxitertypelen
Definition: constants.F90:18
real(kind=realtype) totalr0
Definition: iteration.f90:126
integer(kind=inttype) noldlevels
Definition: iteration.f90:79
real(kind=realtype) totalrfinal
Definition: iteration.f90:126
real(kind=realtype), dimension(:, :), allocatable coefmeshale
Definition: iteration.f90:109
integer(kind=inttype) currentlevel
Definition: iteration.f90:18
real(kind=realtype) t0solver
Definition: iteration.f90:40
character(len=maxitertypelen) itertype
Definition: iteration.f90:84
integer(kind=inttype) subit
Definition: iteration.f90:19
logical changing_grid
Definition: iteration.f90:69
real(kind=realtype) cflmonitor
Definition: iteration.f90:97
real(kind=realtype) totalr
Definition: iteration.f90:126
logical converged
Definition: iteration.f90:52
logical changingoverset
Definition: iteration.f90:70
real(kind=realtype) rhores0
Definition: iteration.f90:127
integer(kind=inttype), dimension(:), allocatable cycling
Definition: iteration.f90:26
real(kind=realtype) totalrstart
Definition: iteration.f90:126
real(kind=realtype) rhoresfinal
Definition: iteration.f90:127
integer(kind=inttype) groundlevel
Definition: iteration.f90:18
real(kind=realtype) rhores
Definition: iteration.f90:127
integer(kind=inttype) nalemeshes
Definition: iteration.f90:107
integer(kind=inttype) rkstage
Definition: iteration.f90:19
real(kind=realtype), dimension(:), allocatable coeftime
Definition: iteration.f90:80
real(kind=realtype) rfil
Definition: iteration.f90:36
logical standalonemode
Definition: iteration.f90:69
logical deforming_grid
Definition: iteration.f90:69
real(kind=alwaysrealtype) stepmonitor
Definition: iteration.f90:98
real(kind=realtype), dimension(:), allocatable coeftimeale
Definition: iteration.f90:108
real(kind=realtype) rhoresstart
Definition: iteration.f90:127
integer(kind=inttype) nalesteps
Definition: iteration.f90:107
logical, dimension(:), allocatable oldsolwritten
Definition: iteration.f90:123
logical exchangepressureearly
Definition: iteration.f90:53
integer(kind=inttype) approxtotalits
Definition: iteration.f90:93
integer(kind=inttype) nstepscycling
Definition: iteration.f90:25
real(kind=realtype) rfilb
Definition: iteration.f90:36
integer(kind=inttype) noldsolavail
Definition: iteration.f90:79
real(kind=realtype) ordersconverged
Definition: iteration.f90:128
real(kind=alwaysrealtype) linresmonitor
Definition: iteration.f90:99
integer(kind=inttype) itertot
Definition: iteration.f90:31
logical timespectralgridsnotwritten
Definition: iteration.f90:121