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

Calculation Error in USER subroutine

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2016, 17:46
Unhappy Calculation Error in USER subroutine
  #1
New Member
 
Asif Zubair
Join Date: Jun 2016
Posts: 2
Rep Power: 0
Asif17 is on a distinguished road
Hi ,

I am new to the field of ANSYS and CFD as I am doing my maser thesis on WIND turbine simulation. I am facing a very weird type of problem and need your help. It is a problem with one of the USER CEL subroutine .

I am using a subroutine to divide the blade in a no of elements .the blade is divided in a number of radial segments. The radial positions of these blade segments are defined by one dimensional arrays RI and RJ

Later in the program, I got some error and I traced it back to the subroutine that it is not giving me correct values of RJ . Then I displayed the results of RJ using the same loop in which it is calculated (attachment 1.png). Fortunately the values of RJ were correct. Then in the same routine, immediately after that loop, I started another loop to display the values of RJ again and unfortunately they were not correct(attachment 2.png). Hence I came to know that here is the error originating. I have rechecked the program and seemingly there is no error and the error is originating somewhere inside the subroutine. I know it is a programming thing but I have posted it in CFX forumn because i am am using another program on fortran without CFX to calculate wind turbine performance using same subroutine and this problem is NOT coming in that program. So I assume it is related to CFX and its Fortran compiler or the memory management system , but I am not sure . I need help in this matter as I am stuck in it for past few days.

The subroutine is as follows

SUBROUTINE LLPOINTS (PI,PREC,R,HUBRAD,M,RI,RJ)


!Inputs : Pi, Prec, R, Hubrad
!output : RI, RJ

INTEGER:: M
REAL::PREC,R,HUBRAD
REAL:: RI(41),RJ(41),DJ(41)
INTEGER :: J
character*100 ::string1, string2, string3

CALL MESAGE( 'WRITE', 'subroutine INIT START' )

CALL MESAGE( 'WRITE', "RI RJ)

DO J=1,M+1


IF (J.LT.M+1) THEN
RI(J)=0.5E+00*(1.E+00+HUBRAD/R)-0.5E+00*(1.E+00-HUBRAD/R)
&*COS((J-0.5E+00)*PI/M)
! RRI(J)=RI(J)*R
RJ(J)=0.5E+00*(1.E+00+HUBRAD/R)-0.5E+00*(1.E+00-HUBRAD/R)
&*COS((J-1.E+00)*PI/M)
!RRJ(J)=RJ(J)*R

IF (ABS(RI(J)).LT.(1/PREC)) THEN

STOP

ENDIF

ELSE
RJ(J)=1.E+00

END IF


write (string1,*) RI(J)
write (string2,*) RJ(J)

CALL MESAGE( 'WRITE', string1//' '//string2)

END DO

CALL MESAGE( 'WRITE','ri rj')

do j =1,m

write (string1,*) RI(J)
write (string2,*) RJ(J)
CALL MESAGE( 'WRITE', string1//' '//string2 )

end do
CALL MESAGE( 'WRITE', 'subroutine LLINE OK' )

END SUBROUTINE
Asif17 is offline   Reply With Quote

Old   June 27, 2016, 10:17
Default
  #2
Member
 
Join Date: Dec 2009
Posts: 44
Rep Power: 16
cfdgremlin is on a distinguished road
You don't appear to have defined PI in your routine, but anyway you should really be using IMPLICIT NONE to ensure that all variables are explicitly defined.

If you are compiling using cfx5mkext on windows, I think you can also use the switch -warn to alert you to any undefined or unused variables.
cfdgremlin is offline   Reply With Quote

Old   June 27, 2016, 20:52
Default
  #3
New Member
 
Asif Zubair
Join Date: Jun 2016
Posts: 2
Rep Power: 0
Asif17 is on a distinguished road
Thanks for the reply . Yes I have not included implicit none in any of the subroutines. I have included it and then I have got a lot of errors related to variable declaration. Can you tell me how to switch- warn ? I have no idea regarding it . Further, when I have resolved all the errors related to variables after incorporating implicit none , at the very end of compilation , I have received an error stating

Error:unresolved external symbol LLINE referenced in function ACD_Dp.

This error was not present before using implicit none.

ACD_Dp is the main USER CEL function that further calls LLINE subroutine . In the LLINE subroutine, LLPOINTS subroutine mentioned above in my question is present.
Asif17 is offline   Reply With Quote

Old   June 29, 2016, 04:45
Default
  #4
Member
 
Join Date: Dec 2009
Posts: 44
Rep Power: 16
cfdgremlin is on a distinguished road
You add it to the command line when you use cfx5mkext to build your library, for example,

cfx5mkext *.F -name mylib -warn

Not sure why you would be getting unresolved symbol errors if you have called you lower subroutines correctly. Have you declared any functions?
cfdgremlin is offline   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
User Subroutine A. Said CFX 9 March 7, 2008 16:49
FLUINJ USER SUBROUTINE! Spyridon Siemens 8 May 22, 2002 06:31
user subroutine of inlet boundary raymond Siemens 4 December 6, 2001 06:44
USER SUBROUTINE IN FLUENT??? tim Main CFD Forum 0 April 24, 1999 05:19
CFX User Subroutine Archive David Creech Main CFD Forum 0 March 17, 1999 13:41


All times are GMT -4. The time now is 18:08.