Schmidt number in code saturne

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Tsubasa
Posts: 130
Joined: Fri Nov 20, 2020 4:09 am

Re: Schmidt number in code saturne

Post by Tsubasa »

Hello,

Yes I referred to some exmaple of "cs_field_set_key_double",
but I cannot find an answer to what is "f" in this case.

Code: Select all

void
cs_user_parameters(cs_domain_t   *domain)
{
  cs_field_set_key_double(f, cs_field_key_id("ksigmas"), 0.3);
}
I tried it with "CS_F_(t)", but this is of course wrong,
becasue ksigmas is not field, right?

Would you tell me tips?

Best regards,
Tsubasa
Yvan Fournier
Posts: 3498
Joined: Mon Feb 20, 2012 3:25 pm

Re: Schmidt number in code saturne

Post by Yvan Fournier »

Hello,

Check the setup.log file for existing field keys.

Code: Select all

void
cs_user_parameters(cs_domain_t   *domain)
{
  cs_field_set_key_double(f, cs_field_key_id("turbulent_schmidt", 0.5));
}
Regards,

Yvan
Tsubasa
Posts: 130
Joined: Fri Nov 20, 2020 4:09 am

Re: Schmidt number in code saturne

Post by Tsubasa »

Hello,

When I add this code in "cs_user_parameters.c"

Code: Select all

void
cs_user_parameters(cs_domain_t   *domain)
{
  cs_field_set_key_double(CS_F_(t), cs_field_key_id("turbulent_schmidt"), 0.3);
}
This error can be seen

Code: Select all

===============================================================
                   CALCULATION PREPARATION
                   =======================
 ===========================================================



SIGSEGV signal (forbidden memory area access) intercepted!

Call stack:
   1: 0x7f424da6e5ff <cs_field_set_key_double+0x1f>   (libsaturne-6.0.so)
   2: 0x7f424db1ee72 <iniusi_+0x123>                  (libsaturne-6.0.so)
   3: 0x7f424db1e929 <initi1_+0x7e>                   (libsaturne-6.0.so)
   4: 0x7f424f12b722 <cs_run+0x4e2>                   (libcs_solver-6.0.so)
   5: 0x7f424f12b0f8 <main+0x178>                     (libcs_solver-6.0.so)
   6: 0x7f424d18ebf7 <__libc_start_main+0xe7>         (libc.so.6)
   7: 0x561027f580aa <_start+0x2a>                    (cs_solver)
End of stack
What should I correct in code?
"CS_F_(t)" is wrong?

Best regards,
Hamada
Yvan Fournier
Posts: 3498
Joined: Mon Feb 20, 2012 3:25 pm

Re: Schmidt number in code saturne

Post by Yvan Fournier »

Hello,

Is a thermal model active ?

Please remember to follow provide at least some of the info recommended in the Forum guidelines, otherwise this is going to take forever...

Regards,

Yvan
Tsubasa
Posts: 130
Joined: Fri Nov 20, 2020 4:09 am

Re: Schmidt number in code saturne

Post by Tsubasa »

Hello Yvan,

No, thermal model is not active. I only set "scalar" in specieas transport.
Do I need thermal model?
In my case I need turbulent schmidt number (not turbulent Prandtl number) which is related to eddy viscosity and eddy diffusivity.
Even though my simulation doesn't take hear into account, should I activate thermal model?

"listing" file shows

Code: Select all

command: 
 ./cs_solver --mpi

***************************************************************

                                  (R)
                      Code_Saturne

                      Version 6.0.5


  Copyright (C) 1998-2019 EDF S.A., France

  revision 6.0.5-3e9e9e94c
  build sam. 21 nov. 2020 14:36:04 CET
  MPI version 3.1 (Open MPI 2.1.1)


  The Code_Saturne CFD tool  is free software;
  you can redistribute it and/or modify it under the terms
  of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  The Code_Saturne CFD tool is distributed in the hope that
  it will be useful, but WITHOUT ANY WARRANTY; without even
  the implied warranty of MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE.  See the GNU General Public License
  for more details.

***************************************************************


Local case configuration:

  Date:                mar. 21 sept. 2021 19:29:21 CEST
  System:              Linux 5.4.0-81-generic (Ubuntu 18.04.5 LTS)
  Machine:             tsubasa-VirtualBox
  Processor:           model name	: Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz
  Memory:              7962 MB
  User:                tsubasa (tsubasa)
  Directory:           /home/tsubasa/Desktop/scalr_transport/course/RESU/test3
  MPI ranks:           4 (appnum attribute: 0)
  OpenMP threads:      1
  Processors/node:     1
  I/O read method:     collective MPI-IO (explicit offsets)
  I/O write method:    collective MPI-IO (explicit offsets)
  I/O rank step:        1

  External libraries for partitioning:
    ParMETIS 4.0.3
    PT-SCOTCH 6.0.9

 Reading metadata from file: "mesh_input"

===============================================================

                   CALCULATION PREPARATION
                   =======================


 ===========================================================



SIGSEGV signal (forbidden memory area access) intercepted!

Call stack:
   1: 0x7f424da6e5ff <cs_field_set_key_double+0x1f>   (libsaturne-6.0.so)
   2: 0x7f424db1ee72 <iniusi_+0x123>                  (libsaturne-6.0.so)
   3: 0x7f424db1e929 <initi1_+0x7e>                   (libsaturne-6.0.so)
   4: 0x7f424f12b722 <cs_run+0x4e2>                   (libcs_solver-6.0.so)
   5: 0x7f424f12b0f8 <main+0x178>                     (libcs_solver-6.0.so)
   6: 0x7f424d18ebf7 <__libc_start_main+0xe7>         (libc.so.6)
   7: 0x561027f580aa <_start+0x2a>                    (cs_solver)
End of stack
My software is ver6.0.5.
You can check some files:
tsubasa.zip
(1.07 MiB) Downloaded 6 times
Best regards,
Tsubasa
Yvan Fournier
Posts: 3498
Joined: Mon Feb 20, 2012 3:25 pm

Re: Schmidt number in code saturne

Post by Yvan Fournier »

Hello,

You don't need a thermal model in general but if you are trying to set the Schmidt number for temperature, then you do need a thermal model to activate the temperature variable.

In your examples it seemed that that was what you were trying to do.

Otherwise, use code similar to the example but replace CS_F_(t) by a pointer to the field whose Schmidt number you want to change (you can repeat for multiple variables if needed).

Regards,

Yvan
Tsubasa
Posts: 130
Joined: Fri Nov 20, 2020 4:09 am

Re: Schmidt number in code saturne

Post by Tsubasa »

Hello Yvan,

As you said, the simulation worked without error.
However, even if I changed Schmidt number from 0.1 to 0.9 by this code

Code: Select all

void
cs_user_parameters(cs_domain_t   *domain)
{
  cs_field_set_key_double(CS_F_(t), cs_field_key_id("turbulent_schmidt"), 0.1);
}

Code: Select all

void
cs_user_parameters(cs_domain_t   *domain)
{
  cs_field_set_key_double(CS_F_(t), cs_field_key_id("turbulent_schmidt"), 0.9);
}
behavier of scalar transport in two simulations are completely same.
I supposed that behavier of scalar transport should be changed especially in terms of how to spread.

Is there another option that I have to change?

In setup.log, I can see this. Does it works or does this mean temperature = 0.9 (not turbulent_schmidt = 0.9)?

Code: Select all

  Key: "turbulent_schmidt", values per field
  ----
    temperature              0.9       
setup.log
(32.47 KiB) Downloaded 4 times

Best regards,
Tsubasa
Yvan Fournier
Posts: 3498
Joined: Mon Feb 20, 2012 3:25 pm

Re: Schmidt number in code saturne

Post by Yvan Fournier »

Hello,

The last message means the turbulent Schmidt for the temperature is set to 0.9.

Not sure why you don't have more influence from this parameter in other cases. This can strongly depend on the test case.

In any case, you can/must set the turbulent Schmidt for each transported scalar. The setup.log file allows you to check you really have the desired settings.

Best regards,

Yvan
Tsubasa
Posts: 130
Joined: Fri Nov 20, 2020 4:09 am

Re: Schmidt number in code saturne

Post by Tsubasa »

Hello,

Even if both "Specieas transpiort" and "Thermalmode" are active, I can see that "turbulent_schmidt" is set only for temperature, but not for "scalar1".

Code: Select all

  Key: "alpha_turbulent_flux_id", values per field
  ----

  Key: "turbulent_schmidt", values per field
  ----
    temperature              0.9       

  Key: "gradient_weighting_id", values per field
  ----
Like this, I hope "turbulent_schmidt" also should be set for "scalar1", but I cannot get it.

Code: Select all

  Key: "diffusivity_ref", values per field
  ----
    temperature              0.0249    
    scalar1                  2.16e-05  

  Key: "turbulent_diffusivity_id", values per field
How can I set turbulent_schmidt for scalar1?
You can find setup.log and setup.xml.
setup.log
(32.47 KiB) Downloaded 4 times
setup.xml
(13.93 KiB) Downloaded 4 times
cs_user_parameters.c
(8 KiB) Downloaded 5 times
Best regards.
Tsubasa
Yvan Fournier
Posts: 3498
Joined: Mon Feb 20, 2012 3:25 pm

Re: Schmidt number in code saturne

Post by Yvan Fournier »

Hello,

For scalars, apply the turbulent Schmidt setting to the fields matching those scalars.

There is no equivalent of CS_F_(t) for general scalars, so you can use cs_field_by_name() to access them, using the names you assigned those scalars.

Then repeat this for the different scalars.

In your code, you are still only setting this for the temperature.

Did you check the Doxygen/html documentation reference (https://www.code-saturne.org/cms/sites/ ... _dico.html) explaining how to access different fields ?

Regards,

Yvan
Post Reply