Skip to content

Commit

Permalink
Modify to use zlev for data logging. (#1600)
Browse files Browse the repository at this point in the history
  • Loading branch information
AMLattanzi authored May 2, 2024
1 parent 571acd4 commit 71b0a5f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
21 changes: 18 additions & 3 deletions Source/IO/ERF_Write1DProfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ ERF::write_1D_profiles (Real time)
if (data_log1.good()) {
// Write the quantities at this time
for (int k = 0; k < hu_size; k++) {
Real z = (k + 0.5)* dx[2];
Real z;
if (zlevels_stag.size() > 1) {
z = 0.5 * (zlevels_stag[k] + zlevels_stag[k+1]);
} else {
z = (k + 0.5)* dx[2];
}
data_log1 << std::setw(datwidth) << std::setprecision(timeprecision) << time << " "
<< std::setw(datwidth) << std::setprecision(datprecision) << z << " "
<< h_avg_u[k] << " " << h_avg_v[k] << " " << h_avg_w[k] << " "
Expand All @@ -78,7 +83,12 @@ ERF::write_1D_profiles (Real time)
if (data_log2.good()) {
// Write the perturbational quantities at this time
for (int k = 0; k < hu_size; k++) {
Real z = (k + 0.5)* dx[2];
Real z;
if (zlevels_stag.size() > 1) {
z = 0.5 * (zlevels_stag[k] + zlevels_stag[k+1]);
} else {
z = (k + 0.5)* dx[2];
}
data_log2 << std::setw(datwidth) << std::setprecision(timeprecision) << time << " "
<< std::setw(datwidth) << std::setprecision(datprecision) << z << " "
<< h_avg_uu[k] - h_avg_u[k]*h_avg_u[k] << " "
Expand Down Expand Up @@ -126,7 +136,12 @@ ERF::write_1D_profiles (Real time)
if (data_log3.good()) {
// Write the average stresses
for (int k = 0; k < hu_size; k++) {
Real z = (k + 0.5)* dx[2];
Real z;
if (zlevels_stag.size() > 1) {
z = 0.5 * (zlevels_stag[k] + zlevels_stag[k+1]);
} else {
z = (k + 0.5)* dx[2];
}
data_log3 << std::setw(datwidth) << std::setprecision(timeprecision) << time << " "
<< std::setw(datwidth) << std::setprecision(datprecision) << z << " "
<< h_avg_tau11[k] << " " << h_avg_tau12[k] << " " << h_avg_tau13[k] << " "
Expand Down
21 changes: 18 additions & 3 deletions Source/IO/ERF_Write1DProfiles_stag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ ERF::write_1D_profiles_stag (Real time)
if (data_log1.good()) {
// Write the quantities at this time
for (int k = 0; k < unstag_size; k++) {
Real z = k * dx[2];
Real z;
if (zlevels_stag.size() > 1) {
z = zlevels_stag[k];
} else {
z = k * dx[2];
}
data_log1 << std::setw(datwidth) << std::setprecision(timeprecision) << time << " "
<< std::setw(datwidth) << std::setprecision(datprecision) << z << " "
<< h_avg_u[k] << " " << h_avg_v[k] << " " << h_avg_w[k] << " "
Expand Down Expand Up @@ -121,7 +126,12 @@ ERF::write_1D_profiles_stag (Real time)

// For internal values, interpolate scalar quantities to faces
for (int k = 1; k < unstag_size; k++) {
Real z = k * dx[2];
Real z;
if (zlevels_stag.size() > 1) {
z = zlevels_stag[k];
} else {
z = k * dx[2];
}
Real uface = 0.5*(h_avg_u[k] + h_avg_u[k-1]);
Real vface = 0.5*(h_avg_v[k] + h_avg_v[k-1]);
Real thface = 0.5*(h_avg_th[k] + h_avg_th[k-1]);
Expand Down Expand Up @@ -212,7 +222,12 @@ ERF::write_1D_profiles_stag (Real time)
if (data_log3.good()) {
// Write the average stresses
for (int k = 0; k < unstag_size; k++) {
Real z = k * dx[2];
Real z;
if (zlevels_stag.size() > 1) {
z = zlevels_stag[k];
} else {
z = k * dx[2];
}
data_log3 << std::setw(datwidth) << std::setprecision(timeprecision) << time << " "
<< std::setw(datwidth) << std::setprecision(datprecision) << z << " "
<< h_avg_tau11[k] << " " << h_avg_tau12[k] << " " << h_avg_tau13[k] << " "
Expand Down

0 comments on commit 71b0a5f

Please sign in to comment.