Problem with usproj for Drag coefficient computation

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Jean-Marc Blanquies

Problem with usproj for Drag coefficient computation

Post by Jean-Marc Blanquies »

Hi,
 
I'm trying to evaluate drag and lift coefficient over a cylinder in a "2D" case. I saw that there were already answers for this problem so i tried to manage with hints given here.
 
By the way, i surely made a mistake in my usproj file as it seems i can't compile it.
 
Here are the error messages :
****************************************
  Compiling user subroutines and linking
 ****************************************
 
Traceback (most recent call last):
  File "/opt/code_saturne-2.1.0/bin/code_saturne", line 49, in <module>
    retcode = cs.execute()
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_script.py", line 62, in execute
    return self.commands[command](options)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_script.py", line 114, in run
    return cs_run.main(options, self.package)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_run.py", line 191, in main
    save_results=save_results)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_case.py", line 1718, in run
    mpi_environment)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_case.py", line 1348, in prepare_data
    d.compile_and_link()
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_case_domain.py", line 627, in compile_and_link
    raise RunCaseError('Compile or link error.')
cs_case_domain.RunCaseError: Compile or link error.
 
 
___________________
 
I attach my usproj. Could someone tell me where i'm wrong ? In fact, i'm totally new with subroutines so i'm not sure of the way to use its.
 
Thanks you very much.
 
Best regards,
 
Jean-Marc Blanquies
Attachments
usproj.f90
(11.34 KiB) Downloaded 251 times
Mickael Hassanaly

Re: Problem with usproj for Drag coefficient computation

Post by Mickael Hassanaly »

Hello Jean Marc,
Could you send me your compile.log file?
Best regards
Mickaël
Jacques Fontaine

Re: Problem with usproj for Drag coefficient computation

Post by Jacques Fontaine »

Hello Jean-Marc,
Yes, there is a compilation error of user subroutines (cs_case_domain.RunCaseError: Compile or link error.).
You can see the compilation error messages in the file Compil.log locate in the folder RESU/201111xx-xx/.
You can also test your compilation using the command code_saturne compile -t in your SRC folder.
I think you use correctly user subroutines (copie .c or .f90 from SRC/REFERENCE to SRC/ and modify it), but you need to respect the correct fortran syntax to compile user files. I saw some mistakes in your usproj (uninitialized variables, ...), I think you will able to correct them with the compilation error messages. Best regards,
JF
Jacques Fontaine

Re: Problem with usproj for Drag coefficient computation

Post by Jacques Fontaine »

I didn't see the quick answer from Miackël! ;) You can also post your Compil.log if you don't understand the errors.
 
JF
Jean-Marc Blanquies

Re: Problem with usproj for Drag coefficient computation

Post by Jean-Marc Blanquies »

Thanks for the info about compile.log.

I manage to solve some errors but there are compile error that i don't understand. In fact i haven't practive fortran for while and i have lost fortran basics.

So here are the last version of my usproj and my compile.log
Attachments
usproj.f90
(11.33 KiB) Downloaded 260 times
compile.log
(1.53 KiB) Downloaded 253 times
Jean-Marc Blanquies

Re: Problem with usproj for Drag coefficient computation

Post by Jean-Marc Blanquies »

I solve some other errors

I don't understand why a parenthesis is missing.

The last are here ;

/home/caelinux/Desktop/cyl/cyl1/RESU/20111109-1502/src_saturne/usproj.f90:296.38: XCOF(II) = xfor(II)/((1.0d0/2.0d0)*RO0(1)*UREF(1)**2*0.025d0*0.025d0*3.141d0)                                       1 Error: Expected a right parenthesis in expression at (1) Error: Unexpected end of file in '/home/caelinux/Desktop/cyl/cyl1/RESU/20111109-1502/src_saturne/usproj.f90' gfortran -I/home/caelinux/Desktop/cyl/cyl1/RESU/20111109-1502/src_saturne -I/opt/code_saturne-2.1.0/include/code_saturne -x f95-cpp-input -Wall -Wno-unused  -D_CS_FC_HAVE_FLUSH  -O -c /home/caelinux/Desktop/cyl/cyl1/RESU/20111109-1502/src_saturne/usproj.f90
Attachments
usproj.f90
(11.25 KiB) Downloaded 261 times
Yvan Fournier

Re: Problem with usproj for Drag coefficient computation

Post by Yvan Fournier »

Hello,

I tool a look at your file, and the error you have is due to RO0 and UREF not being arrays anymore in version 2.1 (iphas has been removed, so RO0(1) is replaced by RO0, and UREF(1) by UREF).

Still, this does not solve everything: your "if /then.. endif" contructs do not match (the first test on ntcabs does not seem to be closed), so I'll let you solve this on your side (I really recommend indenting your if/endif and loop constructs: it will make the code more readable and easier to debug).

You also need to replace:
ra(iforbf + (ifac-1)*ndim + ii -1)
by:
forbr(ii, ifac)

There may be other errors, but you should solve those first.

Best regards,

  Yvan
Jean-Marc Blanquies

Re: Problem with usproj for Drag coefficient computation

Post by Jean-Marc Blanquies »

First thanks for the ro and uref formulation.
I think that i have solved those errors with the file structure.
By the way, now it seems that another problem comes. Compiling usproj seems to work (i think but not sure).
After compiling and linking there is this error message :
 
****************************************
  Compiling user subroutines and linking
 ****************************************
 ****************************
  Preparing calculation data
 ****************************
Traceback (most recent call last):
  File "/opt/code_saturne-2.1.0/bin/code_saturne", line 49, in <module>
    retcode = cs.execute()
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_script.py", line 62, in execute
    return self.commands[command](options)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_script.py", line 114, in run
    return cs_run.main(options, self.package)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_run.py", line 191, in main
    save_results=save_results)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_case.py", line 1718, in run
    mpi_environment)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_case.py", line 1363, in prepare_data
    d.copy_solver_data()
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_case_domain.py", line 725, in copy_solver_data
    self.copy_data_file(f)
  File "/opt/code_saturne-2.1.0/lib/python2.6/site-packages/code_saturne/cs_case_domain.py", line 215, in copy_data_file
    raise RunCaseError(err_str)
cs_case_domain.RunCaseError: ('File: ', 'usproj.f90', '\ncan not be accessed.')

Best regards,

Jean-Marc
Attachments
usproj.f90
(11.22 KiB) Downloaded 266 times
compile.log
(951 Bytes) Downloaded 254 times
Mickael Hassanaly

Re: Problem with usproj for Drag coefficient computation

Post by Mickael Hassanaly »

Hi Jean Marc,
You should have an error file and a listing file. Please post these two files. Your compilation seems to be ok.
 
Best regards
 
Mickaël
Jean-Marc Blanquies

Re: Problem with usproj for Drag coefficient computation

Post by Jean-Marc Blanquies »

Sorry but i haven't those file. In the result directory i have the
compile.log
case.xml
cs_solver executable
and src_saturne directory with usproj
 
 Best regards
 
JM
Post Reply