Skip to content

Commit

Permalink
Add perturb to B (knowing this is not great...)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrete committed Aug 12, 2022
1 parent 6df018f commit 1d0cb19
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/pgen/cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,22 +271,31 @@ void InflowWindX2(std::shared_ptr<MeshBlockData<Real>> &mbd, bool coarse) {
KOKKOS_LAMBDA(const int, const int &k, const int &j, const int &i) {
const auto idx = (k - kb.s) * Ni * Nj + (j - jb.s) * Ni + (i - ib.s);
cons(IDN, k, j, i) = rho_wind_;
cons(IM1, k, j, i) = perturb_ > 0.0 ? mom_wind_ * rand_num(idx, 0) : 0.0;
cons(IM2, k, j, i) =
perturb > 0.0 ? mom_wind_ + mom_wind_ * rand_num(idx, 1) : mom_wind_;
cons(IM3, k, j, i) = perturb_ > 0.0 ? mom_wind_ * rand_num(idx, 2) : 0.0;
// cons(IM1, k, j, i) = perturb_ > 0.0 ? mom_wind_ * rand_num(idx, 0) : 0.0;
// cons(IM2, k, j, i) =
// perturb_ > 0.0 ? mom_wind_ + mom_wind_ * rand_num(idx, 1) : mom_wind_;
// cons(IM3, k, j, i) = perturb_ > 0.0 ? mom_wind_ * rand_num(idx, 2) : 0.0;
cons(IM1, k, j, i) = 0.0;
cons(IM2, k, j, i) = mom_wind_;
cons(IM3, k, j, i) = 0.0;
cons(IEN, k, j, i) =
rhoe_wind_ + 0.5 *
(SQR(cons(IM1, k, j, i)) + SQR(cons(IM2, k, j, i)) +
SQR(cons(IM3, k, j, i))) /
rho_wind_;
if (Bx_ != 0.0) {
cons(IB1, k, j, i) = Bx_;
cons(IEN, k, j, i) += 0.5 * Bx_ * Bx_;
cons(IB2, k, j, i) = perturb_ > 0.0 ? Bx_ * rand_num(idx, 1) : 0.0;
cons(IB3, k, j, i) = perturb_ > 0.0 ? Bx_ * rand_num(idx, 2) : 0.0;
cons(IEN, k, j, i) +=
0.5 * (Bx_ * Bx_ + SQR(cons(IB2, k, j, i)) + SQR(cons(IB3, k, j, i)));
}
if (By_ != 0.0) {
cons(IB1, k, j, i) = perturb_ > 0.0 ? By_ * rand_num(idx, 0) : 0.0;
cons(IB2, k, j, i) = By_;
cons(IEN, k, j, i) += 0.5 * By_ * By_;
cons(IB3, k, j, i) = perturb_ > 0.0 ? By_ * rand_num(idx, 2) : 0.0;
cons(IEN, k, j, i) +=
0.5 * (By_ * By_ + SQR(cons(IB1, k, j, i)) + SQR(cons(IB3, k, j, i)));
}
});
}
Expand Down

0 comments on commit 1d0cb19

Please sign in to comment.