CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > 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 Search this Thread 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: 838
Rep Power: 17
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: 13
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: 838
Rep Power: 17
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: Germany
Posts: 1,377
Rep Power: 29
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.
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: 838
Rep Power: 17
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
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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 Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 03:23
physical boundary error!! kris Siemens 2 August 3, 2005 00:32


All times are GMT -4. The time now is 09:32.