|
[Sponsors] |
April 25, 2023, 08:18 |
New functionObject to extract y+, U+, uTau
|
#1 |
New Member
Martina Formichetti
Join Date: Apr 2021
Posts: 6
Rep Power: 5 |
Hi everyone,
I have been using OpenFOAM for a year now but I am still new to the programming part and am just getting into it now. I am working on turbulent boundary layers over rough walls and wanted to create one functionObject to extract y+, U+, and uTau from the simulation. I followed the "3 weeks series" tutorial to get a general idea of what I should do and started by copying the yPlus functionObject to my working directory together with the Make directory, which I modified accordingly to include the files needed by yPlus.C. Now my problem is that the yPlus.C code is way more difficult than the vorticity one in the "3 weeks series" tutorial and I am not sure where to start. I also am not sure how to make it so it gives 3 outputs, rather than one. Can anyone give me any tips on how to start, and generally what the different sections are for in the source code? Or even if there is any documentation you are aware of that could help me with this, I would appreciate it if you could tell me about it. Sorry if the question is too generic, I am just not familiar with what I am working with and am finding it difficult to find help online. I am using OpenFOAM-v2212 on a Debian11 computer. Thanks in advance to everyone who will reply. Best, Martina The "3 weeks series" tutorial is in the attachments together with the yPlus.C file |
|
April 28, 2023, 06:34 |
|
#2 |
Member
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 94
Rep Power: 15 |
Hi Martina,
You may read relevant sections in "openfoam user guide" and "openfoam programmer's guide" to get to know things better + improving your understanding in C++. A quick reply to what you asked, you may need to change the function execute() to your needs and if you want to write out different things you may also need to change the write() function. This means, you need to update the code in execute() part to calculate things the way you want them. And if you want to write out different variables you need to change the write() function accordingly. OF heavily uses the concept of templates in C++ and that is for sure intimidating for starters (even for advanced users ), so don't feel lost. Also in general in OF when things are passed by reference (&) the intention is that they are going to change within that area of code and when they are passed by a const reference(const sth&) this means that the intention is to use the content of them without messing with them. Regarding writing out 3 outputs, if you mean in the write() function, it is already writing out 3 things (y+ min, y+ max, y+ avg). If you mean in the calculation part, you don't have to return 3 values, instead you may use reference (&) and update your vars accordingly then later use them wherever you need them. |
|
November 30, 2023, 14:44 |
|
#3 |
New Member
Join Date: Aug 2017
Posts: 16
Rep Power: 9 |
Hi Martina,
have you solved this problem? I want to output the same variables. |
|
Tags |
functionobjects, uplus-yplus, utau |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
make custom functionObject available with postProcess | Shibi | OpenFOAM Programming & Development | 10 | October 6, 2023 06:05 |
Cannot find functionObject file residuals | vava10 | OpenFOAM Pre-Processing | 2 | November 14, 2020 13:21 |
Big help for a little girl engineer - Extract and Supply air | Dani86 | Main CFD Forum | 9 | April 30, 2018 19:38 |
creating functionObject for uTau - compilation i.O. - application error | aylalisa | OpenFOAM Programming & Development | 2 | April 29, 2018 15:50 |
Create registered object at runtime using a functionObject | CedricVH | OpenFOAM Programming & Development | 21 | November 28, 2012 06:04 |