ADflow  v1.0
ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
writeSol.F90
Go to the documentation of this file.
1 
2 subroutine writesol(famList, nFamList)
3  !
4  ! writeSol controls the writing of a new grid file, a volume
5  ! solution file and a surface solution file.
6  !
7  use constants
8  use extraoutput
10  use monitor, only: writevolume
11  use inputio, only: storerindlayer
13  use flowvarrefstate, only: nw
21  use haloexchange, only: reshalo1
22  implicit none
23 
24  integer(kind=intType), intent(in) :: nFamList
25  integer(kind=intType), dimension(nFamList), intent(in) :: famList
26  !
27  ! Local variables.
28  !
29  integer :: ierr
30 
31  integer(kind=intType) :: i, nn
32 
33  ! If residuals must be written to the volume solution and if halo
34  ! values must be stored, exchange the data here, because in the
35  ! next call the communication buffers are deleted.
36 
37  if (writevolume .and. storerindlayer .and. &
38  (volwriteresrho .or. volwriteresmom .or. &
40  call reshalo1(1_inttype, 1_inttype, nw)
41 
42  ! Temporary deallocate some memory, such that writeSolution
43  ! is not a memory killer.
44 
45  call deallocatetempmemory(.true.)
46 
47  ! Write the files. The routines called depend on the IO
48  ! format used.
49 
53  call writecgnssurfacesol(famlist)
55 
56  ! Release the memory of the file names.
57 
58  deallocate (gridfilenames, volsolfilenames, &
59  surfsolfilenames, stat=ierr)
60  if (ierr /= 0) &
61  call terminate("writeSol", &
62  "Deallocation failure for the file names.")
63 
64  ! Allocate the memory again that was deallocated in the beginning
65  ! of this routine.
66 
67  call allocatetempmemory(.true.)
68 
69 #ifndef USE_NO_SIGNALS
70 
71  ! It is possible that a kill signal was sent during the writing.
72  ! Therefore determine the global signal as the maximum of the
73  ! local ones.
74 
75  call mpi_allreduce(localsignal, globalsignal, 1, adflow_integer, &
76  mpi_max, adflow_comm_world, ierr)
77 #endif
78 
79 end subroutine writesol
integer adflow_comm_world
logical volwriteresmom
Definition: extraOutput.f90:36
logical volwriteresrhoe
Definition: extraOutput.f90:37
logical volwriteresrho
Definition: extraOutput.f90:36
logical volwriteresturb
Definition: extraOutput.f90:37
integer(kind=inttype) nw
subroutine reshalo1(level, start, end)
logical storerindlayer
Definition: inputParam.F90:164
integer(kind=inttype) localsignal
Definition: killSignals.f90:30
integer(kind=inttype) globalsignal
Definition: killSignals.f90:30
logical writevolume
Definition: monitor.f90:116
character(len=maxstringlen), dimension(:), allocatable volsolfilenames
Definition: outputMod.F90:51
character(len=maxstringlen), dimension(:), allocatable gridfilenames
Definition: outputMod.F90:51
subroutine releasehelpvariableswriting
Definition: outputMod.F90:2880
character(len=maxstringlen), dimension(:), allocatable surfsolfilenames
Definition: outputMod.F90:51
subroutine sethelpvariableswriting
Definition: outputMod.F90:2822
Definition: utils.F90:1
subroutine deallocatetempmemory(resNeeded)
Definition: utils.F90:3834
subroutine allocatetempmemory(resNeeded)
Definition: utils.F90:3908
subroutine terminate(routineName, errorMessage)
Definition: utils.F90:502
subroutine writecgnsgridfile
subroutine writecgnssurfacesol(famList)
subroutine writecgnsvolumesol
subroutine writesol(famList, nFamList)
Definition: writeSol.F90:3