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

Addition of a New boundry Condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 10, 2009, 10:54
Default Addition of a New boundry Condition
  #1
New Member
 
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17
ubaid is on a distinguished road
Hi friends,

I want to introduce a new condition in the file which has the following link.

src/finiteVolum/fileds/fvPatchFields/derived/oscillatingFixedValue

if you go to the file

OscillatinFixedValueFvPatchField.c

you will see that it calculates the frequency value by the following formula

1.0 + amplitude_*
sin(2*mathematicalConstant:i*frequency_*this->db().time().value());
actually i want to introduce the angle theta as a phase angle into the above formula,

I am new into C++, could you guys give me tips how could i proceed it.

Thanks a lot.

Regards
ubaid is offline   Reply With Quote

Old   April 22, 2009, 06:42
Default
  #2
bfa
Member
 
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17
bfa is on a distinguished road
Quote:
Originally Posted by ubaid View Post

1.0 + amplitude_*
sin(2*mathematicalConstant:i*frequency_*this->db().time().value());

actually i want to introduce the angle theta as a phase angle into the above formula,

If your theta is just a phase shift, simply add it inside the sin() function:
Code:
         sin(theta+2*mathematicalConstant::Pi*frequency_*this->db().time().value());
If theta is constant throughout your computation you could add it to the dictionary and read it from there like it is done with the amplitude and frequency variables (see the constructor of oscillatingFixedValueFvPatchField starting in line 81 of the source file). Of course you need to provide storage for a scalar in oscillatingFixedValueFvPatchField.H.
Just take a look at amplitude_ and copy it's behaviour, just changing the name of the variable to theta_ for example.

Have fun,
Bjoern

PS: To get the hang of C++, I recommend the book "The C++ Programming Language" by Bjarne Stroustrup. Or check out the great tutorial at http://www.cplusplus.com/doc/tutorial/
bfa is offline   Reply With Quote

Old   April 22, 2009, 13:06
Default Boundry Condition
  #3
New Member
 
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17
ubaid is on a distinguished road
Dear bfg,

I did it the same way, as you have mentioned. after doing these changes. I wrote the "wmake libso" command in the directory of the finitevolume, and the compiler has created the .so file, and at last i also compiled the rhoTurbFoam file.

But when i used the rhoTurbFoam to solve my case, it created two more folders named 0.200 and 0.400 (according to the times).

In my 0.00 folder, i have added another term that is "angle" after frequency in the U file, but i didnt get the term "angle" in the U file in the folder 0.200.

there is no error, but on execution, the compiler, is not giving the output. I dont know whats the problem. May be I am doing a simple mistake that I cannot find it out.

Please help me out. Actually, this is my semester project and it is taking too much time now.

Thanks a lot for co-operation.

Best Regards,
ubaid is offline   Reply With Quote

Old   July 24, 2009, 15:00
Default
  #4
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17
isabel is on a distinguished road
Sorry for bother you. Do you know how to correct my error?
My code is:

forAll(levelSet,gI)
{
if (levelSet[gI] > 0.0002 )
H[gI] = 1;
else
{
if (levelSet[gI] < 0.0002 )
H[gI] = 0;
else
H[gI] = sin(levelSet[gI]);
}
}


And when I compile, I have this error in the line " H[gI] = sin(levelSet[gI]) " :

levelSetEqn.H:91: error: call of overloaded ‘sin(double&)’ is ambiguous
isabel is offline   Reply With Quote

Old   July 24, 2009, 15:11
Default
  #5
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Wernigerode, Sachsen-Anhalt, Germany
Posts: 281
Rep Power: 18
henrik is on a distinguished road
Isabel,

try

Foam::sin(levelSet[gI])

Henrik

henrik is offline   Reply With Quote

Old   July 24, 2009, 15:19
Default
  #6
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17
isabel is on a distinguished road
Thank you very much, Henrik
Now it works.
isabel 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
unsteady state inlet boundry condition shubham FLUENT 3 March 1, 2009 09:34
boundry condition problem kamal FLUENT 3 June 18, 2008 03:35
How to model a different boundry condition prateek jain CFX 2 May 24, 2007 07:43
wall boundry condition fred FLUENT 0 August 19, 2004 13:10
Temperature rise at a boundry condition Rodrigo FLUENT 5 August 3, 2001 11:04


All times are GMT -4. The time now is 00:03.