Skip to content

Commit

Permalink
fixed a bug, but temp still rises in forced turbulence
Browse files Browse the repository at this point in the history
  • Loading branch information
isriva committed Aug 8, 2023
1 parent f3f6ceb commit f6920af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 8 additions & 3 deletions src_compressible_stag/main_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,14 @@ void main_driver(const char* argv)
}
statsCount++;
if (step%100 == 0) {
amrex::Print() << "Mean Density: " << ComputeSpatialMean(cu, 0) << " Mean Momentum (x):" << ComputeSpatialMean(cumom[0], 0)
<< " Mean Momentum (y):" << ComputeSpatialMean(cumom[1], 0) << " Mean Momentum (z):"
<< ComputeSpatialMean(cumom[2], 0) <<" Mean Energy:" << ComputeSpatialMean(cu, 4) << "\n";
amrex::Print() << "Mean Rho: " << ComputeSpatialMean(cu, 0)
<< " Mean Temp.:" << ComputeSpatialMean(prim, 4)
<< " Mean Press.:" << ComputeSpatialMean(prim, 5)
<< " Mean Mom. (x):" << ComputeSpatialMean(cumom[0], 0)
<< " Mean Mom. (y):" << ComputeSpatialMean(cumom[1], 0)
<< " Mean Mom. (z):" << ComputeSpatialMean(cumom[2], 0)
<< " Mean En.:" << ComputeSpatialMean(cu, 4)
<< "\n";
}

// turbulence outputs
Expand Down
8 changes: 4 additions & 4 deletions src_compressible_stag/timeStepStag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,10 @@ void RK3stepStag(MultiFab& cu,
+ grav[1]*(mompy(i,j+1,k)+mompy(i,j,k))
+ grav[2]*(mompz(i,j,k+1)+mompz(i,j,k)) );
if (turbForcing == 2) {
cup2_fab(i,j,k,4) += 0.5 * dt * ( (turbvf_x_o(i+1,j,k) + 0.25*(turbvf_x(i+1,j,k)-turbvf_x_o(i+1,j,k)))*mompx(i+1,j,k) + mompx(i,j,k)*(turbvf_x_o(i,j,k) + 0.25*(turbvf_x(i,j,k)-turbvf_x_o(i,j,k)))
cup2_fab(i,j,k,4) += 0.5 * 0.25 * dt * ( (turbvf_x_o(i+1,j,k) + 0.25*(turbvf_x(i+1,j,k)-turbvf_x_o(i+1,j,k)))*mompx(i+1,j,k) + mompx(i,j,k)*(turbvf_x_o(i,j,k) + 0.25*(turbvf_x(i,j,k)-turbvf_x_o(i,j,k)))
+ (turbvf_y_o(i,j+1,k) + 0.25*(turbvf_y(i,j+1,k)-turbvf_y_o(i,j+1,k)))*mompy(i,j+1,k) + mompy(i,j,k)*(turbvf_y_o(i,j,k) + 0.25*(turbvf_y(i,j,k)-turbvf_y_o(i,j,k)))
+ (turbvf_z_o(i,j,k+1) + 0.25*(turbvf_z(i,j,k+1)-turbvf_z_o(i,j,k+1)))*mompz(i,j,k+1) + mompz(i,j,k)*(turbvf_z_o(i,j,k) + 0.25*(turbvf_z(i,j,k)-turbvf_z_o(i,j,k))) );
cup2_fab(i,j,k,4) -= dt * energyp_in; // remove the average input energy from random turbulent forcing
cup2_fab(i,j,k,4) -= 0.25 * dt * energyp_in; // remove the average input energy from random turbulent forcing
}
});
}
Expand Down Expand Up @@ -1035,10 +1035,10 @@ void RK3stepStag(MultiFab& cu,
+ grav[1]*(momp2y(i,j+1,k)+momp2y(i,j,k))
+ grav[2]*(momp2z(i,j,k+1)+momp2z(i,j,k)) );
if (turbForcing == 2) {
cu_fab(i,j,k,4) += 0.5 * dt * ( (turbvf_x_o(i+1,j,k) + (2./3.)*(turbvf_x(i+1,j,k)-turbvf_x_o(i+1,j,k)))*momp2x(i+1,j,k) + momp2x(i,j,k)*(turbvf_x_o(i,j,k) + (2./3.)*(turbvf_x(i,j,k)-turbvf_x_o(i,j,k)))
cu_fab(i,j,k,4) += 0.5 * (2./3.) * dt * ( (turbvf_x_o(i+1,j,k) + (2./3.)*(turbvf_x(i+1,j,k)-turbvf_x_o(i+1,j,k)))*momp2x(i+1,j,k) + momp2x(i,j,k)*(turbvf_x_o(i,j,k) + (2./3.)*(turbvf_x(i,j,k)-turbvf_x_o(i,j,k)))
+ (turbvf_y_o(i,j+1,k) + (2./3.)*(turbvf_y(i,j+1,k)-turbvf_y_o(i,j+1,k)))*momp2y(i,j+1,k) + momp2y(i,j,k)*(turbvf_y_o(i,j,k) + (2./3.)*(turbvf_y(i,j,k)-turbvf_y_o(i,j,k)))
+ (turbvf_z_o(i,j,k+1) + (2./3.)*(turbvf_z(i,j,k+1)-turbvf_z_o(i,j,k+1)))*momp2z(i,j,k+1) + momp2z(i,j,k)*(turbvf_z_o(i,j,k) + (2./3.)*(turbvf_z(i,j,k)-turbvf_z_o(i,j,k))) );
cu_fab(i,j,k,4) -= dt * energyp2_in; // remove the average input energy from random turbulent forcing
cu_fab(i,j,k,4) -= (2./3.) * dt * energyp2_in; // remove the average input energy from random turbulent forcing
}
});
}
Expand Down

0 comments on commit f6920af

Please sign in to comment.