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

define a new boundary condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 24, 2012, 08:44
Default define a new boundary condition
  #1
New Member
 
Maosong Cheng
Join Date: Aug 2012
Posts: 19
Rep Power: 13
mscheng is on a distinguished road
Hi FOAMers,

I want to implement a new boundary condition : Tinlet=(averaged Toutlet)*lambda, where lambda is constant. so how to implement it.
mscheng is offline   Reply With Quote

Old   December 30, 2012, 12:54
Default
  #2
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
You need to implement fixedValue B.C., (create derived class, like lambdaTInletFvPatchScalarField for example). Then in method lambdaTInletFvPatchScalarField::updateCoeffs() You must implement something like that

//init some intermediate variables
.........
.........

const volScalarField& T = mesh.lookupObject<volScalarField>("T");
outPatchId = mesh.boundaryMesh().findPatchID("outlet");

scalar ToutAv = gSum(T.boundaryField()[outPatchId]*mesh.magSf().boundaryField()[outPatchId]) /
gSum(mesh.magSf().boundaryField()[outPatchId]);

scalarField Tinlet (this->size(), ToutAv*lambda_);

operator == (Tinle);

fixedValueFvPatchField<scalar>::updateCoeffs();

This B.C. must be implemented in a new dynamic library, which You can link to solver in file fvSolution/controlDict
mkraposhin is offline   Reply With Quote

Old   January 5, 2013, 18:46
Default
  #3
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 mscheng View Post
Hi FOAMers,

I want to implement a new boundary condition : Tinlet=(averaged Toutlet)*lambda, where lambda is constant. so how to implement it.
I personally would recommend groovyBC for this. Assuming your outlet-patch is named outlet something like

Code:
variables (
  "Tout{outlet}=average(T);"
  "lambda=0.5;"
);
valueExpression "lambda*Tout";
would do the trick
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider 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
Radiation interface hinca CFX 15 January 26, 2014 17:11
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
how to define two inlet boundary condition at the different time nuengao FLUENT 0 December 13, 2010 02:42
External Radiation Boundary Condition for Grid Interface CFD XUE FLUENT 0 July 9, 2010 02:53
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 12:24


All times are GMT -4. The time now is 22:27.