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

invoking volVectorField class parameter which exist in "0" folder

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 14, 2016, 16:15
Default invoking volVectorField class parameter which exist in "0" directory to .c file drag
  #1
New Member
 
Kasra
Join Date: Aug 2014
Posts: 29
Rep Power: 11
k.farnagh is on a distinguished road
Hi dears,

I want to lookup or invoke Ub (inflow air velocity at inlet) to drag model (.c file).

Ub is valued in "0" directory and is volVectorField type but its not important for me to keep type class, in other word scalar output is better for me.

I apply "twoPhaseEulerFoam" solver of 2.1.1 OF and drag model is "GidaspowErgunWenYu".

Would you please guide me.

Last edited by k.farnagh; June 22, 2016 at 06:38.
k.farnagh is offline   Reply With Quote

Old   June 23, 2016, 06:44
Default
  #2
New Member
 
Kasra
Join Date: Aug 2014
Posts: 29
Rep Power: 11
k.farnagh is on a distinguished road
no body no suggestion?
k.farnagh is offline   Reply With Quote

Old   June 23, 2016, 23:01
Default
  #3
New Member
 
Jianzhi Li
Join Date: Jul 2013
Location: Shanghai, China
Posts: 27
Rep Power: 12
epi_c is on a distinguished road
Send a message via Skype™ to epi_c
Hi Kasra,

Maybe you can try

const label patchI = U.mesh().boundaryMesh().findPatchID("inlet");
const vectorField Uinlet = U.boundaryField()[patchI];
epi_c is offline   Reply With Quote

Old   June 24, 2016, 06:55
Default
  #4
New Member
 
Kasra
Join Date: Aug 2014
Posts: 29
Rep Power: 11
k.farnagh is on a distinguished road
Hi Dear Jianzhi,

Thanks for reply, As I'm newcomer in coding would you please explain where should I put them. .c file of drag model --> member function or somewhere else?
furthermore should I include some .H file, change Constructor or ...?

Sincerely Yours
Kasra
k.farnagh is offline   Reply With Quote

Old   June 24, 2016, 10:25
Default
  #5
New Member
 
Kasra
Join Date: Aug 2014
Posts: 29
Rep Power: 11
k.farnagh is on a distinguished road
Hi,

I've added below code to end of Member Function of "GidaspowErgunWenYu.c" and nothing else.

Code:
Info<< "Looking up field Ub\n" << endl;
const volVectorField& Ub = Ub.mesh().lookupObject<volVectorField>("Ub");

Info<< "Reading inlet velocity uInlet\n" << endl;
scalar UInlet = 0.0;
const label inletI = Ub.mesh().boundaryMesh().findPatchID("inlet");
const fvPatchVectorField& fvp = Ub.boundaryField()[inletI];

if (fvp.size())
{
UInlet = fvp[0].y();
}
reduce(UInlet, maxOp<scalar>());
I've compiled new drag model and encountered just below warning
Code:
dragModels/GidaspowErgunWenYulogvelo/GidaspowErgunWenYulogvelo.C:98:36: warning: ‘Ub’ may be used uninitialized in this function [-Wmaybe-uninitialized] const volVectorField& Ub = Ub.mesh().lookupObject<volVectorField>("Ub");
However I've ran a case with new drag model and it has stopped calculation when looking for Ub field.

would you please guide me to solve it. thanks again Jianzhi.

Sincerely Yours,
Kasra
k.farnagh 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
The udf.h headers are unable to open- in VISUAL STUDIO 13 sanjeetlimbu Fluent UDF and Scheme Programming 4 May 2, 2016 05:38
[PyFoam] running pyFoam(Plot)Runner.py in parallel Studi OpenFOAM Community Contributions 10 September 6, 2015 16:38
meshing of a compound volume in GMSH shawn3531 OpenFOAM 4 March 12, 2015 10:45
Force can not converge colopolo CFX 13 October 4, 2011 22:03
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 20:30


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