Page 1 of 2

specify different head losses for different subdomains

Posted: Thu Jul 06, 2017 10:05 am
by daniele
Hello,

I cannot manage to impose different head losses in different subdomains, through the cs_user_head_losses.f90.
I actually have to impose different correlations of head losses on different subdomains. I have tried different ways, but none worked so far. The problem is that I cannot understand how to use the cs_user_head_losses.f90 to specify a different ckupdc for different zones.
My first idea was to do a dedicated getcel for each subdomain, and the applying the standard 3 step procedure of the cs_user_head_losses.f90 subroutine. This does not work since the argument of the cs_user_head_losses routine is "ncepdp" which represents the total number of cells where head losses are imposed. But in my case, I need to make dedicated loops over the cells of different subdomains and calculate the "ckupdc" differently depending on the domain...

Is there any way to do it?

Many thanks in advance.

Best regards,

daniele

Re: specify different head losses for different subdomains

Posted: Thu Jul 06, 2017 7:13 pm
by Yvan Fournier
Hello,

This can easily be done using the GUI, or in version 5.0, defining volume zones (either with the GUI or cs_user_zones.c) and setting coefficients in cs_user_head_losses.c

Using the older uskpc.f90, your only option is to "concatenate" different selections, and keep track of those selections when assigning coefficients.

Best regards,

Yvan

Re: specify different head losses for different subdomains

Posted: Fri Jul 07, 2017 5:10 pm
by daniele
Thank you very much, with version 5.0 is much easier!

Nveretheless, I have problems in using the velocity components. In the cs_user_head_losses.c routine attached, the format:

uz = cvara_vel[c_id][2]

gives the following error:

Invalid (not-a-number) values detected for array Velocity.

I cannot understand what is the problem... do you have any idea?

One last point that is not clear for me is the "i" index used for cku[...] in the cs_user_head_losses.c example provided. For how the loop over the zone cells is written, shouldn't we use the syntax cku[c_id][...]? The integer "i" looks to me as count from zero to the total number of cells in the zone...

Thank you very much in advance.

Best regards,

daniele

Re: specify different head losses for different subdomains

Posted: Mon Jul 10, 2017 2:13 pm
by Yvan Fournier
Hello,

Normally, cku is a local array in this case (whose data is copied back to the larger non-interleaved cku that you still have in the Fortran routines), so i is the correct index.

And I don't see anything obviously wrong in your code, so I don't know where the floatingèpoint exception may come from.

Did you run on a debug build ? Do you have backtraces, listings, or error logs ?

Best regards,

Yvan

Re: specify different head losses for different subdomains

Posted: Fri Jul 21, 2017 5:10 pm
by daniele
Hello,

I didn’t answer before because I waited for the installation of v5.0.1 in order to see if the problem could be solved.

Actually, with v5.0.1, I cannot manage to make the cs_user_head_losses.c work anymore. I have no error message anymore, but the routine is not accessed by the solver, any printf I write inside the routine is not printed. All other routines I used with previous versions seem to work fine. I am doing tests with local/serial calculations.

Besides, I allow myself to ask a few questions if you have time to answer them:

1) In v5.beta, I noticed that if I did not select “Head losses” in the “Nature” of the “Volume regions definition” in the GUI, the cs_user_head_losses.c was not taken into account. Nevertheless, for all other source terms (enthalpy, scalars) the cs_user_source_terms.f90 was always taken into account during the calculation, both with or without selecting them inside the “Nature” of the “Volume regions definition”. Is there a defined rule for this?

2) In both v5.beta and v5.0.1, the “Stop now” button in the GUI during the calculation does not work anymore. Is there a specific reason for that?

3) The initialization of enthalpy in the GUI does not work in my case with v5.0.1: whatever value I impose as initialization, enthalpy inside the domain starts from zero at the beginning of the calculation (thus convergence takes much longer to be achieved). Have you ever had this kind of problem?

4) I installed v5.0.1 with the debug option, but I cannot see any difference compared to compile messages in previous versions (installed without the debug). How can I know if the debug environment is correctly installed?

Thank you very much in advance for your time.
Best regards,

Daniele

Re: specify different head losses for different subdomains

Posted: Tue Jul 25, 2017 10:39 am
by Yvan Fournier
Hello,

Could you post a simple setup illustrating the issue ?

Here are also a few answers:

1) the new C functions are based on zones, and require the definition of zones with the appropriate type either in the GUI or in cs_user_zones.c. The Fortran functions do not require the definition of zones, and cannot use them directly.

2) Not sure about "stop now". I'll check it in 5.0.4.

3) No, but enthalpy is rarely used outside specific modules such as combustion of electric arcs, which have specific initializations. I'll need to check here also.

4) In the compile logs, you will see the "-g" option instead of "-O2" or "-O3". That's about all...

Best regards,

Yvan

Re: specify different head losses for different subdomains

Posted: Thu Jul 27, 2017 10:08 am
by daniele
Hello,

Thank you for your help.

I finally found the problem... In order to select the volume zone with:

if (strcmp(zone->name, "...") == 0)

I have to use the "Label" (such as "Zone_i") name and not the "Selection criteria" name appearing in the "Volume regions defintion". This is different from the fortran routines, where the getcel uses the "Selcetion criteria" name, which is the volume name given in the mesh file.

Thank you. Best regards,

daniele

Re: specify different head losses for different subdomains

Posted: Thu Jul 27, 2017 11:37 am
by Yvan Fournier
Hello,

Yes, sorry I did not realize and forgot to mention this.

The objective with zones is to have predefined selections with user-defined names, avoiding rebuilding selection lists at each call. This will be available only in C, and is similar to the logic presented in the GUI (but not the older Fortran routines).

Best regards,

Yvan

Re: specify different head losses for different subdomains

Posted: Fri Jul 28, 2017 8:17 am
by daniele
Hello,

Thanks for the explanation, I see the point.

When you have some time, could you provide me with some feedback regarding the enthalpy initialization issue, which is a quite critical aspect for my simulations?

Thanks a lot in advance.

Best regards,

Daniele

Re: specify different head losses for different subdomains

Posted: Fri Oct 13, 2017 5:03 pm
by daniele
Hello,

Always dealing with different zones definition, I have a new issue.

I would like to impose a pressure drop inside a subdomain (whose name can be found in the "Volume Region definition"), but only in some of its cells (let's say, for example, for the cells that satisfy the condition x>0[m]).

Is there a way to do that directly inside the GUI (using logical operators in the "Selection criteria" line of the "Volume Regions definition")?

Thanks in advance.

Best regards,

Daniele