Dear users,
To my knowledge, field variables of a Code_Saturne simulation can be outputted at 'user desired locations' through either profiles and/or probes, defined through GUI. However the current output is limited in two ways:
1. I get only the cell centred values no matter where the user specified location is located
2. at least the corresponding location for the above output - the cell centres - should be printed in the output, which is not the case.
A more useful output would be to actually interpolate the field variables at any arbitrary location (100s of locations)
Can anyone let me know if and how this can be achieved?
Thanks
Output Field Variables at Arbitrary Locations
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
-
- Posts: 4251
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Output Field Variables at Arbitrary Locations
Hello,
Actually, if you use the CSV format with probles, and additional file with probe locations is generated.
For interpolation, things can be more tricky, as there are multiple possible definitions, both for the interpolation definition and weighting, and near the walls where wall laws are concerned.
Using the "new" (v5.0) system for probes and profiles (see cs_user_postprocess-profiles.c example), users can define their own interpolation function, which may be an option. But there is no predefined function other than "cell-center" at this stage.
Best regards,
Yvan
Actually, if you use the CSV format with probles, and additional file with probe locations is generated.
For interpolation, things can be more tricky, as there are multiple possible definitions, both for the interpolation definition and weighting, and near the walls where wall laws are concerned.
Using the "new" (v5.0) system for probes and profiles (see cs_user_postprocess-profiles.c example), users can define their own interpolation function, which may be an option. But there is no predefined function other than "cell-center" at this stage.
Best regards,
Yvan
Re: Output Field Variables at Arbitrary Locations
Hello Yvan,
Thanks for the reply. I looked into the file you mentioned, cs_user_postprocess-profiles.c, and found the following, where interpolation is possible:
I see that the arguments for interpolation requires the use of the following function defined in cs_interpolate.c
However inside the function there is no interpolation operation taking place!
(I am pasting the case for CS_DOUBLE). Is the function complete or am I missing something?
Thanks for the reply. I looked into the file you mentioned, cs_user_postprocess-profiles.c, and found the following, where interpolation is possible:
Code: Select all
void cs_post_write_probe_values (
int mesh_id,
int writer_id,
const char * var_name,
int var_dim,
cs_post_type_t var_type,
int parent_location_id,
cs_interpolate_from_location_t * interpolate_func,
void * interpolate_input,
const void * vals,
const cs_time_step_t * ts
)
I see that the arguments for interpolation requires the use of the following function defined in cs_interpolate.c
Code: Select all
void
cs_interpolate_from_location_p0(void *input,
cs_datatype_t datatype,
int val_dim,
cs_lnum_t n_points,
const cs_lnum_t point_location[],
const cs_real_3_t point_coords[],
const void *location_vals,
void *point_vals)
However inside the function there is no interpolation operation taking place!
(I am pasting the case for CS_DOUBLE). Is the function complete or am I missing something?
Code: Select all
case CS_DOUBLE:
{
const cs_real_t *l_vals = (const cs_real_t *)location_vals;
cs_real_t *p_vals = point_vals;
for (cs_lnum_t i = 0; i < n_points; i++) {
cs_lnum_t e_id = point_location[i];
if (e_id > -1) {
for (cs_lnum_t j = 0; j < val_dim; j++)
p_vals[i*val_dim + j] = l_vals[e_id*val_dim + j];
}
else {
for (cs_lnum_t j = 0; j < val_dim; j++)
p_vals[i*val_dim + j] = 0;
}
}
}
-
- Posts: 4251
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Output Field Variables at Arbitrary Locations
Hello,
Yes, this function only does P0 interpolation.
The idea is that you can write your own function (with the same number and type of arguments), and pass that function to the call of cs_post_write_probe_values. Using your own function, you can define any type of interpolation you need (but there is no "ready-to-use" function except the one with only P0 "interpolation" yet).
Best regards,
Yvan
Yes, this function only does P0 interpolation.
The idea is that you can write your own function (with the same number and type of arguments), and pass that function to the call of cs_post_write_probe_values. Using your own function, you can define any type of interpolation you need (but there is no "ready-to-use" function except the one with only P0 "interpolation" yet).
Best regards,
Yvan
Re: Output Field Variables at Arbitrary Locations
Yvan,
thanks for your clarifications!
thanks for your clarifications!