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

How to access my topoFvMesh member function in my code?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 7, 2016, 18:09
Default How to access my topoFvMesh member function in my code?
  #1
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Dear all,

I working on a customized version of movingConeTopoFvMesh (called it topoConeTopoFvMesh2) to move my grid (dynamicFvMesh).

I defined an access function
Code:
volScalarField alpha()
{
    return alpha_;
}
Now, I'd like to call this function in my main file.
Code:
   alpha= mesh.alpha();
gives me:
Code:
error: ‘class Foam::dynamicFvMesh’ has no member named ‘alpha’
   alpha= mesh.alpha();
How can I access function this alpha() from my main file?
Cheers,
Cyprien
Cyp is offline   Reply With Quote

Old   November 8, 2016, 10:11
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

1. You can use refCast on mesh to convert dynamicFvMesh to topoConeTopoFvMesh2 (something like
Code:
const topoConeTopoFvMesh2& my_lovely_mesh = refCast<const topoConeTopoFvMesh2>(mesh)
). Then use alpha method of my_lovely_mesh.

2. You can use
Code:
mesh.lookupObject<volScalarField>("name of alpha_ field")
.
alexeym is offline   Reply With Quote

Old   November 8, 2016, 10:31
Default
  #3
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

1. You can use refCast on mesh to convert dynamicFvMesh to topoConeTopoFvMesh2 (something like
Code:
const topoConeTopoFvMesh2& my_lovely_mesh = refCast<const topoConeTopoFvMesh2>(mesh)
). Then use alpha method of my_lovely_mesh.

2. You can use
Code:
mesh.lookupObject<volScalarField>("name of alpha_ field")
.
I got it! Thank you. I indeed have to declare my mesh as a topoConeTopoFvMesh2.
Cyp 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
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 00:35
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 06:59
Please help about the VTKFoam liugx212 OpenFOAM Running, Solving & CFD 0 November 18, 2005 18:27


All times are GMT -4. The time now is 15:26.