From 1d0cb198c92b9eee579d3ecb5617d0629b1f9941 Mon Sep 17 00:00:00 2001 From: Philipp Grete Date: Fri, 12 Aug 2022 11:00:54 +0200 Subject: [PATCH] Add perturb to B (knowing this is not great...) --- src/pgen/cloud.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/pgen/cloud.cpp b/src/pgen/cloud.cpp index 2e0f0f37..e98d0d2e 100644 --- a/src/pgen/cloud.cpp +++ b/src/pgen/cloud.cpp @@ -271,10 +271,13 @@ void InflowWindX2(std::shared_ptr> &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)) + @@ -282,11 +285,17 @@ void InflowWindX2(std::shared_ptr> &mbd, bool coarse) { 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))); } }); }