Skip to content

Commit

Permalink
Fix regression tests for Linux and Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangcs committed Feb 1, 2023
1 parent c3c53b9 commit 422085f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
21 changes: 9 additions & 12 deletions regression/compreg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ for ((i=0; i<PNUM; i++)); do

printf "Problem $i: ${GREEN}${DIRS[i]}/${FILES[i]}${NC}\n"
../testOpenCAEPoro ../examples/${DIRS[i]}/${FILES[i]} > ../examples/${DIRS[i]}/log.out
mv ../examples/${DIRS[i]}/$OCP_LOG ./$i/New_IMPEC_$OCP_LOG 2>/dev/null
mv ../examples/${DIRS[i]}/$OCP_SUM ./$i/New_IMPEC_$OCP_SUM 2>/dev/null
mv ../examples/${DIRS[i]}/$OCP_REV ./$i/New_IMPEC_$OCP_REV 2>/dev/null
sdiff -s ./$i/Old_IMPEC_$OCP_LOG ./$i/New_IMPEC_$OCP_LOG 2>/dev/null
sdiff -s ./$i/Old_IMPEC_$OCP_SUM ./$i/New_IMPEC_$OCP_SUM 2>/dev/null
sdiff -s ./$i/Old_IMPEC_$OCP_REV ./$i/New_IMPEC_$OCP_REV 2>/dev/null
mv ../examples/${DIRS[i]}/$OCP_LOG ./$i/New_$OCP_LOG 2>/dev/null
mv ../examples/${DIRS[i]}/$OCP_SUM ./$i/New_$OCP_SUM 2>/dev/null
mv ../examples/${DIRS[i]}/$OCP_REV ./$i/New_$OCP_REV 2>/dev/null
sdiff -s ./$i/Old_$OCP_LOG ./$i/New_$OCP_LOG 2>/dev/null
sdiff -s ./$i/Old_$OCP_SUM ./$i/New_$OCP_SUM 2>/dev/null
sdiff -s ./$i/Old_$OCP_REV ./$i/New_$OCP_REV 2>/dev/null
done

# Overwrite results
Expand All @@ -61,12 +61,9 @@ read OVERWRITE_OLD

if [ "$OVERWRITE_OLD" = "yes" ]; then
for ((i=0; i<PNUM; i++)); do
mv $i/New_FIM_$OCP_LOG $i/Old_FIM_$OCP_LOG 2>/dev/null
mv $i/New_FIM_$OCP_SUM $i/Old_FIM_$OCP_SUM 2>/dev/null
mv $i/New_FIM_$OCP_REV $i/Old_FIM_$OCP_REV 2>/dev/null
mv $i/New_IMPEC_$OCP_LOG $i/Old_IMPEC_$OCP_LOG 2>/dev/null
mv $i/New_IMPEC_$OCP_SUM $i/Old_IMPEC_$OCP_SUM 2>/dev/null
mv $i/New_IMPEC_$OCP_REV $i/Old_IMPEC_$OCP_REV 2>/dev/null
mv $i/New_$OCP_LOG $i/Old_$OCP_LOG 2>/dev/null
mv $i/New_$OCP_SUM $i/Old_$OCP_SUM 2>/dev/null
mv $i/New_$OCP_REV $i/Old_$OCP_REV 2>/dev/null
done
echo "Overwrite the old results."
else
Expand Down
46 changes: 24 additions & 22 deletions src/OCPOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,38 +611,40 @@ void CriticalInfo::SetVal(const Reservoir& rs, const OCPControl& ctrl)

void CriticalInfo::PrintFastReview(const string& dir) const
{
string FileOut = dir + "FastReview.out";
string FileOut = dir + "FastReview.out";
const USI ns = 12;

ofstream outF(FileOut);
if (!outF.is_open()) {
OCP_ABORT("Can not open " + FileOut);
}

// Item
outF << "\t" << setw(10) << "Time";
outF << "\t" << setw(10) << "dt";
outF << "\t" << setw(10) << "dPmax";
outF << "\t" << setw(10) << "dVmax";
outF << "\t" << setw(10) << "dSmax";
outF << "\t" << setw(10) << "dNmax";
outF << "\t" << setw(10) << "CFL\n";
outF << setw(ns) << "Time";
outF << setw(ns) << "dt";
outF << setw(ns) << "dPmax";
outF << setw(ns) << "dVmax";
outF << setw(ns) << "dSmax";
outF << setw(ns) << "dNmax";
outF << setw(ns) << "CFL" << endl;
// Unit
outF << "\t" << setw(10) << "Days";
outF << "\t" << setw(10) << "Days";
outF << "\t" << setw(10) << "Psia";
outF << "\t" << setw(10) << " ";
outF << "\t" << setw(10) << " ";
outF << "\t" << setw(10) << " ";
outF << "\t" << setw(10) << " \n\n";
outF << setw(ns) << "Days";
outF << setw(ns) << "Days";
outF << setw(ns) << "Psia";
outF << setw(ns) << " ";
outF << setw(ns) << " ";
outF << setw(ns) << " ";
outF << setw(ns) << " " << endl;

USI n = time.size();
for (USI i = 0; i < n; i++) {
outF << "\t" << setw(10) << time[i];
outF << "\t" << setw(10) << dt[i];
outF << "\t" << setw(10) << dPmax[i];
outF << "\t" << setw(10) << dVmax[i];
outF << "\t" << setw(10) << dSmax[i];
outF << "\t" << setw(10) << dNmax[i];
outF << "\t" << setw(10) << cfl[i];
outF << setw(ns) << fixed << setprecision(3) << time[i];
outF << setw(ns) << fixed << setprecision(3) << dt[i];
outF << setw(ns) << scientific << setprecision(3) << dPmax[i];
outF << setw(ns) << scientific << setprecision(3) << dVmax[i];
outF << setw(ns) << scientific << setprecision(3) << dSmax[i];
outF << setw(ns) << scientific << setprecision(3) << dNmax[i];
outF << setw(ns) << scientific << setprecision(3) << cfl[i];
outF << "\n";
}

Expand Down

0 comments on commit 422085f

Please sign in to comment.