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

Re: [TRNSYS-users] Problems with dynamic arrays definition in new types



Dear David,
 
Many thanks, but I followed your instructions and when I compile my Type a lot of errors appear:
1. I wrote the following at the uses statement of my type:
USE TrnsysData, ONLY: STORED,OUT,OCHECK,a,b,c,r,Tn,Tnm05,Tnm1
These arrays are my allocatable arrays which I defined as allocatable within the Trnsysdata routine, as you suggested. The compilation error is:
Error: Name in only-list does not exist.   [STORED]
2. In my type I also included the allocate instructiion, after reading the values of the parameters, as:
IF(.NOT.ALLOCATED(STORED)) ALLOCATE(STORED(NSTORED),stat=istat)
And the compilation error is:
Error: This name does not have a type, and must have an explicit type.   [STORED]
and:
Error: An array-valued argument is required in this context.   [ALLOCATED]
 
Do you know what are the causes of these errors?
 
Many thanks again,
 
Jordi Cipriano
----- Original Message -----
Sent: Friday, May 25, 2007 12:14 AM
Subject: Re: [TRNSYS-users] Problems with dynamic arrays definition in new types

Jordi,
  You have run into an annoyance of Fortran. As soon as you leave the Type subroutine, the allocatable array disappears. What you need to do is define the allocatable array globally in a "data only module" Your ALLOCATE instruction stays where it is but then the array doesn't disappear. You can see what I mean if you look at the file TRNSYSData.for. You will see the lines:

C ********* DECLARE ALLOCATABLE ARRAYS FOR USE IN DYNDATA
DOUBLE PRECISION, ALLOCATABLE :: X1dd( : ,: ),X2dd( : ,: ),X3dd( : ,: )
DOUBLE PRECISION, ALLOCATABLE :: X4dd( : ,: ),YDATAdd( : ,: ),DATAINdd( : )
INTEGER , ALLOCATABLE :: LUSTORdd( : ), IPTdd( : )

those lines declare the allocatable arrays that are actually used in the DynamicData routine.
Cheers,
  David

At 11:03 5/24/2007, jordi cipriano wrote:
Dear Trnsys users,
 
I have a question concerning to the use of Dynamic arrays in new Trnsys types. I'm programming a new Type with fortran 90 and I'm using the instruction ALLOCATABLE to define the dimension of some arrays. This dimension is depending on an input defined in the proforma.
 
The issue is that I don't exactly know at which step iteration should I define the array dimension so that this dimenson keeps saved in each iteration. In other words, if I define the array dimension just bellow the variables definition, each time the trnsys call my type, the matrix appear as "Undefined pointer/array" until trnsys finds the ALLOCATE instruction. This happens even if I've already defined the dimension in previous iteration callings. This fact affects all the calculations because one of the arrays is the STORED array, which I use to update the temporary terms of my ecuations. 
 
Does anybody know who to solve this problem?
 
Many thanks,
 
Jordi Cipriano
BEE-Group
CIMNE-Terrassa
CIMNE. Spain

_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@engr.wisc.edu
https://www.cae.wisc.edu/mailman/listinfo/trnsys-users

****************************************************************************************
Thermal Energy System Specialists (TESS), LLC
David BRADLEY                           2916 Marketplace Drive - Suite 104
Partner                                        Madison, WI 53719
Phone: (608) 274-2577 USA
Fax: (608) 278-1475
E-mail: bradley@tess-inc.com
Web Pages:  http://www.tess-inc.com     and      http://www.trnsys.com

"Providing software solutions for today's energy engineering projects"
****************************************************************************************