Page 1 of 1
Compile issue v3.0.1 Ubuntu 12.04
Posted: Wed Jul 10, 2013 10:53 pm
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
Re: Compile issue v3.0.1 Ubuntu 12.04
Posted: Thu Jul 11, 2013 10:20 am
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
Re: Compile issue v3.0.1 Ubuntu 12.04
Posted: Thu Jul 11, 2013 12:09 pm
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
Re: Compile issue v3.0.1 Ubuntu 12.04
Posted: Thu Jul 11, 2013 12:10 pm
by JamesMcNaughton
And the other compile log for paramx only
Re: Compile issue v3.0.1 Ubuntu 12.04
Posted: Thu Jul 11, 2013 1:05 pm
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
Re: Compile issue v3.0.1 Ubuntu 12.04
Posted: Fri Jul 12, 2013 10:15 am
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