How can I access the updated coordinates on a rotating region from a functionObject
Hello,
I have tried both the coded function object, and implemented a custom function object using foamNewFunctionObject to print the coordinates of a cell on a rotating cellZone. When I invoke the function object, the Velocity is returned correctly and changes with time, however, the coordinates printed of the cell do not change with time, even though the cellZone is correctly rotating. How can I solve that? in other words; how can I get the updated coordinates of cells in a rotating cellZone from within a functionObject? I am stuck, and can't progress further without solving that issue. Could you please provide me some insights? (I am using OpenFOAM7) Thank you |
Hi D.Frank
Could you post your code? The simple answer is: you'll need to update the mesh or load the updated mesh. Most probably your reading the 'constant/polyMesh" over and over instead of the updated mesh regards |
Use writeCellCentres function object then use readFields Function object to read the centers as volVectorField.
|
Here is a minimal example:
Code:
type coded; |
Hi D.Frank
The code is correct: your cell_id isn't changing, and it shouldn't change. These ID's are the reference towards your cells. As per your code: your cell_id is a 'label' not a 'vector'. So your code is correct, but you're missing the link between the cell_id and the calculation of the cell centre. You can do as s1291 suggests, or manipulate the source code of the writeCellCenters function into your custom function. Or depending on what you're doing this thread could also help: https://www.cfd-online.com/Forums/op...ngly-file.html Hope this helps! |
All times are GMT -4. The time now is 06:59. |