|
[Sponsors] |
flow rate correction in timeVaryingMappedFixedValue |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 9, 2020, 07:45 |
flow rate correction in timeVaryingMappedFixedValue
|
#1 |
New Member
Join Date: Sep 2018
Posts: 3
Rep Power: 7 |
Hi all, hope everyone is doing good.
I am using timeVaryingMappedFixedValue BC within pisoFoam to introduce turbulence at an inlet. The problem is that due to spatial interpolation the flow rate (Q) varies slightly with every time step and I'd like to keep it fixed by rescaling the velocity field by a factor (Q_ideal/Q_calculated). Could someone please let me know if such a BC already exists. If not, is there an example on how to calculate the flow rate ( surfaceIntegral(v.dA) ) in an OpenFoam BC? Please consider me a beginner in OpenFoam code implementation. Thank you. |
|
May 9, 2020, 09:45 |
|
#2 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12 |
Hi,
- I don't know any such BC - but I think it is a good idea. - An alternative may be using one of the "coded" boundary conditions. Please have a look at available documentation for these. - Just very rough, untested ideas below. Please be cautious. - First you need to compute the first time-step flow rate, and keep it throughout your simulation in order to refer back at future time steps. For example, a function (I haven't test it - it is just to give some idea, I'm afraid): Code:
scalar computeInitFlowRate(const vector& UReference) { // Compute patch normal across all processors const vector patchNormal ( (-gAverage(patch().nf()) ).normalise() ); // Compute initial flow rate based on an input "UReference" velocity return gSum ( (UReference & patchNormal)*patch().magSf() ); } Code:
void correctFlowRate(vectorField& U, const vector& UReference) { const scalar initFlowRate = computeInitFlowRate(UReference); U *= (initFlowRate/gSum(U & -patch().Sf())); }
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
May 10, 2020, 09:16 |
|
#3 |
New Member
Join Date: Sep 2018
Posts: 3
Rep Power: 7 |
Hi HPE,
Thanks very much for your answer. - I am not using the available BCs because my inlet is non-planar. It is a cylindrical strip instead (see attachment), so it is easier for me to read in the time files. - Non-planar inlet also means that I need local area vectors to calculate . As a first step, I am trying to print out the inlet flow rate at the current time step. With a very rusty openFoam knowledge, I have tried the following in accordance with what you suggested and the original timeVaryingMappedFixedValue BC: Code:
template<class Type> void Foam::timeVaryingMappedFixedValueFixedQFvPatchField<Type>::calcFlowRate(vectorField& U) { const vectorField& areaVec = this->patch().Sf(); // area vectors Pout << "Test Flow Rate: " << gSum( U & -areaVec ) ; // summation of dot product } Code:
calcFlowRate(Uvec); What do you think of the overall approach and could you/someone help regarding the declaration bit please? Thanks again, Vishal |
|
May 13, 2020, 06:13 |
|
#4 |
New Member
Join Date: Sep 2018
Posts: 3
Rep Power: 7 |
Hi all,
I had to create a specialisation of the template. Things seem to work now. Thanks to HPE and Marta from this post How to determine the type of an object in the object registry Have a nice one. |
|
May 13, 2020, 16:46 |
|
#5 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12 |
Hi
- Just as a side note, the code in my previous post should be applicable to non-planar patches as well - since the average considers only the patch-normal distance. Hope this helps.
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
December 14, 2021, 15:03 |
|
#6 |
Member
Junting Chen
Join Date: Feb 2016
Location: Ontario Canada
Posts: 37
Rep Power: 10 |
Hello HPE, do you mind to give a bit more hint on where and how to implement this modify? Many thanks!
|
|
Tags |
fix flow rate |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Match Pressure Inlet/Outlet Boundary Condition Mass Flow Rate | MSchneid | Fluent UDF and Scheme Programming | 3 | February 23, 2019 06:00 |
actual flow rate not match the designed flow rate in ventilation modeling | minecraftgp | OpenFOAM Running, Solving & CFD | 2 | November 18, 2018 12:37 |
Iteration number - flow rate relation | helvas | CFX | 6 | May 30, 2016 02:57 |
Calculating mass flow rate at multiphase flows | Kuslo187 | OpenFOAM Post-Processing | 1 | August 21, 2015 18:11 |
Discrete Phase & Mass Flow Rate | MagnusZeus | FLUENT | 0 | December 2, 2011 17:57 |