Memosa-FVM  0.2
RosselandModel_impl.h
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 "Mesh.h"
6 #include "ThermalFields.h"
7 #include "NumType.h"
8 #include "Array.h"
9 #include "Field.h"
10 #include "StorageSite.h"
11 
12 template<class T>
14 {
15 public:
16  typedef Array<T> TArray;
17 
18  Impl(const GeomFields& geomFields,
19  ThermalFields& thermalFields,
20  const MeshList& meshes) :
21  _meshes(meshes),
22  _geomFields(geomFields),
23  _thermalFields(thermalFields)
24  {
25  const int numMeshes = _meshes.size();
26  for (int n=0; n<numMeshes; n++)
27  {
28  const Mesh& mesh = *_meshes[n];
29 
30  RosselandVC<T> *vc(new RosselandVC<T>());
31  _vcMap[mesh.getID()] = vc;
32  }
33  }
34 
35  VCMap& getVCMap() {return _vcMap;}
36 
37  void init() { advance(1,true); }
38 
39  bool advance(const int niter, bool init = false)
40  {
41  const int numMeshes = _meshes.size();
42  for (int n=0; n<numMeshes; n++)
43  {
44  const Mesh& mesh = *_meshes[n];
45 
46  const RosselandVC<T>& vc = *_vcMap[mesh.getID()];
47 
48  const StorageSite& cells = mesh.getCells();
49 
50  TArray& conductivity= dynamic_cast<TArray&>(_thermalFields.conductivity[cells]);
51 
52  FloatValEvaluator<T> cellT(vc.getVal("temperature"),cells);
53 
54  const int nCells = cells.getCount();
55  const float stefan = 0.0000000567;
56  const T index(1.);
57  const T a(1.);
58  const T sigmas(0.);
59  const T C(1.0);
60  const T gamma = 1/(3*(a+sigmas) - C*sigmas);
61  for(int c=0; c<nCells; c++)
62  {
63 
64  T temp = cellT[c];
65 
66  conductivity[c] = 16*stefan*gamma*index*index*temp*temp*temp;
67  }
68  }
69  return true;
70  }
71 
72 
73 private:
77 
79 };
80 
81 template<class T>
83  ThermalFields& thermalFields,
84  const MeshList& meshes) :
85  Model(meshes),
86  _impl(new Impl(geomFields,thermalFields,meshes))
87 {
88  logCtor();
89 }
90 
91 
92 template<class T>
94 {
95  logDtor();
96 }
97 
98 template<class T>
99 void
101 {
102  _impl->init();
103 }
104 
105 template<class T>
106 typename RosselandModel<T>::VCMap&
107 RosselandModel<T>::getVCMap() {return _impl->getVCMap();}
108 
109 
110 template<class T>
111 bool
113 {
114  return _impl->advance(niter);
115 }
116 
117 
118 
ThermalFields & _thermalFields
virtual void init()
Definition: Mesh.h:49
RosselandModel(const GeomFields &geomFields, ThermalFields &thermalFields, const MeshList &meshes)
#define logCtor()
Definition: RLogInterface.h:26
bool advance(const int niter)
FloatVal< T > getVal(const string varName) const
Definition: FloatVarDict.h:85
bool advance(const int niter, bool init=false)
Impl(const GeomFields &geomFields, ThermalFields &thermalFields, const MeshList &meshes)
const MeshList _meshes
Definition: Model.h:29
Definition: Model.h:13
const StorageSite & getCells() const
Definition: Mesh.h:109
#define logDtor()
Definition: RLogInterface.h:33
virtual ~RosselandModel()
Definition: Array.h:14
std::map< int, RosselandVC< T > * > VCMap
int getCount() const
Definition: StorageSite.h:39
const GeomFields & _geomFields
int getID() const
Definition: Mesh.h:106
vector< Mesh * > MeshList
Definition: Mesh.h:439