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

what is useUserTime flag in function objects?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 21, 2023, 15:57
Default what is useUserTime flag in function objects?
  #1
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
Hi,

In function objects, there is a flag 'useUserTime'.

Could you please explain what does thid flag do? what is its purpose? Any examples to clarify this are appreciated.

Regards
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 4, 2024, 04:52
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Did you already read the documentation note on writeFile.H ?
olesen is offline   Reply With Quote

Old   January 4, 2024, 05:30
Default
  #3
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14
Tobermory will become famous soon enough
This may save you some time in the future, and allow you to avoid pointless posts .
1. Open up Doxygen (you are using the ESI version, I think, so that would be https://www.openfoam.com/documentati...doc/index.html).
2. Type in the thing that you are searching for in the search box, i.e. useUserTime here; if it finds the search item, a drop down of hyperlink(s) will appear with all items starting with your string - click on the appropriate one
3. this will open up the Doxygen pages for the thing you are searching for.

In other words, within just a few seconds you would get:
Code:
bool useUserTime_
protected
Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true
Definition at line 152 of file writeFile.H.
which would give you a high level description and tell you to go look in writeFile.H, as Mark suggested.

Doxygen can be a bit clunky sometimes, but is your key to unlocking the mysteries of OF! Good luck and Happy New Year!
Tobermory is offline   Reply With Quote

Old   January 4, 2024, 05:41
Default
  #4
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
Quote:
Originally Posted by Tobermory View Post
This may save you some time in the future, and allow you to avoid pointless posts .
1. Open up Doxygen (you are using the ESI version, I think, so that would be https://www.openfoam.com/documentati...doc/index.html).
2. Type in the thing that you are searching for in the search box, i.e. useUserTime here; if it finds the search item, a drop down of hyperlink(s) will appear with all items starting with your string - click on the appropriate one
3. this will open up the Doxygen pages for the thing you are searching for.

In other words, within just a few seconds you would get:
Code:
bool useUserTime_
protected
Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true
Definition at line 152 of file writeFile.H.
which would give you a high level description and tell you to go look in writeFile.H, as Mark suggested.

Doxygen can be a bit clunky sometimes, but is your key to unlocking the mysteries of OF! Good luck and Happy New Year!
Dear Tobermory, Thank you very much for your reply. Sorry I didn't mention that I have searched the documentation, and I have even checked the source code.

But the description does not make sense for me at all.

The short description says: "... to use the specified user time..": What is a user time? how can I specify it?
Also in the description: "CA deg instead of seconds": What is CA deg?????

You can see clearly that this description does not make sense without context, that's why I have asked for clarification and examples.


Best regards
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 4, 2024, 05:43
Default
  #5
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
Quote:
Originally Posted by olesen View Post
Did you already read the documentation note on writeFile.H ?
Thank you for your reply. Yes, I have checked the documentation, but unfortunately it is not clear. An example showing how to use this flag in practice would be much helpful.

Thank you.
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 4, 2024, 06:03
Default
  #6
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14
Tobermory will become famous soon enough
Aaah - well, now that's a much better question. "CA" stands for crank angle and comes from the development of engineFoam I believe (correct me Mark if I am wrong).

The userTime is whatever you want it to be ... it suggests degrees in the header, but it could be anything. To see what the useUserTime flag does, take a look at writeFile.C, where you'll see:

Code:
        if (useUserTime_)
        {
            timeValue = fileObr_.time().timeToUserTime(timeValue);
        }
 
        const word timeName = Time::timeName(timeValue);
So now you need to hunt down timeToUserTime, which is defined as a virtual function in TimeState.H, although it seems clear what it's doing - it constructs the name of the time folder from the simulation time and the timeToUserTime function. In other words, the intent is that you generate your own version of the time class with its own version of the timeToUserTime function, and this allows you to name the time folders in a more logical fashion (eg crank angle setting).

If you really want to dig into it, I suggest starting with https://www.openfoam.com/documentati...9ee65af8a.html ... and in particular https://www.openfoam.com/documentati...8C_source.html where you'll see the above being implemented. I found this pretty quickly with a command line grep command.

Good luck again.
olesen likes this.
Tobermory is offline   Reply With Quote

Old   January 4, 2024, 07:01
Default
  #7
Senior Member
 
NotOverUnderated's Avatar
 
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5
NotOverUnderated is on a distinguished road
Quote:
Originally Posted by Tobermory View Post
Aaah - well, now that's a much better question. "CA" stands for crank angle and comes from the development of engineFoam I believe (correct me Mark if I am wrong).

The userTime is whatever you want it to be ... it suggests degrees in the header, but it could be anything. To see what the useUserTime flag does, take a look at writeFile.C, where you'll see:

Code:
        if (useUserTime_)
        {
            timeValue = fileObr_.time().timeToUserTime(timeValue);
        }
 
        const word timeName = Time::timeName(timeValue);
So now you need to hunt down timeToUserTime, which is defined as a virtual function in TimeState.H, although it seems clear what it's doing - it constructs the name of the time folder from the simulation time and the timeToUserTime function. In other words, the intent is that you generate your own version of the time class with its own version of the timeToUserTime function, and this allows you to name the time folders in a more logical fashion (eg crank angle setting).

If you really want to dig into it, I suggest starting with https://www.openfoam.com/documentati...9ee65af8a.html ... and in particular https://www.openfoam.com/documentati...8C_source.html where you'll see the above being implemented. I found this pretty quickly with a command line grep command.

Good luck again.

Nice explanation

Assuming that I understand that and it does what I think it does, I wonder how I can use this in my simulations. Is there a minimal tutorial where this is used? can I use it with pimpleFoam? how?
__________________
Don't keep making the same mistakes. Try to make new mistakes.
NotOverUnderated is offline   Reply With Quote

Old   January 4, 2024, 08:01
Default
  #8
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14
Tobermory will become famous soon enough
Quote:
Originally Posted by NotOverUnderated View Post
Nice explanation

Assuming that I understand that and it does what I think it does, I wonder how I can use this in my simulations. Is there a minimal tutorial where this is used? can I use it with pimpleFoam? how?
No - I don't think so - it's a much more fundamental feature, and you would have to build it into a bespoke solver, including your own definition of the time class etc. This probably means redefining a whole bunch of classes ... but that's just speculation on my part, I haven't researched it fully. The engineFoam solver that I pointed you to gives you an idea of the effort involved.
Tobermory 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
Error in enabling the python wrapper Jinn SU2 Installation 2 April 23, 2022 14:52
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 08:15
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 14:06
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


All times are GMT -4. The time now is 00:10.