Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Conformity error (#6366)

TommyCee
Beginner
3,194 Views

I don't recall getting his compilation error:

error #6366: The shapes of the array expressions do not conform.

I researched it some and none of the other situations seemed to fit mine. I'm embedding the entire code here:

Program Poppe

!Input parameters are:
!Pa          Atmospheric pressure (Pa)
!Qw_in       Water inlet mass flow rate (kg/s)
!Tw_in       Water inlet temp. (K)
!Tw_out      Water outlet temp. (K)
!Qa          Air mass flow rate (kg/s)
!Wa_in       Air inlet humidity ratio   {kg vapor /kg dry air
!Wa_out_est  Est. outlet air humidity ratio
!Ha_in       Air inlet enthalpy (J/kg)
!N           Number of intervals through the fill

!Variable definitions:
!DelTwlev  Water temp. drop across a single level.


!Local variables:
implicit none
real(4) :: i_fgwo, cp_a, cp_v, DeltaTwLev, wa, wo_new, wo_old, Tref2, F1, F2, F3, F4
real(4), dimension (10) :: TwLev, WaLev, HaLev, p_vsw, w_sw, RatioQw_Qa, H_masw, H_v, Le_f, cp_w, dw_dtw, dima_dTw
real(4) :: delta1, z
integer(4) :: j, k !Dummies.

!Initialize the input parameters:
real(4), parameter    :: Tref       =   273.15       !Reference temp. (K)
real(4), parameter    :: Pa         = 10172.27       !Atmospheric pressure (Pa)
real(4), parameter    :: Qw_in      =     3.99       !Water inlet mass flow rate (kg/s)
real(4), parameter    :: Tw_in      =   312.82       !Water inlet temp. (K)
real(4), parameter    :: Tw_out     =   300.92       !Water outlet temp. (K)
real(4), parameter    :: Qa         =     4.134      !Air mass flow rate (kg/s)
real(4), parameter    :: Wa_in      =     0.00616336 !Air inlet humidity ratio
real(4), parameter    :: Wa_out_est =     0.02226    !Est. outlet air humidity ratio
real(4), parameter    :: Ha_in      = 25291.87496    !Air inlet enthalpy (J/kg)
integer(4), parameter :: N          = 10             !Number of intervals through the fill

!NB: This system is designed for UNsaturated plume conditions.
!Establish some constants for later use:
i_fgwo = 3483181.4 - 5862.7703*Tref - 12.139568*Tref**2 - 0.0140290431*Tref**3    !Latent heat of vaporization, J/K (Eqn. A.4.5)

      DeltaTwLev = (Tw_in - Tw_Out)/N !Ave. temp drop over single level. (Eqn. 3.64)

!     Initialize several variables for later use:
      do j = 0,N
        TwLev(j) = Tw_out + j*DeltaTwLev !Calculate the water temperature at this level. (Eqn. 3.63)
        WaLev(j) = Wa_in                 !Initialize the humidity ratio at this level.   (Eqn. ?)
        HaLev(j) = Ha_in                 !Initialize the air enthalpy at this level.     (Eqn. ?)
      enddo

      wa     = Wa_out_est !Est. an initial value for the outlet air humidity ratio which is determined iteratively.
      delta1 = 1          !Seed value
      wo_new = Wa_out_est !Est. outlet air humidity ratio

      Do while (delta1 > 1.0e-07) !Iteration to obtain outlet air humidity ratio for the calculation of mw/ma(subj):
        wo_old = wo_new  
        do k = 0,N
          Tref2       = (TwLev(k) + Tref)/2.0 !Special reference temp. (K)
          cp_w        = 8155.9 - 28.0627*Tref2 + 0.0511283*Tref2**2 - 2.17582e-13*Tref2**6 !Specific heat of water (J/kg•K); Eqn. A.4.2
          z           = 10.79586*(1.0-(Tref/TwLev(k))) + 5.02808*log10(1.0-(Tref/TwLev(k))) + 0.000150474*(1.0-10.0**(-8.29692*((TwLev(k)/Tref)-1.0))) + 0.00042873*(10.0**(4.76955*(1.0-(Tref/TwLev(k))-1.0)) + 2.786118312 )
          p_vsw(k)    = 10**z !Vapor pressure @ saturation water temp. (N/m2)	(Eqn. A.2.1)
          
          w_sw(k)     = (2501.6 - 2.3263*(TwLev(k)-Tref) / 2501.6 + 1.8577*(TwLev(k)-Tref) - 4.184*(TwLev(k)-Tref)) * (0.62509*p_vsw(k) / (Pa-1.005*p_vsw(k)) ) - ( 1.00414*(TwLev(k)-TwLev(k)) / (2501.6 + 1.8577*( TwLev(k)-Tref) - 4.184*(TwLev(k)-Tref))) !(Eqn. A.3.5)
          RatioQw_Qa  = (Qw_in/Qa)*( 1.0 - (Qw_in/Qa)*(wa-WaLev(k)))  !Uses outlet humidity ratio (wa) assumed above. (Eqn. 3.32)

          cp_a   = 1045.356 - 0.03161783*Tref2 + 0.0007083814*Tref2**2 - 2.705209e-07*Tref2**3 !Specific heat of air   (J/kg•K) @Tref (Eqn. A.1.2)
          cp_v   = 0.0013605 + 2.31334*Tref2 - 2.46784e-10*Tref2**5 + 5.91332E-13*Tref2**6     !Specific heat of vapor (J/kg•K) @Tref (Eqn. A.2.2)

          H_masw(k)   = cp_a*(TwLev(k)-Tref) + w_sw(k)*i_fgwo*Tref+w_sw(k) * cp_v*(TwLev(k)-Tref) !Enthalpy (Eqn. A.3.7b)
          H_v(k)      = i_fgwo*cp_v*(TwLev(k)-Tref)                                               !Vapor enthalpy (Eqn. A.3.8)
          LE_f(k)     = 0.866**0.667*( ((((w_sw(k)+0.622)/(WaLev(k)+0.622)))-1.0) / log(W_sw(k)+0.622/WaLev(k)+0.622) )

          F1          = cp_w(k)*(W_sw(k)-WaLev(k))
          F2          = H_masw(k) - HaLev(k)
          F3          = (Le_f(k)-1.0)*( H_masw(k)-HaLev(k) - ((w_sw(k)-WaLev(k))* H_v(k)) )
          F4          = (w_sw(k)-WaLev(k))* cp_w(k) * (TwLev(k)-Tref)

!dw_dtw(k) = 10.2 !This line compiles fine !!
          dw_dtw(k)   = (RatioQw_Qa * F1) / (F2+F3-F4)
          dima_dTw(k) = RatioQw_Qa * cp_w(k) * (1.0 + ((TwLev(k)-Tref)*F1)/(F2+F3-F4) )

          WaLev(k+1)  = WaLev(k) + (dw_dtw(k)*DeltaTwLev)
          HaLev(k+1)  = HaLev(k) + (dima_dTw(k)*DeltaTwLev)
          

        enddo
      EndDo !Do while

end Program Poppe

 

The error message pertains to these 2 variables:

dw_dtw(k)

dima_dTw(k)

0 Kudos
4 Replies
Les_Neilson
Valued Contributor II
3,178 Views

Lines 78 and 79

dw_dtw(k) and dima_dTw(k) are single elements of the arrays.

RatioQw_Qa is a whole array. (Did you miss off the (k) ?)

Hence the non-conformity

Les

0 Kudos
johnyb_
New Contributor I
3,178 Views

Both dw_dtw  and RatioQw_Qa are declared as real(4), dimension(10) arrays.

In the line of code that gives the error, you are assigning the result of (RatioQw_Qa * F1) / (F2+F3-F4) which is an array to a single element of dw_dtw.

The same goes for the second error.

Had you in mind to write (RatioQw_Qa(k) * F1) / (F2+F3-F4) ?

 

edit: sorry, to slow :-/

0 Kudos
Les_Neilson
Valued Contributor II
3,178 Views

johnyb wrote:

Both dw_dtw  and RatioQw_Qa are declared as real(4), dimension(10) arrays.

In the line of code that gives the error, you are assigning the result of (RatioQw_Qa * F1) / (F2+F3-F4) which is an array to a single element of dw_dtw.

The same goes for the second error.

Had you in mind to write (RatioQw_Qa(k) * F1) / (F2+F3-F4) ?

 

edit: sorry, to slow :-/

 

At least we both saw the same error :-)

Les

0 Kudos
TommyCee
Beginner
3,178 Views

You guys both nailed it!  This is what happens when I get too sleepy while coding (I omitted the index for RatioQw_Qa).  Thanks so much, Les & JohnyB.  Bravo!

0 Kudos
Reply