CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

OF/groovyBC: 2nd derivative or power BC

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2013, 03:24
Default OF/groovyBC: 2nd derivative or power BC
  #1
Member
 
Join Date: Nov 2012
Posts: 58
Rep Power: 13
startingWithCFD is on a distinguished road
It recently occurred to me that I have no idea how to impose a BC of the following two sorts:
i) d^2 (X) / dn^2 = 0
ii) d(X) / dn = X^2
Even though they appear rarely, they are used in the literature.
Is there a way to impose them natively in OF or in groovyBC?
startingWithCFD is offline   Reply With Quote

Old   June 23, 2013, 05:25
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 startingWithCFD View Post
It recently occurred to me that I have no idea how to impose a BC of the following two sorts:
i) d^2 (X) / dn^2 = 0
ii) d(X) / dn = X^2
Even though they appear rarely, they are used in the literature.
Is there a way to impose them natively in OF or in groovyBC?
Second derivative: groovyBC is based on the kind of boundary conditions OpenFOAM can impose and I'm not aware of a boundary condition that allows that directly

Power: that is easy: the "pow(X,2)". Although that is "only" explicit as it uses the current value of X to set a gradient for the "next" X
__________________
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

Old   June 23, 2013, 06:21
Default
  #3
Member
 
Join Date: Nov 2012
Posts: 58
Rep Power: 13
startingWithCFD is on a distinguished road
Thanks! I should have imagined the second one, seems obvious now.
startingWithCFD is offline   Reply With Quote

Old   October 3, 2013, 06:55
Default
  #4
Member
 
Join Date: Jun 2011
Posts: 80
Rep Power: 14
maalan is on a distinguished road
Quote:
Second derivative: groovyBC is based on the kind of boundary conditions OpenFOAM can impose and I'm not aware of a boundary condition that allows that directly
Hi there, Bernhard!!

I was wondering if implementing a convective bc like this:
dU/dt + Un*dU/dn = 0,
is possible by using groovy bc.

Could you help me??

Thanks in advance!!
Best,
maalan is offline   Reply With Quote

Old   October 3, 2013, 08:44
Default
  #5
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 maalan View Post
Hi there, Bernhard!!

I was wondering if implementing a convective bc like this:
dU/dt + Un*dU/dn = 0,
is possible by using groovy bc.

Could you help me??

Thanks in advance!!
Best,
basically you want dU/dn (which is the definition of OF for "gradient on the boundary") as a function of the current U and dU/dt. The problem is the dU/dt. you CAN get the U from the last timestep with oldTime(U) and thus calculate it as "(U-oldTime(U))/deltaT()" but I think that during the first iteration U will be oldTime(U) (so if you have only one iteration during the time-loop the expression will degenerate to a zeroGradient. And even with more than one iteration you might get oscillations).
Also does the behaviour of oldTime depend on the solver storing the last time-step value.

You'll have to experiment
__________________
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

Old   September 18, 2014, 18:44
Default
  #6
Member
 
Join Date: Jun 2011
Posts: 80
Rep Power: 14
maalan is on a distinguished road
Quote:
basically you want dU/dn (which is the definition of OF for "gradient on the boundary") as a function of the current U and dU/dt. The problem is the dU/dt. you CAN get the U from the last timestep with oldTime(U) and thus calculate it as "(U-oldTime(U))/deltaT()" but I think that during the first iteration U will be oldTime(U) (so if you have only one iteration during the time-loop the expression will degenerate to a zeroGradient. And even with more than one iteration you might get oscillations).
Also does the behaviour of oldTime depend on the solver storing the last time-step value.

You'll have to experiment
Hi Bernhard!

This is what I have tried but my code blows up at the 3rd time step:

type groovyBC;
refValue uniform (1 0 0);
refGradient uniform (1 0 0);
valueFraction uniform 0;
value uniform (1 0 0);
gradientExpression "-(U-oldTime(U))/deltaT()";
fractionExpression "0";

Would you know what is wrong?? It is supposed that gradientExpression calculates the field derivative normal to the domain...

Thank you!
Best!
maalan is offline   Reply With Quote

Old   September 23, 2014, 13:45
Default
  #7
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 maalan View Post
Hi Bernhard!

This is what I have tried but my code blows up at the 3rd time step:

type groovyBC;
refValue uniform (1 0 0);
refGradient uniform (1 0 0);
valueFraction uniform 0;
value uniform (1 0 0);
gradientExpression "-(U-oldTime(U))/deltaT()";
fractionExpression "0";

Would you know what is wrong?? It is supposed that gradientExpression calculates the field derivative normal to the domain...

Thank you!
Best!
"normal to the domain": you mean "normal to the domain BOUNDARY", right? That is exactly what gradientExpression does

The problem is not groovyBC per se (it gets to the 3rd timestep) but the physics or the implementation of it. My time is limited and I limit myself to problems with swak itself.

Just some hints: check the sign, try under-relaxation, but first write out all timesteps (its only three after all) and try to figure out what goes wrong (my guess is: the BC leads to oszillations because of overcorrection)
Bana likes this.
__________________
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

Old   February 24, 2015, 12:26
Default
  #8
New Member
 
Bruno
Join Date: Oct 2014
Posts: 2
Rep Power: 0
brunotessa is on a distinguished road
Hello maalan! Have you managed to make the BC work? I've tryied the one that you wrote and my code also blows up on the third time step!

I'm new to OF so I have no ideia how to fix it

Thank you
brunotessa 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
2nd derivative in UDS Andrew Garrard FLUENT 9 September 21, 2015 09:15
Boundary condition involving 2nd derivative of U maka OpenFOAM Pre-Processing 1 November 8, 2007 15:04
2nd order derivative calculation at the boundaries Vishal FLUENT 0 May 25, 2006 06:54
Multicomponent fluid Andrea CFX 2 October 11, 2004 05:12
2nd derivative on nonorthogonal FV-mesh Thomas Wolfanger Main CFD Forum 1 June 29, 1999 11:00


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