CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Inlet temperature = outlet temperature + offset? (https://www.cfd-online.com/Forums/openfoam-pre-processing/179611-inlet-temperature-outlet-temperature-offset.html)

GerHan November 3, 2016 08:06

Inlet temperature = outlet temperature + offset?
 
Hello OpenFoamers,

i am new to OpenFoam since 2 month. I am simulation a hot waterflow into a big cylinder using the bouyantBoussinesqPimpleFoam solver.

I managed to set up the case and the results are looking good in my opinion. Now to my problem:

My 0/T file looks like:
internalField uniform 20;
boundaryField
{
inlet
{
type fixedValue;
value 80;
}
outlet
{
type zeroGradient;
}
...
}
Now i want to change my constant inlet Temperature while the simulation. I want to check the outlet temperature, add 10 degrees and use the new calculated falue as inlet value until i reached a maximum temperature at the outlet!
I read something about cyclic (e.g. jumpCyclic) conditions?
But in that case my complete inlet flow is "connected" to the outlet, which i didnt really managed to set up.
Is it maybe possible to read the temperature values at the outlet every timestep, add a constant value and use it as inlet temperature?

Thank you in advance for reading my problems !:rolleyes:

GerHan November 4, 2016 09:05

Hello Openfoamers,

i found the groovyBC application and after installing and setting it up i managed to set the temperature from the outlet onto the inlet with my offset:
In 0/T:
...
inlet
{
type groovyBC;
valueExpression "tOutlet+10";
variables "tOutlet{outlet}=T;";
value uniform 293;//=20° C
}
outlet
{
type zeroGradient;
}

In the end it works fine for me.
The only strange thing i cant explain is that the temperature at the inlet is much bigger at the wall than in the middle of the tube.
But after a few iterations the hole inlet face reaches the calculated temperature "tOutlet+10".

Maybe someone knows about this strange behaviour...

Regards

gschaider November 7, 2016 17:14

Quote:

Originally Posted by GerHan (Post 624137)
Hello Openfoamers,

i found the groovyBC application and after installing and setting it up i managed to set the temperature from the outlet onto the inlet with my offset:
In 0/T:
...
inlet
{
type groovyBC;
valueExpression "tOutlet+10";
variables "tOutlet{outlet}=T;";
value uniform 293;//=20° C
}
outlet
{
type zeroGradient;
}

In the end it works fine for me.
The only strange thing i cant explain is that the temperature at the inlet is much bigger at the wall than in the middle of the tube.
But after a few iterations the hole inlet face reaches the calculated temperature "tOutlet+10".

Maybe someone knows about this strange behaviour...

Regards

I'm amazed that this worked in the form here: your inlet and your outlet have the same number of faces, right?

The problem is that the "first" face in the inlet patch and the "first" one in the outlet do not necessarily correspond. Therefor remove variables should usually only have uniform values (swak doesn't enforce this for cases where it actually makes sense). So better values for tOutlet would be (in increasing order of "physicality"):
"tOutlet{outlet}=average(T);"
"tOutlet{outlet}=sum(T*area())/sum(area());"
"tOutlet{outlet}=sum(T*phi)/sum(phi);"

If you need the non-averaged values from the outlets then there is something called mappedPatch and swak can work with that. Have a look at Examples/tests/mapping*

GerHan November 8, 2016 09:33

Thank you very much for your reply gschaider,

Yes my inlet patch and cell formation look the same like on the outlet.
Thanks to your codeline "tOutlet{outlet}=average(T);" i dont get the warning massage anymore which i think is because of the unifrom values like you explained:

-->FOAM Warning :
From Function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 350
The minimum value 293 and the maximum 293 differ. I will use the average 293

But the strange behaviour i mentioned still occurs with both of the first 2 codelines that you posted.
The third one is crashing with an Error.

But i am glad enough that i solved the warning message (and did understand it) and the temperature is constant over the diameter after a few iterations!!

Regards

gschaider November 8, 2016 15:15

Quote:

Originally Posted by GerHan (Post 624678)
Thank you very much for your reply gschaider,

Yes my inlet patch and cell formation look the same like on the outlet.
Thanks to your codeline "tOutlet{outlet}=average(T);" i dont get the warning massage anymore which i think is because of the unifrom values like you explained:

-->FOAM Warning :
From Function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 350
The minimum value 293 and the maximum 293 differ. I will use the average 293

But the strange behaviour i mentioned still occurs with both of the first 2 codelines that you posted.
The third one is crashing with an Error.

But i am glad enough that i solved the warning message (and did understand it) and the temperature is constant over the diameter after a few iterations!!

Regards

Yeah. The third variation (mass flow average) crashes probably because sum(phi) is 0 in the beginning. Something like "tOutlet{outlet}=sum(T*(phi+1e-10))/sum(phi+1e-10);" might fix that

The warning you posted means that swak automatically defaulted to variation 1 all the time.

No idea about the wall (but it might have something to do with your intitial conditions and the wall BC)

GerHan November 14, 2016 06:36

Yes the new third version is running proprely.

But this doesnt fix the bahaviour as well, but for my case its good enough.
thanks a lot for your posts gschaider, it helped me a lot.

Regards


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