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

‘patchi’ was not declared in this scope

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 26, 2011, 05:02
Default ‘patchi’ was not declared in this scope
  #1
Senior Member
 
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 8
doubtsincfd is on a distinguished road
I am trying to write gradT on a wall in laplacianFoam as follows (code addition in write.H file)

volScalarField surfGradT
(
IOobject
(
"surfGradT",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradT.boundaryField()[patchi].snGrad()
);

on running wmake I am getting the error‘patchi’ was not declared in this scope. How can I resolve this error?
doubtsincfd is offline   Reply With Quote

Old   June 26, 2011, 05:12
Default
  #2
Senior Member
 
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 8
doubtsincfd is on a distinguished road
I am using OF 1.7
doubtsincfd is offline   Reply With Quote

Old   June 26, 2011, 05:23
Default
  #3
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,215
Blog Entries: 35
Rep Power: 94
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings doubtsincfd,

Where did get that code from? The variable patchi is clearly to be used for iterating over all patches...
So, if you check where the variable is defined and used, prior to the code from where you copied it from, you should be able to adapt to your code!

Best regards,
Bruno
__________________
___
I'll be at OFW11 in Portugal
wyldckat is offline   Reply With Quote

Old   June 26, 2011, 05:29
Default
  #4
Senior Member
 
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 8
doubtsincfd is on a distinguished road
Thank you, Bruno

I am trying to build a code based on the code for gradTx given in solvers/basic/laplacianFoam/write.H. I want to calculate normal gradient of T on the patches. I am not so familiar with code modification of OF, so it is quite likely that I am making a basic mistake.

I am trying to define "surfGradT" variable in the same way gradTx has been defined. Why is the code not recognizing patchi?
doubtsincfd is offline   Reply With Quote

Old   June 26, 2011, 05:36
Default
  #5
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,215
Blog Entries: 35
Rep Power: 94
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Quote:
Originally Posted by doubtsincfd View Post
I am trying to define "surfGradT" variable in the same way gradTx has been defined. Why is the code not recognizing patchi?
OK, I've just looked at the file... So, where did you get this from:
Code:
gradT.boundaryField()[patchi].snGrad()
??
__________________
___
I'll be at OFW11 in Portugal
wyldckat is offline   Reply With Quote

Old   June 26, 2011, 05:41
Default
  #6
Senior Member
 
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 8
doubtsincfd is on a distinguished road
I got it from the file

applications/utilities/postProcessing/wall/wallGradU

The formula which I referred from the file is:
wallGradU.boundaryField()[patchi] = -U.boundaryField()patchi].snGrad();
doubtsincfd is offline   Reply With Quote

Old   June 26, 2011, 06:11
Default
  #7
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,215
Blog Entries: 35
Rep Power: 94
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
You dropped a crucial line:
Code:
forAll(wallGradU.boundaryField(), patchi)
{
    wallGradU.boundaryField()[patchi] =
        -U.boundaryField()[patchi].snGrad();
}
The forAll line is the one who iterates over all patches.

My advice to you is this: if you haven't done this before, do this tutorial first: http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam
If you follow that tutorial, you will learn valuable lessons about the OpenFOAM code!

Good luck!
Bruno
__________________
___
I'll be at OFW11 in Portugal
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
Compile calcMassFlowC aurore OpenFOAM Programming & Development 12 March 18, 2014 05:22
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
checking the system setup and Qt version vivek070176 OpenFOAM Installation 22 June 1, 2010 12:34
How to get the max value of the whole field waynezw0618 OpenFOAM Running, Solving & CFD 4 June 17, 2008 05:07
Compiling problems with hello worldC fw407 OpenFOAM Installation 21 January 6, 2008 18:38


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