ADflow  v1.0
ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
masterRoutines.F90
Go to the documentation of this file.
2 contains
3  subroutine master(useSpatial, famLists, funcValues, forces, &
4  bcDataNames, bcDataValues, bcDataFamLists)
5 
6  use constants
11  use iteration, only: currentlevel
12  use inputadjoint, only: viscpc
13  use flowvarrefstate, only: nwf, nw
14  use blockpointers, only: ndom, il, jl, kl
15  use flowvarrefstate, only: viscous
20  use section, only: sections, nsections
21  use monitor, only: timeunsteadyrestart
22  use sa, only: sasource, saviscous, saresscale, qq
23  use haloexchange, only: exchangecoor, whalo2
25  use solverutils, only: timestep_block
31  use utils, only: setpointers, echk
37  use oversetdata, only: oversetpresent
41  use walldistancedata, only: xsurfvec, xsurf
43 
44  implicit none
45 
46  ! Input Arguments:
47  logical, intent(in) :: useSpatial
48  integer(kind=intType), optional, dimension(:, :), intent(in) :: famLists
49  real(kind=realtype), optional, dimension(:, :), intent(out) :: funcvalues
50  character, optional, dimension(:, :), intent(in) :: bcDataNames
51  real(kind=realtype), optional, dimension(:), intent(in) :: bcdatavalues
52  integer(kind=intType), optional, dimension(:, :) :: bcDataFamLists
53 
54  ! Output Variables
55  real(kind=realtype), intent(out), optional, dimension(:, :, :) :: forces
56 
57  ! Working Variables
58  integer(kind=intType) :: ierr, nn, sps, fSize, iRegion
59  real(kind=realtype), dimension(nSections) :: time
60  real(kind=realtype) :: dummyreal
61 
62  if (usespatial) then
63  call adjustinflowangle()
64 
65  ! Update all the BCData
66  call referencestate
67  if (present(bcdatanames)) then
68  do sps = 1, ntimeintervalsspectral
69  call setbcdata(bcdatanames, bcdatavalues, bcdatafamlists, sps, &
70  size(bcdatavalues), size(bcdatafamlists, 2))
71  end do
72  call setbcdatafinegrid(.true.)
73  end if
74 
75  do sps = 1, ntimeintervalsspectral
76  do nn = 1, ndom
77  call setpointers(nn, 1, sps)
78  call xhalo_block()
79  end do
80  end do
81 
82  ! Now exchange the coordinates (fine level only)
83  call exchangecoor(1)
84 
85  do sps = 1, ntimeintervalsspectral
86  ! Update overset connectivity if necessary
88  call updateoversetconnectivity(1_inttype, sps)
89  end if
90  end do
91  end if
92 
93  if (usespatial) then
94  ! Zero out the local volume pointers for the actuator zone
95  do iregion = 1, nactuatorregions
96  actuatorregions(iregion)%volLocal = zero
97  end do
98  end if
99 
100  do sps = 1, ntimeintervalsspectral
101  do nn = 1, ndom
102  call setpointers(nn, 1, sps)
103 
104  if (usespatial) then
105 
106  call vecgetarrayf90(xsurfvec(1, sps), xsurf, ierr)
107  call echk(ierr, __file__, __line__)
108 
109  call volume_block
110 
111  ! Compute the volume of each actuator region
112  do iregion = 1, nactuatorregions
113  call computeactuatorregionvolume(nn, iregion)
114  end do
115 
116  call metric_block
117  call boundarynormals
118 
120  call updatewalldistancesquickly(nn, 1, sps)
121  end if
122 
123  ! These arrays need to be restored before we can move to the next spectral instance.
124  call vecrestorearrayf90(xsurfvec(1, sps), xsurf, ierr)
125  call echk(ierr, __file__, __line__)
126 
127  end if
128 
129  ! Compute the pressures/viscositites
130  call computepressuresimple(.false.)
131 
132  ! Compute Laminar/eddy viscosity if required
133  call computelamviscosity(.false.)
134  call computeeddyviscosity(.false.)
135 
136  ! Make sure to call the turb BC's first incase we need to
137  ! correct for K
138  if (equations == ransequations) then
139  call bcturbtreatment
140  call applyallturbbcthisblock(.true.)
141  end if
142  call applyallbc_block(.true.)
143  end do
144  end do
145 
146  ! Sum the local actuator zone volumes into the global actuator
147  ! zone volumes.
148  if (usespatial) then
149  do iregion = 1, nactuatorregions
150  call mpi_allreduce(actuatorregions(iregion)%volLocal, actuatorregions(iregion)%volume, 1, &
151  adflow_real, mpi_sum, adflow_comm_world, ierr)
152  call echk(ierr, __file__, __line__)
153  end do
154  end if
155 
156  ! Exchange values
157  call whalo2(currentlevel, 1_inttype, nw, .true., .true., .true.)
158 
159  ! Need to re-apply the BCs. The reason is that BC halos behind
160  ! interpolated cells need to be recomputed with their new
161  ! interpolated values from actual compute cells. Only needed for
162  ! overset.
163  if (oversetpresent) then
164  do sps = 1, ntimeintervalsspectral
165  do nn = 1, ndom
166  call setpointers(nn, 1, sps)
167  if (equations == ransequations) then
168  call bcturbtreatment
169  call applyallturbbcthisblock(.true.)
170  end if
171  call applyallbc_block(.true.)
172  end do
173  end do
174  end if
175 
176  ! Main loop for the residual
177  do sps = 1, ntimeintervalsspectral
178  do nn = 1, ndom
179  call setpointers(nn, 1, sps)
180  call initres_block(1, nw, nn, sps)
181  do iregion = 1, nactuatorregions
182  call sourceterms_block(nn, .true., iregion, dummyreal)
183  end do
184 
185  call timestep_block(.false.)
186 
187  ! Compute turbulence residual for RANS equations
188  if (equations == ransequations) then
189 
190  ! Initialize only the Turblent Variables
191  !call unsteadyTurbSpectral_block(itu1, itu1, nn, sps)
192 
193  select case (turbmodel)
194 
195  case (spalartallmaras)
196  allocate (qq(2:il, 2:jl, 2:kl))
197  call sasource
198  call turbadvection(1_inttype, 1_inttype, itu1 - 1, qq)
199  !call unsteadyTurbTerm(1_intType, 1_intType, itu1-1, qq)
200  call saviscous
201  call saresscale
202  deallocate (qq)
203  end select
204  end if
205 
206  ! Compute the mean flow residuals
208  if (lumpeddiss) then
209  select case (spacediscr)
210  case (dissscalar)
212  case (dissmatrix)
214  case (upwind)
215  call inviscidupwindflux(.true.)
216  end select
217  else
218  select case (spacediscr)
219  case (dissscalar)
221  case (dissmatrix)
223  case (upwind)
224  call inviscidupwindflux(.true.)
225  end select
226  end if
227 
228  if (viscous) then
230  if (.not. lumpeddiss .or. viscpc) then
231  call allnodalgradients
232  call viscousflux
233  else
234  call viscousfluxapprox
235  end if
236  end if
237  call sumdwandfw
238  ! if (lowSpeedPreconditioner) then
239  ! call applyLowSpeedPreconditioner
240  ! end if
241  call resscale
242  end do
243  end do
244 
245  ! Compute the final solution values
246  if (present(famlists)) then
247  call getsolution(famlists, funcvalues)
248  end if
249 
250  do sps = 1, ntimeintervalsspectral
251  if (present(forces)) then
252  ! Now we can retrieve the forces/tractions for this spectral instance
253  fsize = size(forces, 2)
254  call getforces(forces(:, :, sps), fsize, sps)
255  end if
256  end do
257 
258  end subroutine master
259 #ifndef USE_COMPLEX
260  subroutine master_d(wdot, xdot, forcesDot, dwDot, famLists, funcValues, funcValuesd, &
261  bcDataNames, bcDataValues, bcDataValuesd, bcDataFamLists)
262 
263  use constants
266  use iteration, only: currentlevel
267  use bcextra_d, only: applyallbc_block_d
268  use inputadjoint, only: viscpc
269  use flowvarrefstate, only: nw, nwf
270  use blockpointers, only: ndom, il, jl, kl, wd, xd, dw, dwd, nbocos, nviscbocos
271  use flowvarrefstate, only: viscous, timerefd
275  use section, only: sections, nsections
276  use monitor, only: timeunsteadyrestart
284  use adjointpetsc, only: x_like
287  use walldistancedata, only: xsurfvec, xsurfvecd, xsurf, xsurfd, wallscatter
298  use oversetdata, only: oversetpresent
303 #include <petsc/finclude/petsc.h>
304  use petsc
305  implicit none
306 
307  ! Input Arguments:
308  real(kind=realtype), intent(in), dimension(:) :: wdot, xdot
309  integer(kind=intType), optional, dimension(:, :), intent(in) :: famLists
310  real(kind=realtype), optional, dimension(:, :), intent(out) :: funcvalues, funcvaluesd
311  character, optional, dimension(:, :), intent(in) :: bcDataNames
312  real(kind=realtype), optional, dimension(:), intent(in) :: bcdatavalues, bcdatavaluesd
313  integer(kind=intType), optional, dimension(:, :) :: bcDataFamLists
314 
315  ! Output variables:
316  real(kind=realtype), intent(out), dimension(:) :: dwdot
317  real(kind=realtype), intent(out), dimension(:, :, :) :: forcesdot
318 
319  ! Working Variables
320  real(kind=realtype), dimension(:, :, :), allocatable :: forces
321  integer(kind=intType) :: ierr, nn, sps, mm, i, j, k, l, fSize, ii, jj, iRegion
322  real(kind=realtype), dimension(nSections) :: time
323  real(kind=realtype) :: dummyreal, dummyreald
324 
325  logical :: useOldCoor ! for adjointextra_d() functions
326  useoldcoor = .false.
327 
328  fsize = size(forcesdot, 2)
329  allocate (forces(3, fsize, ntimeintervalsspectral))
330 
331  call vecplacearray(x_like, xdot, ierr)
332  call echk(ierr, __file__, __line__)
333 
334  ! Set the provided w and x seeds:
335  ii = 0
336  jj = 0
337  domainloop1: do nn = 1, ndom
338  spectalloop1: do sps = 1, ntimeintervalsspectral
339  call setpointers_d(nn, 1, sps)
340  do k = 1, kl
341  do j = 1, jl
342  do i = 1, il
343  do l = 1, 3
344  ii = ii + 1
345  xd(i, j, k, l) = xdot(ii)
346  end do
347  end do
348  end do
349  end do
350  do k = 2, kl
351  do j = 2, jl
352  do i = 2, il
353  do l = 1, nw
354  jj = jj + 1
355  wd(i, j, k, l) = wdot(jj)
356  end do
357  end do
358  end do
359  end do
360  end do spectalloop1
361  end do domainloop1
362 
363  do sps = 1, ntimeintervalsspectral
364  do nn = 1, ndom
365  call setpointers_d(nn, 1, sps)
366  call xhalo_block_d()
367  end do
368  end do
369 
370  ! Now exchange the coordinates. Note that we *must* exhchange the
371  ! actual coordinates as well becuase xhao_block overwrites all
372  ! halo nodes and exchange coor corrects them.
373  call exchangecoor_d(1)
374  call exchangecoor(1)
375 
376  do sps = 1, ntimeintervalsspectral
377  ! Update overset connectivity if necessary
378  if (oversetpresent) then
379  if (oversetupdatemode == updatefast) then
380  call updateoversetconnectivity_d(1_inttype, sps)
381  else if (oversetupdatemode == updatefull) then
382  if (myid == 0) then
383  print *, 'Full overset update derivatives not implemented'
384  end if
385  end if
386  end if
387  end do
388 
389  ! Now set the xsurfd contribution from the full x perturbation.
390  ! scatter from the global seed (in x_like) to xSurfVecd...but only
391  ! if wallDistances were used
393  do sps = 1, ntimeintervalsspectral
394  call vecscatterbegin(wallscatter(1, sps), x_like, xsurfvecd(sps), insert_values, scatter_forward, ierr)
395  call echk(ierr, __file__, __line__)
396 
397  call vecscatterend(wallscatter(1, sps), x_like, xsurfvecd(sps), insert_values, scatter_forward, ierr)
398  call echk(ierr, __file__, __line__)
399  end do
400  end if
401 
403  call referencestate_d
404  if (present(bcdatanames)) then
405  do sps = 1, ntimeintervalsspectral
406  call setbcdata_d(bcdatanames, bcdatavalues, bcdatavaluesd, &
407  bcdatafamlists, sps, size(bcdatavalues), size(bcdatafamlists, 2))
408  end do
409  call setbcdatafinegrid_d(.true.)
410  end if
411 
412  ! Zero out the local volume seeds for the actuator zones
413  do iregion = 1, nactuatorregions
414  actuatorregionsd(iregion)%volLocal = zero
415  end do
416 
417  do sps = 1, ntimeintervalsspectral
418  do nn = 1, ndom
419 
420  call setpointers_d(nn, 1, sps)
423 
424  ! Get the pointers from the petsc vector for the surface
425  ! perturbation for wall distance.
426  call vecgetarrayf90(xsurfvec(1, sps), xsurf, ierr)
427  call echk(ierr, __file__, __line__)
428 
429  ! And it's derivative
430  call vecgetarrayf90(xsurfvecd(sps), xsurfd, ierr)
431  call echk(ierr, __file__, __line__)
432 
433  call volume_block_d()
434  call metric_block_d()
435 
436  ! Loop over the actuator regions to compute the local
437  ! volume seeds
438  do iregion = 1, nactuatorregions
439  call computeactuatorregionvolume_d(nn, iregion)
440  end do
441  call boundarynormals_d()
442 
443  time = timeunsteadyrestart
444  if (equationmode .eq. timespectral) then
445  do mm = 1, nsections
446  time(mm) = time(mm) + (sps - 1) * sections(mm)%timeperiod / real(&
447  & ntimeintervalsspectral, realtype)
448  end do
449  end if
450 
451  call gridvelocitiesfinelevel_block_d(useoldcoor, time, sps, nn)
452  ! required for ts
453  call normalvelocities_block_d(sps)
454  ! required for ts
455  call slipvelocitiesfinelevel_block_d(useoldcoor, time, sps, nn)
456 
458  call updatewalldistancesquickly_d(nn, 1, sps)
459  end if
460 
461  call computepressuresimple_d(.false.)
462  call computelamviscosity_d(.false.)
463  call computeeddyviscosity_d(.false.)
464 
465  ! Make sure to call the turb BC's first incase we need to
466  ! correct for K
467  if (equations == ransequations) then
468  call bcturbtreatment_d
469  call applyallturbbcthisblock_d(.true.)
470  end if
471 
472  call applyallbc_block_d(.true.)
473 
474  ! These arrays need to be restored before we can move to the next spectral instance.
475  call vecrestorearrayf90(xsurfvec(1, sps), xsurf, ierr)
476  call echk(ierr, __file__, __line__)
477 
478  ! And it's derivative
479  call vecrestorearrayf90(xsurfvecd(sps), xsurfd, ierr)
480  call echk(ierr, __file__, __line__)
481  end do
482  end do
483 
484  ! Loop over the actuator regions again to sum the local volume
485  ! seeds into the global volume seeds
486  do iregion = 1, nactuatorregions
487  call mpi_allreduce(actuatorregionsd(iregion)%volLocal, actuatorregionsd(iregion)%volume, 1, &
488  adflow_real, mpi_sum, adflow_comm_world, ierr)
489  call echk(ierr, __file__, __line__)
490  end do
491 
492  ! Just exchange the derivative values.
493  call whalo2_d(1, 1, nw, .true., .true., .true.)
494 
495  ! Need to re-apply the BCs. The reason is that BC halos behind
496  ! interpolated cells need to be recomputed with their new
497  ! interpolated values from actual compute cells. Only needed for
498  ! overset.
499  if (oversetpresent) then
500  do sps = 1, ntimeintervalsspectral
501  do nn = 1, ndom
502  call setpointers_d(nn, 1, sps)
503  if (equations == ransequations) then
504  call bcturbtreatment_d
505  call applyallturbbcthisblock_d(.true.)
506  end if
507  call applyallbc_block_d(.true.)
508  end do
509  end do
510  end if
511 
512  do sps = 1, ntimeintervalsspectral
513  do nn = 1, ndom
514  call setpointers_d(nn, 1, sps)
517 
518  ! initalize the residuals for this block
519  call initres_block_d(1, nw, nn, sps)
520 
521  ! Compute any source terms
522  do iregion = 1, nactuatorregions
523  call sourceterms_block_d(nn, .true., iregion, dummyreal, dummyreald)
524  end do
525 
526  call timestep_block_d(.false.)
527 
528  !Compute turbulence residual for RANS equations
529  if (equations == ransequations) then
530  !call unsteadyTurbSpectral_block(itu1, itu1, nn, sps)
531 
532  select case (turbmodel)
533  case (spalartallmaras)
534  call sasource_d
535  call turbadvection_d(1_inttype, 1_inttype, itu1 - 1, qq)
536  !!call unsteadyTurbTerm_d(1_intType, 1_intType, itu1-1, qq)
537  call saviscous_d
538  call saresscale_d
539  end select
540  end if
541 
542  ! compute the mean flow residual
544 
545  if (lumpeddiss) then
546  select case (spacediscr)
547  case (dissscalar)
549  case (dissmatrix)
551  case (upwind)
552  call inviscidupwindflux_d(.true.)
553  end select
554  else
555  select case (spacediscr)
556  case (dissscalar)
558  case (dissmatrix)
560  case (upwind)
561  call inviscidupwindflux_d(.true.)
562  end select
563  end if
564 
565  if (viscous) then
567  if (.not. lumpeddiss .or. viscpc) then
569  call viscousflux_d
570  else
572  end if
573  end if
574 
575  ! if (lowSpeedPreconditioner) then
576  ! call applyLowSpeedPreconditioner_d
577  ! end if
578  call sumdwandfw_d
579  call resscale_d
580  end do
581  end do
582 
583  ! Compute final solution values
584  if (present(famlists)) then
585  call getsolution_d(famlists, funcvalues, funcvaluesd)
586  end if
587 
588  do sps = 1, ntimeintervalsspectral
589  call getforces_d(forces(:, :, sps), forcesdot(:, :, sps), fsize, sps)
590  end do
591 
592  ! Copy out the residual derivative into the provided dwDot
593  ii = 0
594  do nn = 1, ndom
595  do sps = 1, ntimeintervalsspectral
596  call setpointers_d(nn, 1, sps)
597  do k = 2, kl
598  do j = 2, jl
599  do i = 2, il
600  do l = 1, nw
601  ii = ii + 1
602  dwdot(ii) = dwd(i, j, k, l)
603  end do
604  end do
605  end do
606  end do
607  end do
608  end do
609  call vecresetarray(x_like, ierr)
610  call echk(ierr, __file__, __line__)
611  deallocate (forces)
612  end subroutine master_d
613 
614  subroutine master_b(wbar, xbar, extraBar, forcesBar, dwBar, nState, famLists, &
615  funcValues, funcValuesd, bcDataNames, bcDataValues, bcDataValuesd, bcDataFamLists)
616 
617  ! This is the main reverse mode differentiaion of master. It
618  ! compute the reverse mode sensitivity of *all* outputs with
619  ! respect to *all* inputs. Anything that needs to be
620  ! differentiated for the adjoint method should be included in this
621  ! function. This routine is written by hand, assembling the various
622  ! individually differentiated tapenade routines.
623 
624  use constants
628  use iteration, only: currentlevel
629  use inputadjoint, only: viscpc
630  use fluxes, only: viscousflux
632  use blockpointers, only: ndom, il, jl, kl, wd, xd, dw, dwd
637  use inputadjoint, only: frozenturbulence
638  use utils, only: iswalltype, setpointers_b, echk
639  use adjointpetsc, only: x_like
641  use walldistancedata, only: xsurfvec, xsurfvecd, xsurf, xsurfd, wallscatter
658  use bcextra_b, only: applyallbc_block_b
660  use oversetdata, only: oversetpresent
663  use bcroutines, only: applyallbc_block
666  use monitor, only: timeunsteadyrestart
667  use section, only: sections, nsections ! used in time-declaration
668 
669 #include <petsc/finclude/petsc.h>
670  use petsc
671  implicit none
672 
673  ! Input variables:
674  real(kind=realtype), intent(in), dimension(:) :: dwbar
675  real(kind=realtype), intent(in), dimension(:, :, :) :: forcesbar
676  integer(kind=intType), intent(in) :: nState
677  integer(kind=intType), optional, dimension(:, :), intent(in) :: famLists
678  real(kind=realtype), optional, dimension(:, :) :: funcvalues, funcvaluesd
679  character, optional, dimension(:, :), intent(in) :: bcDataNames
680  real(kind=realtype), optional, dimension(:), intent(in) :: bcdatavalues
681  integer(kind=intType), optional, dimension(:, :) :: bcDataFamLists
682 
683  ! Output Arguments:
684  real(kind=realtype), optional, intent(out), dimension(:) :: wbar, xbar, extrabar
685  real(kind=realtype), optional, dimension(:), intent(out) :: bcdatavaluesd
686 
687  ! Working Variables
688  integer(kind=intType) :: ierr, nn, sps, mm, i, j, k, l, fSize, ii, jj, level, iRegion
689  real(kind=realtype), dimension(:), allocatable :: extralocalbar, bcdatavaluesdlocal
690  real(kind=realtype) :: dummyreal, dummyreald
691  logical :: resetToRans
692  real(kind=realtype), dimension(nSections) :: time
693  logical :: useOldCoor ! for solverutils_b() functions
694  useoldcoor = .false.
695 
696  ! extraLocalBar accumulates the seeds onto the extra variables
697  allocate (extralocalbar(size(extrabar)))
698  extralocalbar = zero
699 
700  ! Place the output spatial seed into the temporary petsc x-like
701  ! vector.
702  xbar = zero
703  call vecplacearray(x_like, xbar, ierr)
704  call echk(ierr, __file__, __line__)
705 
706  ! Set the residual seeds.
707  ii = 0
708  do nn = 1, ndom
709  do sps = 1, ntimeintervalsspectral
710 
711  ! Set pointers and derivative pointers
712  call setpointers_b(nn, 1, sps)
713 
714  ! Set the dw seeds
715  do k = 2, kl
716  do j = 2, jl
717  do i = 2, il
718  do l = 1, nstate
719  ii = ii + 1
720  dwd(i, j, k, l) = dwbar(ii)
721  end do
722  end do
723  end do
724  end do
725  end do
726  end do
727 
728  forcespsloop: do sps = 1, ntimeintervalsspectral
729  fsize = size(forcesbar, 2)
730  call getforces_b(forcesbar(:, :, sps), fsize, sps)
731  end do forcespsloop
732 
733  ! Call the final getSolution_b routine
734  if (present(famlists)) then
735  call getsolution_b(famlists, funcvalues, funcvaluesd)
736  end if
737 
738  spsloop1: do sps = 1, ntimeintervalsspectral
739 
740  domainloop1: do nn = 1, ndom
741  call setpointers_b(nn, 1, sps)
742 
743  ! Now we start running back through the main residual code:
744  call resscale_b
745  call sumdwandfw_b
746 
747  ! if (lowSpeedPreconditioner) then
748  ! call applyLowSpeedPreconditioner_b
749  ! end if
750 
751  ! Note that master_b does not include the first order flux
752  ! approxation codes as those are never needed in reverse.
753  if (viscous) then
754  call viscousflux_b
757  end if
758 
759  ! So the all nodal gradients doesnt' perform the final
760  ! scaling by the volume since it isn't necessary for the
761  ! derivative. We have a special routine to fix that.
762  if (viscous) then
764  call viscousflux
765  end if
766 
767  select case (spacediscr)
768  case (dissscalar)
770  case (dissmatrix)
772  case (upwind)
773  call inviscidupwindflux_b(.true.)
774  end select
775 
777  ! Compute turbulence residual for RANS equations
778  if (equations == ransequations) then
779  select case (turbmodel)
780  case (spalartallmaras)
781  call saresscale_b
782  call saviscous_b
783  !call unsteadyTurbTerm_b(1_intType, 1_intType, itu1-1, qq)
784  call turbadvection_b(1_inttype, 1_inttype, itu1 - 1, qq)
785  ! turbAdvection_b zeros the faceid. This should be ok since
786  ! it presumably is the last call in master using faceid and
787  ! therefore should be the first call in master_b to use faceid
788  call sasource_b
789  end select
790 
791  !call unsteadyTurbSpectral_block_b(itu1, itu1, nn, sps)
792  end if
793 
794  call timestep_block_b(.false.)
795 
796  ! Just to be safe, zero the pLocald value...should not matter
797  dummyreald = zero
798  do iregion = 1, nactuatorregions
799  call sourceterms_block_b(nn, .true., iregion, dummyreal, dummyreald)
800  end do
801 
802  call initres_block_b(1, nw, nn, sps)
803  end do domainloop1
804  end do spsloop1
805 
806  ! All reduce the global AZ volume seeds and store them in the
807  ! local AZ volume seeds.
808  ! This is the inverse of the all reduce that is done in forward
809  ! mode to sum the local seeds into the global seeds.
810  do iregion = 1, nactuatorregions
811  call mpi_allreduce(actuatorregionsd(iregion)%volume, actuatorregionsd(iregion)%volLocal, 1, &
812  adflow_real, mpi_sum, adflow_comm_world, ierr)
813  call echk(ierr, __file__, __line__)
814  end do
815 
816  ! Need to re-apply the BCs. The reason is that BC halos behind
817  ! interpolated cells need to be recomputed with their new
818  ! interpolated values from actual compute cells. Only needed for
819  ! overset.
820  if (oversetpresent) then
821  do sps = 1, ntimeintervalsspectral
822  do nn = 1, ndom
823  call setpointers_b(nn, 1, sps)
824  call applyallbc_block_b(.true.)
825  call applyallbc_block(.true.)
826 
827  if (equations == ransequations) then
828  call applyallturbbcthisblock_b(.true.)
829  call bcturbtreatment_b
830  end if
831  end do
832  end do
833  end if
834 
835  ! Exchange the adjoint values.
836  call whalo2_b(currentlevel, 1_inttype, nw, .true., .true., .true.)
837 
838  spsloop2: do sps = 1, ntimeintervalsspectral
839 
840  ! Get the pointers from the petsc vector for the wall
841  ! surface and it's accumulation. Only necessary for wall
842  ! distance.
843  call vecgetarrayf90(xsurfvec(1, sps), xsurf, ierr)
844  call echk(ierr, __file__, __line__)
845 
846  ! And it's derivative
847  call vecgetarrayf90(xsurfvecd(sps), xsurfd, ierr)
848  call echk(ierr, __file__, __line__)
849 
850  !Zero the accumulation vector on a per-time-spectral instance basis
851  xsurfd = zero
852 
853  domainloop2: do nn = 1, ndom
854  call setpointers_b(nn, 1, sps)
855  call applyallbc_block_b(.true.)
856 
857  ! Run the forward application of the BCs. The reason is that
858  ! the reverse application of the BCs can result in
859  ! inconsisent values in the halos. This has only been
860  ! observed to caluse problems with hot subsonic flow in an
861  ! engine core. This is the same reason we need the applyBCs
862  ! after the _b version above.
863  call applyallbc_block(.true.)
864 
865  if (equations == ransequations) then
866  call applyallturbbcthisblock_b(.true.)
867  call bcturbtreatment_b
868  end if
869  call computeeddyviscosity_b(.false.)
870  call computelamviscosity_b(.false.)
871  call computepressuresimple_b(.false.)
872 
874  call updatewalldistancesquickly_b(nn, 1, sps)
875  end if
876 
877  ! Here we insert the functions related to
878  ! rotational (mesh movement) setup
879  time = timeunsteadyrestart
880  if (equationmode .eq. timespectral) then
881  do mm = 1, nsections
882  time(mm) = time(mm) + (sps - 1) * sections(mm)%timeperiod / real(&
883  & ntimeintervalsspectral, realtype)
884  end do
885  end if
886 
887  call slipvelocitiesfinelevel_block_b(useoldcoor, time, sps, nn)
888  call normalvelocities_block_b(sps)
889  call gridvelocitiesfinelevel_block_b(useoldcoor, time, sps, nn)
890 
891  call boundarynormals_b
892  do iregion = 1, nactuatorregions
893  call computeactuatorregionvolume_b(nn, iregion)
894  end do
895  call metric_block_b
896  call volume_block_b
897 
898  end do domainloop2
899 
900  ! Restore the petsc pointers.
901  call vecgetarrayf90(xsurfvec(1, sps), xsurf, ierr)
902  call echk(ierr, __file__, __line__)
903 
904  ! And it's derivative
905  call vecgetarrayf90(xsurfvecd(sps), xsurfd, ierr)
906  call echk(ierr, __file__, __line__)
907 
908  ! Now accumulate the xsurfd accumulation by using the wall scatter
909  ! in reverse.
911 
912  call vecscatterbegin(wallscatter(1, sps), xsurfvecd(sps), x_like, add_values, scatter_reverse, ierr)
913  call echk(ierr, __file__, __line__)
914 
915  call vecscatterend(wallscatter(1, sps), xsurfvecd(sps), x_like, add_values, scatter_reverse, ierr)
916  call echk(ierr, __file__, __line__)
917  end if
918  end do spsloop2
919 
920  ! Zero out the local volume seeds of the actuator zone
921  do iregion = 1, nactuatorregions
922  actuatorregionsd(iregion)%volLocal = zero
923  end do
924 
925  if (present(bcdatanames)) then
926  allocate (bcdatavaluesdlocal(size(bcdatavaluesd)))
927  bcdatavaluesdlocal = zero
928  call setbcdatafinegrid_b(.true.)
929  do sps = 1, ntimeintervalsspectral
930  call setbcdata_b(bcdatanames, bcdatavalues, bcdatavaluesdlocal, bcdatafamlists, &
931  sps, size(bcdatavalues), size(bcdatafamlists, 2))
932  end do
933  ! Reverse seeds need to accumulated across all processors:
934  call mpi_allreduce(bcdatavaluesdlocal, bcdatavaluesd, size(bcdatavaluesd), adflow_real, &
935  mpi_sum, adflow_comm_world, ierr)
936  deallocate (bcdatavaluesdlocal)
937  end if
938  call referencestate_b
940 
941  do sps = 1, ntimeintervalsspectral
942  ! Update overset connectivity if necessary
943  if (oversetpresent) then
944  if (oversetupdatemode == updatefast) then
945  call updateoversetconnectivity_b(1_inttype, sps)
946  else if (oversetupdatemode == updatefull) then
947  if (myid == 0) then
948  print *, 'Full overset update derivatives not implemented'
949  end if
950  end if
951  end if
952  end do
953  ! Now the adjoint of the coordinate exhcange
954  call exchangecoor_b(1)
955  do nn = 1, ndom
956  do sps = 1, ntimeintervalsspectral
957  call setpointers_b(nn, 1, sps)
958  call xhalo_block_b()
959  end do
960  end do
961 
962  call vecresetarray(x_like, ierr)
963  call echk(ierr, __file__, __line__)
964 
965  ! =========================================
966  ! End of reverse pass
967  ! =========================================
968 
969  ! Store the extra derivatives
970  extralocalbar(ialpha) = alphad
971  extralocalbar(ibeta) = betad
972  extralocalbar(imach) = machd + machcoefd
973  extralocalbar(imachgrid) = machgridd
974  extralocalbar(ipressure) = pinfdimd
975  extralocalbar(itemperature) = tinfdimd
976  extralocalbar(idensity) = rhoinfdimd
977  extralocalbar(ipointrefx) = pointrefd(1)
978  extralocalbar(ipointrefy) = pointrefd(2)
979  extralocalbar(ipointrefz) = pointrefd(3)
980 
981  ! Finally put the output seeds into the provided vectors.
982  ii = 0
983  jj = 0
984  do nn = 1, ndom
985  do sps = 1, ntimeintervalsspectral
986 
987  ! Set pointers and derivative pointers
988  call setpointers_b(nn, 1, sps)
989  ! Set the wbar accumulation
990  do k = 2, kl
991  do j = 2, jl
992  do i = 2, il
993  do l = 1, nstate
994  ii = ii + 1
995  wbar(ii) = wd(i, j, k, l)
996  end do
997  end do
998  end do
999  end do
1000 
1001  ! Set the xvbar accumulation. Note that this must be a sum,
1002  ! becuase we may already have wall distance accumulation
1003  ! from the wallScatter directly into xbar (through x_like).
1004  do k = 1, kl
1005  do j = 1, jl
1006  do i = 1, il
1007  do l = 1, 3
1008  jj = jj + 1
1009  xbar(jj) = xbar(jj) + xd(i, j, k, l)
1010  end do
1011  end do
1012  end do
1013  end do
1014  end do
1015  end do
1016 
1017  ! Finally get the full contribution of the extra variables by
1018  ! summing all local contributions.
1019  extrabar = zero
1020  call mpi_allreduce(extralocalbar, extrabar, size(extrabar), adflow_real, &
1021  mpi_sum, adflow_comm_world, ierr)
1022  call echk(ierr, __file__, __line__)
1023 
1024  end subroutine master_b
1025 
1026  subroutine master_state_b(wbar, dwBar, nState)
1027 
1028  ! This is specialized form of master that *ONLY* computes drdw
1029  ! products. It uses a few specialzed routines that are
1030  ! differentiated without including spatial dependencies. This
1031  ! results in slightly faster code. This specialization is
1032  ! justififed since this routine is needed for the transpose
1033  ! matrix-vector products in solving the adjoint system and thus
1034  ! this routine is called several orders of magniutde more than
1035  ! master_b. This routine has to be fast!
1036 
1037  use constants
1038  use iteration, only: currentlevel
1039  use flowvarrefstate, only: nw, viscous
1040  use blockpointers, only: ndom, il, jl, kl, wd, dwd, iblank
1044  use utils, only: setpointers_d
1045  use haloexchange, only: whalo2_b
1052  use bcextra_b, only: applyallbc_block_b
1053 
1062  use oversetdata, only: oversetpresent
1063  use bcroutines, only: applyallbc_block
1065  implicit none
1066 
1067  ! Input variables:
1068  real(kind=realtype), intent(in), dimension(:) :: dwbar
1069  integer(kind=intType), intent(in) :: nState
1070 
1071  ! Input Arguments:
1072  real(kind=realtype), intent(out), dimension(:) :: wbar
1073 
1074  ! Working Variables
1075  integer(kind=intType) :: ierr, nn, sps, mm, i, j, k, l, fSize, ii, jj, level, iRegion
1076  real(kind=realtype) :: dummyreal
1077 
1078  ! Set the residual seeds.
1079  ii = 0
1080  do nn = 1, ndom
1081  do sps = 1, ntimeintervalsspectral
1082  call setpointers_d(nn, 1, sps)
1083  do k = 2, kl
1084  do j = 2, jl
1085  do i = 2, il
1086  do l = 1, nstate
1087  ii = ii + 1
1088  dwd(i, j, k, l) = dwbar(ii)
1089  end do
1090  end do
1091  end do
1092  end do
1093  end do
1094  end do
1095 
1096  ! ============================================
1097  ! reverse the order of calls from master
1098  ! ============================================
1099 
1100  spsloop1: do sps = 1, ntimeintervalsspectral
1101  domainloop1: do nn = 1, ndom
1102  call setpointers_d(nn, 1, sps)
1103 
1104  ! Now we start running back through the main residual code:
1105  call resscale_b
1106  call sumdwandfw_b
1107 
1108  ! if (lowSpeedPreconditioner) then
1109  ! call applyLowSpeedPreconditioner_b
1110  ! end if
1111 
1112  ! Note that master_b does not include the approximation codes
1113  ! as those are never needed in reverse.
1114  if (viscous) then
1115  call viscousflux_fast_b
1118  end if
1119 
1120  select case (spacediscr)
1121  case (dissscalar)
1123  case (dissmatrix)
1125  case (upwind)
1126  call inviscidupwindflux_fast_b(.true.)
1127  end select
1128 
1130 
1131  ! Compute turbulence residual for RANS equations
1132  if (equations == ransequations) then
1133  select case (turbmodel)
1134  case (spalartallmaras)
1135  call saresscale_fast_b
1136  call saviscous_fast_b
1137  !call unsteadyTurbTerm_b(1_intType, 1_intType, itu1-1, qq)
1138  call turbadvection_fast_b(1_inttype, 1_inttype, itu1 - 1, qq)
1139  call sasource_fast_b
1140  end select
1141 
1142  !call unsteadyTurbSpectral_block_b(itu1, itu1, nn, sps)
1143  end if
1144 
1145  call timestep_block_fast_b(.false.)
1146  do iregion = 1, nactuatorregions
1147  call sourceterms_block_fast_b(nn, .true., iregion, dummyreal)
1148  end do
1149 
1150  call initres_block_fast_b(1, nw, nn, sps)
1151  end do domainloop1
1152  end do spsloop1
1153 
1154  ! Need to re-apply the BCs. The reason is that BC halos behind
1155  ! interpolated cells need to be recomputed with their new
1156  ! interpolated values from actual compute cells. Only needed for
1157  ! overset.
1158  if (oversetpresent) then
1159  do sps = 1, ntimeintervalsspectral
1160  do nn = 1, ndom
1161  call setpointers_d(nn, 1, sps)
1162  call applyallbc_block_b(.true.)
1163  call applyallbc_block(.true.)
1164 
1165  if (equations == ransequations) then
1166  call applyallturbbcthisblock_b(.true.)
1167  call bcturbtreatment_b
1168  end if
1169  end do
1170  end do
1171  end if
1172 
1173  ! Exchange the adjoint values.
1174  call whalo2_b(currentlevel, 1_inttype, nw, .true., .true., .true.)
1175 
1176  spsloop2: do sps = 1, ntimeintervalsspectral
1177  domainloop2: do nn = 1, ndom
1178  call setpointers_d(nn, 1, sps)
1179 
1180  call applyallbc_block_b(.true.)
1181  call applyallbc_block(.true.)
1182 
1183  if (equations == ransequations) then
1184  call applyallturbbcthisblock_b(.true.)
1185  call bcturbtreatment_b
1186  end if
1187 
1188  call computeeddyviscosity_b(.false.)
1189  call computelamviscosity_b(.false.)
1190  call computepressuresimple_b(.false.)
1191 
1192  end do domainloop2
1193  end do spsloop2
1194 
1195  ! Finally put the output seeds into wbar
1196  ii = 0
1197  do nn = 1, ndom
1198  do sps = 1, ntimeintervalsspectral
1199  call setpointers_d(nn, 1, sps)
1200  do k = 2, kl
1201  do j = 2, jl
1202  do i = 2, il
1203  do l = 1, nstate
1204  ii = ii + 1
1205  wbar(ii) = wd(i, j, k, l)!*max(real(iblank(i,j,k)), zero)
1206  end do
1207  end do
1208  end do
1209  end do
1210  end do
1211  end do
1212  end subroutine master_state_b
1213 #endif
1214  subroutine block_res_state(nn, sps, useFlowRes, useTurbRes)
1215 
1216  ! This is a special state-only routine used only for finite
1217  ! differce computations of the jacobian
1218  use constants
1219  use bcroutines, only: applyallbc_block
1220  use inputadjoint, only: viscpc
1221  use blockpointers, only: ndom, wd, xd, dw, il, jl, kl
1222  use flowvarrefstate, only: viscous
1223  use inputphysics, only: equations, turbmodel
1225  use utils, only: setpointers, echk
1226  use residuals, only: sourceterms_block
1227  use turbutils, only: computeeddyviscosity
1229  use adjointextra, only: sumdwandfw, resscale
1234  implicit none
1235 
1236  ! Input Arguments:
1237  integer(kind=intType), intent(in) :: nn, sps
1238  logical, optional, intent(in) :: useFlowRes, useTurbRes
1239 
1240  ! Working Variables
1241  integer(kind=intType) :: ierr, mm, i, j, k, l, fSize, ii, jj, iRegion
1242  real(kind=realtype) :: plocal
1243  logical :: dissApprox, viscApprox, updateIntermed, flowRes, turbRes, storeWall
1244 
1245  flowres = .true.
1246  if (present(useflowres)) then
1247  flowres = useflowres
1248  end if
1249 
1250  turbres = .true.
1251  if (present(useturbres)) then
1252  turbres = useturbres
1253  end if
1254 
1255  call computepressuresimple(.true.)
1256  call computelamviscosity(.true.)
1257  call computeeddyviscosity(.true.)
1258 
1259  ! Make sure to call the turb BC's first incase we need to
1260  ! correct for K
1261  if (equations == ransequations) then
1262  call bcturbtreatment
1263  call applyallturbbcthisblock(.true.)
1264  end if
1265 
1266  call applyallbc_block(.true.)
1267 
1268  ! Set the flags:
1269  dissapprox = lumpeddiss
1270  viscapprox = lumpeddiss
1271  updateintermed = .false.
1272  storewall = .true.
1273  blockettes: if (useblockettes) then
1274  call blocketterescore(dissapprox, viscapprox, updateintermed, flowres, turbres, storewall)
1275  else
1276  call blockrescore(dissapprox, viscapprox, updateintermed, flowres, turbres, storewall, nn, sps)
1277  end if blockettes
1278  do iregion = 1, nactuatorregions
1279  call sourceterms_block(nn, .true., iregion, plocal)
1280  end do
1281  call resscale
1282 
1283  end subroutine block_res_state
1284 #ifndef USE_COMPLEX
1285  subroutine block_res_state_d(nn, sps)
1286 
1287  ! This is a special state-only forward mode linearization
1288  ! computation used to assemble the jacobian.
1289  use constants
1290  use bcextra_d, only: applyallbc_block_d
1291  use inputadjoint, only: viscpc
1292  use blockpointers, only: ndom, wd, xd, dw, dwd
1293  use flowvarrefstate, only: viscous
1294  use inputphysics, only: equations, turbmodel
1297  use utils, only: setpointers_d, echk
1298  use sa_d, only: sasource_d, saviscous_d, saresscale_d, qq
1305  use solverutils_d, only: timestep_block_d
1308  use residuals_d, only: sourceterms_block_d
1310  implicit none
1311 
1312  ! Input Arguments:
1313  integer(kind=intType), intent(in) :: nn, sps
1314 
1315  ! Working Variables
1316  integer(kind=intType) :: ierr, mm, i, j, k, l, fSize, ii, jj, iRegion
1317  real(kind=realtype) :: dummyreal, dummyreald
1318 
1319  call computepressuresimple_d(.true.)
1320  call computelamviscosity_d(.true.)
1321  call computeeddyviscosity_d(.true.)
1322 
1323  ! Make sure to call the turb BC's first incase we need to
1324  ! correct for K
1325  if (equations == ransequations) then
1326  call bcturbtreatment_d
1327  call applyallturbbcthisblock_d(.true.)
1328  end if
1329 
1330  call applyallbc_block_d(.true.)
1331  call timestep_block_d(.false.)
1332 
1333  dw = zero ! These two lines are init_res
1334  dwd = zero
1335 
1336  ! Compute any source terms
1337  do iregion = 1, nactuatorregions
1338  call sourceterms_block_d(nn, .true., iregion, dummyreal, dummyreald)
1339  end do
1340 
1341  !Compute turbulence residual for RANS equations
1342  if (equations == ransequations) then
1343  !call unsteadyTurbSpectral_block(itu1, itu1, nn, sps)
1344 
1345  select case (turbmodel)
1346  case (spalartallmaras)
1347  call sasource_d
1348  call turbadvection_d(1_inttype, 1_inttype, itu1 - 1, qq)
1349  !!call unsteadyTurbTerm_d(1_intType, 1_intType, itu1-1, qq)
1350  call saviscous_d
1351  call saresscale_d
1352  end select
1353  end if
1354 
1355  ! compute the mean flow residual
1357 
1358  if (lumpeddiss) then
1359  select case (spacediscr)
1360  case (dissscalar)
1362  case (dissmatrix)
1364  case (upwind)
1365  call inviscidupwindflux_d(.true.)
1366  end select
1367  else
1368  select case (spacediscr)
1369  case (dissscalar)
1371  case (dissmatrix)
1373  case (upwind)
1374  call inviscidupwindflux_d(.true.)
1375  end select
1376  end if
1377 
1378  if (viscous) then
1380  if (.not. lumpeddiss .or. viscpc) then
1381  call allnodalgradients_d
1382  call viscousflux_d
1383  else
1384  call viscousfluxapprox_d
1385  end if
1386  end if
1387 
1388  ! if (lowSpeedPreconditioner) then
1389  ! call applyLowSpeedPreconditioner_d
1390  ! end if
1391  call sumdwandfw_d
1392  call resscale_d
1393  end subroutine block_res_state_d
1394 #endif
1395 
1396 end module masterroutines
subroutine getforces(forces, npts, sps)
Definition: getForces.F90:3
subroutine getforces_b(forcesd, npts, sps)
Definition: getForces.F90:238
subroutine getforces_d(forces, forcesd, npts, sps)
Definition: getForces.F90:125
subroutine computeactuatorregionvolume_b(nn, iregion)
subroutine computeactuatorregionvolume_d(nn, iregion)
subroutine computeactuatorregionvolume(nn, iRegion)
type(actuatorregiontype), dimension(nactuatorregionsmax), target actuatorregions
type(actuatorregiontype), dimension(nactuatorregionsmax), target actuatorregionsd
integer(kind=inttype) nactuatorregions
subroutine resscale_b()
subroutine boundarynormals_b()
subroutine metric_block_b()
subroutine xhalo_block_b()
subroutine sumdwandfw_b()
subroutine volume_block_b()
subroutine volume_block_d()
subroutine sumdwandfw_d()
subroutine xhalo_block_d()
subroutine metric_block_d()
subroutine boundarynormals_d()
subroutine resscale_d()
subroutine resscale
subroutine volume_block
Definition: adjointExtra.F90:6
subroutine xhalo_block
subroutine sumdwandfw
subroutine boundarynormals
subroutine metric_block
integer(kind=inttype), parameter imach
Definition: ADjointVars.F90:10
integer(kind=inttype), parameter ipointrefy
Definition: ADjointVars.F90:19
integer(kind=inttype), parameter imachgrid
Definition: ADjointVars.F90:11
integer(kind=inttype), parameter ipointrefz
Definition: ADjointVars.F90:20
integer(kind=inttype), parameter ipointrefx
Definition: ADjointVars.F90:18
integer(kind=inttype), parameter ibeta
Definition: ADjointVars.F90:9
integer(kind=inttype), parameter ipressure
Definition: ADjointVars.F90:21
integer(kind=inttype), parameter itemperature
Definition: ADjointVars.F90:22
integer(kind=inttype), parameter ialpha
Definition: ADjointVars.F90:8
integer(kind=inttype), parameter idensity
Definition: ADjointVars.F90:23
Definition: BCData.F90:1
subroutine setbcdata_d(bcDataNamesIn, bcDataIn, bcDataInd, famLists, sps, nVar, nFamMax)
Definition: BCData.F90:1503
subroutine setbcdatafinegrid_d(initializationPart)
Definition: BCData.F90:2894
subroutine setbcdata_b(bcDataNamesIn, bcDataIn, bcDataInd, famLists, sps, nVar, nFamMax)
Definition: BCData.F90:1605
subroutine setbcdatafinegrid_b(initializationPart)
Definition: BCData.F90:2991
subroutine setbcdatafinegrid(initializationPart)
Definition: BCData.F90:2623
subroutine setbcdata(bcDataNamesIn, bcDataIn, famLists, sps, nVar, nFamMax)
Definition: BCData.F90:1405
subroutine applyallbc_block_b(secondHalo)
Definition: BCExtra_b.F90:9
subroutine applyallbc_block_d(secondHalo)
Definition: BCExtra_d.F90:11
subroutine applyallbc_block(secondHalo)
Definition: BCRoutines.F90:58
subroutine blocketterescore(dissApprox, viscApprox, updateIntermed, flowRes, turbRes, storeWall)
Definition: blockette.F90:300
subroutine blockrescore(dissApprox, viscApprox, updateIntermed, flowRes, turbRes, storeWall, nn, sps)
Definition: blockette.F90:756
integer(kind=inttype) jl
real(kind=realtype), dimension(:, :, :, :), pointer wd
integer(kind=inttype) nviscbocos
integer(kind=inttype), dimension(:, :, :), pointer iblank
integer(kind=inttype) nbocos
real(kind=realtype), dimension(:, :, :, :), pointer dw
real(kind=realtype), dimension(:, :, :, :), pointer xd
real(kind=realtype), dimension(:, :, :, :), pointer dwd
integer(kind=inttype) kl
integer(kind=inttype) il
integer adflow_comm_world
integer(kind=inttype), parameter spalartallmaras
Definition: constants.F90:128
real(kind=realtype), parameter zero
Definition: constants.F90:71
integer, parameter itu1
Definition: constants.F90:40
integer(kind=inttype), parameter upwind
Definition: constants.F90:149
integer(kind=inttype), parameter timespectral
Definition: constants.F90:115
integer(kind=inttype), parameter dissmatrix
Definition: constants.F90:149
integer(kind=inttype), parameter updatefull
Definition: constants.F90:240
integer(kind=inttype), parameter updatefast
Definition: constants.F90:240
integer(kind=inttype), parameter dissscalar
Definition: constants.F90:149
integer(kind=inttype), parameter ransequations
Definition: constants.F90:110
integer(kind=inttype) isize1ofdrfviscsubface
Definition: diffSizes.f90:10
integer(kind=inttype) isize1ofdrfbcdata
Definition: diffSizes.f90:8
subroutine computelamviscosity_b(includehalos)
subroutine computepressuresimple_b(includehalos)
subroutine adjustinflowangle_b()
subroutine computespeedofsoundsquared_b()
subroutine allnodalgradients_b()
subroutine adjustinflowangle_d()
subroutine allnodalgradients_d()
subroutine computespeedofsoundsquared_d()
subroutine computelamviscosity_d(includehalos)
subroutine computepressuresimple_d(includehalos)
subroutine allnodalgradients_fast_b()
subroutine allnodalgradients
Definition: flowUtils.F90:1677
subroutine fixallnodalgradientsfromad
Definition: flowUtils.F90:2037
subroutine computespeedofsoundsquared
Definition: flowUtils.F90:489
subroutine computepressuresimple(includeHalos)
Definition: flowUtils.F90:868
subroutine computelamviscosity(includeHalos)
Definition: flowUtils.F90:1202
subroutine adjustinflowangle()
Definition: flowUtils.F90:1326
real(kind=realtype) pinfdimd
real(kind=realtype) tinfdimd
integer(kind=inttype) nwf
real(kind=realtype) rhoinfdimd
integer(kind=inttype) nw
real(kind=realtype) timerefd
subroutine invisciddissfluxmatrix_b()
Definition: fluxes_b.f90:741
subroutine inviscidcentralflux_b()
Definition: fluxes_b.f90:19
subroutine inviscidupwindflux_b(finegrid)
Definition: fluxes_b.f90:4489
subroutine viscousflux_b()
Definition: fluxes_b.f90:8339
subroutine invisciddissfluxscalar_b()
Definition: fluxes_b.f90:3446
subroutine viscousfluxapprox_d()
Definition: fluxes_d.f90:8699
subroutine invisciddissfluxmatrixapprox_d()
Definition: fluxes_d.f90:10805
subroutine viscousflux_d()
Definition: fluxes_d.f90:6583
subroutine invisciddissfluxscalarapprox_d()
Definition: fluxes_d.f90:9566
subroutine inviscidupwindflux_d(finegrid)
Definition: fluxes_d.f90:3520
subroutine invisciddissfluxscalar_d()
Definition: fluxes_d.f90:2602
subroutine invisciddissfluxmatrix_d()
Definition: fluxes_d.f90:764
subroutine inviscidcentralflux_d()
Definition: fluxes_d.f90:18
subroutine invisciddissfluxmatrix_fast_b()
subroutine viscousflux_fast_b()
subroutine inviscidcentralflux_fast_b()
subroutine inviscidupwindflux_fast_b(finegrid)
subroutine invisciddissfluxscalar_fast_b()
Definition: fluxes.F90:1
subroutine invisciddissfluxmatrixapprox
Definition: fluxes.F90:4345
subroutine invisciddissfluxscalar
Definition: fluxes.F90:1050
subroutine invisciddissfluxmatrix
Definition: fluxes.F90:404
subroutine inviscidcentralflux
Definition: fluxes.F90:5
subroutine viscousfluxapprox
Definition: fluxes.F90:3488
subroutine inviscidupwindflux(fineGrid)
Definition: fluxes.F90:1439
subroutine viscousflux
Definition: fluxes.F90:2535
subroutine invisciddissfluxscalarapprox
Definition: fluxes.F90:3862
subroutine whalo2(level, start, end, commPressure, commGamma, commViscous)
subroutine whalo2_d(level, start, end, commPressure, commGamma, commViscous)
subroutine exchangecoor_d(level)
subroutine whalo2_b(level, start, end, commPressure, commGamma, commViscous)
subroutine exchangecoor(level)
subroutine exchangecoor_b(level)
subroutine referencestate_b()
subroutine referencestate_d()
subroutine referencestate
logical viscpc
Definition: inputParam.F90:793
logical frozenturbulence
Definition: inputParam.F90:793
logical useapproxwalldistance
Definition: inputParam.F90:94
logical lowspeedpreconditioner
Definition: inputParam.F90:96
integer(kind=inttype) spacediscr
Definition: inputParam.F90:72
integer(kind=inttype) oversetupdatemode
Definition: inputParam.F90:887
integer(kind=inttype) equations
Definition: inputParam.F90:583
integer(kind=inttype) equationmode
Definition: inputParam.F90:583
real(kind=realtype) betad
Definition: inputParam.F90:612
real(kind=realtype), dimension(3) pointrefd
Definition: inputParam.F90:616
logical walldistanceneeded
Definition: inputParam.F90:589
integer(kind=inttype) turbprod
Definition: inputParam.F90:584
real(kind=realtype) machd
Definition: inputParam.F90:618
real(kind=realtype) alphad
Definition: inputParam.F90:612
integer(kind=inttype) turbmodel
Definition: inputParam.F90:584
real(kind=realtype) machgridd
Definition: inputParam.F90:618
real(kind=realtype) rgasdimd
Definition: inputParam.F90:622
real(kind=realtype) machcoefd
Definition: inputParam.F90:618
integer(kind=inttype) ntimeintervalsspectral
Definition: inputParam.F90:645
integer(kind=inttype) currentlevel
Definition: iteration.f90:18
subroutine block_res_state(nn, sps, useFlowRes, useTurbRes)
subroutine master_d(wdot, xdot, forcesDot, dwDot, famLists, funcValues, funcValuesd, bcDataNames, bcDataValues, bcDataValuesd, bcDataFamLists)
subroutine block_res_state_d(nn, sps)
subroutine master(useSpatial, famLists, funcValues, forces, bcDataNames, bcDataValues, bcDataFamLists)
subroutine master_b(wbar, xbar, extraBar, forcesBar, dwBar, nState, famLists, funcValues, funcValuesd, bcDataNames, bcDataValues, bcDataValuesd, bcDataFamLists)
subroutine master_state_b(wbar, dwBar, nState)
real(kind=realtype) timeunsteadyrestart
Definition: monitor.f90:98
subroutine updateoversetconnectivity(level, sps)
subroutine updateoversetconnectivity_b(level, sps)
subroutine updateoversetconnectivity_d(level, sps)
logical oversetpresent
Definition: overset.F90:373
subroutine initres_block_b(varstart, varend, nn, sps)
subroutine sourceterms_block_b(nn, res, iregion, plocal, plocald)
subroutine initres_block_d(varstart, varend, nn, sps)
subroutine sourceterms_block_d(nn, res, iregion, plocal, plocald)
subroutine initres_block_fast_b(varstart, varend, nn, sps)
subroutine sourceterms_block_fast_b(nn, res, iregion, plocal)
subroutine sourceterms_block(nn, res, iRegion, pLocal)
Definition: residuals.F90:349
subroutine initres_block(varStart, varEnd, nn, sps)
Definition: residuals.F90:428
Definition: sa_b.f90:7
real(kind=realtype), dimension(:, :, :), allocatable qq
Definition: sa_b.f90:11
subroutine saviscous_b()
Definition: sa_b.f90:700
subroutine saresscale_b()
Definition: sa_b.f90:1411
subroutine sasource_b()
Definition: sa_b.f90:28
Definition: sa_d.f90:7
subroutine saresscale_d()
Definition: sa_d.f90:1304
real(kind=realtype), dimension(:, :, :), allocatable qq
Definition: sa_d.f90:11
subroutine sasource_d()
Definition: sa_d.f90:26
subroutine saviscous_d()
Definition: sa_d.f90:678
real(kind=realtype), dimension(:, :, :), allocatable qq
Definition: sa_fast_b.f90:11
subroutine saresscale_fast_b()
Definition: sa_fast_b.f90:1233
subroutine sasource_fast_b()
Definition: sa_fast_b.f90:23
subroutine saviscous_fast_b()
Definition: sa_fast_b.f90:629
Definition: sa.F90:5
subroutine sasource
Definition: sa.F90:89
subroutine saresscale
Definition: sa.F90:676
subroutine saviscous
Definition: sa.F90:345
real(kind=realtype), dimension(:, :, :), allocatable qq
Definition: sa.F90:9
integer(kind=inttype) nsections
Definition: section.f90:44
type(sectiontype), dimension(:), allocatable sections
Definition: section.f90:46
subroutine normalvelocities_block_b(sps)
subroutine slipvelocitiesfinelevel_block_b(useoldcoor, t, sps, nn)
subroutine gridvelocitiesfinelevel_block_b(useoldcoor, t, sps, nn)
subroutine timestep_block_b(onlyradii)
subroutine normalvelocities_block_d(sps)
subroutine slipvelocitiesfinelevel_block_d(useoldcoor, t, sps, nn)
subroutine timestep_block_d(onlyradii)
subroutine gridvelocitiesfinelevel_block_d(useoldcoor, t, sps, nn)
subroutine timestep_block_fast_b(onlyradii)
subroutine timestep_block(onlyRadii)
Definition: solverUtils.F90:44
subroutine getsolution_b(famLists, funcValues, funcValuesd)
subroutine getsolution_d(famLists, funcValues, funcValuesd)
subroutine getsolution(famLists, funcValues, globalValues)
subroutine applyallturbbcthisblock_b(secondhalo)
subroutine bcturbtreatment_b()
subroutine bcturbtreatment_d()
subroutine applyallturbbcthisblock_d(secondhalo)
subroutine bcturbtreatment
subroutine applyallturbbcthisblock(secondHalo)
subroutine computeeddyviscosity_b(includehalos)
subroutine turbadvection_b(madv, nadv, offset, qq)
subroutine turbadvection_d(madv, nadv, offset, qq)
subroutine computeeddyviscosity_d(includehalos)
subroutine turbadvection_fast_b(madv, nadv, offset, qq)
subroutine computeeddyviscosity(includeHalos)
Definition: turbUtils.F90:581
subroutine turbadvection(mAdv, nAdv, offset, qq)
Definition: turbUtils.F90:826
Definition: utils.F90:1
logical function iswalltype(bType)
Definition: utils.F90:1705
subroutine setpointers_d(nn, level, sps)
Definition: utils.F90:3564
subroutine echk(errorcode, file, line)
Definition: utils.F90:5722
subroutine setpointers_b(nn, level, sps)
Definition: utils.F90:3553
subroutine setpointers(nn, mm, ll)
Definition: utils.F90:3237
subroutine updatewalldistancesquickly_b(nn, level, sps)
subroutine updatewalldistancesquickly_d(nn, level, sps)
subroutine updatewalldistancesquickly(nn, level, sps)
real(kind=realtype), dimension(:), pointer xsurf
real(kind=realtype), dimension(:), pointer xsurfd