@@ -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
142142PetscErrorCode 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
0 commit comments