Skip to content

Commit

Permalink
Update turbulence.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
evan1022 authored Mar 8, 2024
1 parent 46b48e1 commit ddc5c78
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/pgen/turbulence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,5 +536,34 @@ void UserWorkBeforeOutput(MeshBlock *pmb, ParameterInput *pin) {
auto state_dist = few_modes_ft.GetDistState();
pin->SetString("problem/turbulence", "state_dist", state_dist);
}
\\
\\ COMPUTE THE AVERAGE OVER PRODUCTS OF S VALUES
\\ PHILIPP: PLEASE FIX THIS
\\
auto correlation_s = tracers_pkg->Param<std::vector<Real>>("correlation_s");
auto correlation_sdot = tracers_pkg->Param<std::vector<Real>>("correlation_sdot");

Kokkos::parallel_reduce(
"",
Kokkos::MDRangePolicy<Kokkos::Rank<1>>(n),
KOKKOS_LAMBDA(const int n, Real &corr_s, Real &corr_sdot) {
auto tracers_pkg = pmb->packages.Get("tracers");
const auto n_lookback = tracers_pkg->Param<int>("n_lookback");
auto idx = n_lookback - 1;
auto &s = swarm->Get<Real>("s").Get();
auto &sdot = swarm->Get<Real>("sdot").Get();
auto corr_s;
auto corr_sdot;

for (i = 0; i < idx; i++) {
corr_s[i] =s(0, n) *s(i,n); \\PHILIPP: HOW DO YOU DO THIS INDEXING?
corr_sdot[i]=sdot(0, n)*sdot(i,n);
}
},
Kokkos::Add<Real>(correlation_s,correlation_sdot));
correlation_s=correlation_s/N;
correlation_sdot=correlation_sdot/N;



} // namespace turbulence

0 comments on commit ddc5c78

Please sign in to comment.