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

Getting errors on compiling boundary condition

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By Hisham
  • 1 Post By Hisham
  • 2 Post By Hisham

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 9, 2012, 02:32
Talking Getting errors on compiling boundary condition
  #1
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 13
shash is on a distinguished road
hi,
i am new to openfoam so please bear with me if my doubt is silly. i was trying to use new boundary condition by modifying oscillatingFixedValue , so i copied it to my OpenFoam/shash-2.1.1/run/pitzdaily/ and made a make dir. in which i modified make/files to

newoscillatingFixedValueFvPatchField.C
EXE = $(FOAM_USER_APPBIN)/newoscillatingFixedValueFvPatchField

then

wclean
rm -rf Make/linux*
wmake
but its showing error :

************************************************
Making dependency list for source file newoscillatingFixedValueFvPatchField.C
SOURCE=newoscillatingFixedValueFvPatchField.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/shash/OpenFOAM/OpenFOAM-2.1.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/shash/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude -I/home/shash/OpenFOAM/OpenFOAM-2.1.1/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/newoscillatingFixedValueFvPatchField.o
In file included from newoscillatingFixedValueFvPatchField.H:242:0,
from newoscillatingFixedValueFvPatchField.C:3:
newoscillatingFixedValueFvPatchField.C: In member function ‘virtual void Foam::newoscillatingFixedValueFvPatchField<Type>:: updateCoeffs()’:
newoscillatingFixedValueFvPatchField.C:180:27: error: there are no arguments to ‘patch’ that depend on a template parameter, so a declaration of ‘patch’ must be available [-fpermissive]
newoscillatingFixedValueFvPatchField.C:180:27: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
newoscillatingFixedValueFvPatchField.C:184:38: error: there are no arguments to ‘patch’ that depend on a template parameter, so a declaration of ‘patch’ must be available [-fpermissive]
newoscillatingFixedValueFvPatchField.C: At global scope:
newoscillatingFixedValueFvPatchField.C:14:8: error: redefinition of ‘Foam::scalar Foam::newoscillatingFixedValueFvPatchField<Type>:: currentScale() const’
newoscillatingFixedValueFvPatchField.C:14:8: error: ‘Foam::scalar Foam::newoscillatingFixedValueFvPatchField<Type>:: currentScale() const’ previously declared here
newoscillatingFixedValueFvPatchField.C:27:1: error: redefinition of ‘Foam::newoscillatingFixedValueFvPatchField<Type>: :newoscillatingFixedValueFvPatchField(const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&)’
newoscillatingFixedValueFvPatchField.C:27:1: error: ‘Foam::newoscillatingFixedValueFvPatchField<Type>: :newoscillatingFixedValueFvPatchField(const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&)’ previously declared here
newoscillatingFixedValueFvPatchField.C:46:1: error: redefinition of ‘Foam::newoscillatingFixedValueFvPatchField<Type>: :newoscillatingFixedValueFvPatchField(const Foam::newoscillatingFixedValueFvPatchField<Type>&, const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&)’
newoscillatingFixedValueFvPatchField.C:46:1: error: ‘Foam::newoscillatingFixedValueFvPatchField<Type>: :newoscillatingFixedValueFvPatchField(const Foam::newoscillatingFixedValueFvPatchField<Type>&, const Foam::fvPatch&, const Foam:imensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&)’ previously declared here


can someone please help me what am i doing wrong .
shash is offline   Reply With Quote

Old   June 9, 2012, 08:28
Default
  #2
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi Shash

First of all I think the question should be under the development section of OF forum (to enhance probability of getting help). Nonetheless, you have a punch of problems:

1. You have not made your homework. You need to read/re-read chapter3 of the user manual.
2. You may need a little brushing on your C++ skills. This place is fantastic. You seem to declare parameters more than once and you need to read about templating a little bit the thing<thingy> thing
3. So you need to do the 1st 2 steps then you can have a question that can actually be answered

I wish these points help you (you'll know they help when you do them)!

Good luck
Hisham
shash likes this.
Hisham is offline   Reply With Quote

Old   June 10, 2012, 05:51
Wink
  #3
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 13
shash is on a distinguished road
hi hisham,

thanks for ur quick reply , i hav already read user guide and hav well enough knowledge of templating , i suppose there is some problem with installation of my compiler as -fpermissive is not enabled (shown in error). i am also attaching my modified code could you please hav a look and suggest the mistake.
my task is to develop velocity profile at inlet v=v0(1+ sin(t)) ;v0 being parabolic f(y).
Attached Files
File Type: h newoscillatingFixedValueFvPatchField.H (5.8 KB, 34 views)
File Type: c newoscillatingFixedValueFvPatchField.C (6.1 KB, 47 views)
shash is offline   Reply With Quote

Old   June 10, 2012, 05:59
Default
  #4
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Why not give the codedFixedValue BC a try. I'll try to look at your BC.

Edit: from the error message and before going into code. You have a object of a class that needs definition of a template. You also have re-declared several variables. The wmake utility makes life much easier (i.e. you do not need to change arguments to your compiler unless you need -pipe to speed compilation for example or you link to some library).
Hisham is offline   Reply With Quote

Old   June 10, 2012, 14:31
Default
  #5
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 13
shash is on a distinguished road
hi hisham,
I think coded bc will work in my case , i have read a blog by you and wrote this code snippet, not sure abt suntax of (ux,0,0)

inlet
{
type codedFixedValue;
value uniform (0 0 0);
redirectType para_osc_bc;
code
#{
fixedValueFvPatchVectorField myPatch (*this);
forAll(myPatch, celli)
{
myPatch[celli] =vector((.1*(1-(this->patch().Cf()[celli](1)*this->patch().Cf()[celli](1)/.01))*(1 + sin(this->db().time().value()))),0,0);
}
operator==(myPatch);
#};
}
shash is offline   Reply With Quote

Old   June 10, 2012, 14:44
Default
  #6
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Quote:
Originally Posted by shash View Post
hi hisham,
I think coded bc will work in my case , i have read a blog by you and wrote this code snippet, not sure abt suntax of (ux,0,0)

inlet
{
type codedFixedValue;
value uniform (0 0 0);
redirectType para_osc_bc;
code
#{
fixedValueFvPatchVectorField myPatch (*this);
forAll(myPatch, celli)
{
myPatch[celli] =vector((.1*(1-(this->patch().Cf()[celli](1)*this->patch().Cf()[celli](1)/.01))*(1 + sin(this->db().time().value()))),0,0);
}
operator==(myPatch);
#};
}
Take notice that: this->patch().Cf()[celli][1] is the y-coordinate of each cell face (@ patch) [0] is x and [2] is z.

To get the sin it is better (I think also necessary) to write it as:
Code:
Foam::sin(this->db().time().value())
The expression reads: Ux = (0.1*(1-Y*Y/0.01)*(1+sin(t)))
if this is what you aim then I guess you have done it or else you may need to define some variable or two to make the code easier to read ... e.g:
Code:
scalar helpVariable(1+Foam::sin(...));
Regards
shash likes this.
Hisham is offline   Reply With Quote

Old   June 10, 2012, 15:45
Default
  #7
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 13
shash is on a distinguished road
hi,
added Foam::sin yet getting this error from it

/home/shash/OpenFOAM/shash-2.1.1/run/pitzDaily/0/U::boundaryField::inlet: In member function ‘virtual void Foam:: para_osc_bcFixedValueFvPatchVectorField::updateCoe ffs()’:
/home/shash/OpenFOAM/shash-2.1.1/run/pitzDaily/0/U::boundaryField::inlet:33:77: error: no match for call to ‘(const Foam::Vector<double>) (int)’
/home/shash/OpenFOAM/shash-2.1.1/run/pitzDaily/0/U::boundaryField::inlet:33:108: error: no match for call to ‘(const Foam::Vector<double>) (int)’
shash is offline   Reply With Quote

Old   June 10, 2012, 16:26
Default
  #8
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Quote:
Originally Posted by shash View Post
hi,
added Foam::sin yet getting this error from it

/home/shash/OpenFOAM/shash-2.1.1/run/pitzDaily/0/U::boundaryField::inlet: In member function ‘virtual void Foam:: para_osc_bcFixedValueFvPatchVectorField::updateCoe ffs()’:
/home/shash/OpenFOAM/shash-2.1.1/run/pitzDaily/0/U::boundaryField::inlet:33:77: error: no match for call to ‘(const Foam::Vector<double>) (int)’
/home/shash/OpenFOAM/shash-2.1.1/run/pitzDaily/0/U::boundaryField::inlet:33:108: error: no match for call to ‘(const Foam::Vector<double>) (int)’
Can you post the U file here
Hisham is offline   Reply With Quote

Old   June 10, 2012, 16:40
Default
  #9
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 13
shash is on a distinguished road
hi hisham,
my U file:

FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
inlet
{
type codedFixedValue;
value uniform (0 0 0); //$internalField;
redirectType awsum_bc;
code
#{
scalar U_0 = 0.1, c = .01 , a = 1, f = 1 ; // Values you need
fixedValueFvPatchField<vector> myPatch (*this);
forAll(myPatch, celli)
{
myPatch[celli] = Foam::vector((U_0*(1- this->patch().Cf()[celli](1) * this->patch().Cf()[celli](1)/c)*(1 + a * Foam::sin(f*this->db().time().value())),0,0);
}
operator==(myPatch);
#};
}


outlet
{
type zeroGradient;
}

upperWall
{
type fixedValue;
value uniform (0 0 0);
}

lowerWall
{
type fixedValue;
value uniform (0 0 0);
}

frontAndBack
{
type empty;
}
}
shash is offline   Reply With Quote

Old   June 10, 2012, 17:03
Default
  #10
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
this->patch().Cf()[celli][1] instead of this->patch().Cf()[celli](1)
shash and granzer like this.
Hisham is offline   Reply With Quote

Old   June 10, 2012, 17:21
Default
  #11
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 13
shash is on a distinguished road
its working finally , THANK YOU HISHAM
shash is offline   Reply With Quote

Old   June 10, 2012, 17:23
Default
  #12
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
You're welcome ... and good luck with your work
Hisham 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
Wind turbine simulation Saturn CFX 58 July 3, 2020 01:13
asking for Boundary condition in FLUENT Destry FLUENT 0 July 27, 2010 00:55
External Radiation Boundary Condition for Grid Interface CFD XUE FLUENT 0 July 9, 2010 02:53
how to set up a wall boundary condition according to calculated wall shear stress? gameoverli OpenFOAM Pre-Processing 1 May 21, 2009 08:28
How to set boundary condition in Fluent for the fo Peiyong FLUENT 1 November 10, 2006 11:44


All times are GMT -4. The time now is 10:46.