Compilation problem using standard user routine

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
PFERRO
Posts: 8
Joined: Mon May 27, 2019 4:49 pm

Re: Compilation problem using standard user routine

Post by PFERRO »

Dear Yvan,

I confirm you that adding the zone as head losses in the gui doesn't solve the problem.

Following your recommendations I have tried with another user routine. Unfortunately I see no print with the cs_user_parameters-base.c routine when adding bft_printf("here") inside each void function.

I have installed code_saturne on ubuntu 16.04 LTS and the routine in C are still not executed by the solver.

The problem appears both in serial and parallel runs.

Is it possible that the problem comes from C libraries used during the installation stage ? When I tried the installation on ubuntu I faced many installation problem. Especially the mpi.h file was not find during the compilation. The solution was to install mpi-default-bin/mpi-default-dev and to modify the setup script : mpiCompC mpicc and mpiCompCxx mpicxx.

Best regards,

PF
Yvan Fournier
Posts: 4221
Joined: Mon Feb 20, 2012 3:25 pm

Re: Compilation problem using standard user routine

Post by Yvan Fournier »

Hello,

Problems can come from an incorrect build, but this seems improbable, especially using different systems. Could you post an updated simple case here so that I can check the issue ? Ideally, run only the "prepare execution" step (advanced run parameters in the v6.0 GUI) and post the contents of the RESU/<run_id> directory, removing cs_solver. This would allow me to check that the local script which is generated is also correct.

Since we have already observed issues on som Ubuntu systems, there might be a problem here, but I suspect a simpler issue here (the kind of issue that is hard to find at first but may seem obvious in retrospect).

Regards,

Yvan
PFERRO
Posts: 8
Joined: Mon May 27, 2019 4:49 pm

Re: Compilation problem using standard user routine

Post by PFERRO »

Dear Yvan,

I have reinstalled everything (OS and code_saturne 6.0.4) and now it works (ubuntu 18.04, 16.04 and also Debian 10). The messages are well printed in the listing file. I probably did something wrong during the installation stage.

Nevertheless there is another problem with the routine user_head_losses.c. I have attached a simple test case :
  • Rectangular geometry with upward flow
  • Two meshes connected
  • One of the mesh (middle of the duct) is associated with a cell zone called "porous"
  • Note that a head losses zone associated to "porous" is defined in the gui
The test cases contains two sub-routines. One in fortran and one in c. For the routine in c it seems that the reader does not enter in the :
if (strcmp(zone->name, "porous") == 0)
statement.

whereas in the fortran routine the
call getcel('porous', nlelt, lstelt)
seems to work.

Best regards,

PF
Attachments
testCase2.zip
(7.55 MiB) Downloaded 220 times
Yvan Fournier
Posts: 4221
Joined: Mon Feb 20, 2012 3:25 pm

Re: Compilation problem using standard user routine

Post by Yvan Fournier »

Hello,

Your 2 syntaxes are not equivalent. The C equivalent of getcell is cs_selector_get_cell_list (you can find examples).

Using zones is recommended when possible because it avoids an allocation/copy/free of the selection, and can be called in a single source code line, but you need to define zones first. The names match the names you assign to volume zones in the GUI or using the cs_user_zones function.

Regards,

Yvan
PFERRO
Posts: 8
Joined: Mon May 27, 2019 4:49 pm

Re: Compilation problem using standard user routine

Post by PFERRO »

Thank Yvan,
it's working !
PF
Post Reply