Skip to content

Commit 68ce662

Browse files
authored
Merge pull request #1681 from CEED/jrwrigh/fix_fluids_alpha
fix(fluids): Update tests for fixed ts_type alpha
2 parents ef67a58 + 8535f0a commit 68ce662

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

examples/fluids/problems/newtonian.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static PetscErrorCode UnitTests_Newtonian(User user, NewtonianIdealGasContext ga
129129
-rho_div_p};
130130

131131
{
132-
CeedScalar rtol = 20 * CEED_EPSILON;
132+
CeedScalar rtol = 40 * CEED_EPSILON;
133133

134134
PetscCall(TestState(STATEVAR_PRIMITIVE, STATEVAR_CONSERVATIVE, gas, Y0, rtol, rtol, rtol));
135135
PetscCall(TestState(STATEVAR_PRIMITIVE, STATEVAR_ENTROPY, gas, Y0, rtol, rtol, rtol));

examples/fluids/src/misc.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,32 +140,34 @@ PetscErrorCode LoadFluidsBinaryVec(MPI_Comm comm, PetscViewer viewer, Vec Q, Pet
140140

141141
// Compare reference solution values with current test run for CI
142142
PetscErrorCode RegressionTest(AppCtx app_ctx, Vec Q) {
143-
Vec Qref;
143+
Vec Q_ref;
144144
PetscViewer viewer;
145-
PetscReal error, Qrefnorm;
145+
PetscReal error, norm_Q, norm_Q_ref;
146146
MPI_Comm comm = PetscObjectComm((PetscObject)Q);
147147

148148
PetscFunctionBeginUser;
149149
// Read reference file
150-
PetscCall(VecDuplicate(Q, &Qref));
150+
PetscCall(VecDuplicate(Q, &Q_ref));
151151
PetscCheck(strcmp(app_ctx->test_file_path, "") != 0, comm, PETSC_ERR_FILE_READ, "File for regression test not given");
152152
PetscCall(PetscViewerBinaryOpen(comm, app_ctx->test_file_path, FILE_MODE_READ, &viewer));
153-
PetscCall(LoadFluidsBinaryVec(comm, viewer, Qref, NULL, NULL));
153+
PetscCall(LoadFluidsBinaryVec(comm, viewer, Q_ref, NULL, NULL));
154154

155155
// Compute error with respect to reference solution
156-
PetscCall(VecAXPY(Q, -1.0, Qref));
157-
PetscCall(VecNorm(Qref, NORM_MAX, &Qrefnorm));
158-
PetscCall(VecScale(Q, 1. / Qrefnorm));
156+
PetscCall(VecNorm(Q_ref, NORM_MAX, &norm_Q));
157+
PetscCall(VecNorm(Q_ref, NORM_MAX, &norm_Q_ref));
158+
PetscCall(VecAXPY(Q, -1.0, Q_ref));
159+
PetscCall(VecScale(Q, 1. / norm_Q_ref));
159160
PetscCall(VecNorm(Q, NORM_MAX, &error));
160161

161162
// Check error
162163
if (error > app_ctx->test_tol) {
163-
PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Test failed with error norm %g\n", (double)error));
164+
PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Test failed with error norm %g\nReference solution max norm: %g Computed solution max norm %g\n",
165+
(double)error, (double)norm_Q_ref, (double)norm_Q));
164166
}
165167

166168
// Cleanup
167169
PetscCall(PetscViewerDestroy(&viewer));
168-
PetscCall(VecDestroy(&Qref));
170+
PetscCall(VecDestroy(&Q_ref));
169171
PetscFunctionReturn(PETSC_SUCCESS);
170172
}
171173

Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)