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

bug in cylindricalCS class or fatal setup error?!!

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 30, 2017, 20:38
Default About the bug in cylindricalCS (compiled in OpenFOAM 4.0)
  #21
New Member
 
Join Date: Jun 2017
Posts: 2
Rep Power: 0
Enzu Zheng is on a distinguished road
Quote:
Originally Posted by sitajeje View Post
Dear Foamers,

I compared the GeometricField.H of OF4.1 and OF2.1, and found that the type of internalField() used in this utility is changed:
OpenFOAM4.1
typedef DimensionedField<Type, GeoMesh> Internal;
....
inline const Internal& internalField() const;

OpenFOAM2.1
typedef Field<Type> InternalField;
....
inline const InternalField& internalField() const;

This made the error that I posted in the last thread. I wonder how should I amend this code so that it can be used for OF4.0? I appreciate greatly for any suggestions and hints!

Thank you very much in advance!

Best regards,
sitajeje
Hi, sitajeje,

I changed it to

forAll (ccCyl.internalField(), i)
{
ccCyl.ref()[i]=cyl.localVector(cc.internalField()[i]);
}

Now it can compile successfully, but any better way to modify it? Thanks.

Best regards,
Enzu
Enzu Zheng is offline   Reply With Quote

Old   August 31, 2017, 09:44
Default convertToCylindrical for OF4.0
  #22
Member
 
Join Date: Sep 2016
Posts: 63
Rep Power: 10
sitajeje is on a distinguished road
Hello Enzu

please find my adaption to OF4.0 in the attachment.

sitajeje
Attached Files
File Type: gz convertToCylindrical.tar.gz (115.1 KB, 79 views)
sitajeje is offline   Reply With Quote

Old   August 31, 2017, 21:03
Default
  #23
New Member
 
Join Date: Jun 2017
Posts: 2
Rep Power: 0
Enzu Zheng is on a distinguished road
Thanks, Sitajeje. This helps.

Enzu
Enzu Zheng is offline   Reply With Quote

Old   September 29, 2017, 06:44
Default
  #24
Member
 
Tom
Join Date: Apr 2017
Posts: 50
Rep Power: 9
tom.opt is on a distinguished road
has anyone found a fix for this code to work in OF5 ?

I get this error when i wmake
convertToCylindrical.C: In function ‘int main(int, char**)’:
convertToCylindrical.C:118:21: error: ‘class Foam::IOobject’ has no member named ‘headerOk’
if (Uheader.headerOk())
^
/opt/openfoam5/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt32Opt/convertToCylindrical.o' failed
make: *** [Make/linux64GccDPInt32Opt/convertToCylindrical.o] Error 1

Last edited by tom.opt; September 29, 2017 at 06:47. Reason: clarify error
tom.opt is offline   Reply With Quote

Old   November 23, 2017, 10:12
Default
  #25
Member
 
Chris Schäfer
Join Date: Apr 2017
Posts: 34
Rep Power: 9
Chris123 is on a distinguished road
I got the same error message. Any idea how to fix it?
Best regards,
Mark
Chris123 is offline   Reply With Quote

Old   November 23, 2017, 12:56
Default
  #26
Member
 
Tom
Join Date: Apr 2017
Posts: 50
Rep Power: 9
tom.opt is on a distinguished road
Quote:
Originally Posted by Chris123 View Post
I got the same error message. Any idea how to fix it?
Best regards,
Mark
Hi Mark,
The way I worked around it was to use paraview for postProcessing, and I just used formulas In the calculator to convert the values that I needed from XYZ to cylindrical.

I think the script was written for an older version of openfoam and doesn't work with newer versions
tom.opt is offline   Reply With Quote

Old   November 24, 2017, 02:48
Default
  #27
Member
 
Chris Schäfer
Join Date: Apr 2017
Posts: 34
Rep Power: 9
Chris123 is on a distinguished road
Thank you Tom. This is also a solution but I would prefere the script solution due to automatize the process.
So no one who updated the script to newer versions of OF?
Chris123 is offline   Reply With Quote

Old   December 15, 2017, 22:03
Default Changing from Cartesian to cylindrical coordinates using a different origin
  #28
New Member
 
Ehimen
Join Date: Jun 2016
Posts: 12
Rep Power: 10
Elliptic CFD is on a distinguished road
This is a quick comment for anyone who is trying to use the OpenFOAM library to change from a Cartesian coordinate system to a cylindrical coordinate system with a different origin. The conversion will not work using the code posted in this forum as the library assumes that the origin is still at [0 0 0].

A quick fix will be to translate the Cartesian coordinate system using the origin of the new cylindrical coordinates then doing the coordinate system conversion. For instance

// Creating cylindrical coordinates
cylindricalCS ccs
(
"ccs",
point(5.0, 0.0, 1.58), // centre point of ccs
vector(0, -1, 0), // axis of ccs
vector(0, 0, -1), // base axis for cylindrical angle
false
);

// The cartersian coordinates used by the simulation
volVectorField cco = mesh.C();

dimensionedVector origin("origin", dimLength, vector(5.0, 0.0, 1.58));

volVectorField cc = cco - origin;

polarCoord.primitiveFieldRef() = ccs.localVector(cc.internalField());

forAll(polarCoord.boundaryField(), patchI)
{
polarCoord.boundaryFieldRef()[patchI] = ccs.localVector(cc.boundaryField()[patchI]);
}

polarCoord.write();

This should work

Quote:
Originally Posted by eagle View Post
Hi all !

Im trying to use this utilitie for a body not aligned with the origin of the mesh. Its because Im simulating a bent pipe and the center of bend is the center of origin and not the rotation axis of the pipe.

The Problem is if Im changing the cylindricalCs like

cylindricalCS cyl(

"cylindricalCS",
-> point(0.169, 0, 0),//origin of cs
vector(0, 0, 1), //rotation axis
vector(0, 1, 0), //start of angle
false); //keyword false: Use radians since cos and sin work with radians

The class/or tool doesn't use the point Im giving it. Im relatively new to foam so Im not
sure if the problem is somewhere around here:

ccCyl.internalField() = cyl.localVector(cc.internalField());
forAll (ccCyl.boundaryField(), patchI)
{
ccCyl.boundaryField()[patchI] = cyl.localVector(cc.boundaryField()[patchI]);
}

I checked Theta and its not in accordance to the center of the cylindrical Coordinatesystem.

I know I could just change the origin of the mesh. But as I'm also simulating a pipe helix and need the cylindrical coordinates somewhere in the helix I do need the answer to this anyway.

I could really use some help here

best regards

-----------------------------------------------------

Edit:

by searching for a solution I considered using:

globalToLocal (const vector &, bool translate) const

instead of:

localVector (const vector &global) const


see here:

http://foam.sourceforge.net/docs/cpp/a00294.html

So Im in the opinion during transformation with localVector the translation of the origin is getting lost.
I could imagine using globalToLocal is solving the problem but I cant use it or dont know how because its
a protected function ?
Elliptic CFD is offline   Reply With Quote

Old   January 8, 2018, 09:42
Default
  #29
Member
 
Chris Schäfer
Join Date: Apr 2017
Posts: 34
Rep Power: 9
Chris123 is on a distinguished road
Hi Ehimen, thank you for your help.
honestly I do not understand which file I have to modify according to your enries, is it the cylindricalCS.C file? Than I do not know where?

Sorry for my unknowledge.
Chris123 is offline   Reply With Quote

Old   August 9, 2018, 15:00
Default
  #30
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 245
Rep Power: 10
gu1 is on a distinguished road
Quote:
Originally Posted by tom.opt View Post
has anyone found a fix for this code to work in OF5 ?

I get this error when i wmake
convertToCylindrical.C: In function ‘int main(int, char**)’:
convertToCylindrical.C:118:21: error: ‘class Foam::IOobject’ has no member named ‘headerOk’
if (Uheader.headerOk())
^
/opt/openfoam5/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt32Opt/convertToCylindrical.o' failed
make: *** [Make/linux64GccDPInt32Opt/convertToCylindrical.o] Error 1
Just switch the Uheader.headerOk() to Uheader.good()
ancolli likes this.
gu1 is offline   Reply With Quote

Old   October 24, 2018, 06:24
Default
  #31
Member
 
Chris Schäfer
Join Date: Apr 2017
Posts: 34
Rep Power: 9
Chris123 is on a distinguished road
Sorry for my late reply. Thank you gu1, now it works.
But now I got Ucyl and Ualpha both with x,y, z option.
Even if I take a look into the "convertTocylindric" file it is not quite clear to me what I see. (e.g. if I select Ucyl (x) looks quite different from Ucyl (y).
Can you please explain me what I got if I choose Ualpha/Ucyl (x,y,z)?
Thank you
Chris123 is offline   Reply With Quote

Old   October 24, 2018, 06:51
Default
  #32
Member
 
Chris Schäfer
Join Date: Apr 2017
Posts: 34
Rep Power: 9
Chris123 is on a distinguished road
I would like to add, Ualpha (y,z) is zero.
My aim is to export U radial data, but I need an allocation to theta and range.
Chris123 is offline   Reply With Quote

Reply


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
How to get the max value of the whole field waynezw0618 OpenFOAM Running, Solving & CFD 4 June 17, 2008 06:07
Which is the fatal error when foamInstallationTest eddy OpenFOAM Installation 2 March 30, 2008 22:13
Installation problem with GCC Norma McKee (Mckee) OpenFOAM Installation 10 March 4, 2007 08:09
a question of open ".cas" and ".dat" files fanzhong Meng FLUENT 4 May 15, 2006 12:40
Fatal error error writing to tmp No space left on device maka OpenFOAM Installation 2 April 3, 2006 09:48


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