|
[Sponsors] |
COMMON blocks for passing arrays -- Please help |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 5, 2006, 12:11 |
COMMON blocks for passing arrays -- Please help
|
#1 |
Guest
Posts: n/a
|
Hello experts,
I am using Star-CD 3.26. I want to pass an array from subroutine POSDAT to subroutine POROS1. In older posts i have read that i should use COMMON block statement in both routines, to pass the array.However it doesn't works.... Can anybody write a working example, if possible with pointers (in Star 3.26 for adjustable arrays you have to use pointers)??? I am looking forward for your answers and if possible any working examples, marcus |
|
May 5, 2006, 13:04 |
Re: COMMON blocks for passing arrays -- Please hel
|
#2 |
Guest
Posts: n/a
|
Have a look in the back of the user guide, this shows the new coding practices for memory allocation and common blocks for 3.2x so should be usefull as a guide.What you need depends on what you are using, for variable size you need a common statement (declaring name and shape of the array), a pointer (pointing to where it is) and also a memory allocation statement which must be issued in the first subroutine you use (otherwise you will be trying to use a common block that hasnt got memory allocation and the code will crash)
|
|
May 5, 2006, 17:12 |
Re: COMMON blocks for passing arrays -- Please hel
|
#3 |
Guest
Posts: n/a
|
Dear Ben, thanks for your answer.
According to the user guide i declare the pointer in POSDAT, by the following lines: ---------POSDAT------------------------ DIMENSION UARRAY(NCMAX) POINTER(P_UARRAY,UARRAY) COMMON/UCOMM1/P_UARRAY CALL CDMALLOC(P_UARRAY,IFLSIZ*NCMAX) do i=1,NCTMAX UARRAY(i) = 50.0 enddo and afterwards i add a COMMON statement in POROS1 like that: COMMON/UCOMM1/P_UARRAY but with no result.... Can you tell my where am i wrong and if it is possible please send me an example of passing variables between subroutines in STAR-CD to my email address: gonnafon@yahoo.gr |
|
May 5, 2006, 17:41 |
Re: COMMON blocks for passing arrays -- Please hel
|
#4 |
Guest
Posts: n/a
|
Do you know how to pass common block between two subroutines in fortran?
Well...it is the same in star-cd user-coding I am not sure it is worth programming user-coding without knowing fortran ? |
|
May 6, 2006, 07:06 |
Re: COMMON blocks for passing arrays -- Please hel
|
#5 |
Guest
Posts: n/a
|
I have to agree, I would be quite happy to provide you with a example of common block usage but without the underlying knowledge you arent going to get much further and when it goes wrong you will just be stuck staring at code again. Other than that I recomend that you speak to your support office for a start and/or attend the subroutines training course as well, if you do want the coding still let me know but I cant see you getting much further.
|
|
May 6, 2006, 08:50 |
Re: COMMON blocks for passing arrays -- Please hel
|
#6 |
Guest
Posts: n/a
|
I am afraid that you are biased towards me.
I have an adequate knowledge of Fortran and i have been able to pass arrays in Fortran code from a subroutine to the main program. However the exactly same technique doesn't work on Star-CD code... If you could send me an example of passing the array UARRAY(NCMAX) from posdat.f to poros1.f i would appreciate it. I just want an example that works on Star. Thank you for your concerning, my email is gonnafon@yahoo.gr That will be my final post, sorry for bothering you. marcus |
|
May 6, 2006, 10:46 |
Re: COMMON blocks for passing arrays -- Please hel
|
#7 |
Guest
Posts: n/a
|
lol well you're not bothering me not sure about other people, I was just concerned that you may have trouble expanding the code to other applications. The uarray is just an arbitrary name by the way, you can call it whatever you want. Anyways when I am back at work on monday I will see what I can sort out.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
sormom.f and common blocks | Sheila | Siemens | 0 | March 25, 2005 20:46 |
common blocks of STAR-CD | Mari | Siemens | 2 | January 26, 2005 04:21 |
how to define own COMMON blocks | Mari | Siemens | 1 | January 12, 2005 09:30 |
Common blocks in VISTUR | Celia | Siemens | 6 | December 26, 2004 03:25 |
common blocks | CMB | Siemens | 1 | November 12, 2004 10:41 |