ADflow  v1.0
ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
outputMod.F90
Go to the documentation of this file.
1 module outputmod
2  !
3  ! This local module contains variables used when writing the
4  ! grid and solution files.
5  !
6  use constants, only: inttype, maxstringlen
7  use su_cgns, only: cgsize_t
8  implicit none
9 
10  ! nblocksCGNSblock(0:cgnsNDom): The number of local blocks per
11  ! cgns block in cumulative storage
12  ! format.
13  ! blocksCGNSblock(nDom): The corresponding local block ID's.
14 
15  integer(kind=intType), dimension(:), allocatable :: nblockscgnsblock
16  integer(kind=intType), dimension(:), allocatable :: blockscgnsblock
17 
18  ! nDomPerProc(0:nProc): The number of flow domains for each
19  ! processor in cumulative storage format.
20  ! IDsBegOrAllDoms(4,..): The CGNS block numbers and the beginning
21  ! indices for all of the flow domains on
22  ! every processor.
23 
24  integer(kind=intType), dimension(:), allocatable :: ndomperproc
25  integer(kind=intType), dimension(:, :), allocatable :: idsbegoralldoms
26 
27  ! nGridsToWrite: Number of grid files to write.
28  ! nVolSolToWrite: Number of volume solution files to write.
29  ! For CGNS nVolSolToWrite == nGridsToWrite.
30  ! nSurfSolToWrite: Number of surface solution files to write.
31 
32  integer(kind=intType) :: ngridstowrite
33  integer(kind=intType) :: nvolsoltowrite
34  integer(kind=intType) :: nsurfsoltowrite
35 
36  ! gridFileNames(nGridsToWrite): Names of the grid files to
37  ! write.
38  ! volSolFileNames(nVolSolToWrite): Names of the volume solution
39  ! files to write.
40  ! surfSolFileNames(nSurfSolToWrite): Names of the surface solution
41  ! files to write.
42  ! fileIDs(nFilesToWrite): Identifiers for the files to
43  ! write. As the grids, volume
44  ! solution and surface solution
45  ! files are written one after
46  ! the other, only one set is
47  ! needed.
48  ! cgnsBases(nFilesToWrite): The CGNS base IDs of the
49  ! files.
50 
51  character(len=maxStringLen), dimension(:), allocatable :: &
53 
54  integer, dimension(:), allocatable :: fileids
55  integer, dimension(:), allocatable :: cgnsbases
56  integer, dimension(:), allocatable :: cgnsisosurfbases
57  integer, dimension(:), allocatable :: cgnsliftdistbases
58 
59  ! useLinksInCGNS: Whether or not to use links in CGNS between
60  ! the grid and volume solution files. If not,
61  ! the grid and solution are written in the
62  ! same file.
63 
64  logical :: uselinksincgns
65 
66 contains
67 
68  subroutine numberofisosurfvariables(nIsoSolVar)
69  !
70  ! numberOfVolSolVariables determines the number of variables
71  ! to be written on the isosurface. These are similar to the
72  ! volume variables.
73  !
74  use flowvarrefstate
75  use inputphysics
76  use extraoutput
77  implicit none
78  !
79  ! Subroutine arguments.
80  !
81  integer(kind=intType), intent(out) :: nIsoSolVar
82 
83  nisosolvar = 0
84 
85  ! Check whether or not some additional solution variables must
86  ! be written.
87  if (isowriterho) nisosolvar = nisosolvar + 1
88  if (isowritevx) nisosolvar = nisosolvar + 1
89  if (isowritevy) nisosolvar = nisosolvar + 1
90  if (isowritevz) nisosolvar = nisosolvar + 1
91  if (isowritep) nisosolvar = nisosolvar + 1
92  if (isowriteturb) nisosolvar = nisosolvar + (nw - nwf)
93  if (isowritemx) nisosolvar = nisosolvar + 1
94  if (isowritemy) nisosolvar = nisosolvar + 1
95  if (isowritemz) nisosolvar = nisosolvar + 1
96  if (isowritervx) nisosolvar = nisosolvar + 1
97  if (isowritervy) nisosolvar = nisosolvar + 1
98  if (isowritervz) nisosolvar = nisosolvar + 1
99  if (isowriterhoe) nisosolvar = nisosolvar + 1
100  if (isowritetemp) nisosolvar = nisosolvar + 1
101  if (isowritecp) nisosolvar = nisosolvar + 1
102  if (isowritemach) nisosolvar = nisosolvar + 1
103  if (isowritermach) nisosolvar = nisosolvar + 1
104  if (isowritemachturb) nisosolvar = nisosolvar + 1
105  if (isowriteeddyvis) nisosolvar = nisosolvar + 1
106  if (isowriteratioeddyvis) nisosolvar = nisosolvar + 1
107  if (isowritedist) nisosolvar = nisosolvar + 1
108  if (isowritevort) nisosolvar = nisosolvar + 1
109  if (isowritevortx) nisosolvar = nisosolvar + 1
110  if (isowritevorty) nisosolvar = nisosolvar + 1
111  if (isowritevortz) nisosolvar = nisosolvar + 1
112  if (isowriteptotloss) nisosolvar = nisosolvar + 1
113  if (isowriteshock) nisosolvar = nisosolvar + 1
114  if (isowritefilteredshock) nisosolvar = nisosolvar + 1
115 
116  ! Check the discrete variables.
117 
118  if (isowriteresrho) nisosolvar = nisosolvar + 1
119  if (isowriteresmom) nisosolvar = nisosolvar + 3
120  if (isowriteresrhoe) nisosolvar = nisosolvar + 1
121  if (isowriteresturb) nisosolvar = nisosolvar &
122  + (nw - nwf)
123 
124  if (isowriteblank) nisosolvar = nisosolvar + 1
125 
126  end subroutine numberofisosurfvariables
127 
128  subroutine numberofsurfsolvariables(nSolVar)
129  !
130  ! numberOfSurfSolVariables determines the number of surface
131  ! variables to be written to the surface solution file.
132  !
133  use precision
134  use extraoutput
135  implicit none
136  !
137  ! Subroutine arguments.
138  !
139  integer(kind=intType), intent(out) :: nSolVar
140 
141  ! Initialize the number of solution variables to zero.
142 
143  nsolvar = 0
144 
145  ! Determine the number of surface variables to be written.
146 
147  if (surfwriterho) nsolvar = nsolvar + 1
148  if (surfwritep) nsolvar = nsolvar + 1
149  if (surfwritetemp) nsolvar = nsolvar + 1
150  if (surfwritevx) nsolvar = nsolvar + 1
151  if (surfwritevy) nsolvar = nsolvar + 1
152  if (surfwritevz) nsolvar = nsolvar + 1
153  if (surfwritervx) nsolvar = nsolvar + 1
154  if (surfwritervy) nsolvar = nsolvar + 1
155  if (surfwritervz) nsolvar = nsolvar + 1
156  if (surfwritecp) nsolvar = nsolvar + 1
157  if (surfwriteptotloss) nsolvar = nsolvar + 1
158  if (surfwritemach) nsolvar = nsolvar + 1
159  if (surfwritermach) nsolvar = nsolvar + 1
160  if (surfwritecf) nsolvar = nsolvar + 1
161  if (surfwritech) nsolvar = nsolvar + 1
162  if (surfwriteyplus) nsolvar = nsolvar + 1
163  if (surfwritecfx) nsolvar = nsolvar + 1
164  if (surfwritecfy) nsolvar = nsolvar + 1
165  if (surfwritecfz) nsolvar = nsolvar + 1
166  if (surfwriteforceindragdir) nsolvar = nsolvar + 1
167  if (surfwriteforceinliftdir) nsolvar = nsolvar + 1
168  if (surfwriteblank) nsolvar = nsolvar + 1
169  if (surfwritesepsensor) nsolvar = nsolvar + 1
170  if (surfwritesepsensorks) nsolvar = nsolvar + 1
171  if (surfwritesepsensorksarea) nsolvar = nsolvar + 1
172  if (surfwritecavitation) nsolvar = nsolvar + 1
173  if (surfwritegc) nsolvar = nsolvar + 1
174 
175  end subroutine numberofsurfsolvariables
176 
177  subroutine numberofvolsolvariables(nVolSolvar, nVolDiscrVar)
178  !
179  ! numberOfVolSolVariables determines the number of volume
180  ! variables to be written to the solution file. A distinction is
181  ! made between solution variables and discrete variables. The
182  ! former discribes the actual solution, the latter is additional
183  ! info such as equation residuals.
184  !
185  use flowvarrefstate
186  use inputphysics
187  use extraoutput
188  implicit none
189  !
190  ! Subroutine arguments.
191  !
192  integer(kind=intType), intent(out) :: nVolSolvar, nVolDiscrVar
193 
194  ! Initialize the number of solution variables to the number of
195  ! independent variables and the number of discrete variables to 0.
196 
197  nvolsolvar = nw
198  nvoldiscrvar = 0
199 
200  ! Check whether or not some additional solution variables must
201  ! be written.
202 
203  if (volwritemx) nvolsolvar = nvolsolvar + 1
204  if (volwritemy) nvolsolvar = nvolsolvar + 1
205  if (volwritemz) nvolsolvar = nvolsolvar + 1
206  if (volwritervx) nvolsolvar = nvolsolvar + 1
207  if (volwritervy) nvolsolvar = nvolsolvar + 1
208  if (volwritervz) nvolsolvar = nvolsolvar + 1
209  if (volwriterhoe) nvolsolvar = nvolsolvar + 1
210  if (volwritetemp) nvolsolvar = nvolsolvar + 1
211  if (volwritecp) nvolsolvar = nvolsolvar + 1
212  if (volwritemach) nvolsolvar = nvolsolvar + 1
213  if (volwritermach) nvolsolvar = nvolsolvar + 1
214  if (volwritemachturb) nvolsolvar = nvolsolvar + 1
215  if (volwriteeddyvis) nvolsolvar = nvolsolvar + 1
216  if (volwriteratioeddyvis) nvolsolvar = nvolsolvar + 1
217  if (volwritedist) nvolsolvar = nvolsolvar + 1
218  if (volwritevort) nvolsolvar = nvolsolvar + 1
219  if (volwritevortx) nvolsolvar = nvolsolvar + 1
220  if (volwritevorty) nvolsolvar = nvolsolvar + 1
221  if (volwritevortz) nvolsolvar = nvolsolvar + 1
222  if (volwriteptotloss) nvolsolvar = nvolsolvar + 1
223  if (volwriteshock) nvolsolvar = nvolsolvar + 1
224  if (volwritefilteredshock) nvolsolvar = nvolsolvar + 1
225  if (volwritegc) nvolsolvar = nvolsolvar + 1
226  if (volwritestatus) nvolsolvar = nvolsolvar + 1
227  if (volwriteintermittency) nvoldiscrvar = nvoldiscrvar + 1
228 
229  ! Check the discrete variables.
230 
231  if (volwriteresrho) nvoldiscrvar = nvoldiscrvar + 1
232  if (volwriteresmom) nvoldiscrvar = nvoldiscrvar + 3
233  if (volwriteresrhoe) nvoldiscrvar = nvoldiscrvar + 1
234  if (volwriteresturb) nvoldiscrvar = nvoldiscrvar &
235  + (nw - nwf)
236 
237  if (volwriteblank) nvoldiscrvar = nvoldiscrvar + 1
238 
239  end subroutine numberofvolsolvariables
240 
241  subroutine copydatabufsingleprecision(val, buffer, &
242  iBeg, jBeg, kBeg, &
243  iEnd, jEnd, kEnd, subRange)
244  !
245  ! copyDataBufSinglePrecision stores the given 1D buffer into the
246  ! subrange of the 3D single precision val array.
247  !
248  use precision
249  implicit none
250  !
251  ! Subroutine arguments.
252  !
253  integer(kind=intType), intent(in) :: iBeg, jBeg, kBeg
254  integer(kind=intType), intent(in) :: iEnd, jEnd, kEnd
255  integer(kind=intType), dimension(3, 2), intent(in) :: subRange
256 
257  real(kind=realtype), dimension(*), intent(in) :: buffer
258  real(kind=4), dimension(ibeg:iend, jbeg:jend, kbeg:kend), &
259  intent(inout) :: val
260  !
261  ! Local variables.
262  !
263  integer(kind=intType) :: i, j, k, ll
264 
265  ! Copy the subrange into val.
266 
267  ll = 0
268  do k = subrange(3, 1), subrange(3, 2)
269  do j = subrange(2, 1), subrange(2, 2)
270  do i = subrange(1, 1), subrange(1, 2)
271  ll = ll + 1
272  val(i, j, k) = real(buffer(ll), singletype)
273  end do
274  end do
275  end do
276 
277  end subroutine copydatabufsingleprecision
278 
279  ! ==================================================================
280 
281  subroutine copydatabufdoubleprecision(val, buffer, &
282  iBeg, jBeg, kBeg, &
283  iEnd, jEnd, kEnd, subRange)
284  !
285  ! copyDataBufDoublePrecision stores the given 1D buffer into the
286  ! subrange of the 3D double precision val array.
287  !
288  use precision
289  implicit none
290  !
291  ! Subroutine arguments.
292  !
293  integer(kind=intType), intent(in) :: iBeg, jBeg, kBeg
294  integer(kind=intType), intent(in) :: iEnd, jEnd, kEnd
295  integer(kind=intType), dimension(3, 2), intent(in) :: subRange
296 
297  real(kind=realtype), dimension(*), intent(in) :: buffer
298  real(kind=8), dimension(ibeg:iend, jbeg:jend, kbeg:kend), &
299  intent(inout) :: val
300  !
301  ! Local variables.
302  !
303  integer(kind=intType) :: i, j, k, ll
304 
305  ! Copy the subrange into val.
306 
307  ll = 0
308  do k = subrange(3, 1), subrange(3, 2)
309  do j = subrange(2, 1), subrange(2, 2)
310  do i = subrange(1, 1), subrange(1, 2)
311  ll = ll + 1
312  val(i, j, k) = real(buffer(ll), doubletype)
313  end do
314  end do
315  end do
316 
317  end subroutine copydatabufdoubleprecision
318 
319  subroutine volsolnames(solNames)
320  !
321  ! volSolNames sets the names for the volume variables to be
322  ! written to the volume solution file. Sids convention names are
323  ! used as much as possible.
324  !
325  use constants
326  use cgnsnames
327  use inputphysics
328  use flowvarrefstate
329  use extraoutput
330  implicit none
331  !
332  ! Subroutine argument.
333  !
334  character(len=*), dimension(*), intent(out) :: solNames
335  !
336  ! Local variables.
337  !
338  integer(kind=intType) :: nn
339  !
340  ! First store the names of the independent flow variables.
341 
342  solnames(1) = cgnsdensity
343  solnames(2) = cgnsvelx
344  solnames(3) = cgnsvely
345  solnames(4) = cgnsvelz
346  solnames(5) = cgnspressure
347 
348  ! The turbulent variables if the RANS equations are solved.
349  ! Note that these are the primitive variables and not the
350  ! conservative ones. The reason is that the sids conventions only
351  ! defines these names and not the conservative ones.
352 
353  if (equations == ransequations) then
354 
355  select case (turbmodel)
356 
358  solnames(itu1) = cgnsturbsanu
359 
361  solnames(itu1) = cgnsturbk
362  solnames(itu2) = cgnsturbomega
363 
364  case (ktau)
365  solnames(itu1) = cgnsturbk
366  solnames(itu2) = cgnsturbtau
367 
368  case (v2f)
369  solnames(itu1) = cgnsturbk
370  solnames(itu2) = cgnsturbepsilon
371  solnames(itu3) = cgnsturbv2
372  solnames(itu4) = cgnsturbf
373 
374  end select
375 
376  end if
377 
378  ! Initialize nn to the number of independent variables.
379 
380  nn = nw
381 
382  ! Check the additional variables to be written.
383 
384  if (volwritemx) then
385  nn = nn + 1
386  solnames(nn) = cgnsmomx
387  end if
388 
389  if (volwritemy) then
390  nn = nn + 1
391  solnames(nn) = cgnsmomy
392  end if
393 
394  if (volwritemz) then
395  nn = nn + 1
396  solnames(nn) = cgnsmomz
397  end if
398 
399  if (volwritervx) then
400  nn = nn + 1
401  solnames(nn) = cgnsrelvelx
402  end if
403 
404  if (volwritervy) then
405  nn = nn + 1
406  solnames(nn) = cgnsrelvely
407  end if
408 
409  if (volwritervz) then
410  nn = nn + 1
411  solnames(nn) = cgnsrelvelz
412  end if
413 
414  if (volwriterhoe) then
415  nn = nn + 1
416  solnames(nn) = cgnsenergy
417  end if
418 
419  if (volwritetemp) then
420  nn = nn + 1
421  solnames(nn) = cgnstemp
422  end if
423 
424  if (volwritecp) then
425  nn = nn + 1
426  solnames(nn) = cgnscp
427  end if
428 
429  if (volwritemach) then
430  nn = nn + 1
431  solnames(nn) = cgnsmach
432  end if
433 
434  if (volwritermach) then
435  nn = nn + 1
436  solnames(nn) = cgnsrelmach
437  end if
438 
439  if (volwritemachturb) then
440  nn = nn + 1
441  solnames(nn) = cgnsmachturb
442  end if
443 
444  if (volwriteeddyvis) then
445  nn = nn + 1
446  solnames(nn) = cgnseddy
447  end if
448 
449  if (volwriteratioeddyvis) then
450  nn = nn + 1
451  solnames(nn) = cgnseddyratio
452  end if
453 
454  if (volwritedist) then
455  nn = nn + 1
456  solnames(nn) = cgnswalldist
457  end if
458 
459  if (volwritevort) then
460  nn = nn + 1
461  solnames(nn) = cgnsvortmagn
462  end if
463 
464  if (volwritevortx) then
465  nn = nn + 1
466  solnames(nn) = cgnsvortx
467  end if
468 
469  if (volwritevorty) then
470  nn = nn + 1
471  solnames(nn) = cgnsvorty
472  end if
473 
474  if (volwritevortz) then
475  nn = nn + 1
476  solnames(nn) = cgnsvortz
477  end if
478 
479  if (volwriteptotloss) then
480  nn = nn + 1
481  solnames(nn) = cgnsptotloss
482  end if
483 
484  if (volwriteresrho) then
485  nn = nn + 1
486  solnames(nn) = cgnsresrho
487  end if
488 
489  if (volwriteresmom) then
490  nn = nn + 1
491  solnames(nn) = cgnsresmomx
492 
493  nn = nn + 1
494  solnames(nn) = cgnsresmomy
495 
496  nn = nn + 1
497  solnames(nn) = cgnsresmomz
498  end if
499 
500  if (volwriteresrhoe) then
501  nn = nn + 1
502  solnames(nn) = cgnsresrhoe
503  end if
504 
505  if (volwriteresturb) then
506 
507  select case (turbmodel)
508 
510  nn = nn + 1
511  solnames(nn) = cgnsresnu
512 
514  nn = nn + 1
515  solnames(nn) = cgnsresk
516 
517  nn = nn + 1
518  solnames(nn) = cgnsresomega
519 
520  case (ktau)
521  nn = nn + 1
522  solnames(nn) = cgnsresk
523 
524  nn = nn + 1
525  solnames(nn) = cgnsrestau
526 
527  case (v2f)
528  nn = nn + 1
529  solnames(nn) = cgnsresk
530 
531  nn = nn + 1
532  solnames(nn) = cgnsresepsilon
533 
534  nn = nn + 1
535  solnames(nn) = cgnsresv2
536 
537  nn = nn + 1
538  solnames(nn) = cgnsresf
539 
540  end select
541 
542  end if
543 
544  if (volwriteshock) then
545  nn = nn + 1
546  solnames(nn) = cgnsshock
547  end if
548 
549  if (volwritefilteredshock) then
550  nn = nn + 1
551  solnames(nn) = cgnsfilteredshock
552  end if
553 
554  if (volwriteblank) then
555  nn = nn + 1
556  solnames(nn) = cgnsblank
557  end if
558 
559  if (volwritegc) then
560  nn = nn + 1
561  solnames(nn) = cgnsgc
562  end if
563 
564  if (volwritestatus) then
565  nn = nn + 1
566  solnames(nn) = cgnsstatus
567  end if
568 
569  if (volwriteintermittency) then
570  nn = nn + 1
571  solnames(nn) = cgnsintermittency
572  end if
573 
574  end subroutine volsolnames
575 
576  subroutine surfsolnames(solNames)
577  !
578  ! surfSolNames sets the names for the surface variables to be
579  ! written to the surface solution file. Sids convention names
580  ! are used as much as possible.
581  !
582  use cgnsnames
583  use extraoutput
584  implicit none
585  !
586  ! Subroutine argument.
587  !
588  character(len=*), dimension(*), intent(out) :: solNames
589  !
590  ! Local variables.
591  !
592  integer(kind=intType) :: nn
593 
594  ! Initialize nn to 0.
595 
596  nn = 0
597 
598  ! Check which surfaces variables must be written and set
599  ! solNames accordingly.
600 
601  if (surfwriterho) then
602  nn = nn + 1
603  solnames(nn) = cgnsdensity
604  end if
605 
606  if (surfwritep) then
607  nn = nn + 1
608  solnames(nn) = cgnspressure
609  end if
610 
611  if (surfwritetemp) then
612  nn = nn + 1
613  solnames(nn) = cgnstemp
614  end if
615 
616  if (surfwritevx) then
617  nn = nn + 1
618  solnames(nn) = cgnsvelx
619  end if
620 
621  if (surfwritevy) then
622  nn = nn + 1
623  solnames(nn) = cgnsvely
624  end if
625 
626  if (surfwritevz) then
627  nn = nn + 1
628  solnames(nn) = cgnsvelz
629  end if
630 
631  if (surfwritervx) then
632  nn = nn + 1
633  solnames(nn) = cgnsrelvelx
634  end if
635 
636  if (surfwritervy) then
637  nn = nn + 1
638  solnames(nn) = cgnsrelvely
639  end if
640 
641  if (surfwritervz) then
642  nn = nn + 1
643  solnames(nn) = cgnsrelvelz
644  end if
645 
646  if (surfwritecp) then
647  nn = nn + 1
648  solnames(nn) = cgnscp
649  end if
650 
651  if (surfwriteptotloss) then
652  nn = nn + 1
653  solnames(nn) = cgnsptotloss
654  end if
655 
656  if (surfwritemach) then
657  nn = nn + 1
658  solnames(nn) = cgnsmach
659  end if
660 
661  if (surfwritermach) then
662  nn = nn + 1
663  solnames(nn) = cgnsrelmach
664  end if
665 
666  if (surfwritecf) then
667  nn = nn + 1
668  solnames(nn) = cgnsskinfmag
669  end if
670 
671  if (surfwritech) then
672  nn = nn + 1
673  solnames(nn) = cgnsstanton
674  end if
675 
676  if (surfwriteyplus) then
677  nn = nn + 1
678  solnames(nn) = cgnsyplus
679  end if
680 
681  if (surfwritecfx) then
682  nn = nn + 1
683  solnames(nn) = cgnsskinfx
684  end if
685 
686  if (surfwritecfy) then
687  nn = nn + 1
688  solnames(nn) = cgnsskinfy
689  end if
690 
691  if (surfwritecfz) then
692  nn = nn + 1
693  solnames(nn) = cgnsskinfz
694  end if
695 
696  if (surfwriteforceindragdir) then
697  nn = nn + 1
698  solnames(nn) = cgnsforceindragdir
699  end if
700 
701  if (surfwriteforceinliftdir) then
702  nn = nn + 1
703  solnames(nn) = cgnsforceinliftdir
704  end if
705 
706  if (surfwriteblank) then
707  nn = nn + 1
708  solnames(nn) = cgnsblank
709  end if
710 
711  if (surfwritesepsensor) then
712  nn = nn + 1
713  solnames(nn) = cgnssepsensor
714  end if
715 
716  if (surfwritesepsensorks) then
717  nn = nn + 1
718  solnames(nn) = cgnssepsensorks
719  end if
720 
721  if (surfwritesepsensorksarea) then
722  nn = nn + 1
723  solnames(nn) = cgnssepsensorksarea
724  end if
725 
726  if (surfwritecavitation) then
727  nn = nn + 1
728  solnames(nn) = cgnscavitation
729  end if
730 
731  if (surfwriteaxismoment) then
732  nn = nn + 1
733  solnames(nn) = cgnsaxismoment
734  end if
735 
736  if (surfwritegc) then
737  nn = nn + 1
738  solnames(nn) = cgnsgc
739  end if
740 
741  end subroutine surfsolnames
742 
743  subroutine storesolinbuffer(buffer, copyInBuffer, solName, &
744  iBeg, iEnd, jBeg, jEnd, kBeg, kEnd)
745  !
746  ! StoreSolInBuffer stores the given range of the variable
747  ! indicated by solName in IOVar and copies it into buffer if
748  ! desired. It is assumed that the variables in blockPointers
749  ! already point to the correct block.
750  !
751  use constants
752  use blockpointers
753  use cgnsgrid
754  use cgnsnames
755  use flowvarrefstate
756  use inputphysics
757  use iomodule
758  use flowutils, only: computeptot
759  use utils, only: terminate
760  use oversetdata, only: oversetpresent
761  use inputio, only: laminartoturbulent
762  implicit none
763  !
764  ! Subroutine arguments.
765  !
766  integer(kind=intType), intent(in) :: iBeg, iEnd, jBeg, jEnd
767  integer(kind=intType), intent(in) :: kBeg, kEnd
768 
769  real(kind=realtype), dimension(*), intent(out) :: buffer
770  character(len=*), intent(in) :: solName
771 
772  logical, intent(in) :: copyInBuffer
773  !
774  ! Local parameters
775  !
776  real(kind=realtype), parameter :: plim = 0.001_realtype
777  real(kind=realtype), parameter :: rholim = 0.001_realtype
778  !
779  ! Local variables.
780  !
781  integer(kind=intType) :: i, j, k, ii, jj, kk, nn
782 
783  real(kind=realtype) :: uuy, uuz, vvx, vvz, wwx, wwy, tmp
784  real(kind=realtype) :: vortx, vorty, vortz, a2, ptotinf, ptot
785  real(kind=realtype) :: a, uova(3), gradp(3)
786 
787  real(kind=realtype), dimension(:, :, :, :), pointer :: wio
788 
789  ! Set the pointer to the correct entry of IOVar. I'm cheating a
790  ! bit here, because I know that only memory has been allocated
791  ! for the first solution ID of IOVar.
792 
793  wio => iovar(nbklocal, 1)%w
794 
795  ! Determine the variable to be stored, compute it and store
796  ! it in the 1D array buffer.
797 
798  select case (solname)
799 
800  case (cgnsdensity)
801  do k = kbeg, kend
802  do j = jbeg, jend
803  do i = ibeg, iend
804  wio(i, j, k, 1) = w(i, j, k, irho)
805  end do
806  end do
807  end do
808 
809  case (cgnsmomx)
810  do k = kbeg, kend
811  do j = jbeg, jend
812  do i = ibeg, iend
813  wio(i, j, k, 1) = w(i, j, k, irho) * w(i, j, k, ivx)
814  end do
815  end do
816  end do
817 
818  case (cgnsmomy)
819  do k = kbeg, kend
820  do j = jbeg, jend
821  do i = ibeg, iend
822  wio(i, j, k, 1) = w(i, j, k, irho) * w(i, j, k, ivy)
823  end do
824  end do
825  end do
826 
827  case (cgnsmomz)
828  do k = kbeg, kend
829  do j = jbeg, jend
830  do i = ibeg, iend
831  wio(i, j, k, 1) = w(i, j, k, irho) * w(i, j, k, ivz)
832  end do
833  end do
834  end do
835 
836  case (cgnsenergy)
837  do k = kbeg, kend
838  do j = jbeg, jend
839  do i = ibeg, iend
840  wio(i, j, k, 1) = w(i, j, k, irhoe)
841  end do
842  end do
843  end do
844 
845  case (cgnsturbsanu, cgnsturbk)
846  do k = kbeg, kend
847  do j = jbeg, jend
848  do i = ibeg, iend
849  wio(i, j, k, 1) = w(i, j, k, itu1)
850  end do
851  end do
852  end do
853 
855  do k = kbeg, kend
856  do j = jbeg, jend
857  do i = ibeg, iend
858  wio(i, j, k, 1) = w(i, j, k, itu2)
859  end do
860  end do
861  end do
862 
863  case (cgnsturbv2)
864  do k = kbeg, kend
865  do j = jbeg, jend
866  do i = ibeg, iend
867  wio(i, j, k, 1) = w(i, j, k, itu3)
868  end do
869  end do
870  end do
871 
872  case (cgnsturbf)
873  do k = kbeg, kend
874  do j = jbeg, jend
875  do i = ibeg, iend
876  wio(i, j, k, 1) = w(i, j, k, itu4)
877  end do
878  end do
879  end do
880 
881  case (cgnsvelx)
882  do k = kbeg, kend
883  do j = jbeg, jend
884  do i = ibeg, iend
885  wio(i, j, k, 1) = w(i, j, k, ivx)
886  end do
887  end do
888  end do
889 
890  case (cgnsvely)
891  do k = kbeg, kend
892  do j = jbeg, jend
893  do i = ibeg, iend
894  wio(i, j, k, 1) = w(i, j, k, ivy)
895  end do
896  end do
897  end do
898 
899  case (cgnsvelz)
900  do k = kbeg, kend
901  do j = jbeg, jend
902  do i = ibeg, iend
903  wio(i, j, k, 1) = w(i, j, k, ivz)
904  end do
905  end do
906  end do
907 
908  case (cgnsrelvelx)
909  do k = kbeg, kend
910  do j = jbeg, jend
911  do i = ibeg, iend
912  wio(i, j, k, 1) = w(i, j, k, ivx) - s(i, j, k, 1)
913  end do
914  end do
915  end do
916 
917  case (cgnsrelvely)
918  do k = kbeg, kend
919  do j = jbeg, jend
920  do i = ibeg, iend
921  wio(i, j, k, 1) = w(i, j, k, ivy) - s(i, j, k, 2)
922  end do
923  end do
924  end do
925 
926  case (cgnsrelvelz)
927  do k = kbeg, kend
928  do j = jbeg, jend
929  do i = ibeg, iend
930  wio(i, j, k, 1) = w(i, j, k, ivz) - s(i, j, k, 3)
931  end do
932  end do
933  end do
934 
935  case (cgnspressure)
936  do k = kbeg, kend
937  do j = jbeg, jend
938  do i = ibeg, iend
939  wio(i, j, k, 1) = p(i, j, k)
940  end do
941  end do
942  end do
943 
944  case (cgnstemp)
945  do k = kbeg, kend
946  do j = jbeg, jend
947  do i = ibeg, iend
948  wio(i, j, k, 1) = p(i, j, k) / (rgas * w(i, j, k, irho))
949  end do
950  end do
951  end do
952 
953  case (cgnscp)
954  tmp = two / (gammainf * pinf * machcoef * machcoef)
955  do k = kbeg, kend
956  do j = jbeg, jend
957  do i = ibeg, iend
958  wio(i, j, k, 1) = tmp * (p(i, j, k) - pinf)
959  end do
960  end do
961  end do
962 
963  case (cgnsmach)
964  do k = kbeg, kend
965  do j = jbeg, jend
966  do i = ibeg, iend
967  a2 = gamma(i, j, k) * max(p(i, j, k), plim) &
968  / max(w(i, j, k, irho), rholim)
969  tmp = (w(i, j, k, ivx)**2 + w(i, j, k, ivy)**2 &
970  + w(i, j, k, ivz)**2) / a2
971  wio(i, j, k, 1) = sqrt(max(zero, tmp))
972  end do
973  end do
974  end do
975 
976  case (cgnsrelmach)
977  do k = kbeg, kend
978  do j = jbeg, jend
979  do i = ibeg, iend
980  a2 = gamma(i, j, k) * max(p(i, j, k), plim) &
981  / max(w(i, j, k, irho), rholim)
982  tmp = ((w(i, j, k, ivx) - s(i, j, k, 1))**2 + &
983  (w(i, j, k, ivy) - s(i, j, k, 2))**2 &
984  + (w(i, j, k, ivz) - s(i, j, k, 3))**2) / a2
985  wio(i, j, k, 1) = sqrt(max(zero, tmp))
986  end do
987  end do
988  end do
989 
990  case (cgnsmachturb)
991  do k = kbeg, kend
992  do j = jbeg, jend
993  do i = ibeg, iend
994  tmp = w(i, j, k, irho) * w(i, j, k, itu1) &
995  / (gamma(i, j, k) * max(p(i, j, k), plim))
996  wio(i, j, k, 1) = sqrt(max(zero, tmp))
997  end do
998  end do
999  end do
1000 
1001  case (cgnseddy)
1002  do k = kbeg, kend
1003  do j = jbeg, jend
1004  do i = ibeg, iend
1005  wio(i, j, k, 1) = rev(i, j, k)
1006  end do
1007  end do
1008  end do
1009 
1010  case (cgnseddyratio)
1011  do k = kbeg, kend
1012  do j = jbeg, jend
1013  do i = ibeg, iend
1014  wio(i, j, k, 1) = rev(i, j, k) / rlv(i, j, k)
1015  end do
1016  end do
1017  end do
1018 
1019  case (cgnswalldist)
1020  do k = kbeg, kend
1021  kk = max(2_inttype, k); kk = min(kl, kk)
1022  do j = jbeg, jend
1023  jj = max(2_inttype, j); jj = min(jl, jj)
1024  do i = ibeg, iend
1025  ii = max(2_inttype, i); ii = min(il, ii)
1026  wio(i, j, k, 1) = d2wall(ii, jj, kk)
1027  end do
1028  end do
1029  end do
1030 
1031  case (cgnsvortmagn)
1032 
1033  do k = kbeg, kend
1034  do j = jbeg, jend
1035  do i = ibeg, iend
1036  tmp = half / vol(i, j, k)
1037  uuy = si(i, j, k, 2) * w(i + 1, j, k, ivx) &
1038  - si(i - 1, j, k, 2) * w(i - 1, j, k, ivx) &
1039  + sj(i, j, k, 2) * w(i, j + 1, k, ivx) &
1040  - sj(i, j - 1, k, 2) * w(i, j - 1, k, ivx) &
1041  + sk(i, j, k, 2) * w(i, j, k + 1, ivx) &
1042  - sk(i, j, k - 1, 2) * w(i, j, k - 1, ivx)
1043 
1044  uuz = si(i, j, k, 3) * w(i + 1, j, k, ivx) &
1045  - si(i - 1, j, k, 3) * w(i - 1, j, k, ivx) &
1046  + sj(i, j, k, 3) * w(i, j + 1, k, ivx) &
1047  - sj(i, j - 1, k, 3) * w(i, j - 1, k, ivx) &
1048  + sk(i, j, k, 3) * w(i, j, k + 1, ivx) &
1049  - sk(i, j, k - 1, 3) * w(i, j, k - 1, ivx)
1050 
1051  vvx = si(i, j, k, 1) * w(i + 1, j, k, ivy) &
1052  - si(i - 1, j, k, 1) * w(i - 1, j, k, ivy) &
1053  + sj(i, j, k, 1) * w(i, j + 1, k, ivy) &
1054  - sj(i, j - 1, k, 1) * w(i, j - 1, k, ivy) &
1055  + sk(i, j, k, 1) * w(i, j, k + 1, ivy) &
1056  - sk(i, j, k - 1, 1) * w(i, j, k - 1, ivy)
1057 
1058  vvz = si(i, j, k, 3) * w(i + 1, j, k, ivy) &
1059  - si(i - 1, j, k, 3) * w(i - 1, j, k, ivy) &
1060  + sj(i, j, k, 3) * w(i, j + 1, k, ivy) &
1061  - sj(i, j - 1, k, 3) * w(i, j - 1, k, ivy) &
1062  + sk(i, j, k, 3) * w(i, j, k + 1, ivy) &
1063  - sk(i, j, k - 1, 3) * w(i, j, k - 1, ivy)
1064 
1065  wwx = si(i, j, k, 1) * w(i + 1, j, k, ivz) &
1066  - si(i - 1, j, k, 1) * w(i - 1, j, k, ivz) &
1067  + sj(i, j, k, 1) * w(i, j + 1, k, ivz) &
1068  - sj(i, j - 1, k, 1) * w(i, j - 1, k, ivz) &
1069  + sk(i, j, k, 1) * w(i, j, k + 1, ivz) &
1070  - sk(i, j, k - 1, 1) * w(i, j, k - 1, ivz)
1071 
1072  wwy = si(i, j, k, 2) * w(i + 1, j, k, ivz) &
1073  - si(i - 1, j, k, 2) * w(i - 1, j, k, ivz) &
1074  + sj(i, j, k, 2) * w(i, j + 1, k, ivz) &
1075  - sj(i, j - 1, k, 2) * w(i, j - 1, k, ivz) &
1076  + sk(i, j, k, 2) * w(i, j, k + 1, ivz) &
1077  - sk(i, j, k - 1, 2) * w(i, j, k - 1, ivz)
1078 
1079  vortx = wwy - vvz; vorty = uuz - wwx; vortz = vvx - uuy
1080 
1081  wio(i, j, k, 1) = tmp * sqrt(vortx**2 + vorty**2 + vortz**2)
1082  end do
1083  end do
1084  end do
1085 
1086  case (cgnsvortx)
1087 
1088  do k = kbeg, kend
1089  do j = jbeg, jend
1090  do i = ibeg, iend
1091  tmp = half / vol(i, j, k)
1092  vvz = si(i, j, k, 3) * w(i + 1, j, k, ivy) &
1093  - si(i - 1, j, k, 3) * w(i - 1, j, k, ivy) &
1094  + sj(i, j, k, 3) * w(i, j + 1, k, ivy) &
1095  - sj(i, j - 1, k, 3) * w(i, j - 1, k, ivy) &
1096  + sk(i, j, k, 3) * w(i, j, k + 1, ivy) &
1097  - sk(i, j, k - 1, 3) * w(i, j, k - 1, ivy)
1098 
1099  wwy = si(i, j, k, 2) * w(i + 1, j, k, ivz) &
1100  - si(i - 1, j, k, 2) * w(i - 1, j, k, ivz) &
1101  + sj(i, j, k, 2) * w(i, j + 1, k, ivz) &
1102  - sj(i, j - 1, k, 2) * w(i, j - 1, k, ivz) &
1103  + sk(i, j, k, 2) * w(i, j, k + 1, ivz) &
1104  - sk(i, j, k - 1, 2) * w(i, j, k - 1, ivz)
1105 
1106  wio(i, j, k, 1) = tmp * (wwy - vvz)
1107  end do
1108  end do
1109  end do
1110 
1111  case (cgnsvorty)
1112 
1113  do k = kbeg, kend
1114  do j = jbeg, jend
1115  do i = ibeg, iend
1116  tmp = half / vol(i, j, k)
1117  uuz = si(i, j, k, 3) * w(i + 1, j, k, ivx) &
1118  - si(i - 1, j, k, 3) * w(i - 1, j, k, ivx) &
1119  + sj(i, j, k, 3) * w(i, j + 1, k, ivx) &
1120  - sj(i, j - 1, k, 3) * w(i, j - 1, k, ivx) &
1121  + sk(i, j, k, 3) * w(i, j, k + 1, ivx) &
1122  - sk(i, j, k - 1, 3) * w(i, j, k - 1, ivx)
1123 
1124  wwx = si(i, j, k, 1) * w(i + 1, j, k, ivz) &
1125  - si(i - 1, j, k, 1) * w(i - 1, j, k, ivz) &
1126  + sj(i, j, k, 1) * w(i, j + 1, k, ivz) &
1127  - sj(i, j - 1, k, 1) * w(i, j - 1, k, ivz) &
1128  + sk(i, j, k, 1) * w(i, j, k + 1, ivz) &
1129  - sk(i, j, k - 1, 1) * w(i, j, k - 1, ivz)
1130 
1131  wio(i, j, k, 1) = tmp * (uuz - wwx)
1132  end do
1133  end do
1134  end do
1135 
1136  case (cgnsvortz)
1137 
1138  do k = kbeg, kend
1139  do j = jbeg, jend
1140  do i = ibeg, iend
1141  tmp = half / vol(i, j, k)
1142  uuy = si(i, j, k, 2) * w(i + 1, j, k, ivx) &
1143  - si(i - 1, j, k, 2) * w(i - 1, j, k, ivx) &
1144  + sj(i, j, k, 2) * w(i, j + 1, k, ivx) &
1145  - sj(i, j - 1, k, 2) * w(i, j - 1, k, ivx) &
1146  + sk(i, j, k, 2) * w(i, j, k + 1, ivx) &
1147  - sk(i, j, k - 1, 2) * w(i, j, k - 1, ivx)
1148 
1149  vvx = si(i, j, k, 1) * w(i + 1, j, k, ivy) &
1150  - si(i - 1, j, k, 1) * w(i - 1, j, k, ivy) &
1151  + sj(i, j, k, 1) * w(i, j + 1, k, ivy) &
1152  - sj(i, j - 1, k, 1) * w(i, j - 1, k, ivy) &
1153  + sk(i, j, k, 1) * w(i, j, k + 1, ivy) &
1154  - sk(i, j, k - 1, 1) * w(i, j, k - 1, ivy)
1155 
1156  wio(i, j, k, 1) = tmp * (vvx - uuy)
1157  end do
1158  end do
1159  end do
1160 
1161  case (cgnsptotloss)
1162 
1163  ! Compute the free stream total pressure.
1164 
1165  call computeptot(rhoinf, uinf, zero, zero, &
1166  pinf, ptotinf)
1167  ptotinf = one / ptotinf
1168 
1169  ! Loop over the cell centers and compute the
1170  ! total pressure loss.
1171 
1172  do k = kbeg, kend
1173  do j = jbeg, jend
1174  do i = ibeg, iend
1175  call computeptot(w(i, j, k, irho), w(i, j, k, ivx), &
1176  w(i, j, k, ivy), w(i, j, k, ivz), &
1177  p(i, j, k), ptot)
1178 
1179  wio(i, j, k, 1) = one - ptot * ptotinf
1180  end do
1181  end do
1182  end do
1183 
1184  case (cgnsresrho)
1185 
1186  do k = kbeg, kend
1187  do j = jbeg, jend
1188  do i = ibeg, iend
1189  ! wIO(i,j,k,1) = dw(i,j,k,irho)
1190  wio(i, j, k, 1) = dw(i, j, k, irho) / vol(i, j, k)
1191  end do
1192  end do
1193  end do
1194 
1195  case (cgnsresmomx)
1196 
1197  do k = kbeg, kend
1198  do j = jbeg, jend
1199  do i = ibeg, iend
1200  ! wIO(i,j,k,1) = dw(i,j,k,imx)
1201  wio(i, j, k, 1) = dw(i, j, k, imx) / vol(i, j, k)
1202  end do
1203  end do
1204  end do
1205 
1206  case (cgnsresmomy)
1207 
1208  do k = kbeg, kend
1209  do j = jbeg, jend
1210  do i = ibeg, iend
1211  ! wIO(i,j,k,1) = dw(i,j,k,imy)
1212  wio(i, j, k, 1) = dw(i, j, k, imy) / vol(i, j, k)
1213  end do
1214  end do
1215  end do
1216 
1217  case (cgnsresmomz)
1218 
1219  do k = kbeg, kend
1220  do j = jbeg, jend
1221  do i = ibeg, iend
1222  ! wIO(i,j,k,1) = dw(i,j,k,imz)
1223  wio(i, j, k, 1) = dw(i, j, k, imz) / vol(i, j, k)
1224  end do
1225  end do
1226  end do
1227 
1228  case (cgnsresrhoe)
1229 
1230  do k = kbeg, kend
1231  do j = jbeg, jend
1232  do i = ibeg, iend
1233  ! wIO(i,j,k,1) = dw(i,j,k,irhoE)
1234  wio(i, j, k, 1) = dw(i, j, k, irhoe) / vol(i, j, k)
1235  end do
1236  end do
1237  end do
1238 
1239  case (cgnsresnu, cgnsresk)
1240 
1241  do k = kbeg, kend
1242  do j = jbeg, jend
1243  do i = ibeg, iend
1244  ! wIO(i,j,k,1) = dw(i,j,k,itu1)
1245  wio(i, j, k, 1) = dw(i, j, k, itu1) / vol(i, j, k)
1246  end do
1247  end do
1248  end do
1249 
1251 
1252  do k = kbeg, kend
1253  do j = jbeg, jend
1254  do i = ibeg, iend
1255  ! wIO(i,j,k,1) = dw(i,j,k,itu2)
1256  wio(i, j, k, 1) = dw(i, j, k, itu2) / vol(i, j, k)
1257  end do
1258  end do
1259  end do
1260 
1261  case (cgnsresv2)
1262 
1263  do k = kbeg, kend
1264  do j = jbeg, jend
1265  do i = ibeg, iend
1266  ! wIO(i,j,k,1) = dw(i,j,k,itu3)
1267  wio(i, j, k, 1) = dw(i, j, k, itu3) / vol(i, j, k)
1268  end do
1269  end do
1270  end do
1271 
1272  case (cgnsresf)
1273 
1274  do k = kbeg, kend
1275  do j = jbeg, jend
1276  do i = ibeg, iend
1277  ! wIO(i,j,k,1) = dw(i,j,k,itu4)
1278  wio(i, j, k, 1) = dw(i, j, k, itu4) / vol(i, j, k)
1279  end do
1280  end do
1281  end do
1282 
1283  case (cgnsblank)
1284  do k = kbeg, kend
1285  do j = jbeg, jend
1286  do i = ibeg, iend
1287  wio(i, j, k, 1) = real(iblank(i, j, k), realtype)
1288  end do
1289  end do
1290  end do
1291 
1292  case (cgnsgc)
1293  do k = kbeg, kend
1294  do j = jbeg, jend
1295  do i = ibeg, iend
1296  wio(i, j, k, 1) = real(globalcell(i, j, k), realtype)
1297  end do
1298  end do
1299  end do
1300 
1301  case (cgnsstatus)
1302  do k = kbeg, kend
1303  do j = jbeg, jend
1304  do i = ibeg, iend
1305  if (oversetpresent) then
1306  wio(i, j, k, 1) = real(status(i, j, k))
1307  else
1308  wio(i, j, k, 1) = 0
1309  end if
1310  end do
1311  end do
1312  end do
1313 
1314  case (cgnsintermittency)
1315  if (laminartoturbulent) then
1316  do k = kbeg, kend
1317  kk = max(2_inttype, k); kk = min(kl, kk)
1318  do j = jbeg, jend
1319  jj = max(2_inttype, j); jj = min(jl, jj)
1320  do i = ibeg, iend
1321  ii = max(2_inttype, i); ii = min(il, ii)
1322  wio(i, j, k, 1) = intermittency(ii, jj, kk)
1323  end do
1324  end do
1325  end do
1326  end if
1327 
1328  case (cgnsshock)
1329 
1330  do k = kbeg, kend
1331  do j = jbeg, jend
1332  do i = ibeg, iend
1333 
1334  ! Here we compute U/a <dot> grad P / ||grad P||
1335  ! Whre U is the velocity vector, a is the speed of
1336  ! sound and P is the pressure.
1337 
1338  ! U / a
1339  a = sqrt(gamma(i, j, k) * max(p(i, j, k), plim) &
1340  / max(w(i, j, k, irho), rholim))
1341  uova = (/w(i, j, k, ivx), w(i, j, k, ivy), w(i, j, k, ivz)/) / a
1342 
1343  ! grad P / ||grad P||
1344 
1345  gradp(1) = si(i, j, k, 1) * p(i + 1, j, k) &
1346  - si(i - 1, j, k, 1) * p(i - 1, j, k) &
1347  + sj(i, j, k, 1) * p(i, j + 1, k) &
1348  - sj(i, j - 1, k, 1) * p(i, j - 1, k) &
1349  + sk(i, j, k, 1) * p(i, j, k + 1) &
1350  - sk(i, j, k - 1, 1) * p(i, j, k - 1)
1351 
1352  gradp(2) = si(i, j, k, 2) * p(i + 1, j, k) &
1353  - si(i - 1, j, k, 2) * p(i - 1, j, k) &
1354  + sj(i, j, k, 2) * p(i, j + 1, k) &
1355  - sj(i, j - 1, k, 2) * p(i, j - 1, k) &
1356  + sk(i, j, k, 2) * p(i, j, k + 1) &
1357  - sk(i, j, k - 1, 2) * p(i, j, k - 1)
1358 
1359  gradp(3) = si(i, j, k, 3) * p(i + 1, j, k) &
1360  - si(i - 1, j, k, 3) * p(i - 1, j, k) &
1361  + sj(i, j, k, 3) * p(i, j + 1, k) &
1362  - sj(i, j - 1, k, 3) * p(i, j - 1, k) &
1363  + sk(i, j, k, 3) * p(i, j, k + 1) &
1364  - sk(i, j, k - 1, 3) * p(i, j, k - 1)
1365 
1366  gradp = gradp / sqrt(gradp(1)**2 + gradp(2)**2 + gradp(3)**2)
1367  ! Dot product
1368  wio(i, j, k, 1) = uova(1) * gradp(1) + uova(2) * gradp(2) + uova(3) * gradp(3)
1369  end do
1370  end do
1371  end do
1372 
1373  case default
1374  call terminate("storeSolInBuffer", &
1375  "This should not happen")
1376 
1377  end select
1378 
1379  ! Copy the data in the 1D buffer, if desired.
1380 
1381  if (copyinbuffer) then
1382  nn = 0
1383  do k = kbeg, kend
1384  do j = jbeg, jend
1385  do i = ibeg, iend
1386  nn = nn + 1
1387  buffer(nn) = wio(i, j, k, 1)
1388  end do
1389  end do
1390  end do
1391  end if
1392 
1393  end subroutine storesolinbuffer
1394 
1395  subroutine storesurfsolinbuffer(sps, buffer, nn, blockID, &
1396  faceID, cellRange, solName, &
1397  viscousSubface, useRindLayer, &
1398  iBeg, iEnd, jBeg, jEnd)
1399  !
1400  ! storeSurfsolInBuffer stores the variable indicated by
1401  ! solName of the given block ID in the buffer. As the solution
1402  ! must be stored in the center of the boundary face the average
1403  ! value of the first internal cell and its corresponding halo is
1404  ! computed. The counter nn is updated in this routine. However
1405  ! it is not initialized, because multiple contributions may be
1406  ! stored in buffer.
1407  !
1408  use blockpointers
1409  use cgnsnames
1410  use constants
1411  use flowvarrefstate
1412  use inputphysics
1413  use inputio
1414  use communication
1415  use utils, only: setpointers
1416  use flowutils, only: computeptot
1417  use inputcostfunctions
1418  use cgnsgrid, only: cgnsdoms, cgnsndom ! see subroutine updateRotationRate in preprocessingAPI.F90
1419  implicit none
1420  !
1421  ! Subroutine arguments.
1422  !
1423  integer(kind=intType), intent(in) :: sps, blockID, faceID
1424  integer(kind=intType), intent(inout) :: nn
1425  integer(kind=intType), dimension(3, 2), intent(in) :: cellRange
1426  real(kind=realtype), dimension(*), intent(out) :: buffer
1427  character(len=*), intent(in) :: solName
1428  logical, intent(in) :: viscousSubface, useRindLayer
1429 
1430  ! if useRindLayer is true, then iBeg, iEnd, jBeg, jEnd are use to determine
1431  ! when the indices are in the rind layer.
1432  integer(kind=intType), optional, intent(in) :: iBeg, iEnd, jBeg, jEnd
1433  !
1434  ! Local variables.
1435  !
1436  integer(kind=intType) :: i, j, k, ior, jor
1437  integer(kind=intType) :: ii, jj, mm, iiMax, jjMax
1438 
1439  integer(kind=intType), dimension(2, 2) :: rangeFace
1440  integer(kind=intType), dimension(3, 2) :: rangeCell
1441 
1442  integer(kind=intType), dimension(:, :), pointer :: viscPointer
1443  integer(kind=intType), dimension(:, :), pointer :: iblank2
1444 
1445  real(kind=realtype) :: fact, gm1, ptotinf, ptot, psurf, rsurf
1446  real(kind=realtype) :: usurf, vsurf, wsurf, m2surf, musurf
1447  real(kind=realtype) :: fx, fy, fz, fn, a2tot, a2, qw
1448  real(kind=realtype) :: tauxx, tauyy, tauzz
1449  real(kind=realtype) :: tauxy, tauxz, tauyz
1450  real(kind=realtype) :: pm1, a, sensor, plocal, sensor1
1451  real(kind=realtype) :: vecttangential(3)
1452  real(kind=realtype) :: vectdotproductfsnormal
1453  real(kind=realtype), dimension(3) :: norm, v
1454  real(kind=realtype) :: coeffpressure
1455 
1456  real(kind=realtype), dimension(:, :, :), pointer :: ww1, ww2
1457  real(kind=realtype), dimension(:, :, :), pointer :: ss1, ss2, ss
1458  real(kind=realtype), dimension(:, :), pointer :: pp1, pp2
1459 
1460  real(kind=realtype), dimension(:, :), pointer :: gamma1, gamma2
1461  real(kind=realtype), dimension(:, :), pointer :: rlv1, rlv2
1462  real(kind=realtype), dimension(:, :), pointer :: dd2wall
1463 
1464  real(kind=realtype) :: uinfdim2 ! MachCoeff-derived (Uinf*Uref)**2
1465  real(kind=realtype) :: rot_speed2 ! norm of wCrossR squared
1466  real(kind=realtype), Dimension(3) :: r_ ! spanwise position for given point
1467  real(kind=realtype), Dimension(3) :: rrate_ ! the rotational rate of the WT
1468  real(kind=realtype), Dimension(3) :: wcrossr ! rotationrate cross radius
1469  real(kind=realtype), dimension(:, :, :), pointer :: xx1, xx2 ! for the coords
1470  ! The original i,j beging of the local block in the entire cgns block.
1471  real(kind=realtype) :: subface_jbegor, subface_jendor, subface_ibegor, subface_iendor
1472 
1473  ! Set the pointers to this block.
1474  call setpointers(blockid, 1_inttype, sps)
1475 
1476  ! Set the offset for the viscous data, such that the range is
1477  ! limited to the actual physical face. Viscous data, like skin
1478  ! friction, need gradIent information, which is not available
1479  ! in the halo's.
1480 
1481  ! CellRange contains the range of the current block in the
1482  ! original cgns block. Substract the offset and store the local
1483  ! range in rangeCell.
1484 
1485  rangecell(1, 1) = cellrange(1, 1) - ibegor + 1
1486  rangecell(1, 2) = cellrange(1, 2) - ibegor + 1
1487 
1488  rangecell(2, 1) = cellrange(2, 1) - jbegor + 1
1489  rangecell(2, 2) = cellrange(2, 2) - jbegor + 1
1490 
1491  rangecell(3, 1) = cellrange(3, 1) - kbegor + 1
1492  rangecell(3, 2) = cellrange(3, 2) - kbegor + 1
1493  !
1494  ! Viscous variables for a non-viscous wall.
1495  ! Simply set the variables to zero and return.
1496  !
1497  if (.not. viscoussubface) then
1498 
1499  select case (solname)
1500 
1504 
1505  ! Update the counter and set this entry of buffer to 0.
1506 
1507  do k = rangecell(3, 1), rangecell(3, 2)
1508  do j = rangecell(2, 1), rangecell(2, 2)
1509  do i = rangecell(1, 1), rangecell(1, 2)
1510  nn = nn + 1
1511  buffer(nn) = zero
1512  end do
1513  end do
1514  end do
1515 
1516  ! Work has been done for this variable. So return.
1517 
1518  return
1519 
1520  end select
1521  end if
1522 
1523  ! Compute the square of (dimensional) inflow velocity from MachCoef for Cp computation
1524  select case (solname)
1526  ! Same formula used in referenceState (see initializeFlow.F90),
1527  ! multiplied by the square of the reference velocity (uRef).
1528  ! MachCoef is initialized in inputParamRoutines.F90 and can also be passed from the python layer
1529  ! Note that the reference quantities (such as pRef, uRef, rhoInfDim, ..) are defined in module
1530  ! flowVarRefState (see flowVarRefState.F90) and first set in the subroutine referenceState
1531  ! (see initializeFlow.F90).
1532  uinfdim2 = (machcoef * machcoef * gammainf * pinf / rhoinf) * uref * uref
1533  end select
1534 
1535  !
1536  ! Determine the face on which the subface is located and set
1537  ! a couple of variables accordingly. In this way a generic
1538  ! treatment is possible and there is no need to repeat the code
1539  ! for each of the six block faces.
1540  ! Note that for dd2Wall a slightly different notation must be
1541  ! used. Reason is that d2Wall starts at index 2, rather than 0.
1542  !
1543 
1544  select case (faceid)
1545 
1546  case (imin)
1547  rangeface(1, 1:2) = rangecell(2, 1:2)
1548  rangeface(2, 1:2) = rangecell(3, 1:2)
1549  iimax = jl; jjmax = kl
1550 
1551  ! We need to get the mesh coordinates further down in order to compute
1552  ! the correct Cp-normalisation for rotational setups.
1553  ! The flow variables, w(0:ib,0:jb,0:kb,1:nw), we point to
1554  ! below uses what is defined in type blockType in block.F90 as
1555  ! ! ib, jb, kb - Block integer dimensions for double halo
1556  ! ! cell-centered quantities.
1557  ! BUT the mesh, x(0:ie,0:je,0:ke,3), is defined with the single halos:
1558  ! ! ie, je, ke - Block integer dimensions for single halo
1559  ! ! cell-centered quantities.
1560  ! This explains why in the (iMax)-case we use:
1561  ! ww1 => w(ie,1:,1:,:); ww2 => w(il,1:,1:,:)
1562  ! namely, we use single halos for w(:,:,:,:) instead of the
1563  ! usual double halos...
1564 
1565  ! we don't have double halo structure for x, so we start from 0
1566  xx1 => x(0, :, :, :); xx2 => x(1, :, :, :) ! 1 is our 2 since we are
1567  ! single haloed...
1568  ww1 => w(1, 1:, 1:, :); ww2 => w(2, 1:, 1:, :)
1569  pp1 => p(1, 1:, 1:); pp2 => p(2, 1:, 1:)
1570  ss => si(1, :, :, :); fact = -one
1571 
1572  pp1 => p(1, 1:, 1:); pp2 => p(2, 1:, 1:)
1573  gamma1 => gamma(1, 1:, 1:); gamma2 => gamma(2, 1:, 1:)
1574 
1575  if (blockismoving) then
1576  ss1 => s(1, 1:, 1:, :); ss2 => s(2, 1:, 1:, :)
1577  end if
1578 
1579  iblank2 => iblank(2, 1:, 1:)
1580  viscpointer => visciminpointer
1581 
1582  if (viscous) then
1583  rlv1 => rlv(1, 1:, 1:); rlv2 => rlv(2, 1:, 1:)
1584  end if
1585 
1586  if (equations == ransequations) dd2wall => d2wall(2, :, :)
1587  subface_ibegor = jbegor
1588  subface_iendor = jendor
1589 
1590  subface_jbegor = kbegor
1591  subface_jendor = kendor
1592 
1593  !===============================================================
1594 
1595  case (imax)
1596  rangeface(1, 1:2) = rangecell(2, 1:2)
1597  rangeface(2, 1:2) = rangecell(3, 1:2)
1598  iimax = jl; jjmax = kl
1599 
1600  xx1 => x(ie - 1, :, :, :); xx2 => x(il - 1, :, :, :)
1601  !
1602  ww1 => w(ie, 1:, 1:, :); ww2 => w(il, 1:, 1:, :)
1603  ss => si(il, :, :, :); fact = one
1604 
1605  pp1 => p(ie, 1:, 1:); pp2 => p(il, 1:, 1:)
1606  gamma1 => gamma(ie, 1:, 1:); gamma2 => gamma(il, 1:, 1:)
1607 
1608  if (blockismoving) then
1609  ss1 => s(ie - 1, 1:, 1:, :); ss2 => s(ie, 1:, 1:, :)
1610  end if
1611 
1612  iblank2 => iblank(il, 1:, 1:)
1613  viscpointer => viscimaxpointer
1614 
1615  if (viscous) then
1616  rlv1 => rlv(ie, 1:, 1:); rlv2 => rlv(il, 1:, 1:)
1617  end if
1618 
1619  if (equations == ransequations) dd2wall => d2wall(il, :, :)
1620 
1621  subface_ibegor = jbegor
1622  subface_iendor = jendor
1623 
1624  subface_jbegor = kbegor
1625  subface_jendor = kendor
1626 
1627  !===============================================================
1628 
1629  case (jmin)
1630  rangeface(1, 1:2) = rangecell(1, 1:2)
1631  rangeface(2, 1:2) = rangecell(3, 1:2)
1632  iimax = il; jjmax = kl
1633 
1634  xx1 => x(:, 0, :, :); xx2 => x(:, 1, :, :)
1635  !
1636  ww1 => w(1:, 1, 1:, :); ww2 => w(1:, 2, 1:, :)
1637  ss => sj(:, 1, :, :); fact = -one
1638 
1639  pp1 => p(1:, 1, 1:); pp2 => p(1:, 2, 1:)
1640  gamma1 => gamma(1:, 1, 1:); gamma2 => gamma(1:, 2, 1:)
1641 
1642  if (blockismoving) then
1643  ss1 => s(1:, 1, 1:, :); ss2 => s(1:, 2, 1:, :)
1644  end if
1645 
1646  iblank2 => iblank(1:, 2, 1:)
1647  viscpointer => viscjminpointer
1648 
1649  if (viscous) then
1650  rlv1 => rlv(1:, 1, 1:); rlv2 => rlv(1:, 2, 1:)
1651  end if
1652 
1653  if (equations == ransequations) dd2wall => d2wall(:, 2, :)
1654 
1655  subface_ibegor = ibegor
1656  subface_iendor = iendor
1657 
1658  subface_jbegor = kbegor
1659  subface_jendor = kendor
1660 
1661  !===============================================================
1662 
1663  case (jmax)
1664  rangeface(1, 1:2) = rangecell(1, 1:2)
1665  rangeface(2, 1:2) = rangecell(3, 1:2)
1666  iimax = il; jjmax = kl
1667 
1668  xx1 => x(:, je - 1, :, :); xx2 => x(:, jl - 1, :, :)
1669  !
1670  ww1 => w(1:, je, 1:, :); ww2 => w(1:, jl, 1:, :)
1671  ss => sj(:, jl, :, :); fact = one
1672 
1673  pp1 => p(1:, je, 1:); pp2 => p(1:, jl, 1:)
1674  gamma1 => gamma(1:, je, 1:); gamma2 => gamma(1:, jl, 1:)
1675 
1676  if (blockismoving) then
1677  ss1 => s(1:, je - 1, 1:, :); ss2 => s(1:, je, 1:, :)
1678  end if
1679 
1680  iblank2 => iblank(1:, jl, 1:)
1681  viscpointer => viscjmaxpointer
1682 
1683  if (viscous) then
1684  rlv1 => rlv(1:, je, 1:); rlv2 => rlv(1:, jl, 1:)
1685  end if
1686 
1687  if (equations == ransequations) dd2wall => d2wall(:, jl, :)
1688 
1689  subface_ibegor = ibegor
1690  subface_iendor = iendor
1691 
1692  subface_jbegor = kbegor
1693  subface_jendor = kendor
1694 
1695  !===============================================================
1696 
1697  case (kmin)
1698  rangeface(1, 1:2) = rangecell(1, 1:2)
1699  rangeface(2, 1:2) = rangecell(2, 1:2)
1700  iimax = il; jjmax = jl
1701 
1702  xx1 => x(:, :, 0, :); xx2 => x(:, :, 1, :)
1703  !
1704  ww1 => w(1:, 1:, 1, :); ww2 => w(1:, 1:, 2, :)
1705  ss => sk(:, :, 1, :); fact = -one
1706 
1707  pp1 => p(1:, 1:, 1); pp2 => p(1:, 1:, 2)
1708  gamma1 => gamma(1:, 1:, 1); gamma2 => gamma(1:, 1:, 2)
1709 
1710  if (blockismoving) then
1711  ss1 => s(1:, 1:, 1, :); ss2 => s(1:, 1:, 2, :)
1712  end if
1713 
1714  iblank2 => iblank(1:, 1:, 2)
1715  viscpointer => visckminpointer
1716 
1717  if (viscous) then
1718  rlv1 => rlv(1:, 1:, 1); rlv2 => rlv(1:, 1:, 2)
1719  end if
1720 
1721  if (equations == ransequations) dd2wall => d2wall(:, :, 2)
1722 
1723  subface_ibegor = ibegor
1724  subface_iendor = iendor
1725 
1726  subface_jbegor = jbegor
1727  subface_jendor = jendor
1728 
1729  !===============================================================
1730 
1731  case (kmax)
1732  rangeface(1, 1:2) = rangecell(1, 1:2)
1733  rangeface(2, 1:2) = rangecell(2, 1:2)
1734  iimax = il; jjmax = jl
1735 
1736  xx1 => x(:, :, ke - 1, :); xx2 => x(:, :, kl - 1, :)
1737  !
1738  ww1 => w(1:, 1:, ke, :); ww2 => w(1:, 1:, kl, :)
1739  ss => sk(:, :, kl, :); fact = one
1740 
1741  pp1 => p(1:, 1:, ke); pp2 => p(1:, 1:, kl)
1742  gamma1 => gamma(1:, 1:, ke); gamma2 => gamma(1:, 1:, kl)
1743 
1744  if (blockismoving) then
1745  ss1 => s(1:, 1:, ke - 1, :); ss2 => s(1:, 1:, ke, :)
1746  end if
1747 
1748  iblank2 => iblank(1:, 1:, kl)
1749  viscpointer => visckmaxpointer
1750 
1751  if (viscous) then
1752  rlv1 => rlv(1:, 1:, ke); rlv2 => rlv(1:, 1:, kl)
1753  end if
1754 
1755  if (equations == ransequations) dd2wall => d2wall(:, :, kl)
1756 
1757  subface_ibegor = ibegor
1758  subface_iendor = iendor
1759 
1760  subface_jbegor = jbegor
1761  subface_jendor = jendor
1762 
1763  end select
1764  !
1765  ! The actual part for storing the data. Determine the variable
1766  ! to be written and loop over the boundary faces of the subface.
1767  !
1768  ! Determine the variable to be written.
1769 
1770  varname:select case(solname)
1771 
1772  case (cgnsdensity)
1773 
1774  do j = rangeface(2, 1), rangeface(2, 2)
1775  do i = rangeface(1, 1), rangeface(1, 2)
1776  nn = nn + 1
1777  buffer(nn) = half * (ww1(i, j, irho) + ww2(i, j, irho))
1778  end do
1779  end do
1780 
1781  !===============================================================
1782 
1783  case (cgnspressure)
1784 
1785  do j = rangeface(2, 1), rangeface(2, 2)
1786  do i = rangeface(1, 1), rangeface(1, 2)
1787  nn = nn + 1
1788  buffer(nn) = half * (pp1(i, j) + pp2(i, j))
1789  end do
1790  end do
1791 
1792  !===============================================================
1793 
1794  case (cgnstemp)
1795 
1796  do j = rangeface(2, 1), rangeface(2, 2)
1797  do i = rangeface(1, 1), rangeface(1, 2)
1798  nn = nn + 1
1799  buffer(nn) = (pp1(i, j) + pp2(i, j)) &
1800  / (rgas * (ww1(i, j, irho) + ww2(i, j, irho)))
1801  end do
1802  end do
1803 
1804  !===============================================================
1805 
1806  case (cgnsvelx)
1807 
1808  do j = rangeface(2, 1), rangeface(2, 2)
1809  do i = rangeface(1, 1), rangeface(1, 2)
1810  nn = nn + 1
1811  if (viscoussurfacevelocities .and. viscous) then
1812  buffer(nn) = ww2(i, j, ivx)
1813  else
1814  buffer(nn) = half * (ww1(i, j, ivx) + ww2(i, j, ivx))
1815  end if
1816  end do
1817  end do
1818 
1819  !===============================================================
1820 
1821  case (cgnsvely)
1822 
1823  do j = rangeface(2, 1), rangeface(2, 2)
1824  do i = rangeface(1, 1), rangeface(1, 2)
1825  nn = nn + 1
1826  if (viscoussurfacevelocities .and. viscous) then
1827  buffer(nn) = ww2(i, j, ivy)
1828  else
1829  buffer(nn) = half * (ww1(i, j, ivy) + ww2(i, j, ivy))
1830  end if
1831  end do
1832  end do
1833 
1834  !===============================================================
1835 
1836  case (cgnsvelz)
1837 
1838  do j = rangeface(2, 1), rangeface(2, 2)
1839  do i = rangeface(1, 1), rangeface(1, 2)
1840  nn = nn + 1
1841  if (viscoussurfacevelocities .and. viscous) then
1842  buffer(nn) = ww2(i, j, ivz)
1843  else
1844  buffer(nn) = half * (ww1(i, j, ivz) + ww2(i, j, ivz))
1845  end if
1846 
1847  end do
1848  end do
1849 
1850  !===============================================================
1851 
1852  case (cgnsrelvelx)
1853  do j = rangeface(2, 1), rangeface(2, 2)
1854  do i = rangeface(1, 1), rangeface(1, 2)
1855  nn = nn + 1
1856  if (viscoussurfacevelocities .and. viscous) then
1857  buffer(nn) = ww2(i, j, ivx) - ss2(i, j, 1)
1858  else
1859  buffer(nn) = half * (ww1(i, j, ivx) + ww2(i, j, ivx)) - half * (ss1(i, j, 1) + ss2(i, j, 1))
1860  end if
1861  end do
1862  end do
1863 
1864  !===============================================================
1865 
1866  case (cgnsrelvely)
1867  do j = rangeface(2, 1), rangeface(2, 2)
1868  do i = rangeface(1, 1), rangeface(1, 2)
1869  nn = nn + 1
1870  if (viscoussurfacevelocities .and. viscous) then
1871  buffer(nn) = ww2(i, j, ivy) - ss2(i, j, 2)
1872  else
1873  buffer(nn) = half * (ww1(i, j, ivy) + ww2(i, j, ivy)) - half * (ss1(i, j, 2) + ss2(i, j, 2))
1874  end if
1875  end do
1876  end do
1877 
1878  !===============================================================
1879 
1880  case (cgnsrelvelz)
1881  do j = rangeface(2, 1), rangeface(2, 2)
1882  do i = rangeface(1, 1), rangeface(1, 2)
1883  nn = nn + 1
1884  if (viscoussurfacevelocities .and. viscous) then
1885  buffer(nn) = ww2(i, j, ivz) - ss2(i, j, 3)
1886  else
1887  buffer(nn) = half * (ww1(i, j, ivz) + ww2(i, j, ivz)) - half * (ss1(i, j, 3) + ss2(i, j, 3))
1888  end if
1889  end do
1890  end do
1891 
1892  !================================================================
1893 
1894  case (cgnscp)
1895 
1896  do j = rangeface(2, 1), rangeface(2, 2)
1897  do i = rangeface(1, 1), rangeface(1, 2)
1898  nn = nn + 1
1899 
1900  call computecoeffpressure()
1901  buffer(nn) = coeffpressure
1902 
1903  end do
1904  end do
1905 
1906  case (cgnsptotloss)
1907 
1908  ! First compute the total pressure of the free stream.
1909 
1910  call computeptot(rhoinf, uinf, zero, zero, &
1911  pinf, ptotinf)
1912  ptotinf = one / ptotinf
1913 
1914  ! Loop over the faces and compute the total pressure loss.
1915 
1916  do j = rangeface(2, 1), rangeface(2, 2)
1917  do i = rangeface(1, 1), rangeface(1, 2)
1918 
1919  psurf = half * (pp1(i, j) + pp2(i, j))
1920  rsurf = half * (ww1(i, j, irho) + ww2(i, j, irho))
1921  usurf = half * (ww1(i, j, ivx) + ww2(i, j, ivx))
1922  vsurf = half * (ww1(i, j, ivy) + ww2(i, j, ivy))
1923  wsurf = half * (ww1(i, j, ivz) + ww2(i, j, ivz))
1924 
1925  call computeptot(rsurf, usurf, vsurf, wsurf, &
1926  psurf, ptot)
1927 
1928  nn = nn + 1
1929  buffer(nn) = one - ptot * ptotinf
1930  end do
1931  end do
1932 
1933  !===============================================================
1934 
1935  case (cgnsmach)
1936 
1937  do j = rangeface(2, 1), rangeface(2, 2)
1938  do i = rangeface(1, 1), rangeface(1, 2)
1939 
1940  psurf = half * (pp1(i, j) + pp2(i, j))
1941  rsurf = half * (ww1(i, j, irho) + ww2(i, j, irho))
1942  usurf = half * (ww1(i, j, ivx) + ww2(i, j, ivx))
1943  vsurf = half * (ww1(i, j, ivy) + ww2(i, j, ivy))
1944  wsurf = half * (ww1(i, j, ivz) + ww2(i, j, ivz))
1945  m2surf = rsurf * (usurf**2 + vsurf**2 + wsurf**2) &
1946  / (half * (gamma1(i, j) + gamma2(i, j)) * psurf)
1947 
1948  nn = nn + 1
1949  buffer(nn) = sqrt(m2surf)
1950  end do
1951  end do
1952 
1953  !===============================================================
1954 
1955  case (cgnsrelmach)
1956 
1957  do j = rangeface(2, 1), rangeface(2, 2)
1958  do i = rangeface(1, 1), rangeface(1, 2)
1959 
1960  psurf = half * (pp1(i, j) + pp2(i, j))
1961  rsurf = half * (ww1(i, j, irho) + ww2(i, j, irho))
1962  usurf = half * (ww1(i, j, ivx) + ww2(i, j, ivx)) - half * (ss1(i, j, 1) + ss2(i, j, 1))
1963  vsurf = half * (ww1(i, j, ivy) + ww2(i, j, ivy)) - half * (ss1(i, j, 2) + ss2(i, j, 2))
1964  wsurf = half * (ww1(i, j, ivz) + ww2(i, j, ivz)) - half * (ss1(i, j, 3) + ss2(i, j, 3))
1965  m2surf = rsurf * (usurf**2 + vsurf**2 + wsurf**2) &
1966  / (half * (gamma1(i, j) + gamma2(i, j)) * psurf)
1967 
1968  nn = nn + 1
1969  buffer(nn) = sqrt(m2surf)
1970  end do
1971  end do
1972 
1973  ! ================================================================
1974 
1975  case (cgnsskinfmag, cgnsyplus, &
1977 
1978  ! To avoid a lot of code duplication these 5 variables are
1979  ! treated together.
1980 
1981  ! Multiplication factor to obtain the skin friction from
1982  ! the wall shear stress.
1983 
1984  fact = two / (gammainf * pinf * machcoef * machcoef)
1985 
1986  ! Loop over the given range of faces. As the viscous data is
1987  ! only present in the owned faces, the values of the halo's
1988  ! are set equal to the nearest physical face. Therefore the
1989  ! working indices are ii and jj.
1990  do j = rangeface(2, 1), rangeface(2, 2)
1991 
1992  ! if statements are used to copy the value of the interior
1993  ! cell since the value isn't defined in the rind cell
1994 
1995  if (present(jbeg) .and. present(jend) .and. (userindlayer)) then
1996  jor = j + subface_jbegor - 1
1997  if (jor == jbeg) then
1998  jj = j + 1
1999  else if (jor == jend + 1) then
2000  jj = j - 1
2001  else
2002  jj = j
2003  end if
2004  else
2005  jj = j
2006 
2007  end if
2008 
2009  do i = rangeface(1, 1), rangeface(1, 2)
2010  if (present(ibeg) .and. present(iend) .and. (userindlayer)) then
2011  ior = i + subface_ibegor - 1
2012  if (ior == ibeg) then
2013  ii = i + 1
2014  else if (ior == iend + 1) then
2015  ii = i - 1
2016  else
2017  ii = i
2018  end if
2019  else
2020  ii = i
2021  end if
2022 
2023  ! Determine the viscous subface on which this
2024  ! face is located.
2025 
2026  mm = viscpointer(ii, jj)
2027 
2028  ! Store the 6 components of the viscous stress tensor
2029  ! a bit easier.
2030 
2031  tauxx = viscsubface(mm)%tau(ii, jj, 1)
2032  tauyy = viscsubface(mm)%tau(ii, jj, 2)
2033  tauzz = viscsubface(mm)%tau(ii, jj, 3)
2034  tauxy = viscsubface(mm)%tau(ii, jj, 4)
2035  tauxz = viscsubface(mm)%tau(ii, jj, 5)
2036  tauyz = viscsubface(mm)%tau(ii, jj, 6)
2037 
2038  ! Compute the "unit" force on this face. The unit normal
2039  ! is outward pointing per definition. A minus sign is
2040  ! present, because of the definition of the viscous
2041  ! stress tensor. Note that in the normal the indices i
2042  ! and j could be used. However this is not done.
2043 
2044  norm(1) = bcdata(mm)%norm(ii, jj, 1)
2045  norm(2) = bcdata(mm)%norm(ii, jj, 2)
2046  norm(3) = bcdata(mm)%norm(ii, jj, 3)
2047 
2048  fx = -(tauxx * norm(1) + tauxy * norm(2) + tauxz * norm(3))
2049  fy = -(tauxy * norm(1) + tauyy * norm(2) + tauyz * norm(3))
2050  fz = -(tauxz * norm(1) + tauyz * norm(2) + tauzz * norm(3))
2051 
2052  fn = fx * norm(1) + fy * norm(2) + fz * norm(3)
2053 
2054  fx = fx - fn * norm(1)
2055  fy = fy - fn * norm(2)
2056  fz = fz - fn * norm(3)
2057 
2058  ! Determine the variable to be stored and compute it.
2059  ! Note that an offset of -1 must be used in dd2Wall,
2060  ! because the original array, d2Wall, starts at 2.
2061  ! First update the counter nn.
2062 
2063  nn = nn + 1
2064 
2065  select case (solname)
2066  case (cgnsskinfmag)
2067  buffer(nn) = fact * sqrt(fx * fx + fy * fy + fz * fz)
2068 
2069  case (cgnsskinfx)
2070  buffer(nn) = fact * fx
2071 
2072  case (cgnsskinfy)
2073  buffer(nn) = fact * fy
2074 
2075  case (cgnsskinfz)
2076  buffer(nn) = fact * fz
2077 
2078  case (cgnsforceindragdir)
2079 
2080  ! Compute pressure coefficient projected in the drag direction
2081  call computecoeffpressure()
2082  buffer(nn) = coeffpressure * dot_product(norm, dragdirection)
2083 
2084  ! Add skin friction projected in the drag direction
2085  buffer(nn) = buffer(nn) + fact * dot_product((/fx, fy, fz/), dragdirection)
2086 
2087  case (cgnsforceinliftdir)
2088 
2089  ! Compute pressure coefficient projected in the lift direction
2090  call computecoeffpressure()
2091  buffer(nn) = coeffpressure * dot_product(norm, liftdirection)
2092 
2093  ! Add skin friction projected in the lift direction
2094  buffer(nn) = buffer(nn) + fact * dot_product((/fx, fy, fz/), liftdirection)
2095 
2096  case (cgnsyplus)
2097  rsurf = half * (ww1(ii, jj, irho) + ww2(ii, jj, irho))
2098  musurf = half * (rlv1(ii, jj) + rlv2(ii, jj))
2099  buffer(nn) = sqrt(rsurf * sqrt(fx * fx + fy * fy + fz * fz)) &
2100  * dd2wall(ii - 1, jj - 1) / musurf
2101  end select
2102 
2103  end do
2104  end do
2105 
2106  ! ================================================================
2107 
2108  case (cgnsstanton)
2109 
2110  ! Some constants needed to compute the stanton number.
2111 
2112  gm1 = gammainf - one
2113  a2tot = gammainf * pinf * (one + half * gm1 * machcoef * machcoef) &
2114  / rhoinf
2115  fact = machcoef * sqrt(gammainf * pinf * rhoinf) / gm1
2116 
2117  ! Loop over the given range of faces. As the viscous data is
2118  ! only present in the owned faces, the values of the halo's
2119  ! are set equal to the nearest physical face. Therefore the
2120  ! working indices are ii and jj.
2121  do j = rangeface(2, 1), rangeface(2, 2)
2122 
2123  ! if statements are used to copy the value of the interior
2124  ! cell since the value isn't defined in the rind cell
2125 
2126  if (present(jbeg) .and. present(jend) .and. (userindlayer)) then
2127  jor = j + jbegor - 1
2128  if (jor == jbeg) then
2129  jj = j + 1
2130  else if (jor == jend + 1) then
2131  jj = j - 1
2132  else
2133  jj = j
2134  end if
2135  else
2136  jj = j
2137 
2138  end if
2139 
2140  do i = rangeface(1, 1), rangeface(1, 2)
2141  if (present(ibeg) .and. present(iend) .and. (userindlayer)) then
2142  ior = i + ibegor - 1
2143  if (ior == ibeg) then
2144  ii = i + 1
2145  else if (ior == iend + 1) then
2146  ii = i - 1
2147  else
2148  ii = i
2149  end if
2150  else
2151  ii = i
2152  end if
2153  ! Determine the viscous subface on which this
2154  ! face is located.
2155 
2156  mm = viscpointer(ii, jj)
2157 
2158  ! Compute the heat flux. Multipy with the sign of the
2159  ! normal to obtain the correct value.
2160 
2161  qw = viscsubface(mm)%q(ii, jj, 1) * bcdata(mm)%norm(ii, jj, 1) &
2162  + viscsubface(mm)%q(ii, jj, 2) * bcdata(mm)%norm(ii, jj, 2) &
2163  + viscsubface(mm)%q(ii, jj, 3) * bcdata(mm)%norm(ii, jj, 3)
2164 
2165  ! Compute the speed of sound squared at the wall and
2166  ! the stanton number, which is stored in buffer.
2167 
2168  a2 = half * (gamma1(ii, jj) + gamma2(ii, jj)) &
2169  * (pp1(ii, jj) + pp2(ii, jj)) &
2170  / (ww1(ii, jj, irho) + ww2(ii, jj, irho))
2171 
2172  nn = nn + 1
2173  buffer(nn) = qw / (fact * (a2tot - a2))
2174 
2175  end do
2176  end do
2177 
2178  ! ================================================================
2179 
2180  case (cgnsblank)
2181 
2182  ! Loop over the given range of faces. Since iblanks are set
2183  ! to 2 for boundary conditions and >= 10 for the boundary,
2184  ! take the minimum of the value and 1, so that cells with
2185  ! valid data always have an iblank of 1.
2186 
2187  do j = rangeface(2, 1), rangeface(2, 2)
2188  do i = rangeface(1, 1), rangeface(1, 2)
2189  nn = nn + 1
2190  buffer(nn) = real(min(iblank2(i, j), 1_inttype), realtype)
2191  end do
2192  end do
2193 
2194  case (cgnssepsensorks)
2195 
2196  do j = rangeface(2, 1), rangeface(2, 2)
2197  if (present(jbeg) .and. present(jend) .and. (userindlayer)) then
2198  jor = j + jbegor - 1
2199  if (jor == jbeg) then
2200  jj = j + 1
2201  else if (jor == jend + 1) then
2202  jj = j - 1
2203  else
2204  jj = j
2205  end if
2206  else
2207  jj = j
2208 
2209  end if
2210 
2211  do i = rangeface(1, 1), rangeface(1, 2)
2212 
2213  if (present(ibeg) .and. present(iend) .and. (userindlayer)) then
2214  ior = i + ibegor - 1
2215  if (ior == ibeg) then
2216  ii = i + 1
2217  else if (ior == iend + 1) then
2218  ii = i - 1
2219  else
2220  ii = i
2221  end if
2222  else
2223  ii = i
2224  end if
2225 
2226  nn = nn + 1
2227 
2228  ! Get normalized surface velocity:
2229  v(1) = ww2(ii, jj, ivx)
2230  v(2) = ww2(ii, jj, ivy)
2231  v(3) = ww2(ii, jj, ivz)
2232 
2233  ! Normalize
2234  v = v / (sqrt(v(1)**2 + v(2)**2 + v(3)**2) + 1e-16)
2235  mm = viscpointer(ii, jj)
2236 
2237  norm(1) = bcdata(mm)%norm(ii, jj, 1)
2238  norm(2) = bcdata(mm)%norm(ii, jj, 2)
2239  norm(3) = bcdata(mm)%norm(ii, jj, 3)
2240 
2241  vectdotproductfsnormal = veldirfreestream(1) * norm(1) + &
2242  veldirfreestream(2) * norm(2) + &
2243  veldirfreestream(3) * norm(3)
2244 
2245  vecttangential(1) = veldirfreestream(1) - vectdotproductfsnormal * norm(1)
2246  vecttangential(2) = veldirfreestream(2) - vectdotproductfsnormal * norm(2)
2247  vecttangential(3) = veldirfreestream(3) - vectdotproductfsnormal * norm(3)
2248 
2249  vecttangential = vecttangential / (sqrt(vecttangential(1)**2 + vecttangential(2)**2 + &
2250  vecttangential(3)**2) + 1e-16)
2251 
2252  ! computing separation sensor
2253  ! velocity dot products
2254  sensor = (v(1) * vecttangential(1) + v(2) * vecttangential(2) + &
2255  v(3) * vecttangential(3))
2256 
2257  ! sepsensor value
2258  sensor = (cos(degtorad * sepsensorksphi) - sensor) / &
2259  (-cos(degtorad * sepsensorksphi) + cos(zero) + 1e-16)
2260 
2261  buffer(nn) = sensor
2262  end do
2263  end do
2264 
2265  case (cgnssepsensorksarea)
2266 
2267  do j = rangeface(2, 1), rangeface(2, 2)
2268  if (present(jbeg) .and. present(jend) .and. (userindlayer)) then
2269  jor = j + jbegor - 1
2270  if (jor == jbeg) then
2271  jj = j + 1
2272  else if (jor == jend + 1) then
2273  jj = j - 1
2274  else
2275  jj = j
2276  end if
2277  else
2278  jj = j
2279 
2280  end if
2281 
2282  do i = rangeface(1, 1), rangeface(1, 2)
2283 
2284  if (present(ibeg) .and. present(iend) .and. (userindlayer)) then
2285  ior = i + ibegor - 1
2286  if (ior == ibeg) then
2287  ii = i + 1
2288  else if (ior == iend + 1) then
2289  ii = i - 1
2290  else
2291  ii = i
2292  end if
2293  else
2294  ii = i
2295  end if
2296 
2297  nn = nn + 1
2298 
2299  ! Get normalized surface velocity:
2300  v(1) = ww2(ii, jj, ivx)
2301  v(2) = ww2(ii, jj, ivy)
2302  v(3) = ww2(ii, jj, ivz)
2303 
2304  ! Normalize
2305  v = v / (sqrt(v(1)**2 + v(2)**2 + v(3)**2) + 1e-16)
2306  mm = viscpointer(ii, jj)
2307 
2308  norm(1) = bcdata(mm)%norm(ii, jj, 1)
2309  norm(2) = bcdata(mm)%norm(ii, jj, 2)
2310  norm(3) = bcdata(mm)%norm(ii, jj, 3)
2311 
2312  vectdotproductfsnormal = veldirfreestream(1) * norm(1) + &
2313  veldirfreestream(2) * norm(2) + &
2314  veldirfreestream(3) * norm(3)
2315 
2316  vecttangential(1) = veldirfreestream(1) - vectdotproductfsnormal * norm(1)
2317  vecttangential(2) = veldirfreestream(2) - vectdotproductfsnormal * norm(2)
2318  vecttangential(3) = veldirfreestream(3) - vectdotproductfsnormal * norm(3)
2319 
2320  vecttangential = vecttangential / (sqrt(vecttangential(1)**2 + vecttangential(2)**2 + &
2321  vecttangential(3)**2) + 1e-16)
2322 
2323  ! computing separation sensor
2324  ! velocity dot products
2325  sensor = (v(1) * vecttangential(1) + v(2) * vecttangential(2) + &
2326  v(3) * vecttangential(3))
2327 
2328  ! sepsensor value
2329  sensor = (cos(degtorad * sepsensorksphi) - sensor) / &
2330  (-cos(degtorad * sepsensorksphi) + cos(zero) + 1e-16)
2331 
2332  sensor = one / (one + exp(-2 * sepsensorkssharpness * (sensor + sepsensorksoffset)))
2333 
2334  buffer(nn) = sensor
2335  end do
2336  end do
2337 
2338  case (cgnssepsensor)
2339  do j = rangeface(2, 1), rangeface(2, 2)
2340  do i = rangeface(1, 1), rangeface(1, 2)
2341  nn = nn + 1
2342  ! Get normalized surface velocity:
2343  v(1) = ww2(i, j, ivx)
2344  v(2) = ww2(i, j, ivy)
2345  v(3) = ww2(i, j, ivz)
2346 
2347  ! Normalize
2348  v = v / (sqrt(v(1)**2 + v(2)**2 + v(3)**2) + 1e-16)
2349 
2350  ! Dot product with free stream
2351  sensor = -dot_product(v, veldirfreestream)
2352 
2353  !Now run through a smooth heaviside function:
2354  sensor = one / (one + exp(-2 * sepsensorsharpness * (sensor - sepsensoroffset)))
2355  buffer(nn) = sensor
2356  end do
2357  end do
2358 
2359  case (cgnscavitation)
2360  fact = two / (gammainf * pinf * machcoef * machcoef)
2361  do j = rangeface(2, 1), rangeface(2, 2)
2362  do i = rangeface(1, 1), rangeface(1, 2)
2363 
2364  nn = nn + 1
2365  ! Get local pressure
2366  plocal = half * (pp1(i, j) + pp2(i, j))
2367 
2368  sensor1 = (-(fact) * (plocal - pinf)) - cavitationnumber
2369  sensor1 = (sensor1**cavexponent) / (one + exp(2 * cavsensorsharpness * (-sensor1 + cavsensoroffset)))
2370  buffer(nn) = sensor1
2371  !print*, sensor
2372  end do
2373  end do
2374  end select varname
2375 
2376  contains
2377 
2379  implicit none
2380 
2381  ! Get frame rotation rate and local surface coordinates
2382  ! by averaging wall and halo cell centers
2383  ! (xx1,xx2 are pointers to the mesh coordinates, see block.F90)
2384  rrate_ = cgnsdoms(1)%rotrate
2385  r_(1) = (half * (xx1(i, j, 1) + xx2(i, j, 1)))
2386  r_(2) = (half * (xx1(i, j, 2) + xx2(i, j, 2)))
2387  r_(3) = (half * (xx1(i, j, 3) + xx2(i, j, 3)))
2388  ! calc cross-product between rotation rate and r_
2389  ! to obtain local apparent wall velocity
2390  wcrossr(1) = rrate_(2) * r_(3) - rrate_(3) * r_(2)
2391  wcrossr(2) = rrate_(3) * r_(1) - rrate_(1) * r_(3)
2392  wcrossr(3) = rrate_(1) * r_(2) - rrate_(2) * r_(1)
2393  rot_speed2 = wcrossr(1)**2 + wcrossr(2)**2 + wcrossr(3)**2
2394  coeffpressure = ((half * (pp1(i, j) + pp2(i, j)) - pinf) * pref) &
2395  / (half * (rhoinfdim) * (uinfdim2 + rot_speed2))
2396  ! Comments on the Cp calculation above:
2397  !
2398  ! Cp = (P_i - P_0) / (0.5*rho*(U_a)^2)
2399  !
2400  ! Numerator (dimensionalized):
2401  ! (P_i-P_0) -> (half*(pp1(i,j)+pp2(i,j))-pInf) * pRef
2402  ! P_i is given by the average of the wall and halo cell
2403  ! (see comment at the beginning of storeSurfsolInBuffer)
2404  ! pp1, pp2 are (nondimensional) pressure pointers, e.g. pp1 => p(1,1:,1:)
2405  !
2406  ! Denominator (dimensionalized): (0.5*rho*(U_a)^2) ->
2407  ! (half*(rhoInfDim)*(uInfDim2 + rot_speed2))
2408  ! The local velocity term includes the rotational components!
2409  end subroutine computecoeffpressure
2410 
2411  end subroutine storesurfsolinbuffer
2412 
2413  subroutine storeoldsolinbuffer(buffer, ind, wID, &
2414  iBeg, iEnd, jBeg, jEnd, kBeg, kEnd)
2415  !
2416  ! storeOldSolInBuffer stores the given range of the wID'th
2417  ! conservative variable of an old solution in buffer. Needed for
2418  ! a time accurate restart. It is assumed that the variables in
2419  ! blockPointers already point to the correct block.
2420  !
2421  use blockpointers
2422  use constants
2423  implicit none
2424  !
2425  ! Subroutine arguments.
2426  !
2427  integer(kind=intType), intent(in) :: ind, wID
2428  integer(kind=intType), intent(in) :: iBeg, iEnd, jBeg, jEnd
2429  integer(kind=intType), intent(in) :: kBeg, kEnd
2430 
2431  real(kind=realtype), dimension(*), intent(out) :: buffer
2432  !
2433  ! Local variables.
2434  !
2435  integer(kind=intType) :: i, j, k, nOld, nn
2436 
2437  ! Store the index in wOld a bit easier.
2438 
2439  nold = ind - 1
2440 
2441  ! Loop over the cell range of the block and copy the wID'th
2442  ! variable in buffer.
2443 
2444  nn = 0
2445 
2446  do k = kbeg, kend
2447  do j = jbeg, jend
2448  do i = ibeg, iend
2449  nn = nn + 1; buffer(nn) = wold(nold, i, j, k, wid)
2450  end do
2451  end do
2452  end do
2453 
2454  end subroutine storeoldsolinbuffer
2455 
2456  subroutine describescheme(string)
2457  !
2458  ! describeScheme gives a short description about the scheme
2459  ! used to obtain the solution. The description is stored in the
2460  ! character array string.
2461  !
2462  use constants
2464  use inputphysics
2465  use flowvarrefstate
2467  implicit none
2468  !
2469  ! Subroutine arguments.
2470  !
2471  character(len=*), intent(out) :: string
2472 
2473  character(len=maxStringLen) :: upwindFormat = "(A, F7.3, A)"
2474 
2475  ! Write the basic scheme info.
2476 
2477  select case (spacediscr)
2478  case (dissscalar)
2479  write (string, stringsci5) "Scalar dissipation scheme, k2 = ", vis2, ", k4 = ", vis4, "."
2480  case (dissmatrix)
2481  write (string, stringsci5) "Matrix dissipation scheme, k2 = ", vis2, ", k4 = ", vis4, "."
2482  case (disscusp)
2483  write (string, stringsci5) "CUSP dissipation scheme, k2 = ", vis2, ", k4 = ", vis4, "."
2484  case (upwind)
2485  select case (limiter)
2486  case (firstorder)
2487  write (string, stringspace) "First order upwind scheme."
2488  case (nolimiter)
2489  write (string, upwindformat) "Second order upwind scheme using linear reconstruction, &
2490  &i.e. no limiter, kappa = ", kappacoef, "."
2491  case (vanalbeda)
2492  write (string, upwindformat) "Second order upwind scheme with Van Albada limiter, &
2493  &kappa =", kappacoef, "."
2494  case (minmod)
2495  write (string, upwindformat) "Second order upwind scheme with Minmod limiter, &
2496  &kappa =", kappacoef, "."
2497  end select
2498 
2499  select case (riemann)
2500  case (roe)
2501  write (string, stringspace) trim(string), "Roe's approximate Riemann Solver."
2502  case (vanleer)
2503  write (string, stringspace) trim(string), "Van Leer flux vector splitting."
2504  case (ausmdv)
2505  write (string, stringspace) trim(string), "ausmdv flux vector splitting."
2506  end select
2507 
2508  end select
2509 
2510  ! In case of the scalar dissipation scheme, write whether or not
2511  ! directional scaling has been applied.
2512 
2513  if (spacediscr == dissscalar) then
2514  if (dirscaling) then
2515  write (string, "(2(A, 1X), ES12.5, A)") trim(string), &
2516  "Directional scaling of dissipation with exponent", adis, "."
2517  else
2518  write (string, stringspace) trim(string), "No directional scaling of dissipation."
2519  end if
2520  end if
2521 
2522  ! For the Euler equations, write the inviscid wall boundary
2523  ! condition treatment.
2524 
2525  if (equations == eulerequations) then
2526  select case (eulerwallbctreatment)
2527  case (constantpressure)
2528  write (string, stringspace) trim(string), "Zero normal pressure gradient", &
2529  "for inviscid wall boundary conditions."
2530  case (linextrapolpressure)
2531  write (string, stringspace) trim(string), "Linear extrapolation of normal pressure gradient", &
2532  "for inviscid wall boundary conditions."
2533  case (quadextrapolpressure)
2534  write (string, stringspace) trim(string), "Quadratic extrapolation of normal pressure gradIent", &
2535  "for inviscid wall boundary conditions."
2536  case (normalmomentum)
2537  write (string, stringspace) trim(string), &
2538  "Normal momentum equation used to determine pressure gradient", &
2539  "for inviscid wall boundary conditions."
2540  end select
2541  end if
2542 
2543  ! If preconditioning is used, write the preconditioner.
2544 
2545  select case (precond)
2546  case (turkel)
2547  write (string, stringspace) trim(string), "Turkel preconditioner for inviscid fluxes."
2548  case (choimerkle)
2549  write (string, stringspace) trim(string), "Choi Merkle preconditioner for inviscid fluxes."
2550  end select
2551 
2552  ! For a viscous computation write that a central discretization
2553  ! is used for the viscous fluxes.
2554 
2555  if (viscous) then
2556  write (string, stringspace) trim(string), "Central discretization for viscous fluxes."
2557  end if
2558 
2559  end subroutine describescheme
2560 
2561  subroutine isosurfnames(solNames)
2562  !
2563  ! isoNames sets the names for the volume variables to be
2564  ! written to the isosurfaces. Sids convention names are
2565  ! used as much as possible.
2566  !
2567  use constants
2568  use cgnsnames
2569  use inputphysics
2570  use flowvarrefstate
2571  use extraoutput
2572  implicit none
2573  !
2574  ! Subroutine argument.
2575  !
2576  character(len=*), dimension(*), intent(out) :: solNames
2577  !
2578  ! Local variables.
2579  !
2580  integer(kind=intType) :: nn
2581 
2582  ! Check the additional variables to be written -- there are no
2583  ! default variables already written
2584  nn = 0
2585  if (isowriterho) then
2586  nn = nn + 1
2587  solnames(nn) = cgnsdensity
2588  end if
2589 
2590  if (isowritevx) then
2591  nn = nn + 1
2592  solnames(nn) = cgnsvelx
2593  end if
2594 
2595  if (isowritevy) then
2596  nn = nn + 1
2597  solnames(nn) = cgnsvely
2598  end if
2599 
2600  if (isowritevz) then
2601  nn = nn + 1
2602  solnames(nn) = cgnsvelz
2603  end if
2604 
2605  if (isowritep) then
2606  nn = nn + 1
2607  solnames(nn) = cgnspressure
2608  end if
2609 
2610  if (isowriteturb) then
2611 
2612  select case (turbmodel)
2613 
2615  nn = nn + 1
2616  solnames(nn) = cgnsturbsanu
2617 
2619  nn = nn + 1
2620  solnames(nn) = cgnsturbk
2621  nn = nn + 1
2622  solnames(nn) = cgnsturbomega
2623 
2624  case (ktau)
2625  nn = nn + 1
2626  solnames(nn) = cgnsturbk
2627  nn = nn + 1
2628  solnames(nn) = cgnsturbtau
2629 
2630  case (v2f)
2631  nn = nn + 1
2632  solnames(nn) = cgnsturbk
2633  nn = nn + 1
2634  solnames(nn) = cgnsturbepsilon
2635  nn = nn + 1
2636  solnames(nn) = cgnsturbv2
2637  nn = nn + 1
2638  solnames(nn) = cgnsturbf
2639 
2640  end select
2641 
2642  end if
2643 
2644  if (isowritemx) then
2645  nn = nn + 1
2646  solnames(nn) = cgnsmomx
2647  end if
2648 
2649  if (isowritemy) then
2650  nn = nn + 1
2651  solnames(nn) = cgnsmomy
2652  end if
2653 
2654  if (isowritemz) then
2655  nn = nn + 1
2656  solnames(nn) = cgnsmomz
2657  end if
2658 
2659  if (isowritervx) then
2660  nn = nn + 1
2661  solnames(nn) = cgnsrelvelx
2662  end if
2663 
2664  if (isowritervy) then
2665  nn = nn + 1
2666  solnames(nn) = cgnsrelvely
2667  end if
2668 
2669  if (isowritervz) then
2670  nn = nn + 1
2671  solnames(nn) = cgnsrelvelz
2672  end if
2673 
2674  if (isowriterhoe) then
2675  nn = nn + 1
2676  solnames(nn) = cgnsenergy
2677  end if
2678 
2679  if (isowritetemp) then
2680  nn = nn + 1
2681  solnames(nn) = cgnstemp
2682  end if
2683 
2684  if (isowritecp) then
2685  nn = nn + 1
2686  solnames(nn) = cgnscp
2687  end if
2688 
2689  if (isowritemach) then
2690  nn = nn + 1
2691  solnames(nn) = cgnsmach
2692  end if
2693 
2694  if (isowritermach) then
2695  nn = nn + 1
2696  solnames(nn) = cgnsrelmach
2697  end if
2698 
2699  if (isowritemachturb) then
2700  nn = nn + 1
2701  solnames(nn) = cgnsmachturb
2702  end if
2703 
2704  if (isowriteeddyvis) then
2705  nn = nn + 1
2706  solnames(nn) = cgnseddy
2707  end if
2708 
2709  if (isowriteratioeddyvis) then
2710  nn = nn + 1
2711  solnames(nn) = cgnseddyratio
2712  end if
2713 
2714  if (isowritedist) then
2715  nn = nn + 1
2716  solnames(nn) = cgnswalldist
2717  end if
2718 
2719  if (isowritevort) then
2720  nn = nn + 1
2721  solnames(nn) = cgnsvortmagn
2722  end if
2723 
2724  if (isowritevortx) then
2725  nn = nn + 1
2726  solnames(nn) = cgnsvortx
2727  end if
2728 
2729  if (isowritevorty) then
2730  nn = nn + 1
2731  solnames(nn) = cgnsvorty
2732  end if
2733 
2734  if (isowritevortz) then
2735  nn = nn + 1
2736  solnames(nn) = cgnsvortz
2737  end if
2738 
2739  if (isowriteptotloss) then
2740  nn = nn + 1
2741  solnames(nn) = cgnsptotloss
2742  end if
2743 
2744  if (isowriteresrho) then
2745  nn = nn + 1
2746  solnames(nn) = cgnsresrho
2747  end if
2748 
2749  if (isowriteresmom) then
2750  nn = nn + 1
2751  solnames(nn) = cgnsresmomx
2752 
2753  nn = nn + 1
2754  solnames(nn) = cgnsresmomy
2755 
2756  nn = nn + 1
2757  solnames(nn) = cgnsresmomz
2758  end if
2759 
2760  if (isowriteresrhoe) then
2761  nn = nn + 1
2762  solnames(nn) = cgnsresrhoe
2763  end if
2764 
2765  if (isowriteresturb) then
2766 
2767  select case (turbmodel)
2768 
2770  nn = nn + 1
2771  solnames(nn) = cgnsresnu
2772 
2774  nn = nn + 1
2775  solnames(nn) = cgnsresk
2776 
2777  nn = nn + 1
2778  solnames(nn) = cgnsresomega
2779 
2780  case (ktau)
2781  nn = nn + 1
2782  solnames(nn) = cgnsresk
2783 
2784  nn = nn + 1
2785  solnames(nn) = cgnsrestau
2786 
2787  case (v2f)
2788  nn = nn + 1
2789  solnames(nn) = cgnsresk
2790 
2791  nn = nn + 1
2792  solnames(nn) = cgnsresepsilon
2793 
2794  nn = nn + 1
2795  solnames(nn) = cgnsresv2
2796 
2797  nn = nn + 1
2798  solnames(nn) = cgnsresf
2799 
2800  end select
2801 
2802  end if
2803 
2804  if (isowriteshock) then
2805  nn = nn + 1
2806  solnames(nn) = cgnsshock
2807  end if
2808 
2809  if (isowritefilteredshock) then
2810  nn = nn + 1
2811  solnames(nn) = cgnsfilteredshock
2812  end if
2813 
2814  if (isowriteblank) then
2815  nn = nn + 1
2816  solnames(nn) = cgnsblank
2817  end if
2818 
2819  end subroutine isosurfnames
2820 
2822  !
2823  ! setHelpVariablesWriting determines the variables, which are
2824  ! needed to write the CGNS files.
2825  !
2826  use block
2827  use cgnsgrid
2828  use communication
2829  use monitor
2830  use utils, only: terminate
2831  implicit none
2832  !
2833  ! Local variables.
2834  !
2835  integer :: ierr, nSend
2836  integer, dimension(nProc) :: recvCounts, displs
2837 
2838  integer(kind=intType) :: i, nn
2839 
2840  integer(kind=intType), dimension(cgnsNDom) :: tmp
2841  integer(kind=intType), dimension(4, nDom) :: buffer
2842 
2843  ! Determine for each CGNS block how many (sub) blocks are stored
2844  ! on this processor. Note that this info is the same for all
2845  ! spectral solutions, so the 1st is fine.
2846 
2847  allocate (nblockscgnsblock(0:cgnsndom), blockscgnsblock(ndom), &
2848  stat=ierr)
2849  if (ierr /= 0) &
2850  call terminate("setHelpVariablesWriting", &
2851  "Memory allocation failure for &
2852  &nBlocksCGNSblock and blocksCGNSblock.")
2853 
2854  nblockscgnsblock = 0
2855  do nn = 1, ndom
2856  i = flowdoms(nn, 1, 1)%cgnsBlockID
2858  end do
2859 
2860  ! Put nBlocksCGNSblock in cumulative storage format.
2861  ! Store this accumulated value in tmp, which serves as
2862  ! a counter later on.
2863 
2864  do i = 1, cgnsndom
2865  tmp(i) = nblockscgnsblock(i - 1)
2866  nblockscgnsblock(i) = nblockscgnsblock(i) + tmp(i)
2867  end do
2868 
2869  ! Determine the values for blocksCGNSblock.
2870 
2871  do nn = 1, ndom
2872  i = flowdoms(nn, 1, 1)%cgnsBlockID
2873  tmp(i) = tmp(i) + 1
2874  blockscgnsblock(tmp(i)) = nn
2875  end do
2876 
2877  end subroutine sethelpvariableswriting
2878 
2880  !
2881  ! releaseHelpVariablesWriting releases the memory of the
2882  ! variables, which were needed to write the CGNS files.
2883  !
2884  use cgnsgrid
2885  use monitor
2886  use utils, only: terminate
2887  implicit none
2888  !
2889  ! Local variables
2890  !
2891  integer :: ierr
2892 
2893  ! Release the memory of the allocatable arrays in outputMod.
2894 
2895  deallocate (nblockscgnsblock, blockscgnsblock, stat=ierr)
2896  if (ierr /= 0) &
2897  call terminate("releaseHelpVariablesWriting", &
2898  "Deallocation failure for nBlocksCGNSblock, &
2899  &etc.")
2900 
2901  end subroutine releasehelpvariableswriting
2902  subroutine writecgnsheader(cgnsInd, base)
2903  !
2904  ! writeCGNSHeader writes a descriptive header to the given base
2905  ! of the given CGNS file. Only processor 0 performs this task.
2906  !
2907  use constants
2908  use cgnsgrid
2909  use cgnsnames
2910  use flowvarrefstate
2911  use su_cgns
2912  use inputphysics
2913  use inputtimespectral
2914  use monitor
2915  use utils, only: terminate, setcgnsrealtype
2916  use commonformats, only: strings
2917 
2918  implicit none
2919  !
2920  ! Subroutine arguments.
2921  !
2922  integer, intent(in) :: cgnsInd, base
2923  !
2924  ! Local variables.
2925  !
2926  integer :: ierr, realTypeCGNS
2927 
2928  real(kind=cgnsrealtype) :: val
2929 
2930  character(len=2048) :: message
2931  character(len=7) :: integerString
2932  character(len=12) :: realString
2933 
2934  ! Set the cgns real type.
2935 
2936  realtypecgns = setcgnsrealtype()
2937 
2938  ! Go to the correct position in the CGNS file.
2939 
2940  call cg_goto_f(cgnsind, base, ierr, "end")
2941  if (ierr /= cg_ok) &
2942  call terminate("writeCGNSHeader", &
2943  "Something wrong when calling cg_goto_f")
2944 
2945  ! Create a data class type node to indicate that nonDimensional
2946  ! solution data is written for which the reference state
2947  ! is known.
2948 
2949  call cg_dataclass_write_f(normalizedbydimensional, ierr)
2950  if (ierr /= cg_ok) &
2951  call terminate("writeCGNSHeader", &
2952  "Something wrong when calling &
2953  &cg_dataclass_write_f")
2954 
2955  ! Write the info about the solver used.
2956 
2957  call cg_descriptor_write_f("SolverInfo", &
2958  "ADflow multiblock code", ierr)
2959  if (ierr /= cg_ok) &
2960  call terminate("writeCGNSHeader", &
2961  "Something wrong when calling &
2962  &cg_descriptor_write_f")
2963 
2964  ! Write the info about the scheme used; message is used as
2965  ! storage for the string containing the scheme description.
2966 
2967  call describescheme(message)
2968  call cg_descriptor_write_f("DiscretizationScheme", message, ierr)
2969  if (ierr /= cg_ok) &
2970  call terminate("writeCGNSHeader", &
2971  "Something wrong when calling &
2972  &cg_descriptor_write_f")
2973 
2974  ! Write the similation type to the CGNS file.
2975 
2976  select case (equationmode)
2977 
2978  case (steady)
2979 
2980  ! Steady mode. Just write this info.
2981 
2982  call cg_simulation_type_write_f(cgnsind, base, &
2983  nontimeaccurate, ierr)
2984  if (ierr /= cg_ok) &
2985  call terminate("writeCGNSHeader", &
2986  "Something wrong when calling &
2987  &cg_simulation_type_write_f")
2988 
2989  !===============================================================
2990 
2991  case (unsteady)
2992 
2993  ! Unsteady mode. First write the simulation type.
2994 
2995  call cg_simulation_type_write_f(cgnsind, base, &
2996  timeaccurate, ierr)
2997  if (ierr /= cg_ok) &
2998  call terminate("writeCGNSHeader", &
2999  "Something wrong when calling &
3000  &cg_simulation_type_write_f")
3001 
3002  ! Write some additional stuff, like time step and
3003  ! physical time. First store it in the big string message.
3004 
3005  write (integerstring, "(i7)") timestepunsteady + &
3007  write (realstring, "(es12.5)") timeunsteady + &
3009 
3010  integerstring = adjustl(integerstring)
3011  realstring = adjustl(realstring)
3012 
3013  write (message, strings) "Unsteady time step ", trim(integerstring), ", physical time ", &
3014  trim(realstring), " seconds"
3015 
3016  ! And write the info.
3017 
3018  call cg_descriptor_write_f("UnsteadyInfo", message, ierr)
3019  if (ierr /= cg_ok) &
3020  call terminate("writeCGNSHeader", &
3021  "Something wrong when calling &
3022  &cg_descriptor_write_f")
3023 
3024  !===============================================================
3025 
3026  case (timespectral)
3027 
3028  ! Time spectral mode. This is not a predefined mode in CGNS
3029  ! and therefore use CG_UserDefined.
3030 
3031  call cg_simulation_type_write_f(cgnsind, base, &
3032  cg_userdefined, ierr)
3033  if (ierr /= cg_ok) &
3034  call terminate("writeCGNSHeader", &
3035  "Something wrong when calling &
3036  &cg_simulation_type_write_f")
3037 
3038  ! Write some info to the string message.
3039 
3040  write (integerstring, "(i7)") ntimeintervalsspectral
3041  integerstring = adjustl(integerstring)
3042 
3043  write (message, strings) "Time spectral mode for periodic problems; ", &
3044  trim(integerstring), " spectral solutions have been used to model the problem."
3045 
3046  ! And write the info.
3047 
3048  call cg_descriptor_write_f("PeriodicInfo", message, ierr)
3049  if (ierr /= cg_ok) &
3050  call terminate("writeCGNSHeader", &
3051  "Something wrong when calling &
3052  &cg_descriptor_write_f")
3053  end select
3054 
3055  ! Go back to the given base in the cgns file.
3056 
3057  call cg_goto_f(cgnsind, base, ierr, "end")
3058  if (ierr /= cg_ok) &
3059  call terminate("writeCGNSHeader", &
3060  "Something wrong when calling cg_goto_f")
3061 
3062  ! Create a flow equation set.
3063 
3064  call cg_equationset_write_f(cgnsphysdim, ierr)
3065  if (ierr /= cg_ok) &
3066  call terminate("writeCGNSHeader", &
3067  "Something wrong when calling &
3068  &cg_equationset_write_f")
3069 
3070  ! Write the rest of the physical model under the flow
3071  ! equation set just created.
3072 
3073  call cg_goto_f(cgnsind, base, ierr, &
3074  "FlowEquationSet_t", 1, "end")
3075  if (ierr /= cg_ok) &
3076  call terminate("writeCGNSHeader", &
3077  "Something wrong when calling cg_goto_f")
3078 
3079  ! Write the governing equations solved.
3080 
3081  select case (equations)
3082  case (eulerequations)
3083  call cg_governing_write_f(euler, ierr)
3084 
3085  case (nsequations)
3086  call cg_governing_write_f(nslaminar, ierr)
3087 
3088  case (ransequations)
3089  call cg_governing_write_f(nsturbulent, ierr)
3090  end select
3091 
3092  if (ierr /= cg_ok) &
3093  call terminate("writeCGNSHeader", &
3094  "Something wrong when calling &
3095  &cg_governing_write_f")
3096 
3097  ! Write the information about the gas model used.
3098  ! Determine the cp model used in the computation.
3099 
3100  select case (cpmodel)
3101 
3102  case (cpconstant)
3103 
3104  ! Constant cp and thus constant gamma.
3105 
3106  call cg_model_write_f("GasModel_t", ideal, ierr)
3107  if (ierr /= cg_ok) &
3108  call terminate("writeCGNSHeader", &
3109  "Something wrong when calling &
3110  &cg_model_write_f")
3111 
3112  ! Write the actual value of gamma; this must be done under
3113  ! gas model type, which explains the goto statement.
3114 
3115  call cg_goto_f(cgnsind, base, ierr, "FlowEquationSet_t", &
3116  1, "GasModel_t", 1, "end")
3117  if (ierr /= cg_ok) &
3118  call terminate("writeCGNSHeader", &
3119  "Something wrong when calling cg_goto_f")
3120 
3121  val = gammaconstant
3122  call cg_array_write_f(cgnsheatratio, realtypecgns, &
3123  1, int(1, cgsize_t), val, ierr)
3124  if (ierr /= cg_ok) &
3125  call terminate("writeCGNSHeader", &
3126  "Something wrong when calling &
3127  &cg_array_write_f")
3128 
3129  ! And create a data class under SpecificHeatRatio to tell that
3130  ! this is a nonDimensional parameter.
3131 
3132  call cg_goto_f(cgnsind, base, ierr, &
3133  "FlowEquationSet_t", 1, &
3134  "GasModel_t", 1, "DataArray_t", 1, "end")
3135  if (ierr /= cg_ok) &
3136  call terminate("writeCGNSHeader", &
3137  "Something wrong when calling cg_goto_f")
3138 
3139  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3140  if (ierr /= cg_ok) &
3141  call terminate("writeCGNSHeader", &
3142  "Something wrong when calling &
3143  &cg_dataclass_write_f")
3144 
3145  !===============================================================
3146 
3147  case (cptempcurvefits)
3148 
3149  ! Cp as function of the temperature is given via curve fits.
3150 
3151  call cg_model_write_f("GasModel_t", thermallyperfect, ierr)
3152  if (ierr /= cg_ok) &
3153  call terminate("writeCGNSHeader", &
3154  "Something wrong when calling &
3155  &cg_model_write_f")
3156 
3157  end select
3158 
3159  ! The rest of physical model description is only
3160  ! for viscous flows.
3161 
3162  viscoustest: if (viscous) then
3163 
3164  ! Write the info of the viscosity model. Under the flow
3165  ! equation set.
3166 
3167  call cg_goto_f(cgnsind, base, ierr, &
3168  "FlowEquationSet_t", 1, "end")
3169  if (ierr /= cg_ok) &
3170  call terminate("writeCGNSHeader", &
3171  "Something wrong when calling cg_goto_f")
3172 
3173  call cg_model_write_f("ViscosityModel_t", sutherlandlaw, ierr)
3174  if (ierr /= cg_ok) &
3175  call terminate("writeCGNSHeader", &
3176  "Something wrong when calling &
3177  &cg_model_write_f")
3178 
3179  ! Write the info about the thermal conductivity, i.e.
3180  ! Constant Prandtl number. Write the used value as well.
3181 
3182  call cg_model_write_f("ThermalConductivityModel_t", &
3183  constantprandtl, ierr)
3184  if (ierr /= cg_ok) &
3185  call terminate("writeCGNSHeader", &
3186  "Something wrong when calling &
3187  &cg_model_write_f")
3188 
3189  call cg_goto_f(cgnsind, base, ierr, "FlowEquationSet_t", 1, &
3190  "ThermalConductivityModel_t", 1, "end")
3191  if (ierr /= cg_ok) &
3192  call terminate("writeCGNSHeader", &
3193  "Something wrong when calling cg_goto_f")
3194 
3195  val = prandtl
3196  call cg_array_write_f(cgnsprandtl, realtypecgns, 1, int(1, cgsize_t), &
3197  val, ierr)
3198  if (ierr /= cg_ok) &
3199  call terminate("writeCGNSHeader", &
3200  "Something wrong when calling &
3201  &cg_array_write_f")
3202 
3203  ! And create a data class under Prandtl number to tell that
3204  ! this is a nonDimensional parameter.
3205 
3206  call cg_goto_f(cgnsind, base, ierr, "FlowEquationSet_t", &
3207  1, "ThermalConductivityModel_t", 1, &
3208  "DataArray_t", 1, "end")
3209  if (ierr /= cg_ok) &
3210  call terminate("writeCGNSHeader", &
3211  "Something wrong when calling cg_goto_f")
3212 
3213  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3214  if (ierr /= cg_ok) &
3215  call terminate("writeCGNSHeader", &
3216  "Something wrong when calling &
3217  &cg_dataclass_write_f")
3218 
3219  ! The rest of the physical model description is only for the
3220  ! RANS equations.
3221 
3222  turbulenttest: if (equations == ransequations) then
3223 
3224  select case (turbmodel)
3225 
3226  case (spalartallmaras)
3227  call writecgnssainfo(cgnsind, base)
3228 
3229  case (spalartallmarasedwards)
3230  call writecgnssaeinfo(cgnsind, base)
3231 
3232  case (komegawilcox)
3233  call writecgnskomegawilcoxinfo(cgnsind, base)
3234 
3235  case (komegamodified)
3236  call writecgnskomegamodifiedinfo(cgnsind, base)
3237 
3238  case (ktau)
3239  call writecgnsktauinfo(cgnsind, base)
3240 
3241  case (mentersst)
3242  call writecgnsmentersstinfo(cgnsind, base)
3243 
3244  case (v2f)
3245  call writecgnsv2finfo(cgnsind, base)
3246  end select
3247 
3248  end if turbulenttest
3249 
3250  end if viscoustest
3251 
3252  ! Write the reference state.
3253 
3254  call writecgnsreferencestate(cgnsind, base)
3255  end subroutine writecgnsheader
3256 
3257  subroutine writecgnskomegamodifiedinfo(cgnsInd, cgnsBase)
3258  !
3259  ! writeCGNSKomegaModifiedInfo writes information about the
3260  ! modified k-omega turbulence model to the cgns file.
3261  !
3262  use inputphysics
3263  use cgnsnames
3264  use su_cgns
3265  use utils, only: terminate, setcgnsrealtype
3266  implicit none
3267  !
3268  ! Subroutine arguments
3269  !
3270  integer, intent(in) :: cgnsInd, cgnsBase
3271  !
3272  ! Local variables.
3273  !
3274  integer :: realTypeCGNS, ierr
3275 
3276  real(kind=cgnsrealtype) :: val
3277 
3278  ! Set the cgns real type.
3279 
3280  realtypecgns = setcgnsrealtype()
3281 
3282  ! Write the info of the turbulence model under the flow equation
3283  ! set. So move to this location first.
3284 
3285  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3286  "FlowEquationSet_t", 1, "end")
3287  if (ierr /= cg_ok) &
3288  call terminate("writeCGNSKomegaModifiedInfo", &
3289  "Something wrong when calling cg_goto_f")
3290 
3291  ! Write that the k-omega model is used.
3292 
3293  call cg_model_write_f("TurbulenceModel_t", &
3294  twoequation_wilcox, ierr)
3295  if (ierr /= cg_ok) &
3296  call terminate("writeCGNSKomegaModifiedInfo", &
3297  "Something wrong when calling cg_model_write_f")
3298 
3299  ! Write the turbulent closure type.
3300 
3301  call cg_model_write_f("TurbulenceClosure_t", eddyviscosity, ierr)
3302  if (ierr /= cg_ok) &
3303  call terminate("writeCGNSKomegaModifiedInfo", &
3304  "Something wrong when calling cg_model_write_f")
3305 
3306  ! Write the details of the turbulence model under the turbulent
3307  ! closure type.
3308 
3309  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3310  "TurbulenceClosure_t", 1, "end")
3311  if (ierr /= cg_ok) &
3312  call terminate("writeCGNSKomegaModifiedInfo", &
3313  "Something wrong when calling cg_goto_f")
3314 
3315  ! Write the value of the turbulent prandtl number.
3316 
3317  val = prandtlturb
3318  call cg_array_write_f(cgnsprandtlturb, realtypecgns, &
3319  1, int(1, cgsize_t), val, ierr)
3320  if (ierr /= cg_ok) &
3321  call terminate("writeCGNSKomegaModifiedInfo", &
3322  "Something wrong when calling cg_array_write_f")
3323 
3324  ! Indicate that this is a nonDimensional parameter.
3325 
3326  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3327  "TurbulenceClosure_t", 1, "DataArray_t", 1, "end")
3328  if (ierr /= cg_ok) &
3329  call terminate("writeCGNSKomegaModifiedInfo", &
3330  "Something wrong when calling cg_goto_f")
3331 
3332  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3333  if (ierr /= cg_ok) &
3334  call terminate("writeCGNSKomegaModifiedInfo", &
3335  "Something wrong when calling &
3336  &cg_dataclass_write_f")
3337  end subroutine writecgnskomegamodifiedinfo
3338 
3339  subroutine writecgnskomegawilcoxinfo(cgnsInd, cgnsBase)
3340  !
3341  ! writeCGNSKomegaWilcoxInfo writes information about the
3342  ! standard Wilcox k-omega turbulence model to the cgns file.
3343  !
3344  use inputphysics
3345  use cgnsnames
3346  use su_cgns
3347  use utils, only: terminate, setcgnsrealtype
3348  implicit none
3349  !
3350  ! Subroutine arguments
3351  !
3352  integer, intent(in) :: cgnsInd, cgnsBase
3353  !
3354  ! Local variables.
3355  !
3356  integer :: realTypeCGNS, ierr
3357 
3358  real(kind=cgnsrealtype) :: val
3359 
3360  ! Set the cgns real type.
3361 
3362  realtypecgns = setcgnsrealtype()
3363 
3364  ! Write the info of the turbulence model under the flow equation
3365  ! set. So move to this location first.
3366 
3367  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3368  "FlowEquationSet_t", 1, "end")
3369  if (ierr /= cg_ok) &
3370  call terminate("writeCGNSKomegaWilcoxInfo", &
3371  "Something wrong when calling cg_goto_f")
3372 
3373  ! Write that the k-omega model is used.
3374 
3375  call cg_model_write_f("TurbulenceModel_t", &
3376  twoequation_wilcox, ierr)
3377  if (ierr /= cg_ok) &
3378  call terminate("writeCGNSKomegaWilcoxInfo", &
3379  "Something wrong when calling cg_model_write_f")
3380 
3381  ! Write the turbulent closure type.
3382 
3383  call cg_model_write_f("TurbulenceClosure_t", eddyviscosity, ierr)
3384  if (ierr /= cg_ok) &
3385  call terminate("writeCGNSKomegaWilcoxInfo", &
3386  "Something wrong when calling cg_model_write_f")
3387 
3388  ! Write the details of the turbulence model under the turbulent
3389  ! closure type.
3390 
3391  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3392  "TurbulenceClosure_t", 1, "end")
3393  if (ierr /= cg_ok) &
3394  call terminate("writeCGNSKomegaWilcoxInfo", &
3395  "Something wrong when calling cg_goto_f")
3396 
3397  ! Write the value of the turbulent prandtl number.
3398 
3399  val = prandtlturb
3400  call cg_array_write_f(cgnsprandtlturb, realtypecgns, &
3401  1, int(1, cgsize_t), val, ierr)
3402  if (ierr /= cg_ok) &
3403  call terminate("writeCGNSKomegaWilcoxInfo", &
3404  "Something wrong when calling cg_array_write_f")
3405 
3406  ! Indicate that this is a nonDimensional parameter.
3407 
3408  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3409  "TurbulenceClosure_t", 1, "DataArray_t", 1, "end")
3410  if (ierr /= cg_ok) &
3411  call terminate("writeCGNSKomegaWilcoxInfo", &
3412  "Something wrong when calling cg_goto_f")
3413 
3414  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3415  if (ierr /= cg_ok) &
3416  call terminate("writeCGNSKomegaWilcoxInfo", &
3417  "Something wrong when calling &
3418  &cg_dataclass_write_f")
3419  end subroutine writecgnskomegawilcoxinfo
3420 
3421  subroutine writecgnsktauinfo(cgnsInd, cgnsBase)
3422  !
3423  ! WriteCGNSKtauInfo writes information about the k-tau
3424  ! turbulence model to the cgns file.
3425  !
3426  use inputphysics
3427  use cgnsnames
3428  use su_cgns
3429  use utils, only: terminate, setcgnsrealtype
3430  implicit none
3431  !
3432  ! Subroutine arguments
3433  !
3434  integer, intent(in) :: cgnsInd, cgnsBase
3435  !
3436  ! Local variables.
3437  !
3438  integer :: realTypeCGNS, ierr
3439 
3440  real(kind=cgnsrealtype) :: val
3441 
3442  ! Set the cgns real type.
3443 
3444  realtypecgns = setcgnsrealtype()
3445 
3446  ! Write the info of the turbulence model under the flow equation
3447  ! set. So move to this location first.
3448 
3449  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3450  "FlowEquationSet_t", 1, "end")
3451  if (ierr /= cg_ok) &
3452  call terminate("writeCGNSKtauInfo", &
3453  "Something wrong when calling cg_goto_f")
3454 
3455  ! Write that user defined model is used; k-tau is not
3456  ! supported by cgns.
3457 
3458  call cg_model_write_f("TurbulenceModel_t", &
3459  cg_userdefined, ierr)
3460  if (ierr /= cg_ok) &
3461  call terminate("writeCGNSKtauInfo", &
3462  "Something wrong when calling cg_model_write_f")
3463 
3464  ! Write the turbulent closure type.
3465 
3466  call cg_model_write_f("TurbulenceClosure_t", eddyviscosity, ierr)
3467  if (ierr /= cg_ok) &
3468  call terminate("writeCGNSKtauInfo", &
3469  "Something wrong when calling cg_model_write_f")
3470 
3471  ! Write the details of the turbulence model under the turbulent
3472  ! closure type.
3473 
3474  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3475  "TurbulenceClosure_t", 1, "end")
3476  if (ierr /= cg_ok) &
3477  call terminate("writeCGNSKtauInfo", &
3478  "Something wrong when calling cg_goto_f")
3479 
3480  ! Write the value of the turbulent prandtl number.
3481 
3482  val = prandtlturb
3483  call cg_array_write_f(cgnsprandtlturb, realtypecgns, &
3484  1, int(1, cgsize_t), val, ierr)
3485  if (ierr /= cg_ok) &
3486  call terminate("writeCGNSKtauInfo", &
3487  "Something wrong when calling cg_array_write_f")
3488 
3489  ! Indicate that this is a nonDimensional parameter.
3490 
3491  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3492  "TurbulenceClosure_t", 1, "DataArray_t", 1, "end")
3493  if (ierr /= cg_ok) &
3494  call terminate("writeCGNSKtauInfo", &
3495  "Something wrong when calling cg_goto_f")
3496 
3497  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3498  if (ierr /= cg_ok) &
3499  call terminate("writeCGNSKtauInfo", &
3500  "Something wrong when calling &
3501  &cg_dataclass_write_f")
3502  end subroutine writecgnsktauinfo
3503 
3504  subroutine writecgnsmentersstinfo(cgnsInd, cgnsBase)
3505  !
3506  ! WriteCGNSMenterSSTInfo writes information about menter's
3507  ! SST turbulence model to the cgns file.
3508  !
3509  use inputphysics
3510  use cgnsnames
3511  use su_cgns
3512  use utils, only: terminate, setcgnsrealtype
3513  implicit none
3514  !
3515  ! Subroutine arguments
3516  !
3517  integer, intent(in) :: cgnsInd, cgnsBase
3518  !
3519  ! Local variables.
3520  !
3521  integer :: realTypeCGNS, ierr
3522 
3523  real(kind=cgnsrealtype) :: val
3524 
3525  ! Set the cgns real type.
3526  ! Note that this info is only written to the 1st base.
3527 
3528  realtypecgns = setcgnsrealtype()
3529 
3530  ! Write the info of the turbulence model under the flow equation
3531  ! set. So move to this location first.
3532 
3533  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3534  "FlowEquationSet_t", 1, "end")
3535  if (ierr /= cg_ok) &
3536  call terminate("writeCGNSMenterSSTInfo", &
3537  "Something wrong when calling cg_goto_f")
3538 
3539  ! Write that the SST variant of the kOmega model is used.
3540 
3541  call cg_model_write_f("TurbulenceModel_t", &
3542  twoequation_mentersst, ierr)
3543  if (ierr /= cg_ok) &
3544  call terminate("writeCGNSMenterSSTInfo", &
3545  "Something wrong when calling cg_model_write_f")
3546 
3547  ! Write the turbulent closure type.
3548 
3549  call cg_model_write_f("TurbulenceClosure_t", eddyviscosity, ierr)
3550  if (ierr /= cg_ok) &
3551  call terminate("writeCGNSMenterSSTInfo", &
3552  "Something wrong when calling cg_model_write_f")
3553 
3554  ! Write the details of the turbulence model under the turbulent
3555  ! closure type.
3556 
3557  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3558  "TurbulenceClosure_t", 1, "end")
3559  if (ierr /= cg_ok) &
3560  call terminate("writeCGNSMenterSSTInfo", &
3561  "Something wrong when calling cg_goto_f")
3562 
3563  ! Write the value of the turbulent prandtl number.
3564 
3565  val = prandtlturb
3566  call cg_array_write_f(cgnsprandtlturb, realtypecgns, &
3567  1, int(1, cgsize_t), val, ierr)
3568  if (ierr /= cg_ok) &
3569  call terminate("writeCGNSMenterSSTInfo", &
3570  "Something wrong when calling cg_array_write_f")
3571 
3572  ! Indicate that this is a nonDimensional parameter.
3573 
3574  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3575  "TurbulenceClosure_t", 1, "DataArray_t", 1, "end")
3576  if (ierr /= cg_ok) &
3577  call terminate("writeCGNSMenterSSTInfo", &
3578  "Something wrong when calling cg_goto_f")
3579 
3580  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3581  if (ierr /= cg_ok) &
3582  call terminate("writeCGNSMenterSSTInfo", &
3583  "Something wrong when calling &
3584  &cg_dataclass_write_f")
3585  end subroutine writecgnsmentersstinfo
3586 
3587  subroutine writecgnsreferencestate(cgnsInd, cgnsBase)
3588  !
3589  ! writeCGNSReferenceState writes the reference state to the
3590  ! cgns file. Enough info is specified such that a restart can be
3591  ! performed by a different solver, which uses a different
3592  ! nonDimensionalization.
3593  !
3594  use constants
3595  use cgnsnames
3596  use su_cgns
3597  use inputphysics
3598  use flowvarrefstate
3599  use utils, only: terminate, setcgnsrealtype
3600  implicit none
3601  !
3602  ! Subroutine arguments
3603  !
3604  integer, intent(in) :: cgnsInd, cgnsBase
3605  !
3606  ! Local variables.
3607  !
3608  integer :: ierr, realTypeCGNS, ii
3609 
3610  integer(kind=intType) :: i
3611 
3612  real(kind=cgnsrealtype) :: val
3613 
3614  ! Set the cgns real type.
3615 
3616  realtypecgns = setcgnsrealtype()
3617 
3618  ! Go to the base.
3619 
3620  call cg_goto_f(cgnsind, cgnsbase, ierr, "end")
3621  if (ierr /= cg_ok) &
3622  call terminate("writeReferenceState", &
3623  "Something wrong when calling cg_goto_f")
3624 
3625  ! Create the reference state node with a nice description.
3626 
3627  call cg_state_write_f("Reference state variables for &
3628  &nonDimensional data. Variables are &
3629  &nonDimensionalized using the reference &
3630  &density, pressure and temperature.", ierr)
3631  if (ierr /= cg_ok) &
3632  call terminate("writeReferenceState", &
3633  "Something wrong when calling cg_state_write_f")
3634 
3635  ! The actual data should be written below the reference state
3636  ! node. So go there first.
3637 
3638  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3639  "ReferenceState_t", 1, "end")
3640  if (ierr /= cg_ok) &
3641  call terminate("writeReferenceState", &
3642  "Something wrong when calling cg_goto_f")
3643 
3644  ! Write the Mach number and indicate that it is a nonDimensional
3645  ! parameter
3646 
3647  val = mach
3648  call cg_array_write_f(cgnsmach, realtypecgns, 1, int(1, cgsize_t), val, ierr)
3649  if (ierr /= cg_ok) &
3650  call terminate("writeReferenceState", &
3651  "Something wrong when calling cg_array_write_f")
3652 
3653  ii = 1
3654  call cg_goto_f(cgnsind, cgnsbase, ierr, "ReferenceState_t", 1, &
3655  "DataArray_t", ii, "end")
3656  if (ierr /= cg_ok) &
3657  call terminate("writeReferenceState", &
3658  "Something wrong when calling cg_goto_f")
3659 
3660  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3661  if (ierr /= cg_ok) &
3662  call terminate("writeReferenceState", &
3663  "Something wrong when calling &
3664  &cg_dataclass_write_f")
3665 
3666  ! Write the 3 flow angles. The units are degrees.
3667 
3668  velocitydir: do i = 1, 3
3669 
3670  ! Go to the reference state node.
3671 
3672  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3673  "ReferenceState_t", 1, "end")
3674  if (ierr /= cg_ok) &
3675  call terminate("writeReferenceState", &
3676  "Something wrong when calling cg_goto_f")
3677 
3678  ! Store component i of the direction in val.
3679 
3680  val = veldirfreestream(i)
3681 
3682  select case (i)
3683  case (1_inttype)
3684 
3685  call cg_array_write_f(cgnsvelvecx, realtypecgns, &
3686  1, int(1, cgsize_t), val, ierr)
3687 
3688  case (2_inttype)
3689  call cg_array_write_f(cgnsvelvecy, realtypecgns, &
3690  1, int(1, cgsize_t), val, ierr)
3691 
3692  case (3_inttype)
3693  call cg_array_write_f(cgnsvelvecz, realtypecgns, &
3694  1, int(1, cgsize_t), val, ierr)
3695  end select
3696 
3697  if (ierr /= cg_ok) &
3698  call terminate("writeReferenceState", &
3699  "Something wrong when calling &
3700  &cg_array_write_f")
3701 
3702  ! Write the info that the unit vector is nondimensional.
3703 
3704  ii = ii + 1
3705  call cg_goto_f(cgnsind, cgnsbase, ierr, "ReferenceState_t", 1, &
3706  "DataArray_t", ii, "end")
3707  if (ierr /= cg_ok) &
3708  call terminate("writeReferenceState", &
3709  "Something wrong when calling cg_goto_f")
3710 
3711  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3712  if (ierr /= cg_ok) &
3713  call terminate("writeReferenceState", &
3714  "Something wrong when calling &
3715  &cg_dataclass_write_f")
3716 
3717  end do velocitydir
3718 
3719  ! Write some reference values of the density, pressure, temperature,
3720  ! velocity and length.
3721 
3722  refloop: do i = 1, 5
3723 
3724  ! Go to the reference state node.
3725 
3726  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3727  "ReferenceState_t", 1, "end")
3728  if (ierr /= cg_ok) &
3729  call terminate("writeReferenceState", &
3730  "Something wrong when calling cg_goto_f")
3731 
3732  ! Write a value, depending on i.
3733 
3734  select case (i)
3735  case (1_inttype)
3736  val = rhoref
3737  call cg_array_write_f(cgnsdensity, realtypecgns, &
3738  1, int(1, cgsize_t), val, ierr)
3739  case (2_inttype)
3740  val = pref
3741  call cg_array_write_f(cgnspressure, realtypecgns, &
3742  1, int(1, cgsize_t), val, ierr)
3743 
3744  case (3_inttype)
3745  val = tref
3746  call cg_array_write_f(cgnstemp, realtypecgns, &
3747  1, int(1, cgsize_t), val, ierr)
3748 
3749  case (4_inttype)
3750  val = sqrt(pref / rhoref)
3751  call cg_array_write_f(cgnsvelocity, realtypecgns, &
3752  1, int(1, cgsize_t), val, ierr)
3753 
3754  case (5_inttype)
3755  val = one
3756  call cg_array_write_f(cgnslength, realtypecgns, &
3757  1, int(1, cgsize_t), val, ierr)
3758  end select
3759 
3760  if (ierr /= cg_ok) &
3761  call terminate("writeReferenceState", &
3762  "Something wrong when calling &
3763  &cg_array_write_f")
3764 
3765  ! Write the info that the this reference value is dimensional
3766  ! and based on si units.
3767 
3768  ii = ii + 1
3769  call cg_goto_f(cgnsind, cgnsbase, ierr, "ReferenceState_t", 1, &
3770  "DataArray_t", ii, "end")
3771  if (ierr /= cg_ok) &
3772  call terminate("writeReferenceState", &
3773  "Something wrong when calling cg_goto_f")
3774 
3775  call cg_dataclass_write_f(dimensional, ierr)
3776  if (ierr /= cg_ok) &
3777  call terminate("writeReferenceState", &
3778  "Something wrong when calling &
3779  &cg_dataclass_write_f")
3780 
3781  call cg_units_write_f(kilogram, meter, second, kelvin, &
3782  cg_null, ierr)
3783  if (ierr /= cg_ok) &
3784  call terminate("writeReferenceState", &
3785  "Something wrong when calling &
3786  &cg_units_write_f")
3787 
3788  end do refloop
3789  end subroutine writecgnsreferencestate
3790 
3791  subroutine writecgnssainfo(cgnsInd, cgnsBase)
3792  !
3793  ! WriteCGNSSaInfo writes information about the Spalart
3794  ! Allmaras turbulence model to the cgns file.
3795  !
3796  use inputphysics
3797  use cgnsnames
3798  use su_cgns
3799  use utils, only: terminate, setcgnsrealtype
3800  implicit none
3801  !
3802  ! Subroutine arguments
3803  !
3804  integer, intent(in) :: cgnsInd, cgnsBase
3805  !
3806  ! Local variables.
3807  !
3808  integer :: realTypeCGNS, ierr
3809 
3810  real(kind=cgnsrealtype) :: val
3811 
3812  ! Set the cgns real type.
3813 
3814  realtypecgns = setcgnsrealtype()
3815 
3816  ! Write the info of the turbulence model under the flow equation
3817  ! set. So move to this location first.
3818 
3819  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3820  "FlowEquationSet_t", 1, "end")
3821  if (ierr /= cg_ok) &
3822  call terminate("writeCGNSSaInfo", &
3823  "Something wrong when calling cg_goto_f")
3824 
3825  ! Write that the spalart-allmaras model is used.
3826 
3827  call cg_model_write_f("TurbulenceModel_t", &
3828  oneequation_spalartallmaras, ierr)
3829  if (ierr /= cg_ok) &
3830  call terminate("writeCGNSSaInfo", &
3831  "Something wrong when calling cg_model_write_f")
3832 
3833  ! Write the turbulent closure type.
3834 
3835  call cg_model_write_f("TurbulenceClosure_t", eddyviscosity, ierr)
3836  if (ierr /= cg_ok) &
3837  call terminate("writeCGNSSaInfo", &
3838  "Something wrong when calling cg_model_write_f")
3839 
3840  ! Write the details of the turbulence model under the turbulent
3841  ! closure type.
3842 
3843  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3844  "TurbulenceClosure_t", 1, "end")
3845  if (ierr /= cg_ok) &
3846  call terminate("writeCGNSSaInfo", &
3847  "Something wrong when calling cg_goto_f")
3848 
3849  ! Write the value of the turbulent prandtl number.
3850 
3851  val = prandtlturb
3852  call cg_array_write_f(cgnsprandtlturb, realtypecgns, &
3853  1, int(1, cgsize_t), val, ierr)
3854  if (ierr /= cg_ok) &
3855  call terminate("writeCGNSSaInfo", &
3856  "Something wrong when calling cg_array_write_f")
3857 
3858  ! Indicate that this is a nonDimensional parameter.
3859 
3860  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3861  "TurbulenceClosure_t", 1, "DataArray_t", 1, "end")
3862  if (ierr /= cg_ok) &
3863  call terminate("writeCGNSSaInfo", &
3864  "Something wrong when calling cg_goto_f")
3865 
3866  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3867  if (ierr /= cg_ok) &
3868  call terminate("writeCGNSSaInfo", &
3869  "Something wrong when calling &
3870  &cg_dataclass_write_f")
3871  end subroutine writecgnssainfo
3872 
3873  subroutine writecgnssaeinfo(cgnsInd, cgnsBase)
3874  !
3875  ! WriteCGNSSaeInfo writes information about the Spalart
3876  ! Allmaras turbulence model using the Edwards modification to
3877  ! the cgns file.
3878  !
3879  use inputphysics
3880  use cgnsnames
3881  use su_cgns
3882  use utils, only: terminate, setcgnsrealtype
3883  implicit none
3884  !
3885  ! Subroutine arguments
3886  !
3887  integer, intent(in) :: cgnsInd, cgnsBase
3888  !
3889  ! Local variables.
3890  !
3891  integer :: realTypeCGNS, ierr
3892 
3893  real(kind=cgnsrealtype) :: val
3894 
3895  ! Set the cgns real type.
3896 
3897  realtypecgns = setcgnsrealtype()
3898 
3899  ! Write the info of the turbulence model under the flow equation
3900  ! set. So move to this location first.
3901 
3902  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3903  "FlowEquationSet_t", 1, "end")
3904  if (ierr /= cg_ok) &
3905  call terminate("writeCGNSSaInfo", &
3906  "Something wrong when calling cg_goto_f")
3907 
3908  ! Write that the spalart-allmaras model is used.
3909 
3910  call cg_model_write_f("TurbulenceModel_t", &
3911  oneequation_spalartallmaras, ierr)
3912  if (ierr /= cg_ok) &
3913  call terminate("writeCGNSSaInfo", &
3914  "Something wrong when calling cg_model_write_f")
3915 
3916  ! Write the turbulent closure type.
3917 
3918  call cg_model_write_f("TurbulenceClosure_t", eddyviscosity, ierr)
3919  if (ierr /= cg_ok) &
3920  call terminate("writeCGNSSaInfo", &
3921  "Something wrong when calling cg_model_write_f")
3922 
3923  ! Write the details of the turbulence model under the turbulent
3924  ! closure type.
3925 
3926  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3927  "TurbulenceClosure_t", 1, "end")
3928  if (ierr /= cg_ok) &
3929  call terminate("writeCGNSSaInfo", &
3930  "Something wrong when calling cg_goto_f")
3931 
3932  ! Write the value of the turbulent prandtl number.
3933 
3934  val = prandtlturb
3935  call cg_array_write_f(cgnsprandtlturb, realtypecgns, &
3936  1, int(1, cgsize_t), val, ierr)
3937  if (ierr /= cg_ok) &
3938  call terminate("writeCGNSSaInfo", &
3939  "Something wrong when calling cg_array_write_f")
3940 
3941  ! Indicate that this is a nonDimensional parameter.
3942 
3943  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
3944  "TurbulenceClosure_t", 1, "DataArray_t", 1, "end")
3945  if (ierr /= cg_ok) &
3946  call terminate("writeCGNSSaInfo", &
3947  "Something wrong when calling cg_goto_f")
3948 
3949  call cg_dataclass_write_f(nondimensionalparameter, ierr)
3950  if (ierr /= cg_ok) &
3951  call terminate("writeCGNSSaInfo", &
3952  "Something wrong when calling &
3953  &cg_dataclass_write_f")
3954  end subroutine writecgnssaeinfo
3955 
3956  subroutine writecgnsv2finfo(cgnsInd, cgnsBase)
3957  !
3958  ! WriteCGNSV2fInfo writes information about Durbin's v2f
3959  ! turbulence model to the cgns file.
3960  !
3961  use inputphysics
3962  use cgnsnames
3963  use su_cgns
3964  use utils, only: terminate, setcgnsrealtype
3965  implicit none
3966  !
3967  ! Subroutine arguments
3968  !
3969  integer, intent(in) :: cgnsInd, cgnsBase
3970  !
3971  ! Local variables.
3972  !
3973  integer :: realTypeCGNS, ierr
3974 
3975  real(kind=cgnsrealtype) :: val
3976 
3977  ! Set the cgns real type.
3978 
3979  realtypecgns = setcgnsrealtype()
3980 
3981  ! Write the info of the turbulence model under the flow equation
3982  ! set. So move to this location first.
3983 
3984  call cg_goto_f(cgnsind, cgnsbase, ierr, &
3985  "FlowEquationSet_t", 1, "end")
3986  if (ierr /= cg_ok) &
3987  call terminate("writeCGNSV2fInfo", &
3988  "Something wrong when calling cg_goto_f")
3989 
3990  ! Write that user defined model is used; v2-f is not
3991  ! supported by cgns.
3992 
3993  call cg_model_write_f("TurbulenceModel_t", cg_userdefined, ierr)
3994 
3995  if (ierr /= cg_ok) &
3996  call terminate("writeCGNSV2fInfo", &
3997  "Something wrong when calling cg_model_write_f")
3998 
3999  ! Write the turbulent closure type.
4000 
4001  call cg_model_write_f("TurbulenceClosure_t", eddyviscosity, ierr)
4002  if (ierr /= cg_ok) &
4003  call terminate("writeCGNSV2fInfo", &
4004  "Something wrong when calling cg_model_write_f")
4005 
4006  ! Write the details of the turbulence model under the turbulent
4007  ! closure type.
4008 
4009  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
4010  "TurbulenceClosure_t", 1, "end")
4011  if (ierr /= cg_ok) &
4012  call terminate("writeCGNSV2fInfo", &
4013  "Something wrong when calling cg_goto_f")
4014 
4015  ! Write the value of the turbulent prandtl number.
4016 
4017  val = prandtlturb
4018  call cg_array_write_f(cgnsprandtlturb, realtypecgns, &
4019  1, int(1, cgsize_t), val, ierr)
4020  if (ierr /= cg_ok) &
4021  call terminate("writeCGNSV2fInfo", &
4022  "Something wrong when calling cg_array_write_f")
4023 
4024  ! Indicate that this is a nonDimensional parameter.
4025 
4026  call cg_goto_f(cgnsind, cgnsbase, ierr, "FlowEquationSet_t", 1, &
4027  "TurbulenceClosure_t", 1, "DataArray_t", 1, "end")
4028  if (ierr /= cg_ok) &
4029  call terminate("writeCGNSV2fInfo", &
4030  "Something wrong when calling cg_goto_f")
4031 
4032  call cg_dataclass_write_f(nondimensionalparameter, ierr)
4033  if (ierr /= cg_ok) &
4034  call terminate("writeCGNSV2fInfo", &
4035  "Something wrong when calling &
4036  &cg_dataclass_write_f")
4037  end subroutine writecgnsv2finfo
4038 
4039 end module outputmod
Definition: BCData.F90:1
Definition: block.F90:1
integer(kind=inttype) ndom
Definition: block.F90:761
type(blocktype), dimension(:, :, :), allocatable, target flowdoms
Definition: block.F90:771
integer(kind=inttype), dimension(:, :), pointer viscjminpointer
real(kind=realtype), dimension(:, :, :), pointer gamma
integer(kind=inttype) kendor
integer(kind=inttype) jl
integer(kind=inttype) iendor
integer(kind=inttype), dimension(:, :), pointer viscjmaxpointer
integer(kind=inttype) jendor
integer(kind=inttype) kbegor
logical blockismoving
real(kind=realtype), dimension(:, :, :), pointer p
integer(kind=inttype) ie
real(kind=realtype), dimension(:, :, :), pointer intermittency
real(kind=realtype), dimension(:, :, :, :), pointer w
type(viscsubfacetype), dimension(:), pointer viscsubface
integer(kind=inttype) nbklocal
real(kind=realtype), dimension(:, :, :), pointer d2wall
integer(kind=inttype), dimension(:, :, :), pointer iblank
integer(kind=inttype), dimension(:, :, :), pointer globalcell
integer(kind=inttype), dimension(:, :), pointer viscimaxpointer
real(kind=realtype), dimension(:, :, :), pointer rlv
real(kind=realtype), dimension(:, :, :, :), pointer si
integer(kind=inttype) ibegor
integer(kind=inttype), dimension(:, :, :), pointer status
real(kind=realtype), dimension(:, :, :, :), pointer sj
integer(kind=inttype), dimension(:, :), pointer visckminpointer
real(kind=realtype), dimension(:, :, :, :), pointer s
integer(kind=inttype) jbegor
real(kind=realtype), dimension(:, :, :), pointer rev
real(kind=realtype), dimension(:, :, :, :), pointer dw
real(kind=realtype), dimension(:, :, :, :), pointer sk
real(kind=realtype), dimension(:, :, :), pointer vol
integer(kind=inttype) je
integer(kind=inttype) ke
real(kind=realtype), dimension(:, :, :, :), pointer x
integer(kind=inttype), dimension(:, :), pointer visckmaxpointer
integer(kind=inttype), dimension(:, :), pointer visciminpointer
real(kind=realtype), dimension(:, :, :, :, :), pointer wold
integer(kind=inttype) kl
integer(kind=inttype) il
type(cgnsblockinfotype), dimension(:), allocatable cgnsdoms
Definition: cgnsGrid.F90:495
integer cgnsphysdim
Definition: cgnsGrid.F90:487
integer(kind=inttype) cgnsndom
Definition: cgnsGrid.F90:491
character(len=maxcgnsnamelen), parameter cgnsrelvely
Definition: cgnsNames.f90:60
character(len=maxcgnsnamelen), parameter cgnsresv2
Definition: cgnsNames.f90:201
character(len=maxcgnsnamelen), parameter cgnsmomz
Definition: cgnsNames.f90:33
character(len=maxcgnsnamelen), parameter cgnsresrhoe
Definition: cgnsNames.f90:189
character(len=maxcgnsnamelen), parameter cgnsresrho
Definition: cgnsNames.f90:181
character(len=maxcgnsnamelen), parameter cgnssepsensorksarea
Definition: cgnsNames.f90:280
character(len=maxcgnsnamelen), parameter cgnsrelmach
Definition: cgnsNames.f90:76
character(len=maxcgnsnamelen), parameter cgnsturbomega
Definition: cgnsNames.f90:41
character(len=maxcgnsnamelen), parameter cgnsdensity
Definition: cgnsNames.f90:27
character(len=maxcgnsnamelen), parameter cgnsskinfx
Definition: cgnsNames.f90:110
character(len=maxcgnsnamelen), parameter cgnsturbtau
Definition: cgnsNames.f90:43
character(len=maxcgnsnamelen), parameter cgnsvelocity
Definition: cgnsNames.f90:125
character(len=maxcgnsnamelen), parameter cgnsshock
Definition: cgnsNames.f90:163
character(len=maxcgnsnamelen), parameter cgnsresmomy
Definition: cgnsNames.f90:185
character(len=maxcgnsnamelen), parameter cgnsaxismoment
Definition: cgnsNames.f90:282
character(len=maxcgnsnamelen), parameter cgnsvelz
Definition: cgnsNames.f90:56
character(len=maxcgnsnamelen), parameter cgnsvortmagn
Definition: cgnsNames.f90:90
character(len=maxcgnsnamelen), parameter cgnsvelvecy
Definition: cgnsNames.f90:151
character(len=maxcgnsnamelen), parameter cgnsfilteredshock
Definition: cgnsNames.f90:166
character(len=maxcgnsnamelen), parameter cgnseddyratio
Definition: cgnsNames.f90:86
character(len=maxcgnsnamelen), parameter cgnsresomega
Definition: cgnsNames.f90:195
character(len=maxcgnsnamelen), parameter cgnstemp
Definition: cgnsNames.f90:70
character(len=maxcgnsnamelen), parameter cgnsmomy
Definition: cgnsNames.f90:31
character(len=maxcgnsnamelen), parameter cgnsvely
Definition: cgnsNames.f90:54
character(len=maxcgnsnamelen), parameter cgnsmachturb
Definition: cgnsNames.f90:78
character(len=maxcgnsnamelen), parameter cgnseddy
Definition: cgnsNames.f90:84
character(len=maxcgnsnamelen), parameter cgnsresnu
Definition: cgnsNames.f90:191
character(len=maxcgnsnamelen), parameter cgnsvelvecx
Definition: cgnsNames.f90:149
character(len=maxcgnsnamelen), parameter cgnsintermittency
Definition: cgnsNames.f90:175
character(len=maxcgnsnamelen), parameter cgnsresmomz
Definition: cgnsNames.f90:187
character(len=maxcgnsnamelen), parameter cgnssepsensor
Definition: cgnsNames.f90:278
character(len=maxcgnsnamelen), parameter cgnsvorty
Definition: cgnsNames.f90:94
character(len=maxcgnsnamelen), parameter cgnslength
Definition: cgnsNames.f90:129
character(len=maxcgnsnamelen), parameter cgnsptotloss
Definition: cgnsNames.f90:98
character(len=maxcgnsnamelen), parameter cgnscavitation
Definition: cgnsNames.f90:281
character(len=maxcgnsnamelen), parameter cgnsskinfz
Definition: cgnsNames.f90:114
character(len=maxcgnsnamelen), parameter cgnsvortx
Definition: cgnsNames.f90:92
character(len=maxcgnsnamelen), parameter cgnsvelx
Definition: cgnsNames.f90:52
character(len=maxcgnsnamelen), parameter cgnsrelvelx
Definition: cgnsNames.f90:58
character(len=maxcgnsnamelen), parameter cgnsresf
Definition: cgnsNames.f90:203
character(len=maxcgnsnamelen), parameter cgnsrestau
Definition: cgnsNames.f90:197
character(len=maxcgnsnamelen), parameter cgnsprandtl
Definition: cgnsNames.f90:137
character(len=maxcgnsnamelen), parameter cgnsgc
Definition: cgnsNames.f90:169
character(len=maxcgnsnamelen), parameter cgnsprandtlturb
Definition: cgnsNames.f90:139
character(len=maxcgnsnamelen), parameter cgnsskinfmag
Definition: cgnsNames.f90:108
character(len=maxcgnsnamelen), parameter cgnsrelvelz
Definition: cgnsNames.f90:62
character(len=maxcgnsnamelen), parameter cgnscp
Definition: cgnsNames.f90:72
character(len=maxcgnsnamelen), parameter cgnsskinfy
Definition: cgnsNames.f90:112
character(len=maxcgnsnamelen), parameter cgnsyplus
Definition: cgnsNames.f90:122
character(len=maxcgnsnamelen), parameter cgnsturbepsilon
Definition: cgnsNames.f90:45
character(len=maxcgnsnamelen), parameter cgnsresmomx
Definition: cgnsNames.f90:183
character(len=maxcgnsnamelen), parameter cgnsmomx
Definition: cgnsNames.f90:29
character(len=maxcgnsnamelen), parameter cgnsheatratio
Definition: cgnsNames.f90:135
character(len=maxcgnsnamelen), parameter cgnsstanton
Definition: cgnsNames.f90:120
character(len=maxcgnsnamelen), parameter cgnsstatus
Definition: cgnsNames.f90:172
character(len=maxcgnsnamelen), parameter cgnssepsensorks
Definition: cgnsNames.f90:279
character(len=maxcgnsnamelen), parameter cgnsforceindragdir
Definition: cgnsNames.f90:116
character(len=maxcgnsnamelen), parameter cgnsresepsilon
Definition: cgnsNames.f90:199
character(len=maxcgnsnamelen), parameter cgnsturbk
Definition: cgnsNames.f90:39
character(len=maxcgnsnamelen), parameter cgnsvelvecz
Definition: cgnsNames.f90:153
character(len=maxcgnsnamelen), parameter cgnsenergy
Definition: cgnsNames.f90:35
character(len=maxcgnsnamelen), parameter cgnsturbsanu
Definition: cgnsNames.f90:37
character(len=maxcgnsnamelen), parameter cgnsturbf
Definition: cgnsNames.f90:49
character(len=maxcgnsnamelen), parameter cgnspressure
Definition: cgnsNames.f90:68
character(len=maxcgnsnamelen), parameter cgnsresk
Definition: cgnsNames.f90:193
character(len=maxcgnsnamelen), parameter cgnsturbv2
Definition: cgnsNames.f90:47
character(len=maxcgnsnamelen), parameter cgnsblank
Definition: cgnsNames.f90:274
character(len=maxcgnsnamelen), parameter cgnsvortz
Definition: cgnsNames.f90:96
character(len=maxcgnsnamelen), parameter cgnsmach
Definition: cgnsNames.f90:74
character(len=maxcgnsnamelen), parameter cgnswalldist
Definition: cgnsNames.f90:88
character(len=maxcgnsnamelen), parameter cgnsforceinliftdir
Definition: cgnsNames.f90:118
character(len=maxstringlen) stringspace
character(len=maxstringlen) strings
character(len=maxstringlen) stringsci5
integer(kind=inttype), parameter spalartallmarasedwards
Definition: constants.F90:128
integer(kind=inttype), parameter spalartallmaras
Definition: constants.F90:128
integer(kind=inttype), parameter roe
Definition: constants.F90:155
integer(kind=inttype), parameter vanleer
Definition: constants.F90:155
integer(kind=inttype), parameter disscusp
Definition: constants.F90:149
integer(kind=inttype), parameter firstorder
Definition: constants.F90:142
integer(kind=inttype), parameter cptempcurvefits
Definition: constants.F90:124
real(kind=realtype), parameter degtorad
Definition: constants.F90:89
real(kind=realtype), parameter zero
Definition: constants.F90:71
integer(kind=inttype), parameter imax
Definition: constants.F90:293
integer, parameter itu3
Definition: constants.F90:43
integer(kind=inttype), parameter kmin
Definition: constants.F90:296
integer(kind=inttype), parameter jmax
Definition: constants.F90:295
integer, parameter itu2
Definition: constants.F90:42
integer(kind=inttype), parameter constantpressure
Definition: constants.F90:170
integer(kind=inttype), parameter ausmdv
Definition: constants.F90:155
integer(kind=inttype), parameter turkel
Definition: constants.F90:165
integer(kind=inttype), parameter ktau
Definition: constants.F90:128
integer, parameter itu1
Definition: constants.F90:40
integer, parameter irho
Definition: constants.F90:34
integer, parameter imx
Definition: constants.F90:65
integer(kind=inttype), parameter choimerkle
Definition: constants.F90:165
integer(kind=inttype), parameter vanalbeda
Definition: constants.F90:160
integer(kind=inttype), parameter upwind
Definition: constants.F90:149
integer(kind=inttype), parameter komegawilcox
Definition: constants.F90:128
integer(kind=inttype), parameter eulerequations
Definition: constants.F90:110
integer(kind=inttype), parameter timespectral
Definition: constants.F90:115
integer(kind=inttype), parameter komegamodified
Definition: constants.F90:128
integer, parameter ivx
Definition: constants.F90:35
integer(kind=inttype), parameter unsteady
Definition: constants.F90:115
integer, parameter irhoe
Definition: constants.F90:38
integer(kind=inttype), parameter quadextrapolpressure
Definition: constants.F90:170
real(kind=realtype), parameter one
Definition: constants.F90:72
integer, parameter maxstringlen
Definition: constants.F90:16
real(kind=realtype), parameter half
Definition: constants.F90:80
integer(kind=inttype), parameter dissmatrix
Definition: constants.F90:149
integer(kind=inttype), parameter imin
Definition: constants.F90:292
integer(kind=inttype), parameter steady
Definition: constants.F90:115
integer, parameter ivz
Definition: constants.F90:37
real(kind=realtype), parameter two
Definition: constants.F90:73
integer(kind=inttype), parameter minmod
Definition: constants.F90:160
integer, parameter itu4
Definition: constants.F90:44
integer(kind=inttype), parameter cpconstant
Definition: constants.F90:124
integer(kind=inttype), parameter linextrapolpressure
Definition: constants.F90:170
integer, parameter imz
Definition: constants.F90:67
integer(kind=inttype), parameter nolimiter
Definition: constants.F90:160
integer(kind=inttype), parameter mentersst
Definition: constants.F90:128
integer, parameter imy
Definition: constants.F90:66
integer(kind=inttype), parameter nsequations
Definition: constants.F90:110
integer(kind=inttype), parameter kmax
Definition: constants.F90:297
integer, parameter ivy
Definition: constants.F90:36
integer(kind=inttype), parameter dissscalar
Definition: constants.F90:149
integer(kind=inttype), parameter ransequations
Definition: constants.F90:110
integer(kind=inttype), parameter jmin
Definition: constants.F90:294
integer(kind=inttype), parameter normalmomentum
Definition: constants.F90:170
integer(kind=inttype), parameter v2f
Definition: constants.F90:128
logical volwritervy
Definition: extraOutput.f90:30
logical volwritemy
Definition: extraOutput.f90:29
logical surfwritemach
Definition: extraOutput.f90:18
logical surfwritecavitation
Definition: extraOutput.f90:23
logical isowritevortx
Definition: extraOutput.f90:51
logical isowritevz
Definition: extraOutput.f90:45
logical surfwritevy
Definition: extraOutput.f90:16
logical volwritegc
Definition: extraOutput.f90:38
logical volwriteintermittency
Definition: extraOutput.f90:39
logical surfwritecfx
Definition: extraOutput.f90:21
logical surfwritegc
Definition: extraOutput.f90:23
logical surfwriteyplus
Definition: extraOutput.f90:20
logical volwriteblank
Definition: extraOutput.f90:37
logical volwriteshock
Definition: extraOutput.f90:38
logical volwritermach
Definition: extraOutput.f90:33
logical isowritecp
Definition: extraOutput.f90:48
logical surfwriteforceindragdir
Definition: extraOutput.f90:24
logical isowritetemp
Definition: extraOutput.f90:48
logical surfwriteblank
Definition: extraOutput.f90:22
logical isowriterhoe
Definition: extraOutput.f90:48
logical isowritemx
Definition: extraOutput.f90:46
logical volwritervz
Definition: extraOutput.f90:30
logical isowriteeddyvis
Definition: extraOutput.f90:49
logical volwritedist
Definition: extraOutput.f90:34
logical isowritevortz
Definition: extraOutput.f90:52
logical volwritevorty
Definition: extraOutput.f90:35
logical isowritemach
Definition: extraOutput.f90:49
logical surfwritecfy
Definition: extraOutput.f90:21
logical volwriteresmom
Definition: extraOutput.f90:36
logical surfwritesepsensorks
Definition: extraOutput.f90:22
logical isowriteratioeddyvis
Definition: extraOutput.f90:51
logical surfwritecfz
Definition: extraOutput.f90:21
logical surfwritervx
Definition: extraOutput.f90:17
logical isowritervx
Definition: extraOutput.f90:47
logical volwriterhoe
Definition: extraOutput.f90:31
logical volwriteresrhoe
Definition: extraOutput.f90:37
logical surfwriteforceinliftdir
Definition: extraOutput.f90:24
logical isowriteresmom
Definition: extraOutput.f90:53
logical volwriteratioeddyvis
Definition: extraOutput.f90:34
logical volwriteresrho
Definition: extraOutput.f90:36
logical volwritestatus
Definition: extraOutput.f90:38
logical isowriteturb
Definition: extraOutput.f90:45
logical surfwritervz
Definition: extraOutput.f90:17
logical isowriteresturb
Definition: extraOutput.f90:54
logical isowriteresrhoe
Definition: extraOutput.f90:54
logical isowritermach
Definition: extraOutput.f90:50
logical isowriteshock
Definition: extraOutput.f90:55
logical isowriteblank
Definition: extraOutput.f90:54
logical surfwritevx
Definition: extraOutput.f90:16
logical isowritevx
Definition: extraOutput.f90:44
logical volwritecp
Definition: extraOutput.f90:31
logical volwriteptotloss
Definition: extraOutput.f90:36
logical surfwritep
Definition: extraOutput.f90:15
logical volwritemachturb
Definition: extraOutput.f90:32
logical surfwritesepsensorksarea
Definition: extraOutput.f90:22
logical isowriteptotloss
Definition: extraOutput.f90:53
logical isowritevorty
Definition: extraOutput.f90:52
logical volwriteeddyvis
Definition: extraOutput.f90:32
logical volwritemx
Definition: extraOutput.f90:29
logical volwritemach
Definition: extraOutput.f90:32
logical isowritep
Definition: extraOutput.f90:45
logical volwritervx
Definition: extraOutput.f90:30
logical surfwriteptotloss
Definition: extraOutput.f90:18
logical surfwritecf
Definition: extraOutput.f90:20
logical surfwritervy
Definition: extraOutput.f90:17
logical isowritemy
Definition: extraOutput.f90:46
logical surfwritesepsensor
Definition: extraOutput.f90:22
logical isowritefilteredshock
Definition: extraOutput.f90:55
logical surfwriteaxismoment
Definition: extraOutput.f90:23
logical isowritedist
Definition: extraOutput.f90:51
logical volwritevort
Definition: extraOutput.f90:35
logical isowritervy
Definition: extraOutput.f90:47
logical volwritemz
Definition: extraOutput.f90:29
logical volwritevortx
Definition: extraOutput.f90:34
logical surfwritevz
Definition: extraOutput.f90:16
logical volwriteresturb
Definition: extraOutput.f90:37
logical isowriterho
Definition: extraOutput.f90:44
logical isowritevort
Definition: extraOutput.f90:52
logical isowritervz
Definition: extraOutput.f90:47
logical surfwritermach
Definition: extraOutput.f90:19
logical volwritetemp
Definition: extraOutput.f90:31
logical volwritefilteredshock
Definition: extraOutput.f90:38
logical surfwritech
Definition: extraOutput.f90:20
logical isowritemz
Definition: extraOutput.f90:46
logical volwritevortz
Definition: extraOutput.f90:35
logical isowriteresrho
Definition: extraOutput.f90:53
logical surfwritetemp
Definition: extraOutput.f90:15
logical isowritemachturb
Definition: extraOutput.f90:49
logical surfwriterho
Definition: extraOutput.f90:15
logical surfwritecp
Definition: extraOutput.f90:18
logical isowritevy
Definition: extraOutput.f90:44
subroutine computeptot(rho, u, v, w, p, ptot)
Definition: flowUtils.F90:171
real(kind=realtype) rhoinfdim
real(kind=realtype) gammainf
real(kind=realtype) uinf
real(kind=realtype) pinf
real(kind=realtype) rgas
real(kind=realtype) uref
real(kind=realtype) rhoref
integer(kind=inttype) nwf
real(kind=realtype) tref
integer(kind=inttype) nw
real(kind=realtype) rhoinf
real(kind=realtype) pref
real(kind=realtype) sepsensorsharpness
Definition: inputParam.F90:307
real(kind=realtype) cavsensoroffset
Definition: inputParam.F90:309
real(kind=realtype) cavsensorsharpness
Definition: inputParam.F90:310
real(kind=realtype) sepsensoroffset
Definition: inputParam.F90:304
real(kind=realtype) sepsensorkssharpness
Definition: inputParam.F90:308
real(kind=realtype) sepsensorksphi
Definition: inputParam.F90:306
real(kind=realtype) sepsensorksoffset
Definition: inputParam.F90:305
integer(kind=inttype) cavexponent
Definition: inputParam.F90:311
real(kind=realtype) vis2
Definition: inputParam.F90:78
integer(kind=inttype) eulerwallbctreatment
Definition: inputParam.F90:75
real(kind=realtype) adis
Definition: inputParam.F90:78
real(kind=realtype) vis4
Definition: inputParam.F90:78
real(kind=realtype) kappacoef
Definition: inputParam.F90:80
integer(kind=inttype) riemann
Definition: inputParam.F90:74
integer(kind=inttype) limiter
Definition: inputParam.F90:73
integer(kind=inttype) precond
Definition: inputParam.F90:74
integer(kind=inttype) spacediscr
Definition: inputParam.F90:72
logical viscoussurfacevelocities
Definition: inputParam.F90:168
logical laminartoturbulent
Definition: inputParam.F90:177
real(kind=realtype) gammaconstant
Definition: inputParam.F90:595
integer(kind=inttype) equations
Definition: inputParam.F90:583
integer(kind=inttype) equationmode
Definition: inputParam.F90:583
real(kind=realtype) prandtlturb
Definition: inputParam.F90:596
real(kind=realtype), dimension(3) dragdirection
Definition: inputParam.F90:601
integer(kind=inttype) turbmodel
Definition: inputParam.F90:584
real(kind=realtype) machcoef
Definition: inputParam.F90:593
real(kind=realtype) cavitationnumber
Definition: inputParam.F90:605
real(kind=realtype) prandtl
Definition: inputParam.F90:596
real(kind=realtype), dimension(3) liftdirection
Definition: inputParam.F90:600
integer(kind=inttype) cpmodel
Definition: inputParam.F90:584
real(kind=realtype) mach
Definition: inputParam.F90:593
real(kind=realtype), dimension(3) veldirfreestream
Definition: inputParam.F90:599
integer(kind=inttype) ntimeintervalsspectral
Definition: inputParam.F90:645
type(iotype), dimension(:, :), allocatable iovar
Definition: IOModule.f90:49
integer(kind=inttype) timestepunsteady
Definition: monitor.f90:97
real(kind=realtype) timeunsteady
Definition: monitor.f90:98
real(kind=realtype) timeunsteadyrestart
Definition: monitor.f90:98
integer(kind=inttype) ntimestepsrestart
Definition: monitor.f90:97
logical uselinksincgns
Definition: outputMod.F90:64
subroutine writecgnskomegawilcoxinfo(cgnsInd, cgnsBase)
Definition: outputMod.F90:3340
subroutine describescheme(string)
Definition: outputMod.F90:2457
subroutine surfsolnames(solNames)
Definition: outputMod.F90:577
integer(kind=inttype) nsurfsoltowrite
Definition: outputMod.F90:34
character(len=maxstringlen), dimension(:), allocatable volsolfilenames
Definition: outputMod.F90:51
subroutine storesolinbuffer(buffer, copyInBuffer, solName, iBeg, iEnd, jBeg, jEnd, kBeg, kEnd)
Definition: outputMod.F90:745
integer(kind=inttype), dimension(:), allocatable blockscgnsblock
Definition: outputMod.F90:16
integer(kind=inttype) ngridstowrite
Definition: outputMod.F90:32
integer, dimension(:), allocatable fileids
Definition: outputMod.F90:54
integer(kind=inttype), dimension(:), allocatable ndomperproc
Definition: outputMod.F90:24
subroutine writecgnsheader(cgnsInd, base)
Definition: outputMod.F90:2903
character(len=maxstringlen), dimension(:), allocatable gridfilenames
Definition: outputMod.F90:51
integer(kind=inttype), dimension(:, :), allocatable idsbegoralldoms
Definition: outputMod.F90:25
subroutine writecgnsv2finfo(cgnsInd, cgnsBase)
Definition: outputMod.F90:3957
integer(kind=inttype) nvolsoltowrite
Definition: outputMod.F90:33
subroutine storeoldsolinbuffer(buffer, ind, wID, iBeg, iEnd, jBeg, jEnd, kBeg, kEnd)
Definition: outputMod.F90:2415
subroutine numberofisosurfvariables(nIsoSolVar)
Definition: outputMod.F90:69
subroutine writecgnssaeinfo(cgnsInd, cgnsBase)
Definition: outputMod.F90:3874
subroutine numberofsurfsolvariables(nSolVar)
Definition: outputMod.F90:129
subroutine writecgnssainfo(cgnsInd, cgnsBase)
Definition: outputMod.F90:3792
subroutine releasehelpvariableswriting
Definition: outputMod.F90:2880
integer(kind=inttype), dimension(:), allocatable nblockscgnsblock
Definition: outputMod.F90:15
subroutine copydatabufsingleprecision(val, buffer, iBeg, jBeg, kBeg, iEnd, jEnd, kEnd, subRange)
Definition: outputMod.F90:244
subroutine storesurfsolinbuffer(sps, buffer, nn, blockID, faceID, cellRange, solName, viscousSubface, useRindLayer, iBeg, iEnd, jBeg, jEnd)
Definition: outputMod.F90:1399
integer, dimension(:), allocatable cgnsliftdistbases
Definition: outputMod.F90:57
subroutine copydatabufdoubleprecision(val, buffer, iBeg, jBeg, kBeg, iEnd, jEnd, kEnd, subRange)
Definition: outputMod.F90:284
subroutine isosurfnames(solNames)
Definition: outputMod.F90:2562
subroutine writecgnskomegamodifiedinfo(cgnsInd, cgnsBase)
Definition: outputMod.F90:3258
character(len=maxstringlen), dimension(:), allocatable surfsolfilenames
Definition: outputMod.F90:51
subroutine numberofvolsolvariables(nVolSolvar, nVolDiscrVar)
Definition: outputMod.F90:178
integer, dimension(:), allocatable cgnsisosurfbases
Definition: outputMod.F90:56
subroutine writecgnsmentersstinfo(cgnsInd, cgnsBase)
Definition: outputMod.F90:3505
subroutine sethelpvariableswriting
Definition: outputMod.F90:2822
subroutine writecgnsreferencestate(cgnsInd, cgnsBase)
Definition: outputMod.F90:3588
subroutine writecgnsktauinfo(cgnsInd, cgnsBase)
Definition: outputMod.F90:3422
subroutine volsolnames(solNames)
Definition: outputMod.F90:320
integer, dimension(:), allocatable cgnsbases
Definition: outputMod.F90:55
logical oversetpresent
Definition: overset.F90:373
integer, parameter singletype
Definition: precision.F90:117
integer, parameter doubletype
Definition: precision.F90:118
integer, parameter realtype
Definition: precision.F90:112
Definition: utils.F90:1
integer function setcgnsrealtype()
Definition: utils.F90:5578
subroutine setpointers(nn, mm, ll)
Definition: utils.F90:3237
subroutine terminate(routineName, errorMessage)
Definition: utils.F90:502
subroutine computecoeffpressure()
Definition: outputMod.F90:2379