CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Cylindrical Coordinates Conversion

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 22, 2024, 02:21
Default Cylindrical Coordinates Conversion
  #1
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Hi guys
I defined the stress tensor as a volScalarField in createFields.H. Then I calculated it as:
Code:
volTensorField gradU = fvc::grad(U);
tauS = etaS*twoSymm(gradU);
Then I converted stress tensor components to Cylindrical Coordinates using cylindricalCoordinates.H:
Code:
const volVectorField C = mesh.C(); // Initial Coordinates
const volVectorField CT = C-origin_; // Transfomed Coordinates

forAll(C,i)
{
 scalar teta = std::atan2(CT[i].y(), CT[i].x()); 
 if (teta < 0)
 {
     teta += 2*PI;  
 }
 scalar sin = Foam::sin(teta);
 scalar cos = Foam::cos(teta);
 
 // velocity field
 UC[i].x() =  U[i].x()*cos + U[i].y()*sin; // R component
 UC[i].y() = -U[i].x()*sin + U[i].y()*cos; // theta component
 UC[i].z() =  U[i].z();    // Z component
 
 // Solvent Stress Tensor
 tauSRT[i].xx() = tauS[i].xx()*pow(cos,2) + tauS[i].yy()*pow(sin,2) + 2 * tauS[i].xy()*cos*sin;    // TauS_rr
 tauSRT[i].xy() = ( tauS[i].yy() - tauS[i].xx() )*cos*sin + tauS[i].xy() * ( pow(cos,2) - pow(sin,2) );  // TauS_rt
 tauSRT[i].xz() = tauS[i].xz()*cos + tauS[i].yz()*sin;        // TauS_rz
 tauSRT[i].yy() = tauS[i].xx()*pow(sin,2) + tauS[i].yy()*pow(cos,2) - 2 * tauS[i].xy()*cos*sin;    // TauS_tt
 tauSRT[i].yz() = -tauS[i].xz()*sin + tauS[i].yz()*cos;        // TauS_tz
 tauSRT[i].zz() = tauS[i].zz();              // TauS_zz
}
and included it at the end of the runTime loop of the solver code, where all of the variables are calculated:

Code:
#include "cylindricalCoordinates.H"
We expected to see equal values for the magnitude of the stress tensor in XY and RT (R-teta), as I can see the same values for velocity in both coordinates system. However, the magnitude of the stress tensor in XY and RT are different! as you can see in the following picture:


Do you know what the problem is?
alimea is offline   Reply With Quote

Reply

Tags
cartesian, cylindrical coordinates, openfoam 9.0, stress tensor


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finite Volume Method For Cylindrical Coordinates falopsy Main CFD Forum 45 August 14, 2023 22:14
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 18 May 11, 2018 08:31
SIMPLE algorithm in 3D cylindrical coordinates zouchu Main CFD Forum 1 January 20, 2014 18:02
Cylindrical coordinates ? T.D. OpenFOAM Running, Solving & CFD 17 September 26, 2010 16:37
Calculation in cylindrical coordinates Franz Wingelhofer CFX 0 December 28, 1999 08:46


All times are GMT -4. The time now is 01:02.