Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WriteThrust.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 thrust history into a file.
26 !
27 ! Description: none.
28 !
29 ! Input: global%thrustTotal = total thrust
30 !
31 ! Output: to file.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: WriteThrust.F90,v 1.3 2008/12/06 08:44:10 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2003 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE writethrust( global )
44 
45  USE moddatatypes
46  USE moderror
47  USE modglobal, ONLY : t_global
48  USE modmpi
49  USE modparameters
50  IMPLICIT NONE
51 
52 ! ... parameters
53  TYPE(t_global), POINTER :: global
54 
55 ! ... local variables
56  CHARACTER(CHRLEN+4) :: fname
57 
58 #ifdef MPI
59  REAL(RFREAL) :: localthrust(2), globalthrust(2)
60 #endif
61 
62 !******************************************************************************
63 
64  CALL registerfunction( global,'WriteThrust',&
65  'WriteThrust.F90' )
66 
67 ! sum up data from other processors
68 
69 #ifdef MPI
70  localthrust(1) = global%thrustMom
71  localthrust(2) = global%thrustPress
72 
73  CALL mpi_reduce( localthrust,globalthrust,2,mpi_rfreal,mpi_sum,masterproc, &
74  global%mpiComm,global%mpierr )
75  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
76 
77  global%thrustMom = globalthrust(1)
78  global%thrustPress = globalthrust(2)
79 #endif
80  global%thrustTotal = global%thrustMom + global%thrustPress
81 
82 ! steady flow
83 
84  IF (global%flowType==flow_steady .AND. global%myProcid==masterproc) THEN
85  WRITE(if_thrust,1000,err=10) global%currentIter,global%thrustMom, &
86  global%thrustPress,global%thrustTotal
87 
88 ! unsteady flow
89 
90  ELSE IF (global%flowType==flow_unsteady .AND. global%myProcid==masterproc) THEN
91  WRITE(if_thrust,2000,err=10) global%currentTime,global%thrustMom, &
92  global%thrustPress,global%thrustTotal
93  ENDIF
94 
95 ! close and open file (instead of fflush)
96 
97  IF (global%thrustOpenClose .AND. global%myProcid==masterproc) THEN
98  WRITE(fname,'(A)') trim(global%outDir)//trim(global%casename)//'.thr'
99  CLOSE(if_thrust)
100  OPEN(if_thrust,file=fname,form='FORMATTED',status='OLD',position='APPEND')
101  ENDIF
102 
103 ! finalize
104 
105  CALL deregisterfunction( global )
106  goto 999
107 
108 10 CONTINUE
109  CALL errorstop( global,err_file_write,__line__,'Thrust history file.' )
110 
111 1000 FORMAT(i6,1pe13.4,2e13.4)
112 2000 FORMAT(1pe12.5,3e13.4)
113 
114 999 CONTINUE
115 
116 END SUBROUTINE writethrust
117 
118 !******************************************************************************
119 !
120 ! RCS Revision history:
121 !
122 ! $Log: WriteThrust.F90,v $
123 ! Revision 1.3 2008/12/06 08:44:10 mtcampbe
124 ! Updated license.
125 !
126 ! Revision 1.2 2008/11/19 22:17:24 mtcampbe
127 ! Added Illinois Open Source License/Copyright
128 !
129 ! Revision 1.1 2004/12/01 16:52:27 haselbac
130 ! Initial revision after changing case
131 !
132 ! Revision 1.1 2003/06/02 17:12:00 jblazek
133 ! Added computation of thrust.
134 !
135 !******************************************************************************
136 
137 
138 
139 
140 
141 
142 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE form
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine writethrust(global)
Definition: WriteThrust.F90:43