Page 1 of 1

time average of profiles

Posted: Wed Apr 29, 2020 3:46 pm
by daniele
Hello,

I was wondering if it is possible to make code_Saturne calculate the time average of a user defined profile or probe.
In the GUI, when I add a time average, I do not understand how to set the x,y,z position where I want the average to be calculated. Maybe I misunderstand the use of time averages...?
I had a look but could find no such example in the SRC subroutines.

Thank you very much.
Best regards,
Daniele

Re: time average of profiles

Posted: Wed Apr 29, 2020 11:44 pm
by Yvan Fournier
Hello,

This is not possible directly, but you can output profile or probe values of time-average variables.
This is slightly less efficient, but will lead to the same results.

Regards,

Yvan

Re: time average of profiles

Posted: Thu Apr 30, 2020 8:16 am
by daniele
Hello Yvan,

Thank you for your help.
What I understand is that "Time averages" in the GUI calculates the average of the selected variables for all cells, is that right?
Then, I can define a profile calling that average?
Have I understood exactly? Is there an example in any user routine?

Thank you very much.
Best regards,
Daniele

Re: time average of profiles

Posted: Thu Apr 30, 2020 10:32 am
by Yvan Fournier
Hello,

Yes, this is correct. I am not sure there is a specific example, but:
- you can do it directly in the GUI (if the time average is also declared in the GUI, it is available for probes and profiles)
- in user subroutines, you simply use the name of the time average as a "regular" field name for profiles and probes.

Best regards,

Yvan

Re: time average of profiles

Posted: Wed Jun 17, 2020 5:10 pm
by daniele
Hello,

When postprocessing profiles, I sometimes get the error:

Code: Select all

System error: File too large

../../../src/fvm/fvm_to_plot.c:203: Fatal error.

Error opening file: "profiles/profile5_120170.dat"
And the simulation crashes.
It looks like a memory problem. Have you ever faced this error?

Thank you very much in advance.
Best regards,
Daniele

Re: time average of profiles

Posted: Thu Jun 18, 2020 12:07 am
by Yvan Fournier
Hello,

Yes, unless your files really are huge (which is not the intended use of profiles), this seems typical of a memory error.

If proofreading your user defined functions does not rapidly allow you to find a suspect part, the most efficient debugging technique for this type of issue is using Valgrind on a debug build of code_saturne, or using a Adress-Sanitizer-based debug build (Valgrind usually allows us to find 99% of such bugs, and if that does not work, AdressSanitize (debug build adding CFLAGS=-fsanitize=address and FCFLAGS=-fsanitize=addess using the gcc or clang debugger),

Otherwise, bisection is always the "last resort" debug tool, but is painful.

If you observe this without any user-defined sources, then we may have a bug, or abuild issue, so in this case we need the usual recommended info as per the forum guidelines.

Best regards,

Yvan

Re: time average of profiles

Posted: Fri Sep 09, 2022 4:27 pm
by finzeo
Sorry if it's wrong to continue with this thread, but I think it would help to ask how the time averaging option works:

if I set it to start averaging a certain variable at a time t=a, the value that is saved at a time t=a+x comes from averaging the values of that variable in the interval [a,a+x] ? or another interval it is used?

Re: time average of profiles

Posted: Fri Sep 09, 2022 7:25 pm
by Yvan Fournier
Hello,

Your interpretation is correct.

Averaging is done on the interval [a,a+x].

It uses recurrence formulas, so is kept up to date at each time step.

Regards,

Yvan