Canoe
Comprehensive Atmosphere N' Ocean Engine
turbulence_model.cpp
Go to the documentation of this file.
1 // C/C++ headers
2 #include <algorithm>
3 #include <string>
4 #include <vector>
5 
6 // Athena++ headers
7 #include <athena/athena.hpp>
8 #include <athena/mesh/mesh.hpp>
9 #include <athena/scalars/scalars.hpp>
10 
11 // application
12 #include <application/application.hpp>
13 #include <application/exceptions.hpp>
14 
15 // canoe
16 #include <configure.hpp>
17 
18 // snap
19 #include "turbulence_model.hpp"
20 
21 // constructor, initializes data structures and parameters
22 
23 TurbulenceModel::TurbulenceModel(MeshBlock *pmb, ParameterInput *pin)
24  : pmy_block(pmb) {
25  if (NTURBULENCE == 0) return;
26 
27  w.InitWithShallowSlice(pmb->pscalars->r, 4, NCLOUD + NCHEMISTRY + NTRACER,
28  NTURBULENCE);
29  u.InitWithShallowSlice(pmb->pscalars->s, 4, NCLOUD + NCHEMISTRY + NTRACER,
30  NTURBULENCE);
31 
32  int ncells1 = pmb->ncells1;
33  int ncells2 = pmb->ncells2;
34  int ncells3 = pmb->ncells3;
35 
36  mut.NewAthenaArray(ncells3, ncells2, ncells1);
37 }
38 
40  if (NTURBULENCE == 0) return;
41 
42  Application::Logger app("snap");
43  app->Log("Destroy TurbulenceModel");
44 }
45 
47  ParameterInput *pin) {
48  Application::Logger app("snap");
49  app->Log("Create turbulenceModel");
50 
51  TurbulenceModelPtr pturb = nullptr;
52 
53  if (pin->DoesParameterExist("hydro", "turbulence")) {
54  std::string turbulence_model = pin->GetString("hydro", "turbulence");
55  if (turbulence_model == "none") {
56  pturb = std::make_shared<TurbulenceModel>(pmb, pin);
57  } else if (turbulence_model == "kepsilon") {
58  pturb = std::make_shared<KEpsilonTurbulence>(pmb, pin);
59  if (NTURBULENCE < 2)
60  throw NotImplementedError(
61  "NTURBULENCE must be at least 2 for k-epsilon model");
62  } else {
63  throw NotImplementedError(turbulence_model);
64  }
65  }
66 
67  return pturb;
68 }
static TurbulenceModelPtr Create(MeshBlock *pmb, ParameterInput *pin)
TurbulenceModel(MeshBlock *pmb, ParameterInput *pin)
virtual ~TurbulenceModel()
AthenaArray< Real > u
AthenaArray< Real > mut
AthenaArray< Real > w
std::shared_ptr< TurbulenceModel > TurbulenceModelPtr