Hello,
I have a simple question... How can I call the x,y,z cell centroid coordinates in C subroutines?
For example if I have to write:
if (x>2[m]) then source_term=s
I found examples on how to do that in Fortran, but no examples with C routines.
Thanks a lot in advance.
Best regards,
daniele
space coordinates with C subroutines
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
-
- Posts: 284
- Joined: Fri Dec 04, 2015 1:42 pm
Re: space coordinates with C subroutines
Hello,
In the Doxygen documentation you can find a specific section about "How to access and manage the mesh entities and mesh quantities ?", for both Fortran and C. This is the link http://code-saturne.org/doxygen/src/mesh.html.
Also, in the file " cs_user_mesh-modify.c" in the EXAMPLE directory you can view some example anout how to access.
Regards,
Luciano
In the Doxygen documentation you can find a specific section about "How to access and manage the mesh entities and mesh quantities ?", for both Fortran and C. This is the link http://code-saturne.org/doxygen/src/mesh.html.
Also, in the file " cs_user_mesh-modify.c" in the EXAMPLE directory you can view some example anout how to access.
Regards,
Luciano
Re: space coordinates with C subroutines
Dear Luciano,
Thank you very much for your help.
Nevertheless, in the documents you suggested I could not find exactly what I need.
In order to use a more practical example, if we consider the cs_user_head_losses.f90 of version 4, we find a getcel as the following:
call getcel('X <= 6.0 and X >=4.0 and Y >=2.0 and Y<=8.0',nlelt,lstelt)
How can I write the same space conditions in the cs_user_head_losses.c? I mean, can I simply still use "X" and "Y" name variable in c subroutines?
Many thanks in advance.
Best regards,
Daniele
Thank you very much for your help.
Nevertheless, in the documents you suggested I could not find exactly what I need.
In order to use a more practical example, if we consider the cs_user_head_losses.f90 of version 4, we find a getcel as the following:
call getcel('X <= 6.0 and X >=4.0 and Y >=2.0 and Y<=8.0',nlelt,lstelt)
How can I write the same space conditions in the cs_user_head_losses.c? I mean, can I simply still use "X" and "Y" name variable in c subroutines?
Many thanks in advance.
Best regards,
Daniele
-
- Posts: 284
- Joined: Fri Dec 04, 2015 1:42 pm
Re: space coordinates with C subroutines
Hello Daniele,
In the file " cs_user_mesh-modify.c" there is an example of cells selection for a specific criteria using the function "cs_selector_get_cell_list()"
Regards,
Luciano
In the file " cs_user_mesh-modify.c" there is an example of cells selection for a specific criteria using the function "cs_selector_get_cell_list()"
Code: Select all
cs_lnum_t n_selected_cells = 0;
cs_lnum_t *selected_cells = NULL;
const char criteria[] = "box[0.5, 0.5, 0, 1, 1, 0.05]";
BFT_MALLOC(selected_cells, mesh->n_cells, cs_lnum_t);
cs_selector_get_cell_list(criteria, &n_selected_cells, selected_cells);
Luciano