learning fortran

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
charles lahure

learning fortran

Post by charles lahure »

Hi
I'm using CS 3.0.5
I've been able to complete the 3 first tutorials but I'm now stuck in the computation of the average temperature of case 4

I don't know fortran. I will learn this langage from dedicated manuals

But is there some specific CS tutorials ?
How can I compile .f90 file with gfortran ?
Do i need to compile using the command: code_saturne compile
May I debug simply using gdb / emacs ?

Thank you
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: learning fortran

Post by Yvan Fournier »

Hello,

edit: Could you move this thread to the "Code_Saturne Usage" section /edit (moved from installation)

You have good Fortran manuals at the IDRIS website (very detailed and complete, perhaps too much for simple user subroutines).

Yes, using "code_saturne compile" is the recommended way of compiling, as it handles all 'include/module" paths, and linking. The compile.log file (when running a case), or the "terminal" output of "code_saturne compile" (when you run it manually) echo all the details of the compilation commands used. You can always run them manually based on that, but it is not very useful.

If you use Emacs, you can compile directly under Emacs: when you press "meta+make", Emacs suggests "make -k"; simply replace that with "code_saturne compile" (or "<your prefix>/code_saturne compile" if the "code_saturne" command is not in your path), and Emacs will happily run the compile and parse the output (with its colorization, ...)

To debug, go to the RESU/<run_id> of a case that failed (or run a new case adding the --initialize option to the "code_saturne run" command which is in the SCRIPTS/runcase of a given case, then go to the new RESU/<run_id>). In the file named run_solver.sh, or run_solver (for more recent versions), you will have the run command and path for the "cs_solver" executable. That is what you want to run under a debugger (whether Emacs/gdb, gdb alone, ddd+gdb, TotalView, or whatever debugger you prefer.

To debug, it is first recommended to build debugging version of the code (adding --enable-debug to the configure command; details in the installation guide, if you have not followed it already).

Regards,

Yvan
charles lahure

Re: learning fortran

Post by charles lahure »

Thanks for the answer.

I don't know how to move this thread. Sorry for the mistake
Post Reply