Carmen Code
 All Classes Files Functions Variables Macros Pages
Functions
PrintIntegral.cpp File Reference

Print integral values into file "FileName". More...

#include "Carmen.h"
Include dependency graph for PrintIntegral.cpp:

Functions

void PrintIntegral (const char *FileName)
 Writes the integral values, like e.g flame velocity, global error, into file FileName. More...
 

Detailed Description

Print integral values into file "FileName".

Function Documentation

void PrintIntegral ( const char *  FileName)

Writes the integral values, like e.g flame velocity, global error, into file FileName.

Parameters
FileNameName of the file
Returns
void
31 {
32  // --- Local variables ---
33 
34  real t; // time
35  FILE *output; // output file
36  int i; // counter
37  real Volume=1.; // Total volume
38 
39  // --- Open file ---
40 
41  if ( (IterationNo == 0) ? (output = fopen(FileName,"w")) : (output = fopen(FileName,"a")) )
42  {
43  // HEADER
44 
45  if (IterationNo == 0)
46  {
47 
48  fprintf(output, "#");
49  fprintf(output, TXTFORMAT, " Time");
50  fprintf(output, TXTFORMAT, "CFL");
51  fprintf(output, TXTFORMAT, "Energy");
52  fprintf(output, TXTFORMAT, "Div B Max");
53  fprintf(output, TXTFORMAT, "ch");
54  fprintf(output, TXTFORMAT, "Helicity");
55  fprintf(output, TXTFORMAT, "DivB Max norm");
56 /*
57  if (Multiresolution)
58  {
59  fprintf(output, TXTFORMAT, "Memory comp.");
60  fprintf(output, TXTFORMAT, "CPU comp.");
61  if (ExpectedCompression != 0. || CVS)
62  fprintf(output, TXTFORMAT, "Tolerance");
63  // if (CVS)
64  // fprintf(output, TXTFORMAT, "Av. Pressure");
65 
66  }
67 */
68  if (!ConstantTimeStep)
69  {
70  if (StepNb == 3) fprintf(output, TXTFORMAT, "RKF Error");
71  fprintf(output, TXTFORMAT,"Next time step");
72  fprintf(output, "%13s ", "IterationNo");
73  fprintf(output, "%13s ", "IterationNb");
74  }
75 
76  fprintf(output,"\n");
77 
78  }
79 
80  if (ConstantTimeStep)
82  else
83  t = ElapsedTime;
84 
85  fprintf(output, FORMAT, t);
86 
87  // --- Compute total volume ---
88 
89  for (i=1; i<= Dimension; i++)
90  Volume *= fabs(XMax[i]-XMin[i]);
91 
92  // Print CFL
93  fprintf(output, FORMAT,Eigenvalue*TimeStep/SpaceStep);
94 
95  // Print momentum and energy
96  //fprintf(output, FORMAT, GlobalMomentum);
97  fprintf(output, FORMAT, GlobalEnergy);
98  fprintf(output, FORMAT, DIVBMax);
99  fprintf(output, FORMAT, ch);
100  fprintf(output, FORMAT, Helicity);
101  fprintf(output, FORMAT, DIVB);
102 
103 
104 /*
105  if (Multiresolution)
106  {
107  fprintf(output, FORMAT, (1.*CellNb)/(1<<(ScaleNb*Dimension)));
108  fprintf(output, FORMAT, CPUTime.CPUTime()/(IterationNo*FVTimeRef));
109 
110  if (ExpectedCompression != 0.)
111  fprintf(output, FORMAT, Tolerance);
112 
113  // if (CVS)
114  //{
115  // fprintf(output, FORMAT, ComputedTolerance(ScaleNb));
116  // fprintf(output, FORMAT, QuantityAverage.value(1));
117  //}
118  }
119 */
120  if (!ConstantTimeStep)
121  {
122  if (StepNb == 3) fprintf(output, FORMAT, RKFError);
123  fprintf(output, FORMAT, TimeStep);
124  fprintf(output, "%13i ", IterationNo);
125  fprintf(output, "%13i ", IterationNb);
126  }
127 
128  fprintf(output, "\n");
129  fclose(output);
130  }
131  else
132  {
133  cout << "PrintIntegral.cpp: In method `void PrintIntegral(Node*, char*)´:\n";
134  cout << "PrintIntegral.cpp: cannot open file " << FileName << '\n';
135  cout << "carmen: *** [PrintIntegral.o] Execution error\n";
136  cout << "carmen: abort execution.\n";
137  exit(1);
138  }
139 }
int IterationNb
Definition: Parameters.cpp:37
real DIVB
Definition: Parameters.cpp:136
real ch
Definition: Parameters.cpp:140
real XMax[4]
Definition: Parameters.cpp:77
real DIVBMax
Definition: Parameters.cpp:137
real Eigenvalue
Definition: Parameters.cpp:157
#define TXTFORMAT
Definition: PreProcessor.h:33
real SpaceStep
Definition: Parameters.cpp:156
int Dimension
Definition: Parameters.cpp:74
real RKFError
Definition: Parameters.cpp:190
int IterationNo
Definition: Parameters.cpp:168
real ElapsedTime
Definition: Parameters.cpp:95
real GlobalEnergy
Definition: Parameters.cpp:197
real Helicity
Definition: Parameters.cpp:195
int StepNb
Definition: Parameters.cpp:36
real XMin[4]
Definition: Parameters.cpp:76
real TimeStep
Definition: Parameters.cpp:40
#define FORMAT
Definition: PreProcessor.h:32
bool ConstantTimeStep
Definition: Parameters.cpp:94
#define real
Definition: PreProcessor.h:31

Here is the caller graph for this function: