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

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"
****************************************************************************************