Memosa-FVM  0.2
testOneDConduction.cpp
Go to the documentation of this file.
1 // This file os part of FVM
2 // Copyright (c) 2012 FVM Authors
3 // See LICENSE file for terms.
4 
5 #include <string>
6 #include <iostream>
7 #include <fstream>
8 
9 using namespace std;
10 
11 #include "PC.h"
12 #include "OneDConduction.h"
13 
14 typedef PC<3,1> PCType;
15 
16 #define NCELLS 20
17 int main(int argc, char *argv[])
18 {
19 
20  PCType kConst;
21  kConst = 1.,0.1;
22 
23  OneDConduction<PCType> model(NCELLS,kConst);
24 
25  model.solve();
26 
27  Array<PCType>& Tc = *model.getSolution();
28 
29  ofstream mean_file, sd_file;
30  mean_file.open("/tmp/mean-uqtk.dat");
31  sd_file.open("/tmp/sd-uqtk.dat");
32 
33  double dx=1.0/NCELLS;
34  double x = dx/2.0;
35  for(int c=0; c<NCELLS; c++)
36  {
37  mean_file << x << " " << Tc[c]._data[0] << endl;
38  sd_file << x << " " << stdDev(Tc[c]) << endl;
39  x += dx;
40  }
41 
42  mean_file.close();
43  sd_file.close();
44 
45  return 0;
46 }
Definition: PC.h:61
int main(int argc, char *argv[])
PC< 3, 1 > PCType
#define NCELLS
boost::shared_ptr< Array< T > > getSolution()
double stdDev(const PC< ORDER, DIM > &a)
Definition: PC.h:363
Definition: Array.h:14
T * _data
Definition: Array.h:500