CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens

COMMON blocks for passing arrays -- Please help

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2006, 12:11
Default COMMON blocks for passing arrays -- Please help
  #1
marcus
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

  Reply With Quote

Old   May 5, 2006, 13:04
Default Re: COMMON blocks for passing arrays -- Please hel
  #2
Ben
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)

  Reply With Quote

Old   May 5, 2006, 17:12
Default Re: COMMON blocks for passing arrays -- Please hel
  #3
marcus
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

  Reply With Quote

Old   May 5, 2006, 17:41
Default Re: COMMON blocks for passing arrays -- Please hel
  #4
Question
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 ?

  Reply With Quote

Old   May 6, 2006, 07:06
Default Re: COMMON blocks for passing arrays -- Please hel
  #5
Ben
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.
  Reply With Quote

Old   May 6, 2006, 08:50
Default Re: COMMON blocks for passing arrays -- Please hel
  #6
marcus
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
  Reply With Quote

Old   May 6, 2006, 10:46
Default Re: COMMON blocks for passing arrays -- Please hel
  #7
Ben
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.
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 19:52.