CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   How to deal with the user subroutine problem? (https://www.cfd-online.com/Forums/siemens/55346-how-deal-user-subroutine-problem.html)

Particle May 5, 2006 06:38

How to deal with the user subroutine problem?
 
I use DATA and SAVE sentences in STARCD's user subroutine to input the initial values to some arguments (arrays), but this action does not work well. When I run star in Linux (It is ok in Windows), the message 'Received signal sigsegv - exiting' is gotten and then STARCD quits the calculation. Does anybudy know what is the correct way to use DATA in STARCD's user subroutine in Linux? Maybe it is the another BUG in STARCD!

Ben May 5, 2006 07:57

Re: How to deal with the user subroutine problem?
 
It sounds more like crappy coding to me, you might want to be a LOT more specific about what you are doing (hint STAR-CD has more than one subroutine), where does it sigseg, what does the subroutine do, are the arrays variable or fixed, how is the memory allocated, which version are you using and the list goes on......what sort of debugging have you done yourself and what are the results of it?

Particle May 5, 2006 09:00

Re: How to deal with the user subroutine problem?
 
I use the conduc.f, coteet.f, densit.f and vismol.f. For example, in conduc.f code, I use the input code is:

dimension tscw(1:80),conscw(1:80)

SAVE tscw,conscw

DATA (tscw(ikk),ikk=1,80)/ arrays data /

DATA (conscw(ikk),ikk=1,80)/ arrays data / The STARCD version is 3.26.019 and the Absoft Fortran version is 9.0. The codes are OK for I can run them in Windows STARCD3.24 with Absoft Fortran 8.2 without any problem. In Linux, it is only ok to use the direct input sentence (i.e. tscw(1)=..and so on). Therefore I think the DATA input is a BUG in STARCD. Am I correct? What is your idea?

Ben May 5, 2006 09:16

Re: How to deal with the user subroutine problem?
 
I'm slightly confused as to what you are doing, if you are trying to fill the two arrays with values between 1 and 80 why not just use:

DIMNESION TSCW(80),CONSCW(80)

DO i=1,80 TSCW(i)=i CONSCW(i)=i ENDDO


Richard May 5, 2006 09:48

Re: How to deal with the user subroutine problem?
 
Are you sure the DATA statements are the issue? Have you tried debugging: "star -g -devtool=gdb", then in gdb do "run"; I'm assuming your machine has gdb. It should tell you which line is generating the sigsegv.

Particle May 5, 2006 10:48

Re: How to deal with the user subroutine problem?
 
I think you are totaly not understand my question. Do you think my arrays are so simple like tscw(i)=i? Why not think them as tscw(1)=888.888, tscw(2)=666.666 and so on like more complicated arrays?

Ben May 5, 2006 11:03

Re: How to deal with the user subroutine problem?
 
so what are you trying to do then? fill the arrays with different numbers?

Question May 5, 2006 16:37

Re: How to deal with the user subroutine problem?
 
Does the same kind fortran coding does the same on its own?

You can do a simple fortran coding and if it does not work it comes from the fortran, otherwise it is star-cd


Particle May 6, 2006 00:30

Re: How to deal with the user subroutine problem?
 
Of course, it is the same fortran. I am not sure if you understand Fortran. Why not first try to use DATA input in STARCD by youself and then to answer my question? According to your anf BEN's marplot answers, now I am sure that it is a real BUG in STARCD. Actually, STARCD has too many BUGS except this one.

Ben May 6, 2006 06:01

Re: How to deal with the user subroutine problem?
 
I have used the DATA call in hundreds of routines and never had a problem myself, when a case is crashing with user subroutines 99 times out of 100 it is a problem in the user coding and not the solver itself.

You might want to justify the bugs statement, yes STAR has bugs as does all other codes but the buggier part of the code tends to be pro-STAR and not the solver (they are developed by different parts of CD), again in my experience poor users tend to cry bug the minute anything goes wrong when in fact they just don't have the training and knowledge to use the code properly. Although I am sure you have attended the relevent training courses (i.e. basic and usubs) and are long experienced in using commercial codes! If it is a bug speak to the support if you are so worried but I am willing to bet good money its your coding!

Particle May 6, 2006 06:25

Re: How to deal with the user subroutine problem?
 
In the right way, I have dealed with the problem using Richard's tips. It is not inaccurate in my coding. Could you tell us how do you use DATA call never had a problem by youself? What are the tips?

Ben May 6, 2006 06:27

Re: How to deal with the user subroutine problem?
 
You still havent fully explained what you are trying to do, you seem to have two arrays but I am not sure what you are trying to do with them


Athur Lee May 6, 2006 16:49

Re: How to deal with the user subroutine problem?
 
I think the correct approach would be to use the same DATA declaration in a fortran stand alone program and in a user-coding from star-cd

if the stand alone program works and not in user-coding there is a problem with star-cd

Can you confirm you have tried the DATA statement in a stand alone fortran program and that it does not fail?

It should be very quick to check, below is an example:

DIMENSION A(5), B(3,3) DATA A,B /14*0.0/ !! 5 + 3x3 = 14...

!! check the size of the array = number

!! of data between //

to intialize only part of the matrix:

DATA (B(i,1), i=1,3)/3*1./ DATA ((B(i,j),i=1,2),j=1,2)/4*2./ DATA B(3,3)/0./


Athur Lee May 6, 2006 16:52

Re: How to deal with the user subroutine problem?
 
This forum does not keep carriage returns...

DATA (B(i,1), i=1,3)/3*1./

DATA ((B(i,j),i=1,2),j=1,2)/4*2./

DATA B(3,3)/0./

Particle May 6, 2006 21:51

Re: How to deal with the user subroutine problem?
 
Yes. I have checked all fo the DATA call in stand alone Fortran program. It is no problem. However, in my case, the array is not so simple, every array's element has its own value, so I have to use 80 values inside / /. I also test my case in a stand alone Fortran program. It is Ok either. I can conclude that it is STARCD's problem if you will not use 'gdb' to run the subroutine with DATA call.

Ben May 8, 2006 13:36

Re: How to deal with the user subroutine problem?
 
If you can conclude that you had better get onto support and ask them to check it out, let us know how it goes....I could do with a laugh!

Particle May 8, 2006 22:49

Re: How to deal with the user subroutine problem?
 
I do not care if you do a laugh or not. It is your business. If the support of STARCD is good enough, I believe STARCD will have no so many BUGs. Too many BUGs in STARCD!!! Too many BUGs in STARCD!!!

Ben May 9, 2006 05:19

Re: How to deal with the user subroutine problem?
 
go use something else then

Particle May 9, 2006 08:42

Re: How to deal with the user subroutine problem?
 
Yes. CFX is better!!!


TG May 9, 2006 09:25

Re: How to deal with the user subroutine problem?
 
Particle-You do understand that this site is not user support and that nobody from CD is required to answer here? These are just other users. If you want help you have to call them up. Have you even tried calling user support? I find it mind-boggling that you can take a program that runs, add your own user subroutine to it at which point it stops working, and then claim there is bug in STAR. Assuming your code is right (who knows?) then maybe you have the wrong compiler version or patch or maybe you are trying to compile on an unsupported kernel or glibc. There are lots of possibilities other than bugs.


Jim May 11, 2006 14:47

Re: How to deal with the user subroutine problem?
 
This logic doesn't work - the coding may not fail on its own, but if you remove the user-coding from STAR, no doubt it won't crash either.

A few points:

1. Are you sure it's the data statements - ie. have you removed all other coding from the routine and does it still crash?

2. you say that your data statements are very long. How many characters are there on any one line? Some compilers don't like long lines. Try the same code, but with a small array (e.g. array(1:2)). It's very unlikely that it's just that STAR "doesn't do data statements".

3. Try printing the array. You may find that some of it's OK, then it crashes halfway through printing the array. This would suggest that it's not being assigned correctly.

4. Go on a diplomacy course. There are a lot of people in this forum who have done a lot of very complex user-coding with STAR. The power of its user-coding is one of the reasons why it's the second most used CFD code in the world. Giving up and assuming it's a bug is the easy option, but generally not the right one.

Your test of compiling the code on its own is one approach, but not the definitive one. User-coding isn't the same as compiling a program on its own, for example STAR uses a whole host of compiler flags, and the routine is being called from a large and complex program. User-coding can be more demanding than writing a program on its own, because if you allocate an array incorrectly it can overright something that you kidda needed, whereas you can get away with it in a standalone program.

5. Good luck. Complex user-coding can be hard work, but remember that's because it's complex, not because user-coding in STAR is buggy. It isn't. As has already been said, you invariably end up making a change in your code rather than submitting a bug.

Richard May 19, 2006 09:30

Re: How to deal with the user subroutine problem?
 
Particle - do you have any news for us about this problem?


All times are GMT -4. The time now is 05:58.