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

private boundary condition in controlDict strange behaviour

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 21, 2009, 06:55
Default private boundary condition in controlDict strange behaviour
  #1
Senior Member
 
Mark Couwenberg
Join Date: Mar 2009
Location: Netherlands
Posts: 130
Rep Power: 7
markc is on a distinguished road
Hello All,

I wrote a private boundary condition which I want to use in interFoam-like solvers. Instead of adding the library in the interFoam - options file, I tried to add a line in controlDict:
>>>
libs ("libBoundaryConditions.so");
<<<
This works but when using some utilities, e.g. foamToVTK (and some others as well) the utility fails with an error message like:

>>>
request for uniformDimensionedVectorField g from objectRegistry region0 failed
available objects of type uniformDimensionedVectorField are

0
(
)
<<<
Uncommenting the lib in controlDict makes the utility to work fine. This behavior is not with all utilities, e.g. checkMesh, setFields work fine in all cases.
Adding a private library to a solver without rebuilding is a very nice solution, however in this cases it is a bit inconvenient and I wonder what is going wrong here. Is it a bug or am I doing something wrong?

I attach two folders:
1. waveBCdev, the BC in question (which generates surface waves). Put in user/applications and do: wmake libso
2. waveTank, a testcase. Do: blockMesh, setFields and interFoam. commenting/uncommenting the line in question in controlDict will show the behavior.

Note that the files are intended for OF1.6, however this behavior was already noted in OF1.5.

Any help is appreciated.

Best regards,

Mark
Attached Files
File Type: gz waveBCdev.tar.gz (4.6 KB, 28 views)
File Type: gz waveTank.tar.gz (4.9 KB, 22 views)
markc is offline   Reply With Quote

Old   October 22, 2009, 05:59
Default
  #2
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 11
eugene is on a distinguished road
Hi Markc,

Your problem is the following:

Your new boundary uses the gravity vector "g" which is normally loaded into the object registry from the environmentalProperties dictionary by the top level code. If the top level code does not explicitly load the variable into the database, then it will not be available to the boundary condition. foamToVTK for example does not load environmentalProperties so when the boundary is initialised it cannot find the correct field "uniformDimensionedVectorField g".

Note that the variable is only required when the field the boundary is used for is initialised. Thus setFields and checkMesh do not trigger this error because they do not create the field that uses the boundary.
eugene is offline   Reply With Quote

Old   October 22, 2009, 07:57
Default
  #3
Senior Member
 
Mark Couwenberg
Join Date: Mar 2009
Location: Netherlands
Posts: 130
Rep Power: 7
markc is on a distinguished road
Hello Eugene,

Thanks for taking the time looking at my case. Your answer is perfectly clear. The workaround now seems to be to load a gravity vector in a way which is independant of the object registry. Instead of:
>>>
const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>(" g");
<<<
I will try something like:
>>>
uniformDimensionedVectorField g
(
IOobject
(
"g",
this->db().time().constant(),
this->db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
<<<

Once again thanks for your reply,

Brgds,

Mark
markc is offline   Reply With Quote

Old   October 22, 2009, 08:15
Default
  #4
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 11
eugene is on a distinguished road
Hi Markc,

What you propose is one option, but it would require disk access every timestep, which is costly.

Rather I would suggest you create g as an autoPtr<uniformDimensionedVectorField> and then initialise it with the lookup version if available. If g does not exist in the database, you could either read it from file or just ignore it, print a warning and not update the boundary values.
eugene is offline   Reply With Quote

Old   June 23, 2010, 04:53
Default
  #5
Senior Member
 
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 6
Rickard.Solsjo is on a distinguished road
I realize it was a long time ago since you started this thread.
I have the same problem with the uniform.......field g. If it is not loaded by the enviromentalproperties how do you fix it? Im using rhoPisoFoam and I copied the enviromentalproperties file from another and put it into the constant folder.
Do I add some line in the fvSchemes, Solution, controlDict or similar ?

Tx
R
Rickard.Solsjo is offline   Reply With Quote

Old   April 4, 2011, 10:01
Default
  #6
Member
 
Samuel ARNAUD
Join Date: Feb 2011
Location: Grenoble, FRANCE
Posts: 39
Rep Power: 5
sixwp is on a distinguished road
Hi Rickard,

I had exactly the same problem (with icoFoam but anyway, still). I just managed to solve it.

In my case, the BC were the problems. For, p I had buoyantPressure BC for a wall and it wasn't fitted for icoFoam (with a zeroGradient, it's fine).
I will suggest to have a look at your BC, carefully!

Hope that can help you
__________________
Sam
sixwp is offline   Reply With Quote

Old   April 5, 2011, 03:51
Default
  #7
Senior Member
 
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 6
Rickard.Solsjo is on a distinguished road
Thx for the reply!
But I fixed my problem some 8months ago =)
Rickard.Solsjo is offline   Reply With Quote

Old   April 5, 2011, 03:58
Default
  #8
Member
 
Samuel ARNAUD
Join Date: Feb 2011
Location: Grenoble, FRANCE
Posts: 39
Rep Power: 5
sixwp is on a distinguished road
Yeah I realised your message was old after writing the reply ^^
Anyway, that may help someone else :-)
__________________
Sam
sixwp is offline   Reply With Quote

Old   June 30, 2011, 05:33
Default
  #9
New Member
 
Juanito
Join Date: Oct 2010
Posts: 27
Rep Power: 6
Aerospace is on a distinguished road
Quote:
Originally Posted by Rickard.Solsjo View Post
Thx for the reply!
But I fixed my problem some 8months ago =)
Hi Rickard,

I'm doing a heatTransfer problem and I have the same error using the new version, OF 2.0. Could you tell me how do you solve the problem in your case without change the BCs?

Best regards.
Aerospace is offline   Reply With Quote

Old   June 30, 2011, 05:49
Default
  #10
Senior Member
 
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 6
Rickard.Solsjo is on a distinguished road
Hey
Can you upload the case?
Rickard.Solsjo is offline   Reply With Quote

Old   November 10, 2011, 12:38
Default
  #11
New Member
 
Juanito
Join Date: Oct 2010
Posts: 27
Rep Power: 6
Aerospace is on a distinguished road
Quote:
Originally Posted by Rickard.Solsjo View Post
Hey
Can you upload the case?

I'm sorry i dind't see your post. I'm trying to employ decomposePar with uniformDensityHidrostaticPressure as BC for p_rgh (buoyantBoussinesqSimpleFoam solver) but this error message appears:

request for uniformDimensionedVectorField g from objectRegistry region0 failed
available objects of type uniformDimensionedVectorField are

0
(
)

Do you know how to fix it?

Thankyou very much!!
Aerospace is offline   Reply With Quote

Old   November 18, 2011, 15:59
Default
  #12
New Member
 
aero company
Join Date: Nov 2011
Posts: 1
Rep Power: 0
mkh_sakr is on a distinguished road
hi,
i try to use uniformDensityHydrostaticPressure with simpleFoam and I face the same problem (uniformDimensionVectorField g is not included )how can i solve it
mkh_sakr is offline   Reply With Quote

Old   November 23, 2011, 11:18
Default
  #13
New Member
 
Juanito
Join Date: Oct 2010
Posts: 27
Rep Power: 6
Aerospace is on a distinguished road
Quote:
Originally Posted by mkh_sakr View Post
hi,
i try to use uniformDensityHydrostaticPressure with simpleFoam and I face the same problem (uniformDimensionVectorField g is not included )how can i solve it
I solved it employing the buoyantPressure BC at the outler, it works like the uniformDensityHydrostaticPressure for buoyant solve.

If your are working with a solver which doesn't employ bouyancy the uniformDensityHydrostaticPressure is not needed.

Regards
Aerospace 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
Axis Boundary Condition..what is it? CFDtoy FLUENT 6 February 13, 2007 06:51
How to set boundary condition in Fluent for the fo Peiyong FLUENT 1 November 10, 2006 12:44
Help Urgent about changing boundary condition Anjum Naveed FLUENT 7 August 14, 2006 13:25
1 and 2 Order Boundary condition at the same place CFD_Flo Main CFD Forum 4 July 11, 2005 12:57
How to resolve boundary condition problem? sam FLUENT 2 July 20, 2003 03:19


All times are GMT -4. The time now is 20:44.