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

Boundary condition

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

Like Tree7Likes
  • 1 Post By BarCFD
  • 1 Post By MSF
  • 1 Post By babakflame
  • 2 Post By babakflame
  • 2 Post By Zhiheng Wang

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 20, 2017, 16:22
Default Boundary condition
  #1
New Member
 
Join Date: Jun 2017
Posts: 11
Rep Power: 8
BarCFD is on a distinguished road
Hello FOAMers,

I want to impose a boundary condition which is an exponential function of the Field. Lets assume that I want to solve Laplace equation for temperature (thermal diffusion in solid). How can I have following boundary conditions?
Attached Images
File Type: jpg Untitled.jpg (12.5 KB, 101 views)
Kummi likes this.
BarCFD is offline   Reply With Quote

Old   September 21, 2017, 04:35
Default
  #2
MSF
New Member
 
Join Date: Apr 2014
Location: Germany
Posts: 24
Rep Power: 11
MSF is on a distinguished road
Hi,

I think the easiest way would be groovyBC.

https://openfoamwiki.net/index.php/Contrib/groovyBC

Best,
Moritz
Kummi likes this.
MSF is offline   Reply With Quote

Old   September 21, 2017, 08:12
Default
  #3
Member
 
Join Date: Feb 2016
Posts: 41
Rep Power: 10
LeeRuns is on a distinguished road
Couldn't we just add this to the openfoam build

Sent from my SM-G930V using CFD Online Forum mobile app
LeeRuns is offline   Reply With Quote

Old   September 21, 2017, 20:59
Default
  #4
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15
babakflame is on a distinguished road
This a robin type boundary condition in OpenFOAM.

Search a little bit before asking. Here is the link:

http://www.modlab.lv/docs/2011/OpenF...Vilums_pdf.pdf

How to write exponential in boundary condition plus laplace samples see these threads:

codedFixedValue boundary condition

source term modification in poisson equation does not affect results
Kummi likes this.
babakflame is offline   Reply With Quote

Old   September 25, 2017, 15:09
Default
  #5
New Member
 
Join Date: Jun 2017
Posts: 11
Rep Power: 8
BarCFD is on a distinguished road
Quote:
Originally Posted by MSF View Post
Hi,

I think the easiest way would be groovyBC.

https://openfoamwiki.net/index.php/Contrib/groovyBC

Best,
Moritz

Thanks Moritz,

I tired groovyBC. It works for easier robin type boundary condition such as :
k*grad(n,T)+alpha*(T-Tinf)=0;
However, for my case I have an exponential function and groovy cannot find the root.
BarCFD is offline   Reply With Quote

Old   September 25, 2017, 15:17
Default
  #6
New Member
 
Join Date: Jun 2017
Posts: 11
Rep Power: 8
BarCFD is on a distinguished road
Quote:
Originally Posted by babakflame View Post
This a robin type boundary condition in OpenFOAM.

Search a little bit before asking. Here is the link:

http://www.modlab.lv/docs/2011/OpenF...Vilums_pdf.pdf

How to write exponential in boundary condition plus laplace samples see these threads:

codedFixedValue boundary condition

source term modification in poisson equation does not affect results

Thanks bobi,

First example is an ordinary robin boundary condition which is possible by groovy. I have already tried this one.

Last link was about source term in Laplace equation. I could not find the application for my case as boundary condition.

However, I think I should try codedFixedValue to extract internalField and to find root of boundary equation -[ k*grad(n,T)+exp(alpha*(T-Tinf)) ]- iteratively. Thanks for your help.
BarCFD is offline   Reply With Quote

Old   September 26, 2017, 14:25
Default
  #7
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15
babakflame is on a distinguished road
I have written another sample for Robin Type boundary condition without Groovy. Just using the basics of c++ and OpenFoam.

Find it here:

Snippet for redefining fixedGradient boundary condition for a patch inside solver
Zhiheng Wang and BarCFD like this.
babakflame is offline   Reply With Quote

Old   September 27, 2017, 18:26
Default
  #8
Member
 
Zhiheng Wang
Join Date: Mar 2016
Posts: 72
Rep Power: 9
Zhiheng Wang is on a distinguished road
Quote:
Originally Posted by babakflame View Post
I have written another sample for Robin Type boundary condition without Groovy. Just using the basics of c++ and OpenFoam.

Find it here:

Snippet for redefining fixedGradient boundary condition for a patch inside solver
[QUOTE=babakflame;665758]I have written another sample for Robin Type boundary condition without Groovy. Just using the basics of c++ and OpenFoam.

Wiith All regards to bobi aka babakFlame for excellent and nice explanation

i can Just add few lines

scalarField GradT = T.boundaryFieldRef()[patchID].snGrad();
scalarField Tpatch = T.boundaryFieldRef()[patchID];
forAll(GradT,I)
{
scalar CONV = kappa*GradT[I] - Foam::exp(alpha*(Tpatch - Tinf));

}
if it is iterative bc you can add scalar CONVERGE = kappa*GradT[I] - Foam::exp(alpha*(Tpatch - Tinf)); with convergence 10-4 or 10-3 some thing under while loop which will give you Tnew for equation
But what is need of k*dT/dn if delta T = 0 at upper domain ???? what you want to find out ????
Here kappa and alpha are assumed to be const for variable add
volScalarField& Kapp = thermo.kappa(); use Kappa.boundaryfieldRef()[patchID][faceI] in code or reference it in scalarField as previously done for GradT and Tpatch
with thermo as basicThermo or psiReactingThermo object.
But Here kdT/dn doent have units same as exp(alpha(T-Tinf)) what you want to find Heat Flux or Temperature satisfies the condition ??
Kummi and BarCFD like this.
Zhiheng Wang is offline   Reply With Quote

Old   September 29, 2017, 16:57
Default
  #9
New Member
 
Join Date: Jun 2017
Posts: 11
Rep Power: 8
BarCFD is on a distinguished road
[QUOTE=Zhiheng Wang;665901][QUOTE=babakflame;665758]

Thanks a lot Zhiheng!

Actually I have made an example here. My goal was to find the way to impose boundary condition which is a function of Field (exponential func). My Field in fact is not Temperate. I as solving potential field and boundary condition is local current density which linked to potential by Bulter-Volmer equation.

Thanks again for your comments and your concern
BarCFD is offline   Reply With Quote

Reply

Tags
boundaries condition, groovybc, laplacianfoam

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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Centrifugal fan j0hnny CFX 13 October 1, 2019 14:55
Accessing multiple boundary patches from a custom boundary condition file ripudaman OpenFOAM Programming & Development 0 October 22, 2014 19:34
Radiation interface hinca CFX 15 January 26, 2014 18:11
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44


All times are GMT -4. The time now is 06:14.