From 4a06a6d7597238533b1a007d2bd229dc94e96430 Mon Sep 17 00:00:00 2001 From: Stephen Copplestone Date: Mon, 11 Jul 2022 18:31:16 +0200 Subject: [PATCH] Fixed error in "Read external field ..." output. Use correct index of variable in 2D mode. --- src/io_hdf5/hdf5_input_field.f90 | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/io_hdf5/hdf5_input_field.f90 b/src/io_hdf5/hdf5_input_field.f90 index 7b93ea044..5f08f2945 100644 --- a/src/io_hdf5/hdf5_input_field.f90 +++ b/src/io_hdf5/hdf5_input_field.f90 @@ -186,20 +186,19 @@ SUBROUTINE ReadVariableExternalFieldFromHDF5() END DO ! iDir = 1, iDirMax ! Sanity check -IF(VariableExternalFieldDim.EQ.2)THEN - IF(MINVAL(DeltaExternalField(1:2)).LT.0.) CALL abort(__STAMP__,'Failed to calculate the deltas for variable external field.') - ! z-dir: VariableExternalFieldN(1) - ! r-dir: VariableExternalFieldN(2) - IF(NbrOfColumns.NE.VariableExternalFieldN(1)*VariableExternalFieldN(2)) CALL abort(__STAMP__,'Wrong number of points in 2D') - SWRITE (UNIT_stdOut,'(A,2(I0,A))') " Read external field with ",VariableExternalFieldN(3)," x ",VariableExternalFieldN(1),& - " data points" -ELSE - IF(MINVAL(DeltaExternalField).LT.0.) CALL abort(__STAMP__,'Failed to calculate the deltas for variable external field.') - IF(NbrOfColumns.NE.VariableExternalFieldN(1)*VariableExternalFieldN(2)*VariableExternalFieldN(3)) CALL abort(__STAMP__,& - 'Wrong number of points in 3D') - SWRITE (UNIT_stdOut,'(A,3(I0,A))') " Read external field with ",VariableExternalFieldN(1)," x ",VariableExternalFieldN(2)," x ",& - VariableExternalFieldN(3)," data points" -END IF ! VariableExternalFieldDim.EQ.2 +ASSOCIATE( x => VariableExternalFieldN(1:3) ) + IF(VariableExternalFieldDim.EQ.2)THEN + IF(MINVAL(DeltaExternalField(1:2)).LT.0.) CALL abort(__STAMP__,'Failed to calculate the deltas for variable external field.') + ! z-dir: x(1) + ! r-dir: x(2) + IF(NbrOfColumns.NE.x(1)*x(2)) CALL abort(__STAMP__,'Wrong number of points in 2D') + SWRITE (UNIT_stdOut,'(A,2(I0,A))') " Read external field with ",x(1)," x ",x(2)," data points" + ELSE + IF(MINVAL(DeltaExternalField).LT.0.) CALL abort(__STAMP__,'Failed to calculate the deltas for variable external field.') + IF(NbrOfColumns.NE.x(1)*x(2)*x(3)) CALL abort(__STAMP__,'Wrong number of points in 3D') + SWRITE (UNIT_stdOut,'(A,3(I0,A))') " Read external field with ",x(1)," x ",x(2)," x ",x(3)," data points" + END IF ! VariableExternalFieldDim.EQ.2 +END ASSOCIATE !WRITE (*,*) " =", VariableExternalFieldMin !WRITE (*,*) " =", VariableExternalFieldMax