Hi Finzo and Yvon,
Thanks for your advice on this.
I have implemented a few tensors that I would like to keep track of in run time, and I would like to check that I have correctly implemented the cs_field API correctly. This works has been somewhat based off the discussion at
viewtopic.php?t=2963&start=10.
In these calculations, Sij and wij are the mean-strain rate and the mean-rotation tensors, and T1ij and T2ij are Pope's invariant tensors. I can view these fields in paraview after runtime.
In the current implementation, I gradually run out of memory as the program progresses. I am hoping that you could provide any guidance on how to better utilise the cs_field API in these user defined functions? In this work I have defined strain as a full tensor, rather than a symmetric one. This is so I can use for loops to iterate through the calculation of Pope's Invariants.
Any guidance on this would be greatly appreciated.
Best regards,
Sean Hanrahan
Additional Note:
In the cs_user_parameters.c file, I have included the following details.
/*Build new field*/
// Strain, Pope's Invariants - T1
int field_type = CS_FIELD_USER;
bool has_previous = true;
cs_field_t *f1, *f2, *f3, *f4, *f5;
f1 = cs_field_create("rij_buo", field_type, CS_MESH_LOCATION_CELLS, 6, has_previous);
f2 = cs_field_create("sij", field_type, CS_MESH_LOCATION_CELLS, 9, has_previous);
f3 = cs_field_create("wij", field_type, CS_MESH_LOCATION_CELLS, 9, has_previous);
f4 = cs_field_create("T1ij", field_type, CS_MESH_LOCATION_CELLS, 9, has_previous);
f5 = cs_field_create("T2ij", field_type, CS_MESH_LOCATION_CELLS, 9, has_previous);
int k_var = cs_field_key_id("first_moment_id");
const int k_post = cs_field_key_id("post_vis");
cs_field_set_key_int(f1, k_var, 1);
cs_field_lock_key(f1, k_var);
cs_field_set_key_int_bits(f1, k_post, CS_POST_ON_LOCATION);
cs_field_set_key_int(f2, k_var, 1);
cs_field_lock_key(f2, k_var);
cs_field_set_key_int_bits(f2, k_post, CS_POST_ON_LOCATION);
cs_field_set_key_int(f3, k_var, 1);
cs_field_lock_key(f3, k_var);
cs_field_set_key_int_bits(f3, k_post, CS_POST_ON_LOCATION);
cs_field_set_key_int(f4, k_var, 1);
cs_field_lock_key(f4, k_var);
cs_field_set_key_int_bits(f4, k_post, CS_POST_ON_LOCATION);
cs_field_set_key_int(f5, k_var, 1);
cs_field_lock_key(f5, k_var);
cs_field_set_key_int_bits(f5, k_post, CS_POST_ON_LOCATION);