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

Vary inlet velocity based on temperature

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 12, 2024, 16:35
Default Vary inlet velocity based on temperature
  #1
New Member
 
Join Date: Feb 2024
Posts: 5
Rep Power: 2
delMonster is on a distinguished road
Hi everyone, I'd much appreciate some advice / guidance. I've used codedMixed quite a lot to vary boundary conditions based on time. I was hoping someone has perhaps varied inlet velocity based on a temperature located at a predefined location in the system volume and could perhaps share how they achieved this. Alternatively anyone knowledgeable that would be so kind as to point me in the right direction. Thanks
delMonster is offline   Reply With Quote

Old   March 13, 2024, 03:32
Default
  #2
Senior Member
 
Join Date: Dec 2021
Posts: 207
Rep Power: 5
Alczem is on a distinguished road
Hey!


I think inputValueMapper can probably achieve what you do. Here is an example by Tobias Holzmann:



https://www.linkedin.com/pulse/new-f...obias-holzmann


I tried to use it several times, but I find it very confusing you basically need a functionObjet that stores some quantities that inputValueMapper can then read and use.


Also, I could not make it work with precompiled OpenFoam for Windows (v2212). I had to recompile OpenFoam with slight modifications (cant remember what, but a thread was discussing this) and run my tests on Linux. Maybe it was fixed though.



If you manage to make it work, please share the setup, I am curious to see more examples of this feature that could be really useful!


EDIT:


This thread shows the changes to the code, but it was because of one specific boundary condition. Other boundary conditions worked even with precompiled OpenFoam.
Alczem is offline   Reply With Quote

Old   March 13, 2024, 03:39
Default
  #3
New Member
 
Join Date: Feb 2024
Posts: 5
Rep Power: 2
delMonster is on a distinguished road
Quote:
Originally Posted by Alczem View Post
Hey!


I think inputValueMapper can probably achieve what you do. Here is an example by Tobias Holzmann:



https://www.linkedin.com/pulse/new-f...obias-holzmann


I tried to use it several times, but I find it very confusing you basically need a functionObjet that stores some quantities that inputValueMapper can then read and use.


Also, I could not make it work with precompiled OpenFoam for Windows (v2212). I had to recompile OpenFoam with slight modifications (cant remember what, but a thread was discussing this) and run my tests on Linux. Maybe it was fixed though.



If you manage to make it work, please share the setup, I am curious to see more examples of this feature that could be really useful!


EDIT:


This thread shows the changes to the code.

Thanks, really appreciate that. I'm on wsl at the moment. I'll definitely share if I can get it to work.
delMonster is offline   Reply With Quote

Old   March 13, 2024, 06:01
Default
  #4
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
This can be easily done by codedFixedValue. A template can be seen as:


inlet
{
type codedFixedValue;
value uniform (10 0 0);
name linearTBC1;
code
#{
const fvMesh& mesh = this->patch().boundaryMesh().mesh();
volVectorField& U = mesh.lookupObjectRef<volVectorField>("U");
#};
}

What you need is just access your field (U in the above code, T for your code) in the boundary condition.
__________________
My OpenFOAM algorithm website: http://dyfluid.com
By far the largest Chinese CFD-based forum: http://www.cfd-china.com/category/6/openfoam
We provide lots of clusters to Chinese customers, and we are considering to do business overseas: http://dyfluid.com/DMCmodel.html
sharonyue is offline   Reply With Quote

Old   March 13, 2024, 07:52
Default
  #5
New Member
 
Join Date: Feb 2024
Posts: 5
Rep Power: 2
delMonster is on a distinguished road
Thanks, I'll give that a try! Much appreciated.
delMonster is offline   Reply With Quote

Old   March 17, 2024, 04:47
Default
  #6
New Member
 
Join Date: Feb 2024
Posts: 5
Rep Power: 2
delMonster is on a distinguished road
Hi sharonyue,


I tried your proposed method below:



Quote:
Originally Posted by sharonyue View Post
This can be easily done by codedFixedValue. A template can be seen as:


inlet
{
type codedFixedValue;
value uniform (10 0 0);
name linearTBC1;
code
#{
const fvMesh& mesh = this->patch().boundaryMesh().mesh();
volVectorField& U = mesh.lookupObjectRef<volVectorField>("U");
#};
}

What you need is just access your field (U in the above code, T for your code) in the boundary condition.

Since I want to access the temperature field at the outlet boundary condition I modified it as follows:


Quote:
const fvMesh& mesh = this->patch().boundaryMesh().mesh();
label bottomoutlet = mesh.boundaryMesh().findPatchID("bottom_outlet");
volScalarField& T = mesh.lookupObjectRef<volScalarField>("T");
const fvPatchScalarField& T_p = T.boundaryField()[bottomoutlet];

Info << "T at outlet = " << T_p << " K" << endl;
However, I'm not getting back a value, I'm getting the initial boundary condition type:


Quote:
T at outlet = type inletOutlet;
inletValue nonuniform List<scalar> 0();
value nonuniform List<scalar> 0(); K
I'm probably missing something silly. Have you got any idea where I'm going wrong?
delMonster is offline   Reply With Quote

Old   March 17, 2024, 04:49
Default
  #7
New Member
 
Join Date: Feb 2024
Posts: 5
Rep Power: 2
delMonster is on a distinguished road
Quote:
Originally Posted by Alczem View Post

If you manage to make it work, please share the setup, I am curious to see more examples of this feature that could be really useful!


EDIT:


This thread shows the changes to the code, but it was because of one specific boundary condition. Other boundary conditions worked even with precompiled OpenFoam.

Looking at that thread, I was not able to get this working for that boundary condition
delMonster 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
Variable inlet temperature in Fluent yogesh03y FLUENT 0 January 20, 2023 09:11
Issues on the simulation of high-speed compressible flow within turbomachinery dowlee OpenFOAM Running, Solving & CFD 11 August 6, 2021 06:40
using outlet velocity profile as inlet for next set of iterations tricha122 FLUENT 0 November 22, 2020 09:40
kindly help me .. i have and error at line number 147.. m zubair Fluent UDF and Scheme Programming 0 February 10, 2019 11:25
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 05:13


All times are GMT -4. The time now is 08:50.