time average of profiles

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
daniele
Posts: 148
Joined: Wed Feb 01, 2017 11:42 am

time average of profiles

Post 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
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: time average of profiles

Post 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
daniele
Posts: 148
Joined: Wed Feb 01, 2017 11:42 am

Re: time average of profiles

Post 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
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: time average of profiles

Post 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
daniele
Posts: 148
Joined: Wed Feb 01, 2017 11:42 am

Re: time average of profiles

Post 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
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: time average of profiles

Post 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
finzeo
Posts: 53
Joined: Fri Sep 09, 2022 4:23 pm

Re: time average of profiles

Post 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?
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: time average of profiles

Post 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
Post Reply