CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] time-dependent inletOutlet with groovyBC? (https://www.cfd-online.com/Forums/openfoam-community-contributions/125693-time-dependent-inletoutlet-groovybc.html)

letzel October 29, 2013 09:44

time-dependent inletOutlet with groovyBC?
 
Dear Foamers,

given a measured time series of patch-normal velocity Un, is it possible with groovyBC and timelines or lookuptables to set time-dependent inletOutlet boundary conditions on that patch?
I want to set up the following scenario:
  • in case of inflow (say Un >= 0), set inflow boundary condition (value of Un uniform over patch),
  • in case of outflow (say Un < 0), set zeroGradient pressure boundary condition.
Regards,
Marcus

gschaider October 29, 2013 12:08

Quote:

Originally Posted by letzel (Post 459654)
Dear Foamers,

given a measured time series of patch-normal velocity Un, is it possible with groovyBC and timelines or lookuptables to set time-dependent inletOutlet boundary conditions on that patch?
I want to set up the following scenario:
  • in case of inflow (say Un >= 0), set inflow boundary condition (value of Un uniform over patch),
  • in case of outflow (say Un < 0), set zeroGradient pressure boundary condition.
Regards,
Marcus

Yep. Assuming you have a timeline Un defined
Code:

valueExpression "-normal()*Un";
fractionExpression "Un<0 ? 0 : 1";


letzel October 30, 2013 03:37

Quote:

Originally Posted by gschaider (Post 459687)
Yep. Assuming you have a timeline Un defined
Code:

valueExpression "-normal()*Un";
fractionExpression "Un<0 ? 0 : 1";


Excellent. That means the U boundary condition on that patch is done.

Follow-up question: How do I have to set the corresponding pressure boundary condition on that patch? I would expect that a similar case distinction depending on the sign of Un needs to be implemented for p.

gschaider October 30, 2013 06:18

Quote:

Originally Posted by letzel (Post 459788)
Excellent. That means the U boundary condition on that patch is done.

Follow-up question: How do I have to set the corresponding pressure boundary condition on that patch? I would expect that a similar case distinction depending on the sign of Un needs to be implemented for p.

That depends on your physics. But any switching here can be done in a similar fashion (of course you can use Un inside a pressure condition as well)

letzel November 4, 2013 12:43

Sorry, the description of my scenario given above was not precise. Let me try to clarify. Basically I am planning to mimick "inletOutlet", the patch field type derived from mixed (table 5.4 in OF 2.2.2 user guide) using the patch-normal velocity component Un:
  • in case of inflow (Un >= 0),
    • for pressure use zeroGradient, and
    • for U use valueExpression "-normal()*Un"
  • in case of outflow (Un < 0),
    • for pressure use fixedValue, and
    • for U use zeroGradient.
My question is how to implement this pressure boundary condition with the help of fractionExpression "Un<0 ? 0 : 1" or
fractionExpression "Un<0 ? 1 : 0".

Whether or not this pressure boundary condition will work well in this case, this will be the next question...

gschaider November 4, 2013 20:08

Quote:

Originally Posted by letzel (Post 460495)
Sorry, the description of my scenario given above was not precise. Let me try to clarify. Basically I am planning to mimick "inletOutlet", the patch field type derived from mixed (table 5.4 in OF 2.2.2 user guide) using the patch-normal velocity component Un:
  • in case of inflow (Un >= 0),
    • for pressure use zeroGradient, and
    • for U use valueExpression "-normal()*Un"
  • in case of outflow (Un < 0),
    • for pressure use fixedValue, and
    • for U use zeroGradient.
My question is how to implement this pressure boundary condition with the help of fractionExpression "Un<0 ? 0 : 1" or
fractionExpression "Un<0 ? 1 : 0".

Whether or not this pressure boundary condition will work well in this case, this will be the next question...

I'd say the second one. I'm not quite sure what your problem is: the meaning of the ?:-operator or fractionExpression. Because if you understand these two it should be quite clear

letzel December 10, 2013 09:47

Thank you, Bernhard, the second one worked out fine.

As a follow-up question, I should now compare this with a conditional totalPressure boundary condition in case of outflow as follows:
  • in case of inflow (Un >= 0),
    • for pressure use zeroGradient, and
    • for U use valueExpression "-normal()*Un"
  • in case of outflow (Un < 0),
    • for pressure use totalPressure, and
    • for U use zeroGradient.
Does the groovyBC syntax allow for this? If so, how?

gschaider December 11, 2013 16:08

Quote:

Originally Posted by letzel (Post 465708)
Thank you, Bernhard, the second one worked out fine.

As a follow-up question, I should now compare this with a conditional totalPressure boundary condition in case of outflow as follows:
  • in case of inflow (Un >= 0),
    • for pressure use zeroGradient, and
    • for U use valueExpression "-normal()*Un"
  • in case of outflow (Un < 0),
    • for pressure use totalPressure, and
    • for U use zeroGradient.
Does the groovyBC syntax allow for this? If so, how?

U we've already got covered I think.

p shouldn't be a big problem either. The catch is that you've got to specify the total pressure as an expression. You can't use the readymade BC


All times are GMT -4. The time now is 16:23.