@@ -43,6 +43,8 @@ const Real TeosClampValue2 =
4343 0.0009662964459162306 ; // Expected value for TEOS-10 eos clamping test 2
4444const Real TeosClampValue3 =
4545 0.0010086299185825206 ; // Expected value for TEOS-10 eos clamping test 3
46+ const Real TeosClampValue4 =
47+ 0.000970887661659709 ; // Expected value for TEOS-10 eos clamping test 4
4648const Real LinearExpValue =
4749 0.0009784735812133072 ; // Expected value for Linear eos
4850
@@ -303,7 +305,9 @@ int testEosTeos10Clamping() {
303305 Array2DReal TArray = Array2DReal (" TArray" , Mesh->NCellsAll , NVertLevels);
304306 Array2DReal PArray = Array2DReal (" PArray" , Mesh->NCellsAll , NVertLevels);
305307 // / Use Kokkos::deep_copy to fill the entire view with the ref value
306- // / Test with valid poly75t values first.
308+ // / -------------------------------------
309+ // / Test with valid poly75t values first (no clamping)
310+ // / -------------------------------------
307311 deepCopy (SArray, 35.0 );
308312 deepCopy (TArray, 5.0 );
309313 deepCopy (PArray, 400.0 );
@@ -335,8 +339,10 @@ int testEosTeos10Clamping() {
335339 LOG_INFO (" EosTest SpecVolClampingNone TEOS-10: PASS" );
336340 }
337341
342+ // / -------------------------------------
338343 // / Test with an ivalid poly75t salinity value second
339- deepCopy (SArray, 45.0 );
344+ // / -------------------------------------
345+ deepCopy (SArray, 45.0 ); // Clamping happens at 42.0
340346 deepCopy (TArray, 5.0 );
341347 deepCopy (PArray, 400.0 );
342348 deepCopy (TestEos->SpecVol , 0.0 );
@@ -367,9 +373,11 @@ int testEosTeos10Clamping() {
367373 LOG_INFO (" EosTest SpecVolClampingSalt TEOS-10: PASS" );
368374 }
369375
370- // / Test with an ivalid poly75t temperature value third
376+ // / -------------------------------------
377+ // / Test with an ivalid high poly75t temperature value third
378+ // / -------------------------------------
371379 deepCopy (SArray, 35.0 );
372- deepCopy (TArray, 100.0 );
380+ deepCopy (TArray, 100.0 ); // Clamping happens at 95.0
373381 deepCopy (PArray, 400.0 );
374382 deepCopy (TestEos->SpecVol , 0.0 );
375383
@@ -391,12 +399,46 @@ int testEosTeos10Clamping() {
391399 SpecVolH = createHostMirrorCopy (SpecVol);
392400 if (numMismatches != 0 ) {
393401 Err++;
394- LOG_ERROR (" EosTest: TEOS SpecVolClampingTemp isApprox FAIL, "
402+ LOG_ERROR (" EosTest: TEOS SpecVolClampingTempHi isApprox FAIL, "
395403 " expected {}, got {} with {} mismatches" ,
396404 TeosClampValue3, SpecVolH (1 , 1 ), numMismatches);
397405 }
398406 if (Err == 0 ) {
399- LOG_INFO (" EosTest SpecVolClampingTemp TEOS-10: PASS" );
407+ LOG_INFO (" EosTest SpecVolClampingTempHi TEOS-10: PASS" );
408+ }
409+
410+ // / -------------------------------------
411+ // / Test with an ivalid low poly75t temperature value last
412+ // / -------------------------------------
413+ deepCopy (SArray, 35.0 );
414+ deepCopy (TArray, -5.0 ); // Clamping happens at -2.2160968103069774
415+ deepCopy (PArray, 400.0 );
416+ deepCopy (TestEos->SpecVol , 0.0 );
417+
418+ // / Compute specific volume
419+ TestEos->computeSpecVol (TArray, SArray, PArray);
420+
421+ // / Check all array values against expected value
422+ numMismatches = 0 ;
423+ SpecVol = TestEos->SpecVol ;
424+ parallelReduce (
425+ " CheckSpecVolMatrix-Teos" , {Mesh->NCellsAll , NVertLevels},
426+ KOKKOS_LAMBDA (int i, int j, int &localCount) {
427+ if (!isApprox (SpecVol (i, j), TeosClampValue4, RTol)) {
428+ localCount++;
429+ }
430+ },
431+ numMismatches);
432+
433+ SpecVolH = createHostMirrorCopy (SpecVol);
434+ if (numMismatches != 0 ) {
435+ Err++;
436+ LOG_ERROR (" EosTest: TEOS SpecVolClampingTempLo isApprox FAIL, "
437+ " expected {}, got {} with {} mismatches" ,
438+ TeosClampValue4, SpecVolH (1 , 1 ), numMismatches);
439+ }
440+ if (Err == 0 ) {
441+ LOG_INFO (" EosTest SpecVolClampingTempLo TEOS-10: PASS" );
400442 }
401443
402444 return Err;
0 commit comments