Compile issue v3.0.1 Ubuntu 12.04

All questions about installation
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
JamesMcNaughton
Posts: 72
Joined: Mon Mar 19, 2012 1:21 pm

Compile issue v3.0.1 Ubuntu 12.04

Post by JamesMcNaughton »

I am having trouble getting subroutines to compile for saturne v3.0.1 in Ubuntu 12.04

I have added something to paramx.f90 and when I compile this subroutine doesn't compile with the changes.

I have also tried on a different system which has the same saturne installed (but I didn't install it) and everything compile as I expect so it must be my installation.

I remember reading something about this being an Ubuntu thing previously but cannot find it in the forums.

Any help greatly appreciated.

Thanks

James
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Compile issue v3.0.1 Ubuntu 12.04

Post by Yvan Fournier »

Hello James,

Are you trying to install a modified version, or modifying paramx.f90 and using it as a user subroutine ?

Modifying paramx.f90 as a user subroutine would be a vey bad idea, but modifying it and rebuilding the source should be fine. What error message do you obtain ?

Regards,

Yvan
JamesMcNaughton
Posts: 72
Joined: Mon Mar 19, 2012 1:21 pm

Re: Compile issue v3.0.1 Ubuntu 12.04

Post by JamesMcNaughton »

Hi Yvan

Yes I am not trying to recompile the code or anything.

I've attached a minimal example of what is happening: I declare an integer in paramx and try to use it in cs_user_extra_operations

If I compile (code_saturne compile) with only paramx in the directory there doesn't seem to be a problem. But when I add cs_user_extra_operations the compiler seems to ignore paramx and give an error.

I've attached the files and two compile logs in case they flag anything that seems out of sorts?

Thanks again

James
Attachments
compile.log.both.txt
(402 Bytes) Downloaded 353 times
cs_user_extra_operations.f90
(5.59 KiB) Downloaded 368 times
paramx.f90
(3.65 KiB) Downloaded 312 times
JamesMcNaughton
Posts: 72
Joined: Mon Mar 19, 2012 1:21 pm

Re: Compile issue v3.0.1 Ubuntu 12.04

Post by JamesMcNaughton »

And the other compile log for paramx only
Attachments
compile.log.paramx_only.txt
(702 Bytes) Downloaded 364 times
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Compile issue v3.0.1 Ubuntu 12.04

Post by Yvan Fournier »

Hello James,

If you are using "code_saturne compile", never add existing Fortran module files in user subroutines.
Depending on the compiler, modules may be handled differently, but if you modify a module, the only safe solution is to recompile the whole code.

If you need to define user modules or global variables, add them in cs_user_modules.f90. It is there exactly for this kind of situation.

I'll add that although many people do it, in general, adding "non-user" subroutines in a case's source directory should be considered bad practice. It may be more expedient and practical for debugging, testing or adding patches, but rebuilding the code is much safer.

Regards,

Yvan
JamesMcNaughton
Posts: 72
Joined: Mon Mar 19, 2012 1:21 pm

Re: Compile issue v3.0.1 Ubuntu 12.04

Post by JamesMcNaughton »

Hi Yvan

Thank you for the advice regarding the modules.

Wanting to modify the paramx module comes from my v2.0 modifications where it was a header file and so these issues never followed. The reason for paramx is that it is a new boundary condition I am adding and wanted to group together.

I can of course add to the user modules file like you say and so will do that in future.

Thanks again

James
Post Reply