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

How can I get a cell's height?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Display Modes
Old   November 27, 2013, 20:09
Default How can I get a cell's height?
  #1
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing,China
Posts: 500
Rep Power: 6
sharonyue is on a distinguished road
Hi guys,

mesh.C() returns a vector. But I want this vector's height, for example, mesh.C().z()???

Thanks very much.
sharonyue is offline   Reply With Quote

Old   November 28, 2013, 00:08
Default
  #2
New Member
 
Join Date: Nov 2012
Posts: 13
Rep Power: 3
lixx is on a distinguished road
mesh.C() returns a vectorField. If you want to get a specific cell's z-component, you still have to get the index of that cell.
lixx is offline   Reply With Quote

Old   November 28, 2013, 01:44
Default
  #3
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing,China
Posts: 500
Rep Power: 6
sharonyue is on a distinguished road
Quote:
Originally Posted by lixx View Post
mesh.C() returns a vectorField. If you want to get a specific cell's z-component, you still have to get the index of that cell.
Hi,

But I get a volScalarFields by mech.C().component(2)? It compiles well...

Code:
volScalarField Gk
    (
        IOobject
        (
            "Gk",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        GkReference + slot*mesh.C().component(2)//GkReference is volScalarField. slot is  dimensionedScalar
    );
sharonyue is offline   Reply With Quote

Old   November 28, 2013, 04:06
Default
  #4
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 912
Rep Power: 16
akidess will become famous soon enough
Quote:
Originally Posted by sharonyue View Post
But I get a volScalarFields by mech.C().component(2)?
What did you expect?
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Check out the scientific computing exchange http://scicomp.stackexchange.com
akidess is offline   Reply With Quote

Old   November 30, 2013, 20:28
Default
  #5
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing,China
Posts: 500
Rep Power: 6
sharonyue is on a distinguished road
Quote:
Originally Posted by akidess View Post
What did you expect?
Some others say I should use forAll
sharonyue is offline   Reply With Quote

Old   November 30, 2013, 21:25
Default
  #6
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 6,983
Blog Entries: 32
Rep Power: 68
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
Greetings to all!

This is what I usually do when I need to find a piece of code in OpenFOAM, more specifically for this kind:
Code:
cd $FOAM_UTILITIES
find . -name "*.[HC]" | xargs grep -sl "mesh.C()"
And the very first hit is shown here: https://github.com/OpenFOAM/OpenFOAM...ineSwirl.C#L56

Best regards,
Bruno
sharonyue likes this.
wyldckat is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
No layers in a small gap bobburnquist OpenFOAM Native Meshers: snappyHexMesh and Others 2 November 25, 2012 08:54
Import netgen mesh to OpenFOAM hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50
snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Native Meshers: snappyHexMesh and Others 2 March 27, 2011 21:11
snappyHexMesh aborting Tobi OpenFOAM Native Meshers: snappyHexMesh and Others 0 November 10, 2010 03:23
physical boundary error!! kris CD-adapco 2 August 3, 2005 00:32


All times are GMT -4. The time now is 03:16.