Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
drive1.F90
Go to the documentation of this file.
1 
5 
9 subroutine nek_init(intracomm)
10  use kinds, only : dp
11 
12  use dealias, only : init_dealias
13  use domain, only : init_domain
14  use dxyz, only : init_dxyz
15  use esolv, only : init_esolv
16  use fdmh1, only : init_fdmh1
17  use geom, only : init_geom
18  use hsmg, only : init_hsmg, use_spectral_coarse
19  use input, only : init_input
20  use ixyz, only : init_ixyz
21 ! use geom, only : init_mass
22  use mesh, only : init_mesh
23  use mvgeom, only : init_mvgeom
24  use parallel, only : init_parallel
25  use scratch, only : init_scratch
26  use semhat, only : init_semhat
27  use soln, only : init_soln
28  use topol, only : init_topol
29  use turbo, only : init_turbo
30  use zper, only : init_zper
31 
32  use ctimer, only : etimes, dnekclock, etime1, ifsync, etims0, dnekclock_sync
33  use input, only : ifflow, iftran, solver_type, param
34  use soln, only : nid, jp
35  use tstep, only : istep, instep, nsteps, fintim, time
36 
37  implicit none
38 
39  integer, intent(inout) :: intracomm
40  integer :: igeom
41 
42  real(DP) :: tpp
43 
44  logical :: ifsync_
45 
46  call get_session_info(intracomm)
47 
48 ! Initalize Nek (MPI stuff, word sizes, ...)
49 ! call iniproc (initalized in get_session_info)
50 
51  etimes = dnekclock()
52  istep = 0
53  tpp = 0.0
54 
55  call opcount(1)
56 
57 ! Initialize and set default values.
58  call init_dealias()
59  call init_dxyz()
60  call init_domain()
61  call init_esolv()
62  call init_fdmh1()
63  call init_geom()
64 ! call init_gmres()
65  call init_hsmg()
66  call init_input()
67  call init_ixyz()
68 ! call init_mass()
69  call init_mesh()
70  call init_mvgeom()
71  call init_parallel()
72  call init_scratch()
73  call init_semhat()
74  call init_soln()
75  call init_topol()
76  call init_turbo()
77  call init_zper()
78 
79  call initdim
80  call initdat
81  call files
82 
83 ! Read .rea +map file
84  etime1 = dnekclock()
85  call readat
86 
87  use_spectral_coarse = .false.
88  if (param(48) == 1.) then
89  use_spectral_coarse = .true.
90  endif
91 
92  ifsync_ = ifsync
93  ifsync = .true.
94 
95 ! Initialize some variables
96  call setvar
97 
98 ! Check for zero steps
99  instep=1
100  if (nsteps == 0 .AND. fintim == 0.) instep=0
101 
102 ! Setup domain topology
103  igeom = 2
104  call setup_topo
105 
106 ! Compute GLL stuff (points, weights, derivate op, ...)
107  call genwz
108 
109 ! Initalize io unit
110  call io_init
111 
112 ! Set size for CVODE solver
113 #if 0
114  if(ifcvode .AND. nsteps > 0) call cv_setsize(0,nfield)
115 #endif
116 
117 ! USRDAT
118  if(nid == 0) write(6,*) 'call usrdat'
119  call usrdat
120  if(nid == 0) write(6,'(A,/)') ' done :: usrdat'
121 
122 ! generate geometry (called after usrdat in case something changed)
123  call gengeom(igeom)
124 
125 !max if (ifmvbd) call setup_mesh_dssum ! Set up dssum for mesh (needs geom)
126 
127 ! USRDAT2
128  if(nid == 0) write(6,*) 'call usrdat2'
129  call usrdat2
130  if(nid == 0) write(6,'(A,/)') ' done :: usrdat2'
131 
132  call geom_reset(1) ! recompute Jacobians, etc.
133  call vrdsmsh ! verify mesh topology
134 
135  call echopar ! echo back the parameter stack
136  call setlog ! Initalize logical flags
137 
138 ! Zero out masks corresponding to Dirichlet boundary points.
139  call bcmask
140 
141 ! Need eigenvalues to set tolerances in presolve (SETICS)
142  if (fintim /= 0.0 .OR. nsteps /= 0) call geneig(igeom)
143 
144 ! Verify mesh topology
145  call vrdsmsh
146 
147 ! Pressure solver initialization (uses "SOLN" space as scratch)
148  if (ifflow .AND. (fintim /= 0 .OR. nsteps /= 0)) then
149  call estrat
150  if (iftran .AND. solver_type == 'itr') then
151  call set_overlap
152  elseif (solver_type == 'fdm' .OR. solver_type == 'pdm')then
153  write(*,*) "Oops: gfdm"
154 #if 0
155  ifemati = .true.
156  kwave2 = 0.0
157  if (ifsplit) ifemati = .false.
158  call gfdm_init(nx2,ny2,nz2,ifemati,kwave2)
159 #endif
160  elseif (solver_type == '25D') then
161  write(*,*) "Oops"
162 #if 0
163  call g25d_init
164 #endif
165  endif
166  endif
167 
168 ! USRDAT3
169  if(nid == 0) write(6,*) 'call usrdat3'
170  call usrdat3
171  if(nid == 0) write(6,'(A,/)') ' done :: usrdat3'
172 
173 ! Set initial conditions + compute field properties
174  call setprop
175  call setics
176 
177 ! USRCHK
178  if(instep /= 0) then
179  if(nid == 0) write(6,*) 'call userchk'
180  call userchk
181  if(nid == 0) write(6,'(A,/)') ' done :: userchk'
182  endif
183 
184 ! Initialize CVODE
185 #if 0
186  if(ifcvode .AND. nsteps > 0) call cv_init
187 #endif
188 
189  call comment
190 ! call sstest (isss)
191 
192  call dofcnt
193 
194  jp = 0 ! Set perturbation field count to 0 for baseline flow
195 
196 ! call in_situ_init()
197 
198 ! Initalize timers to ZERO
199  call time00
200  call opcount(2)
201 
202  etims0 = dnekclock_sync()
203  IF (nid == 0) THEN
204  WRITE (6,*) ' '
205  IF (time /= 0.0) WRITE (6,'(A,E14.7)') ' Initial time:',time
206  WRITE (6,'(A,g13.5,A)') &
207  ' Initialization successfully completed ', &
208  etims0-etimes, ' sec'
209  ENDIF
210 
211  ifsync = ifsync_ ! restore initial value
212 
213  return
214  end subroutine nek_init
215 !-----------------------------------------------------------------------
219 subroutine nek_solve
220  use ctimer, only : ifsync
221  use tstep, only : instep, nid, istep, nsteps, lastep
222  implicit none
223 
224 ! real*4 :: papi_mflops
225 ! integer*8 :: papi_flops
226 
227  integer :: isyc, itime, msteps, kstep
228 
229  call nekgsync()
230 
231  if (instep == 0) then
232  if(nid == 0) write(6,'(/,A,/,A,/)') &
233  ' nsteps=0 -> skip time loop', &
234  ' running solver in post processing mode'
235  else
236  if(nid == 0) write(6,'(/,A,/)') 'Starting time loop ...'
237  endif
238 
239  isyc = 0
240  itime = 0
241  if(ifsync) isyc=1
242  itime = 1
243  call nek_comm_settings(isyc,itime)
244 
245  call nek_comm_startstat()
246 
247  istep = 0
248  msteps = 1
249 
250  do kstep=1,nsteps,msteps
251  call nek__multi_advance(kstep,msteps)
252  call userchk
253  call prepost( .false. ,'his')
254 ! call in_situ_check()
255  if (lastep == 1) goto 1001
256  enddo
257  1001 lastep=1
258 
259 
260  call nek_comm_settings(isyc,0)
261 
262  call comment
263 
264 ! check for post-processing mode
265  if (instep == 0) then
266  nsteps=0
267  istep=0
268  if(nid == 0) write(6,*) 'call userchk'
269  call userchk
270  if(nid == 0) write(6,*) 'done :: userchk'
271  call prepost( .true. ,'his')
272  else
273  if (nid == 0) write(6,'(/,A,/)') &
274  'end of time-step loop'
275  endif
276 
277 
278  RETURN
279 end subroutine nek_solve
280 !-----------------------------------------------------------------------
284 subroutine nek_advance
285  use input, only : iftran, ifsplit, ifheat, ifflow, param
286  implicit none
287 
288  integer :: igeom
289 
290  call nekgsync
291  IF (iftran) CALL settime
292 !max if (ifmhd ) call cfl_check
293  CALL setsolv
294  CALL comment
295 
296  if (ifsplit) then ! PN/PN formulation
297 
298  igeom = 1
299  if (ifheat) call heat(igeom)
300  call setprop
301  !call qthermal
302  igeom = 1
303  if (ifflow) call fluid(igeom)
304  if (param(103) > 0) call q_filter(param(103))
305  call setup_convect(2) ! Save convective velocity _after_ filter
306 
307  else ! PN-2/PN-2 formulation
308  write(*,*) "Oops! Pn-2/Pn-2"
309 #if 0
310  call setprop
311  do igeom=1,ngeom
312 
313  if (igeom > 2) call userchk_set_xfer
314 
315  if (ifgeom) then
316  call gengeom(igeom)
317  call geneig(igeom)
318  endif
319 
320  if (ifmhd) then
321  if (ifheat) call heat(igeom)
322  call induct(igeom)
323  elseif (ifpert) then
324  write(*,*) "Oops! ifpert"
325 #if 0
326  if (ifbase .AND. ifheat) call heat(igeom)
327  if (ifbase .AND. ifflow) call fluid(igeom)
328  if (ifflow) call fluidp(igeom)
329  if (ifheat) call heatp(igeom)
330 #endif
331  else ! std. nek case
332  if (ifheat) call heat(igeom)
333  if (ifflow) call fluid(igeom)
334  if (ifmvbd) call meshv(igeom)
335  endif
336 
337  if (igeom == ngeom .AND. param(103) > 0) &
338  call q_filter(param(103))
339 
340  call setup_convect(igeom) ! Save convective velocity _after_ filter
341 
342  enddo
343 #endif
344  endif
345 
346  return
347 end subroutine nek_advance
348 !-----------------------------------------------------------------------
350 subroutine nek_end
351  use parallel, only : xxth
352  use tstep, only : instep
353  implicit none
354 
355  if(instep /= 0) call runstat
356  if(xxth(1) > 0) call crs_stats(xxth(1))
357 
358 ! call in_situ_end()
359  return
360 end subroutine nek_end
361 !-----------------------------------------------------------------------
365 subroutine nek__multi_advance(kstep,msteps)
366  use tstep, only : istep
367  implicit none
368 
369  integer, intent(in) :: kstep
370  integer, intent(in) :: msteps
371  integer i
372 
373  do i=1,msteps
374  istep = kstep + i - 1
375  call nek_advance
376  enddo
377 
378  return
379 end subroutine nek__multi_advance
380 
381 !-----------------------------------------------------------------------
#define nek_comm_settings
Definition: nek_comm.c:34
#define crs_stats
Definition: crs.h:10
subroutine init_semhat()
Definition: semhat_mod.F90:18
cleaned
Definition: scratch_mod.F90:2
subroutine init_geom()
Definition: geom_mod.F90:49
cleaned
Definition: tstep_mod.F90:2
subroutine init_soln()
Definition: soln_mod.F90:71
Input parameters from preprocessors.
Definition: input_mod.F90:11
Definition: soln_mod.F90:1
subroutine init_zper
Definition: zper_mod.F90:56
subroutine setvar
Initialize variables.
Definition: drive2.F90:148
subroutine files
Defines machine specific input and output file names.
Definition: drive2.F90:484
subroutine init_turbo
Definition: turbo_mod.F90:23
subroutine initdim
Transfer array dimensions to common.
Definition: drive2.F90:7
subroutine nek_solve
integrate the governing equations in time
Definition: drive1.F90:219
subroutine runstat
print run statistics from ctimer
Definition: drive2.F90:943
subroutine io_init
Definition: prepost.F90:903
Definition: dxyz_mod.F90:3
Module containing data for HSMG.
Definition: hsmg_mod.F90:3
subroutine init_scratch()
Definition: scratch_mod.F90:36
subroutine geom_reset(icall)
Generate geometry data.
Definition: ic.F90:1513
subroutine genwz
Generate derivative and interpolation operators. GENERATE.
Definition: coef.F90:13
real(dp) function dnekclock_sync()
Definition: ctimer_mod.F90:113
Arrays for direct stiffness summation. cleaned.
Definition: topol_mod.F90:3
subroutine setsolv
Set ifsolv = .FALSE.
Definition: subs1.F90:881
subroutine init_topol()
Definition: topol_mod.F90:42
subroutine opcount(ICALL)
init opcounter
Definition: drive2.F90:1357
subroutine setlog()
Subroutine to initialize logical flags.
Definition: bdry.F90:3
cleaned
Definition: semhat_mod.F90:2
subroutine init_domain()
Definition: domain_mod.F90:25
subroutine setics
Set initial conditions.
Definition: ic.F90:5
subroutine dofcnt
count degrees of freedom
Definition: drive2.F90:1415
subroutine setup_convect(igeom)
Definition: convect.F90:11
subroutine init_dealias()
Definition: dealias_mod.F90:18
subroutine time00
zero the ctimer
Definition: drive2.F90:872
subroutine init_parallel()
cleaned
Definition: mesh_mod.F90:2
real(dp) function dnekclock()
Definition: ctimer_mod.F90:103
#define nek_comm_startstat
Definition: nek_comm.c:36
subroutine prepost(ifdoin, prefin)
Store results for later postprocessing. Recent updates: p65 now indicates the number of parallel i/o ...
Definition: prepost.F90:5
subroutine readat()
Read in data from preprocessor input file (.rea)
Definition: connect2.F90:3
Cleaned.
Definition: zper_mod.F90:2
subroutine setprop
Set variable property arrays.
Definition: setprop.F90:5
subroutine fluid(igeom)
Driver for solving the incompressible Navier-Stokes equations.
Definition: drive2.F90:732
subroutine gengeom(igeom)
Generate geometry data.
Definition: drive2.F90:412
subroutine get_session_info(intracomm)
Definition: singlmesh.F90:2
subroutine geneig(igeom)
Compute eigenvalues.
Definition: drive2.F90:674
cleaned
Definition: parallel_mod.F90:2
subroutine init_esolv()
Definition: esolv_mod.F90:11
subroutine init_fdmh1()
Definition: fdmh1_mod.F90:16
cleaned
Definition: turbo_mod.F90:2
subroutine init_ixyz()
Definition: ixyz_mod.F90:17
subroutine init_dxyz()
Definition: dxyz_mod.F90:28
subroutine nekgsync()
Definition: comm_mpi.F90:318
cleaned
Definition: mvgeom_mod.F90:2
Geometry arrays.
Definition: geom_mod.F90:2
subroutine nek_advance
take a single time-step
Definition: drive1.F90:284
subroutine nek_end
perform any end-of-run reporting
Definition: drive1.F90:350
subroutine init_mvgeom()
Definition: mvgeom_mod.F90:25
subroutine bcmask
Zero out masks corresponding to Dirichlet boundary points.
Definition: bdry.F90:304
subroutine init_input()
Definition: input_mod.F90:79
subroutine echopar
Echo the nonzero parameters from the readfile to the logfile.
Definition: drive2.F90:320
subroutine setup_topo()
Parallel compatible routine to find connectivity of element structure. On Processor 0: ...
Definition: connect1.F90:12
subroutine init_hsmg()
Definition: hsmg_mod.F90:72
subroutine init_mesh()
Definition: mesh_mod.F90:22
subroutine nek_init(intracomm)
initialize nek
Definition: drive1.F90:9
subroutine heat(igeom)
Driver for temperature or passive scalar.
Definition: drive2.F90:812
subroutine userchk_set_xfer
Dummy for singlmesh.
Definition: singlmesh.F90:55
subroutine vrdsmsh()
Verify that mesh and dssum are properly defined by performing a direct stiffness operation on the X...
Definition: connect2.F90:1578
subroutine settime
setup time-stepping
Definition: drive2.F90:612
subroutine comment
No need to comment !!
Definition: drive2.F90:94
subroutine initdat
Initialize and set default values.
Definition: drive2.F90:39
subroutine nek__multi_advance(kstep, msteps)
take a chunk of time-steps
Definition: drive1.F90:365
Definition: ixyz_mod.F90:2