Page 1 of 1

Order of compilation (plus an unrelated question on findpt)

Posted: Fri Oct 30, 2015 6:41 pm
by CTrinca
Hello everyone,

I have a question about whether it is possible to specify the order of compilation of the files in SRC. I have a couple of subroutines and variables that I wish to access from some of my user subroutines, so it seemed a good idea to me to include them in a Fortran module. However, in order to work, it must be compiled before the files where it is used, otherwise I get an error like this:

Code: Select all

use map_bundle
    1
Fatal Error: Can't open module file 'map_bundle.mod' for reading at (1): No such file or directory
Is there a way to work around this problem?

Another question, unrelated to the first one: currently I am using the subroutine "findpt" to identify the cell a point belongs to, but if I am right it actually finds the cell whose centre is closest to the point. I am worried that when the size of two adjoining cells is different, using it on a point close to the face they share would return the wrong cell. Can this happen? Does a safer way exist?

Thanks in advance to anybody answering.
Cheers,

Cosimo

Re: Order of compilation (plus an unrelated question on find

Posted: Fri Oct 30, 2015 9:26 pm
by Yvan Fournier
Hello,

Files are copied in arbitrary order (based on python os.listdir and filters), with one exception:
if a file is called "user_modules.f90", it will be be compiled before all other Fortran code.

So you should simply place all your Fortran modules in this file.

You are right regarding "findpt". This is why I intend to replace that with code similar to the one used for code/code coupling or for mapped inlets (based on the ple_locator and fvm_point_point_location subsystems), but higher priorities keep popping up, so I have not done it yet, even though I have been willing to do it for over a year... (this will include a rewrite of both probes an profiles management code, to make it more similar/consistent with to postprocessing output submeshes and variables from cs_user_postprocess.c / cs_user_postprocess_var.f90)
You might wand to look at the code for mapped inlets (cs_boundary_conditions_map* functions in src/base/cs_boundary_conditions.c), but this requires lower-level coding than using findpt.

Regards,

Yvan

Re: Order of compilation (plus an unrelated question on find

Posted: Mon Nov 02, 2015 11:31 am
by CTrinca
Hello Yvan,

Thanks for your quick answer.
Putting my module into cs_user_modules solved my problem. I am now going to give a close look to the functions you pointed me to, I hope that won't be too difficult for me.
Thanks again and regards,

Cosimo