Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PREP_GenxWriteSolution.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: write flow solution to file for one region.
26 !
27 ! Description: solution is written in user selected Genx format
28 !
29 ! Input: gridLevel = initial grid level
30 ! region = dimensions and cons. variables of current region
31 ! iReg = region number
32 ! wins, winv = surface and volume window names
33 !
34 ! Output: to file through Rocout.
35 !
36 ! Notes: solution is stored only for the current grid level; it is also
37 ! stored for all dummy cells. All regions are written into one file.
38 ! There is no transfer of data from other processors.
39 !
40 !******************************************************************************
41 !
42 ! $Id: PREP_GenxWriteSolution.F90,v 1.4 2008/12/06 08:44:50 mtcampbe Exp $
43 !
44 ! Copyright: (c) 2001 by the University of Illinois
45 !
46 !******************************************************************************
47 
48 SUBROUTINE genxwritesolution( gridLevel,iReg,region,wins,winv )
49 
50  USE moddatatypes
51  USE moddatastruct, ONLY : t_region
52  USE modglobal, ONLY : t_global
53  USE moderror
54 #ifdef GENX
56 #endif
57  USE modparameters
58  IMPLICIT NONE
59  include "roccomf90.h"
60 
61 ! ... parameters
62  INTEGER :: gridlevel, ireg
63  TYPE(t_region) :: region
64  CHARACTER(CHRLEN) :: wins, winv
65  CHARACTER(CHRLEN) :: fname
66 
67 ! ... loop variables
68  INTEGER :: ipatch
69 
70 ! ... local variables
71  TYPE(t_global), POINTER :: global
72  INTEGER :: write_attr, set_option, surf_all, vol_all, errflg
73 
74 !******************************************************************************
75 
76  global => region%global
77 
78  CALL registerfunction( global,'GenxWriteSolution',&
79  'PREP_GenxWriteSolution.F90' )
80 
81 ! obtain function handle ------------------------------------------------------
82 
83  write_attr = com_get_function_handle( 'OUT.write_attribute')
84  set_option = com_get_function_handle( 'OUT.set_option')
85 
86  IF ( ireg==1) THEN
87  CALL genxwriterocinout( global )
88  ENDIF
89  CALL com_call_function( set_option, 2, 'mode', 'w')
90 
91 ! do not append process rank --------------------------------------------------
92 
93  CALL com_call_function( set_option, 2, 'rankwidth', '0')
94 
95 ! write volume window ---------------------------------------------------------
96 
97  vol_all = com_get_attribute_handle( trim(winv)//'.all')
98 
99  WRITE(fname,'(A,I5.5)') '../Rocin/fluid_',ireg
100  CALL com_call_function( write_attr, 4, trim(fname), vol_all, &
101  "fluid", "00.000000")
102 
103 ! write surface window --------------------------------------------------------
104 
105  surf_all = com_get_attribute_handle( trim(wins)//'.all')
106 
107  WRITE(fname,'(A,I5.5)') '../Rocin/ifluid_',ireg
108  CALL com_call_function( write_attr, 4, trim(fname), surf_all, &
109  "ifluid", "00.000000")
110 
111 ! delete volume and surface windows -------------------------------------------
112 
113  CALL com_delete_window( trim(winv))
114  CALL com_delete_window( trim(wins))
115 
116 ! deallocate arrays -----------------------------------------------------------
117 
118  DEALLOCATE( region%levels(gridlevel)%grid%xyz,stat=errflg )
119  global%error = errflg
120  IF (global%error /= 0) CALL errorstop( global,err_deallocate,__line__ )
121 
122  DEALLOCATE( region%levels(gridlevel)%mixt%cv,stat=errflg )
123  global%error = errflg
124  IF (global%error /= 0) CALL errorstop( global,err_deallocate,__line__ )
125 
126  DO ipatch=1,region%nPatches
127  DEALLOCATE( region%levels(gridlevel)%patches(ipatch)%surfCoord,stat=errflg )
128  global%error = errflg
129  IF (global%error /= 0) CALL errorstop( global,err_deallocate,__line__ )
130 
131  DEALLOCATE( region%levels(gridlevel)%patches(ipatch)%bcFlag,stat=errflg )
132  global%error = errflg
133  IF (global%error /= 0) CALL errorstop( global,err_deallocate,__line__ )
134  ENDDO
135 
136 ! finalize --------------------------------------------------------------------
137 
138  CALL deregisterfunction( global )
139 
140 END SUBROUTINE genxwritesolution
141 
142 !******************************************************************************
143 !
144 ! RCS Revision history:
145 !
146 ! $Log: PREP_GenxWriteSolution.F90,v $
147 ! Revision 1.4 2008/12/06 08:44:50 mtcampbe
148 ! Updated license.
149 !
150 ! Revision 1.3 2008/11/19 22:18:00 mtcampbe
151 ! Added Illinois Open Source License/Copyright
152 !
153 ! Revision 1.2 2004/12/03 03:28:46 wasistho
154 ! rflo_modinterfacesprep to prep_modinterfaces
155 !
156 ! Revision 1.1 2004/12/03 02:20:08 wasistho
157 ! added prefix
158 !
159 ! Revision 1.1 2004/12/03 00:40:49 wasistho
160 ! lower to upper case
161 !
162 ! Revision 1.5 2004/10/12 04:32:52 wasistho
163 ! split to one block per HDF file
164 !
165 ! Revision 1.4 2004/07/27 03:33:23 wasistho
166 ! restructured directories
167 !
168 ! Revision 1.3 2004/07/23 23:24:11 wasistho
169 ! moved creation of Rocin under Rocflo
170 !
171 ! Revision 1.2 2004/07/23 04:31:03 wasistho
172 ! Genx: readin from Rocin, standalone: read .inp file i.o. command line input
173 !
174 ! Revision 1.1 2004/06/30 00:06:05 wasistho
175 ! initial import for GEN3
176 !
177 !
178 !******************************************************************************
179 
180 
181 
182 
183 
184 
185 
void set_option(const char *option_name, const char *option_val)
Set an option for Rocout, such as controlling the output format.
Definition: Rocout.C:552
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine genxwriterocinout(global)
static void write_attr(std::ostream &os, const COM::Attribute *attr, int i)
subroutine genxwritesolution(gridLevel, iReg, region, wins, winv)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469