Hello everyone,
I'm trying to collect time series of data in code_saturne during the calculation itself and not during the post-process phase (i.e., the simulation is running and i collect the data in a user-defined array). This is needed because i'm trying to have full coupling with a neural network which requires time series of data to perform predictions.
Looking at the documentation i found two function: field_get_val_prev2_s(), field_get_val_prev_s(), both return the previous values array for the previous iteration (is there any difference between the two?). I'm wondering if there is any way of retrieving values from even more in the past (i.e., from 10 timesteps ago).
Thanks for the help,
Francesco
Collecting variable values at different timesteps
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
-
- Posts: 4153
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Collecting variable values at different timesteps
Hello,
You can increase the number of time steps saved in a given field by using cs_field_set_n_time_vals for all fields where you need this, but if you keep too many values, the memory use may go up quite fast..
For each associated time, field->vals points to the values associated with time step n-i (where n is the current time step).
This is usable only from C code_not Fortran, but the Fortran code has been deprecated for a while and most of it will be removed in v9.0, so I recommend avoidin Fortran for this.
To save memory, projecting to a coarser mesh may be useful, but also more involved.
Best regards,
Yvan
You can increase the number of time steps saved in a given field by using cs_field_set_n_time_vals for all fields where you need this, but if you keep too many values, the memory use may go up quite fast..
For each associated time, field->vals points to the values associated with time step n-i (where n is the current time step).
This is usable only from C code_not Fortran, but the Fortran code has been deprecated for a while and most of it will be removed in v9.0, so I recommend avoidin Fortran for this.
To save memory, projecting to a coarser mesh may be useful, but also more involved.
Best regards,
Yvan
Re: Collecting variable values at different timesteps
Hello,
Ok i think i got it, i just have one question: checking on the documentation it says that by calling vals[p][:] i'll be able to call the array values at time n-p (if n is my current timestep and p is the the new value for n_time_vals), which implies that if i simply call vals i will have all of the values at the different timesteps, right?
Regards,
Francesco
Ok i think i got it, i just have one question: checking on the documentation it says that by calling vals[p][:] i'll be able to call the array values at time n-p (if n is my current timestep and p is the the new value for n_time_vals), which implies that if i simply call vals i will have all of the values at the different timesteps, right?
Regards,
Francesco
-
- Posts: 4153
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Collecting variable values at different timesteps
Hello,
The vals array stores pointers to each time step's values array, but each array is allocated separately so is not contiguous.
So you cannot acces it as a single array, unless you modify the way it is allocated in cs_fields.c (which would be feasible but has never been required so far).
Beat regards,
Yvan
The vals array stores pointers to each time step's values array, but each array is allocated separately so is not contiguous.
So you cannot acces it as a single array, unless you modify the way it is allocated in cs_fields.c (which would be feasible but has never been required so far).
Beat regards,
Yvan