View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004058 | OpenFOAM | Bug | public | 2024-02-27 15:04 | 2024-02-28 10:58 |
Reporter | Johan Spang | Assigned To | will | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | GNU/Linux | OS | Other | OS Version | (please specify) |
Product Version | 11 | ||||
Fixed in Version | 11 | ||||
Summary | 0004058: cylindricalFunctionObject rendering incorrect results | ||||
Description | I am using the cylindricalFunctionObject to study the radial, tangential and axial components of U in a rotodynamic case (looking at the components of the generated 'cylindrical(U)' vector field in paraview). I noticed that something is wrong with the radial and tangential components. I traced the problem down to a dependence on the axial distance of each cell centre from the origin. My case uses the incompressibleFluid solver and contains an MRF zone. | ||||
Steps To Reproduce | To replicate with a simple 2D-case: * Copy tutorials/incompressibleFluid/mixerVessel2DMRF to a temporary directory * Run the Allrun script in the copied mixerVessel2DMRF folder * Optionally, run the command 'touch test.foam' inside the mixerVessel2DMRF folder (for opening in paraview later) * Make two new copies of the local mixerVessel2DMRF folder (including the generated solution data), name them with -1 and -2 extension. Now the temporary folder contains the following: mixerVessel2DMRF mixerVessel2DMRF-1 mixerVessel2DMRF-2 * Navigate to the mixerVessel2DMRF-1 directory * run transformPoints "translate=(0 0 0.1)" * Navigate to the mixerVessel2DMRF-2 directory * run transformPoints "translate=(0 0 0.2)" * save the attached postProcessDict to the temporary folder * inside each of the 3 cases run 'foamPostProcess -dict ../postProcessDict' (this will run the cylindricalFunctionObject and output the cylindrical(U) vector field for all time steps) * Visualize the 3 different cases and compare mag(U) with mag(cylindrical(U)) - see attached image for an example that shows the problem. The results are only as expected for the base case where z = 0 for all cells. | ||||
Additional Information | In src/functionObjects/field/cylindrical/cylindricalFunctionObject.C: Foam::tensor Foam::functionObjects::cylindrical::R(const vector& p) const { vector dir = p - origin_; dir /= mag(dir) + vSmall; const vector axis = axis_/mag(axis_); const vector r = dir - (dir & axis)*axis; return tensor(r, axis^r, axis); } Should not r be normalized? replacing: const vector r = dir - (dir & axis)*axis; with: vector r_ = dir - (dir & axis)*axis; const vector r = r_ / (mag(r_) + vSmall); Gives the expected results, as shown in the right column in the attached image. It also produces the expected results in my real world 3D case. A side note: src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C seems to be implemented in a similar way, but I have not tested if it has any issues. | ||||
Tags | No tags attached. | ||||
|
postProcessDict (961 bytes)
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 11 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // functions { cartesianToCylindrical { type cylindrical; libs ("libfieldFunctionObjects.so"); origin (0 0 0); axis (0 0 1); field U; writeControl outputTime; writeInterval 1; } } // ************************************************************************* // |
|
Thanks for the report. Fixed in v11 and in dev. https://github.com/OpenFOAM/OpenFOAM-11/commit/bc5adc26e6fac70447370342d4a48fc3481eb993 https://github.com/OpenFOAM/OpenFOAM-dev/commit/66835ba9a9d6a2631b52b51bf9b84353016076ef |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-02-27 15:04 | Johan Spang | New Issue | |
2024-02-27 15:04 | Johan Spang | File Added: postProcessDict | |
2024-02-27 15:04 | Johan Spang | File Added: visualization.png | |
2024-02-28 10:58 | will | Assigned To | => will |
2024-02-28 10:58 | will | Status | new => resolved |
2024-02-28 10:58 | will | Resolution | open => fixed |
2024-02-28 10:58 | will | Fixed in Version | => 11 |
2024-02-28 10:58 | will | Note Added: 0013202 |