|
[Sponsors] |
Change of boundary conditions during run time |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 17, 2011, 10:38 |
Change of boundary conditions during run time
|
#1 |
New Member
Alexander Sakowitz
Join Date: Jan 2011
Posts: 1
Rep Power: 0 |
I would like to simulate the flow in an engine with valves opening and closing. In order to do this I would like to set a zero gradient condition for the velocity, if the valve is open and a fixedValue condition (value =0) if the valve is closed. Has someone done this before or do you have some recommendations how to start with this problem?
|
|
January 17, 2011, 12:05 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
valve { type groovyBC; valueExpression "vector(0,0,0)"; gradientExpression "vector(0,0,0)"; // not strictly necessary. Default fractionExpression "sin(time())>0 ? 1 : 0"; } That opens closes the valve with a frequency of 1/2pi Bernhard Last edited by gschaider; January 17, 2011 at 15:33. Reason: Defined valueExpression twice |
||
January 17, 2011, 14:18 |
|
#3 |
Senior Member
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19 |
Hi Bernhard,
First of all, I'm a big fan of groovyBC. I have a similar question: What if I had 2 (or more) conditions that had to be met before changing the boundary condition? Just as an example, time and say, max(Temperature). In my solver, I'd like to set a flag that captures this condition: Code:
scalar switchBC = 0; if (time >= someValue1 || max(temp) >= someValue2) { switchBC = 1; } else { switchBC = 0; } Code:
valve { type groovyBC; valueExpression "vector(0,0,0)"; gradientExpression "vector(0,0,0)"; // not strictly necessary. Default valueExpression "switchBC>0 ? 1 : 0"; } |
|
January 17, 2011, 15:32 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
valve { type groovyBC; variables "switchBC=time >= someValue1 || max(temp) >= someValue2;"; valueExpression "vector(0,0,0)"; gradientExpression "vector(0,0,0)"; // not strictly necessary. Default fractionExpression "switchBC>0 ? 1 : 0"; } The other interpretation (that is not based on the code but on your text) would be that once switchBC changed its value to 1 it would stay one (even if the temperature drops afterwards and the threshold time is not yet used). Such a memory variable is not yet possible in groovyBC (a work-around may be possible using the expressionField-functionObject in swak but I'm not 100% sure). If a bugReport/featureRequest shows up in the swak4Foam-Mantis (feature additions like this will not be done in the "pure" groovyBC anymore) I will think about a way to implement it (no promises) Bernhard |
||
January 17, 2011, 16:09 |
|
#5 |
Senior Member
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19 |
Ah, ok, thanks. I see how it can be done now.
I guess my example was a bit ambiguous but what I was trying to ask is if there's any way for groovyBC to access a memory variable (like an int) which is set in the solver. |
|
April 12, 2014, 02:23 |
|
#6 |
New Member
Laurien Vandewalle
Join Date: Jun 2013
Location: Ghent, Belgium
Posts: 29
Rep Power: 13 |
Hi,
I was wondering if it is possible to change the gradient of a fixedGradient boundary field in a solver/utility. More specifically, I am simulating a pipe flow with a constant heat flux imposed at the wall. When the simulation is complete, I use a self-written utility myMoveMesh that calculates a certain wall displacement and subsequently moves the wall radially inwards. In this way the diameter/area of the pipe decreases and hence, the gradient of the temperature at the wall needs to change. When the new mesh is written, I want to restart the simulation with the new pipe dimensions. Therefore, I need to read the new boundary condition from the T-file in a time folder. What I want to do is calculate the new gradient in the myMoveMesh utility, assign this somehow to the wall boundary and than have this new gradient written in the boundaryField of the T-file after calling T.write(). Is there a way to do this? Kind regards, Laurien |
|
Tags |
boundary conditions, transient |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Residence Time Distribution with Periodic Boundary Conditions | sanjose | FLUENT | 1 | September 7, 2016 05:13 |
non reflective boundary conditions for incompresible flow | Pascal_doran | OpenFOAM Programming & Development | 16 | August 25, 2015 06:35 |
CFX doesn't continue calculation... | mactech001 | CFX | 6 | November 15, 2009 22:25 |
Convective Heat Transfer - Heat Exchanger | Mark | CFX | 6 | November 15, 2004 16:55 |
A problem about setting boundary conditions | lyang | Main CFD Forum | 0 | September 19, 1999 19:29 |