Problem with cs_user_initialization not passing the values

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
fracenvi
Posts: 21
Joined: Wed Jun 19, 2024 9:58 am

Re: Problem with cs_user_initialization not passing the values

Post by fracenvi »

Hello,

I'm currently using a standard build of the 7.0.0 with HDF5, CGNS and med libraries. I highly appreciate what are you doing for me. Keep me posted.

Thank you and regards,
Francesco
fracenvi
Posts: 21
Joined: Wed Jun 19, 2024 9:58 am

Re: Problem with cs_user_initialization not passing the values

Post by fracenvi »

I'm sorry i just noticed that in the setup.tar.gz file i've missed the mechanism i'm using to simulate hydrogen combustion (it is the conventional one defined according to code_saturne notation). I report it to the bottom of this message.

Regards,
Francesco

9 Num current species
500 Num of tabulation point for enthalpy-temperature
298.0 TMAX
2700.0 TMIN

H2 O2 H2O N2 H O OH H2O2 HO2
0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35 Abscoeff (radiation)
3 Num of elemental species / below: first column -> molar mass of elemental species; remaining -> elemental comp of species
0.001 2 0 2 0 1 1 1 2 1
0.016 0 2 1 0 0 1 1 2 2
0.018 0 0 0 2 0 0 0 0 0
2 Num of global species known (fuel,oxy,prod)
1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 Composition Fuel
0.0 1.0 0.0 3.76 0.0 0.0 0.0 0.0 0.0 Composition Oxydant
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 Composition Products
Yvan Fournier
Posts: 4135
Joined: Mon Feb 20, 2012 3:25 pm

Re: Problem with cs_user_initialization not passing the values

Post by Yvan Fournier »

Hello,

Your setup seems to be for v7.0. Could you try it in v8.0 ?

Also, running the code in debug mode, I get a Fortran error in src/cogc/colecd.f90, line 607 (for v7.0), because iico2 is 0 (i.e. there is no CO2 variable), probably because the is no CO2 variable entry in your thermochemistry file.

This needs to be fixed before I can reach the point where your variable initializations are done then overwritten.

Best regards,

Yvan
fracenvi
Posts: 21
Joined: Wed Jun 19, 2024 9:58 am

Re: Problem with cs_user_initialization not passing the values

Post by fracenvi »

Hello,

I retried to run the case on an 8.0.3 build with the same setup mentioned before and still it doesn't work. Concerning the issue of CO2 this looks a bit odd considering there won't be any CO2 in any model where no carbon compound combustion is involved (my case is H2 so i don't expect any CO2 to form). Anyway this is the model updated with CO2 present:

5 Num current species
500 Num of tabulation point for enthalpy-temperature
300.0 TMIN
2700.0 TMAX

H2 O2 H2O N2 CO2
0.35 0.35 0.35 0.35 0.35 Abscoeff (radiation)
4 Num of elemental species / below: first column -> molar mass of elemental species; remaining -> elemental comp of species
0.001 2 0 2 0 0
0.012 0 0 0 0 1
0.016 0 2 1 0 2
0.018 0 0 0 2 0
2 Num of global species known (fuel,oxy,prod)
1.0 0.0 0.0 0.0 0.0 Composition Fuel
0.0 1.0 0.0 3.76 0.0 Composition Oxydant
0.0 0.0 0.0 0.0 0.0 Composition Products


Hope this may help you to get to the initialization part.

Thanks as always and regards,
Francesco
Yvan Fournier
Posts: 4135
Joined: Mon Feb 20, 2012 3:25 pm

Re: Problem with cs_user_initialization not passing the values

Post by Yvan Fournier »

Hello,

Be careful with fixed-size arrays.... On may machine, I needed to switch to BFT_MALLOC to avoid memory errors (as fixed-size arrays are handled on the stack, and the corresponding size may be too limited vs dynamically allocated arrays.

I attache the changed file (with paths also changed for debugging on my side, but your paths were probably good on your machine).

The overwrite/reset to 0 happens here :

caltri -> phyvar -> cs_physical_properties1 -> d3pphy

Best regards,

Yvan
Attachments
cs_user_initialization-base.c
(6.97 KiB) Downloaded 507 times
fracenvi
Posts: 21
Joined: Wed Jun 19, 2024 9:58 am

Re: Problem with cs_user_initialization not passing the values

Post by fracenvi »

Hello,

I guess i got what is the problem. Looking at the varoius subroutine calls you mentioned, according to the documentation, cs_physical_properties1 gets called both BEFORE and AFTER the user subroutines which means the reset for temperature and mass fractions is implicit in the code itself. Do you have any suggestion on how to stall this behaviour only during initialization time? Because i noticed it is indeed used in every time step.

Thanks as always and regards,
Francesco
Post Reply