Problem with cs_user_initialization not passing the values
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
Problem with cs_user_initialization not passing the values
Hello everyone,
I'm currently trying to restart a simulation with field data retrieved from a simulation performed externally to code_saturne, and i thought that a quick workaround would be of working with cs_user_initialization subroutines. Problem is: despite compiling the code successfully, no field got passed at all into the solver. Anyone have any idea of what can be the reason? I'm aware that there is another user subroutine that makes use of MEDCoupling but i have already tried that with the same result.
I attached the files needed to reproduce the behaviour.
Thanks to everyone that can help,
Francesco
I'm currently trying to restart a simulation with field data retrieved from a simulation performed externally to code_saturne, and i thought that a quick workaround would be of working with cs_user_initialization subroutines. Problem is: despite compiling the code successfully, no field got passed at all into the solver. Anyone have any idea of what can be the reason? I'm aware that there is another user subroutine that makes use of MEDCoupling but i have already tried that with the same result.
I attached the files needed to reproduce the behaviour.
Thanks to everyone that can help,
Francesco
- Attachments
-
- setup.tar.gz
- (2.97 MiB) Downloaded 879 times
-
- Posts: 4153
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Problem with cs_user_initialization not passing the values
Hello,
Which version of code_saturne are you using and on which system ? Have you successfully used other user-defined functions with this build before ?
Best regards
Yvan
Which version of code_saturne are you using and on which system ? Have you successfully used other user-defined functions with this build before ?
Best regards
Yvan
Re: Problem with cs_user_initialization not passing the values
Hello Yvan,
I'm currently using the 7.0.0 version on Ubuntu 22.04.3 but i have tried to use the 8.0.3 and it gives me the same result. The build i made for the code is a standard one wih HDF5, CGNS, and med libraries pre-installed on my workstation.
For the user-defined functions, i also use a cs_user_parameters for changing the density relaxation coefficient, and it seems to be working.
Do you have any suggestion?
Regards,
Francesco
I'm currently using the 7.0.0 version on Ubuntu 22.04.3 but i have tried to use the 8.0.3 and it gives me the same result. The build i made for the code is a standard one wih HDF5, CGNS, and med libraries pre-installed on my workstation.
For the user-defined functions, i also use a cs_user_parameters for changing the density relaxation coefficient, and it seems to be working.
Do you have any suggestion?
Regards,
Francesco
-
- Posts: 4153
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Problem with cs_user_initialization not passing the values
Hello,
If You see the messages you added (""Time in cs_user_initialization-ANN.c" and "END !" in the run_solver.log file, then it confirms the function was called correctly. Otherwise, this is strange. Just in case, you can try renaming cs_user_initialization-base.c to cs_user_initialization.c, but I would expect this to have an influence only if using --disable-shared when configuring the build). In any case, it is easy to test.
Best regards,
Yvan
If You see the messages you added (""Time in cs_user_initialization-ANN.c" and "END !" in the run_solver.log file, then it confirms the function was called correctly. Otherwise, this is strange. Just in case, you can try renaming cs_user_initialization-base.c to cs_user_initialization.c, but I would expect this to have an influence only if using --disable-shared when configuring the build). In any case, it is easy to test.
Best regards,
Yvan
Re: Problem with cs_user_initialization not passing the values
Hello,
It seems to not be working also in this case, despite showing the two messages. I've tried your easy fix and also checked whether the files are correctly loaded into the script with few debug prints.
Any other suggestions?
Kind regards,
Francesco
It seems to not be working also in this case, despite showing the two messages. I've tried your easy fix and also checked whether the files are correctly loaded into the script with few debug prints.
Any other suggestions?
Kind regards,
Francesco
-
- Posts: 4153
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Problem with cs_user_initialization not passing the values
Hello,
Did you check the return codes for calls to fread and fopen, to make sure data is read correctly ?
What are the min/max/mean values indicated in the run_solver.log at the computation start ? Maybe data is read and reinitialized for this model (that would be considered a bug).
Best regards,
Yvan
Did you check the return codes for calls to fread and fopen, to make sure data is read correctly ?
What are the min/max/mean values indicated in the run_solver.log at the computation start ? Maybe data is read and reinitialized for this model (that would be considered a bug).
Best regards,
Yvan
Re: Problem with cs_user_initialization not passing the values
Hello,
I did check whether data have been correctly read, and it seems like a sort reinitialization takes place since, as you said, there seems to be not a correspondence between min/max/mean values. I attached a snapshot of my run_solver.log.
I also tried to force the initialization with my data, going to compile a cs build with the cs_user_initialization.c modified in order to keep into account my routines, but it seems to not be working as well.
Do you think there might be other ways to initialize those data at this point?
Regards,
Francesco
I did check whether data have been correctly read, and it seems like a sort reinitialization takes place since, as you said, there seems to be not a correspondence between min/max/mean values. I attached a snapshot of my run_solver.log.
I also tried to force the initialization with my data, going to compile a cs build with the cs_user_initialization.c modified in order to keep into account my routines, but it seems to not be working as well.
Do you think there might be other ways to initialize those data at this point?
Regards,
Francesco
-
- Posts: 4153
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Problem with cs_user_initialization not passing the values
Hello,
I suspect a reinitialization, but am not sure where it happens.
If you are familiar with using a debugger, putting a breakpoint in your user initialization, and putting a watchpoint on the first value of one of your initialized fields would certainly help find this quickly.
Otherwise adding "print" statements at different points on the code can help but will take longer.
Best regards,
Yvan
I suspect a reinitialization, but am not sure where it happens.
If you are familiar with using a debugger, putting a breakpoint in your user initialization, and putting a watchpoint on the first value of one of your initialized fields would certainly help find this quickly.
Otherwise adding "print" statements at different points on the code can help but will take longer.
Best regards,
Yvan
Re: Problem with cs_user_initialization not passing the values
Hello,
I'm sorry but I'm kinda new to programming and stuff like this, I will give it a shot nonetheless. When you say user initialization you only refer to the routines that i'm introducing through the SRC folder?
Regards,
Francesco
I'm sorry but I'm kinda new to programming and stuff like this, I will give it a shot nonetheless. When you say user initialization you only refer to the routines that i'm introducing through the SRC folder?
Regards,
Francesco
-
- Posts: 4153
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Problem with cs_user_initialization not passing the values
Hello,
Yes. The idea If you are not familiar with a debugger, I can do a quick test on my side (it seems all the required files are in your archive). Just remind me which version of the code you are using.
Best regards,
Yvan
Yes. The idea If you are not familiar with a debugger, I can do a quick test on my side (it seems all the required files are in your archive). Just remind me which version of the code you are using.
Best regards,
Yvan