Dear expert team,
I want to calculate an integration over a slice. I plan to add a variable using "cs_parameters_add_property", then do the integration in cs_user_extra_operations. The version I'm using is 6.0.8.
The definition of the new variable (swirl number) is attached, and the simulation domain is a pipe.
Ux is the streamwise velocity, U_theta is the tangential velocity, which can be calculated based on Uy and Uz. r is the radial distance from the axis. R is the radius of the pipe.
The geometry is using x-y-z coordinates. I need to calculate the swirl number at 3 streamwise locations and need the time monitoring of the 3 swirl numbers.
Do you have any guidance on how to do the integration?
Best regards,
Xiaoxue
integration over a slice
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
-
- Posts: 4208
- Joined: Mon Feb 20, 2012 3:25 pm
Re: integration over a slice
Hello,
Some of the examples in the development branch might help you (https://github.com/code-saturne/code_sa ... rofile.cxx), though they are not quite simple...
Integrating a variable in a given direction or over a slice is always a bit tricky, since we need to project from an unstructured mesh to a structured one at some point. If your mesh is a Cartesian-type mesh, you might be able to integrate fields over single directions by summing values at cells with neighboring cells aligned along the chosen axis, bit you need to do this iteratively, without counting cells twice (for example by setting a cell's value to 0 once you have added it to another cell), and handling parallel partitioning boundaries...
Best regards,
Yvan
Some of the examples in the development branch might help you (https://github.com/code-saturne/code_sa ... rofile.cxx), though they are not quite simple...
Integrating a variable in a given direction or over a slice is always a bit tricky, since we need to project from an unstructured mesh to a structured one at some point. If your mesh is a Cartesian-type mesh, you might be able to integrate fields over single directions by summing values at cells with neighboring cells aligned along the chosen axis, bit you need to do this iteratively, without counting cells twice (for example by setting a cell's value to 0 once you have added it to another cell), and handling parallel partitioning boundaries...
Best regards,
Yvan
-
- Posts: 29
- Joined: Fri Mar 02, 2018 11:50 am
Re: integration over a slice
Hi Yvan,
Thanks for the information. The example is indeed not simple.
My geometry is Cartesian-type, the cells are aligned along the axis. The geometry is a pipe and the mesh is extruded along the axis.
To do the integration over a slice perpendicular to the axis, I'll need the surface area of the cell, the coordinate of the cell, and the velocity at the cell.
Do you have simpler examples or suggestions?
Thanks very much,
Xiaoxue
Thanks for the information. The example is indeed not simple.
My geometry is Cartesian-type, the cells are aligned along the axis. The geometry is a pipe and the mesh is extruded along the axis.
To do the integration over a slice perpendicular to the axis, I'll need the surface area of the cell, the coordinate of the cell, and the velocity at the cell.
Do you have simpler examples or suggestions?
Thanks very much,
Xiaoxue
-
- Posts: 4208
- Joined: Mon Feb 20, 2012 3:25 pm
Re: integration over a slice
Hello,
No, I do not have simpler examples. All the information you need can be accessed through mesh, mesh quantities, and field structures, which are documented here: https://www.code-saturne.org/documentat ... _dico.html
But I have no example of combining those in a way that is useful to you. You'll need to loop over cell faces (or loop over faces and add contributions to cells), comparing using face normals with x, y, z directions to determine whether a given face joins 2 cells aligned perpendicular to the axis or not...
Best regards,
Yvan
No, I do not have simpler examples. All the information you need can be accessed through mesh, mesh quantities, and field structures, which are documented here: https://www.code-saturne.org/documentat ... _dico.html
But I have no example of combining those in a way that is useful to you. You'll need to loop over cell faces (or loop over faces and add contributions to cells), comparing using face normals with x, y, z directions to determine whether a given face joins 2 cells aligned perpendicular to the axis or not...
Best regards,
Yvan