[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Range check error -> dirty solution



Hello Bengt, hello Peter, hello Harald Drueck,

in the type 140 are small programming errors in range definition. We gave the information in 1997 to the programmer of type140, but he said
that we are the only users with this problem. So the bug wasn't fixed.
We programmed a dirty solution and for first aid I will give it to you. But it is realy dirty and so I will hope that this email-conversation
will initiate Harald to give all type140-users a proper solution.

OK, the dirty solution:

-----------------------------------------------------------------------------------------------------------------------------------
first part, old version:

C      Calculate boundary vector                                      *
C**********************************************************************
       DO 10 i = 1,Nmax
          DO 11 j = 1,3
C------ --> It's not necessary to calculate nodes that are
C           not occupied by heatexchangers
            If (j.eq.1.and.SYSINFO(i,1).eq.0) GOTO 11
            IF (j.eq.3.and.(ABS(SYSINFO(i,2))
     1          + ABS(SYSINFO(i,3))).eq.0) GOTO 11
            if (j.eq.1) then
               BO(i,j)=sigma*(DU(i,j)*Told(i-1,j)
     1                + DR(i,j)*Told(i,j+1) + DO(i,j)*Told(i+1,j))
     2                + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j)+SOURCE(i,j)
     3                + (CAP(i,j)/DT-sigma*DDSTAR(i,j))*Told(i,j)
            else if (j.eq.3) then
               BO(i,j)=sigma*(DU(i,j)*Told(i-1,j)
     1                 + DL(i,j)*Told(i,j-1) + DO(i,j)*Told(i+1,j))
     2                 + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j) + SOURCE(i,j)
     3                 + (CAP(i,j)/DT-sigma * DDSTAR(i,j))*Told(i,j)
            else
               BO(i,j)=sigma*(DO(i,j)*Told(i+1,j)+DU(i,j)*Told(i-1,j)
     1                 + DL(i,j)*Told(i,j-1) + DR(i,j)*Told(i,j+1))
     2                 + (CAP(i,j)/DT-sigma*DDSTAR(i,j))*Told(i,j)
     3                 + SOURCE(i,j)+DB(i,j)*Tamb+DF(i,j)*Tinp(i,j)
            end if
11       Continue
10    Continue

first part, new version:

c     *** modification
c    Andreas Buehring, 1999
C      Calculate boundary vector                                      *
C**********************************************************************
       DO 10 i = 1,Nmax
          DO 11 j = 1,3
C------ --> It's not necessary to calculate nodes that are
C           not occupied by heatexchangers
            If (j.eq.1.and.SYSINFO(i,1).eq.0) GOTO 11
            IF (j.eq.3.and.(ABS(SYSINFO(i,2))
     1          + ABS(SYSINFO(i,3))).eq.0) GOTO 11
            if (j.eq.1) then
c     ATTENTION; IF i=1 Told(0,j) not defined !!! -> error !!!!
              if(i.eq.1) then
               BO(i,j)=sigma*(DU(i,j)*Told(i,j)
     1                + DR(i,j)*Told(i,j+1) + DO(i,j)*Told(i+1,j))
     2                + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j)+SOURCE(i,j)
     3                + (CAP(i,j)/DT-sigma*DDSTAR(i,j))*Told(i,j)
              else
               BO(i,j)=sigma*(DU(i,j)*Told(i-1,j)
     1                + DR(i,j)*Told(i,j+1) + DO(i,j)*Told(i+1,j))
     2                + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j)+SOURCE(i,j)
     3                + (CAP(i,j)/DT-sigma*DDSTAR(i,j))*Told(i,j)
              end if
            else if (j.eq.3) then
              if(i.eq.1) then
               BO(i,j)=sigma*(DU(i,j)*Told(i,j)
     1                 + DL(i,j)*Told(i,j-1) + DO(i,j)*Told(i+1,j))
     2                 + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j) + SOURCE(i,j)
     3                 + (CAP(i,j)/DT-sigma * DDSTAR(i,j))*Told(i,j)
              else
               BO(i,j)=sigma*(DU(i,j)*Told(i-1,j)
     1                 + DL(i,j)*Told(i,j-1) + DO(i,j)*Told(i+1,j))
     2                 + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j) + SOURCE(i,j)
     3                 + (CAP(i,j)/DT-sigma * DDSTAR(i,j))*Told(i,j)
              end if
            else
              if(i.eq.1) then
               BO(i,j)=sigma*(DO(i,j)*Told(i+1,j)+DU(i,j)*Told(i,j)
     1                 + DL(i,j)*Told(i,j-1) + DR(i,j)*Told(i,j+1))
     2                 + (CAP(i,j)/DT-sigma*DDSTAR(i,j))*Told(i,j)
     3                 + SOURCE(i,j)+DB(i,j)*Tamb+DF(i,j)*Tinp(i,j)
              else
               BO(i,j)=sigma*(DO(i,j)*Told(i+1,j)+DU(i,j)*Told(i-1,j)
     1                 + DL(i,j)*Told(i,j-1) + DR(i,j)*Told(i,j+1))
     2                 + (CAP(i,j)/DT-sigma*DDSTAR(i,j))*Told(i,j)
     3                 + SOURCE(i,j)+DB(i,j)*Tamb+DF(i,j)*Tinp(i,j)
              end if
            end if
11       Continue
10    Continue
c     *** end of modification

--------------------------------------------------------------------------------------------------------------------
second part, old version:

                 XSTERN=Tnew(I,J)
c                  write(*,*)i,j
                 if (j.eq.1) then
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i-1,j)
     1                 + DR(i,j)*Tnew(i,j+1) + DO(i,j)*Tnew(i+1,j))

                 else if (j.eq.3) then
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i-1,j)
     1                 + DL(i,j)*Tnew(i,j-1) + DO(i,j)*Tnew(i+1,j))

                 else
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i-1,j)
     1                 + DL(i,j)*Tnew(i,j-1) + DR(i,j)*Tnew(i,j+1)
     2                 + DO(i,j)*Tnew(i+1,j))

                 end if

second part, new version:

c     *** modification
c    Andreas Buehring, 1999
                 XSTERN=Tnew(I,J)
c                  write(*,*)i,j
                 if (j.eq.1) then
c     ATTENTION: if i=1 Tnew out of range -> ERROR !!!
                  if(i.eq.1) then
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i,j)
     1                 + DR(i,j)*Tnew(i,j+1) + DO(i,j)*Tnew(i+1,j))
                  else
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i-1,j)
     1                 + DR(i,j)*Tnew(i,j+1) + DO(i,j)*Tnew(i+1,j))
                  end if
                 else if (j.eq.3) then
                  if(i.eq.1) then
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i,j)
     1                 + DL(i,j)*Tnew(i,j-1) + DO(i,j)*Tnew(i+1,j))
                  else
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i-1,j)
     1                 + DL(i,j)*Tnew(i,j-1) + DO(i,j)*Tnew(i+1,j))
                  end if
                 else
                  if(i.eq.1) then
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i,j)
     1                 + DL(i,j)*Tnew(i,j-1) + DR(i,j)*Tnew(i,j+1)
     2                 + DO(i,j)*Tnew(i+1,j))
                  else
                    RL=(sigma-1.)*(DU(i,j)*Tnew(i-1,j)
     1                 + DL(i,j)*Tnew(i,j-1) + DR(i,j)*Tnew(i,j+1)
     2                 + DO(i,j)*Tnew(i+1,j))
                  end if
                 end if
c     *** end of modification


---------------------------------------------------------------------------------------------------------------

third part, old version (in subroutine s_store):

         D(i) = sigma*(DU(i,j)*Told(i-1,j) + DO(i,j)*Told(i+1,j))
     1        + DL(i,j)*Told(i,j-1) + DR(i,j)*Told(i,j+1)
     2        + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j) + SOURCE(i,j)
     3        + (CAP(i,j)/DT - sigma*DDSTAR(i,j))*Told(i,j)
10    Continue

third part, new version:

c     *** modification
c     Pedro da Silva, 08.05.1997
c     Avoiding trying to read from TOLD out of Range when i,j=1
              IF((i.GT.1).AND.(j.GT.1)) THEN
              D(i) = sigma*(DU(i,j)*Told(i-1,j) + DO(i,j)*Told(i+1,j))
     1        + DL(i,j)*Told(i,j-1) + DR(i,j)*Told(i,j+1)
     2        + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j) + SOURCE(i,j)
     3        + (CAP(i,j)/DT - sigma*DDSTAR(i,j))*Told(i,j)
              ELSE
              D(i) = sigma*(DU(i,j)*Told(i,j) + DO(i,j)*Told(i+1,j))
     1        + DL(i,j)*Told(i,j) + DR(i,j)*Told(i,j+1)
     2        + DB(i,j)*Tamb + DF(i,j)*Tinp(i,j) + SOURCE(i,j)
     3        + (CAP(i,j)/DT - sigma*DDSTAR(i,j))*Told(i,j)
              END IF
c     *** end of modification
10    Continue

------------------------------------------------------------------------

Ok, it's realy not a proper way, but it works. So it's Haralds turn to give the users a better solution.

Best regards, Andreas

-------------------------------------------------------------------
Peter Vogelsanger schrieb:

> Hello Bengt
>
> I suppose we have come accross the same problem. If so, this or an
> equivalent measure will help: When compiling with the dvf-compiler, the
> compiler option /check:all has to be REMOVED for miltiport storage (type
> 140). The reason, it seems, is that not all the possible ranges for
> parameter values are accouted for in the type 140-code.
>
> Hope this helps.
>
> Best regards            Peter
>

--
MAIL : Fraunhofer Institute for Solar Energy Systems,
       Andreas Buehring, Solar Building,
       Oltmannsstr. 5, 79100 Freiburg, Germany
PHONE: +49 (0)761-4588-288
HANDY: +49 (0)179-298 22 50
FAX  : ++49 (0)761-4588-132
EMAIL: buehring@ise.fhg.de
--