Canoe
Comprehensive Atmosphere N' Ocean Engine
pressure_anomaly.cpp
Go to the documentation of this file.
1 #include "../coordinates/coordinates.hpp"
2 #include "diagnostics.hpp"
3 
4 PressureAnomaly::PressureAnomaly(MeshBlock *pmb) : Diagnostics(pmb, "presa") {
5  type = "SCALARS";
6  long_name = "Pressure anomaly";
7  units = "pa";
8  mean_.NewAthenaArray(ncells1_);
9  data.NewAthenaArray(ncells3_, ncells2_, ncells1_);
10 }
11 
13  MeshBlock *pmb = pmy_block_;
14  Coordinates *pcoord = pmb->pcoord;
15  int is = pmb->is, js = pmb->js, ks = pmb->ks;
16  int ie = pmb->ie, je = pmb->je, ke = pmb->ke;
17 
18  mean_.ZeroClear();
19 
20  // calculate horizontal mean
21  for (int k = ks; k <= ke; ++k)
22  for (int j = js; j <= je; ++j) {
23  pcoord->CellVolume(k, j, is, ie, vol_);
24  for (int i = is; i <= ie; ++i) mean_(i) += vol_(i) * w(IPR, k, j, i);
25  }
26 
28 
29  // pressure anomaly
30  for (int k = ks; k <= ke; ++k)
31  for (int j = js; j <= je; ++j)
32  for (int i = is; i <= ie; ++i)
33  data(k, j, i) = w(IPR, k, j, i) - mean_(i) / total_vol_(i);
34 }
void gatherAllData23_(AthenaArray< Real > &total_vol, AthenaArray< Real > &total_data)
std::string units
Definition: diagnostics.hpp:17
AthenaArray< Real > mean_
mean and eddy component
Definition: diagnostics.hpp:48
AthenaArray< Real > vol_
Definition: diagnostics.hpp:56
std::string long_name
Definition: diagnostics.hpp:17
std::string type
Definition: diagnostics.hpp:16
AthenaArray< Real > data
Definition: diagnostics.hpp:19
MeshBlock * pmy_block_
Definition: diagnostics.hpp:44
AthenaArray< Real > total_vol_
Definition: diagnostics.hpp:57
void Finalize(AthenaArray< Real > const &w)
PressureAnomaly(MeshBlock *pmb)