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

Help-How to reach the goal in my BC,what's the error?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2009, 03:15
Question Help-How to reach the goal in my BC,what's the error?
  #1
Member
 
jingjing
Join Date: Mar 2009
Location: shanghai,China
Posts: 30
Rep Power: 17
zhajingjing is on a distinguished road

I have to write a new boundary condition derived from the " mixed "type. The goal is to set the velocity at the boundary as follow:
  1. The horizontal velocity gets the value from a function of time or the coordinate XYZ .
  2. The vertical velocity must be made to equal to the value on the cells next to the boundary.How can I reach the goal correctly.
About the first goal:
The following sentences must have some error that I could not found out:

Code:
const labelList patchCells = this->patch().faceCells();
            scalar UMaker(0);
             UMaker=cos(omega_*db().time().value());
            forAll(patchCells,i)
            {
               this->refValue()[i]= vector(UMaker,0.0,0.0);
              this->refGrad()[i] = vector(0.0,0.0,0.0);
              this->valueFraction()[i] = 0.0;
            }
I just set the horizontal velocity to be UMaker, and set the vertical velocity to be zero.Even simple like this ,I still get the following message after "wmake libso" and running a wave tank case.

gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type waveMakerVelocity)
on patch inlet of field U in file "/home/jingjing/OpenFOAM/jingjing-1.5/run/othercases/surfacewaveBC/waveBC2/linearWave/0/U"
You are probably trying to solve for a field with a generic boundary condition.

From function genericFvPatchField<Type>::gradientInternalCoeffs( ) const
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 692.

FOAM exiting

why???

about the second goal:
Can I fetch the vertical velocity on the cells next to the patch like this:

Code:
const tmp< Field<vector> >& refUy=this->patchInternalField();
forAll(patchCells,i)
{
       Uy=refUy()[patchCells[i]].y();
...
then I can change "this->refValue()[i]= vector(UMaker,0.0,0.0); " to "this->refValue()[i]= vector(UMaker,Uy,0.0); "?
If it's not correct.What's the correct expression for the second goal?

Any help will be appreciated!!!


zhajingjing is offline   Reply With Quote

Old   October 13, 2009, 08:01
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by zhajingjing View Post


gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type waveMakerVelocity)
on patch inlet of field U in file "/home/jingjing/OpenFOAM/jingjing-1.5/run/othercases/surfacewaveBC/waveBC2/linearWave/0/U"
You are probably trying to solve for a field with a generic boundary condition.

From function genericFvPatchField<Type>::gradientInternalCoeffs( ) const
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 692.

FOAM exiting

why???
This means that your solver doesn't know the boundary condition. Either you must link it to your solver or load the binary as a plugin (libs in controlDict). If you do that, check that the TypeName-macro is set to the name you're specify in the boundaryField

BTW: another possibility would be to prototype the boundary condition in groovyBC. internalField() would get you the internal values of a field
gschaider is offline   Reply With Quote

Old   October 13, 2009, 10:21
Default There may be other reasons
  #3
Member
 
jingjing
Join Date: Mar 2009
Location: shanghai,China
Posts: 30
Rep Power: 17
zhajingjing is on a distinguished road
Hi gschaider,

I have examined it carefully.About the link problem: after " wmake libso" , my BC became a lib like any other standard BCs in FOAM. In this situation,if the BC has no error, it will be known by the solver. I have implemented other non-standard BC well in this way.So it may be not the link problem but the error from my BC code.
BWT, in my version (1.5), the method "load the binary as a plugin (libs in controlDict)" doesn't work .I don't know why
The typeName in the case file 0/U is as the same as that in my BC code.
So I still don't know why the solver cann't know my BC.-----where is the error in my BC?

maybe for the second goal ,I can use " Uy=internalField()[patchCells[i]].y(); "But that is not the key point.

Thanks for any help!

Last edited by zhajingjing; October 14, 2009 at 04:26.
zhajingjing is offline   Reply With Quote

Old   October 14, 2009, 04:59
Default this is my BC code
  #4
Member
 
jingjing
Join Date: Mar 2009
Location: shanghai,China
Posts: 30
Rep Power: 17
zhajingjing is on a distinguished road
Hello everyone,

the following is my BC and a waveTank case,if you are interested in my problem,you can have a look and try .Thank you

jingjing
Attached Files
File Type: gz waveMakerVelocity.tar.gz (47.3 KB, 2 views)
File Type: gz linearWave.tar.gz (3.8 KB, 1 views)

Last edited by zhajingjing; October 14, 2009 at 10:57.
zhajingjing is offline   Reply With Quote

Old   October 14, 2009, 15:31
Thumbs down a foolish mistake!
  #5
Member
 
jingjing
Join Date: Mar 2009
Location: shanghai,China
Posts: 30
Rep Power: 17
zhajingjing is on a distinguished road
I'm so sorry that I make a foolish mistake-----I forgot to add the BC lib to the solver's makefile and recompile the solver. I used a non-standard BC successfully long time ago,so I forgot the correct way of linking a new BC to a solver.
I apologize for wasting your time.
zhajingjing 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
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 10:31
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50
Compiling problems with hello worldC fw407 OpenFOAM Installation 21 January 6, 2008 18:38
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
user subroutine error CFDUSER CFX 2 December 9, 2006 07:31


All times are GMT -4. The time now is 01:35.