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

New functionObject to extract y+, U+, uTau

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2023, 08:18
Question New functionObject to extract y+, U+, uTau
  #1
New Member
 
Martina Formichetti
Join Date: Apr 2021
Posts: 6
Rep Power: 5
MartinaFormichetti is on a distinguished road
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
Attached Files
File Type: pdf implementNormalizedHelicityFunctionObject.pdf (110.9 KB, 22 views)
File Type: pdf yPlus.C.pdf (41.3 KB, 19 views)
MartinaFormichetti is offline   Reply With Quote

Old   April 28, 2023, 06:34
Default
  #2
Member
 
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 94
Rep Power: 15
einstein_zee is on a distinguished road
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.
einstein_zee is offline   Reply With Quote

Old   November 30, 2023, 14:44
Default
  #3
New Member
 
Join Date: Aug 2017
Posts: 16
Rep Power: 9
Wang Shang is on a distinguished road
Hi Martina,

have you solved this problem? I want to output the same variables.
Wang Shang is offline   Reply With Quote

Reply

Tags
functionobjects, uplus-yplus, utau


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
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


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