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

Switch schemes in code

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 25, 2023, 13:10
Thumbs down Switch schemes in code
  #1
Senior Member
 
Join Date: Jan 2019
Posts: 125
Blog Entries: 1
Rep Power: 0
Michael@UW is on a distinguished road
I want to manually switch the time scheme in the code, for example, when t<100, using Euler, otherwise using backward.


Is there a way to achieve this goal in the code?
It seems the ddtScheme always read the data from the file fvSchemes. I cannot dynamically switch the scheme.


Thanks!
Michael@UW is offline   Reply With Quote

Old   February 27, 2023, 02:06
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 736
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
Using foamDictionary inside Allrun script?
dlahaye is offline   Reply With Quote

Old   February 27, 2023, 03:24
Default
  #3
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,086
Rep Power: 26
Yann will become famous soon enough
The timeActivatedFileUpdate function object does exactly this:

Cheers,
Yann
dlahaye and überschwupper like this.
Yann is offline   Reply With Quote

Old   February 27, 2023, 16:46
Default
  #4
Senior Member
 
Join Date: Jan 2019
Posts: 125
Blog Entries: 1
Rep Power: 0
Michael@UW is on a distinguished road
Quote:
Originally Posted by Yann View Post
The timeActivatedFileUpdate function object does exactly this:

Cheers,
Yann

Yann,

Thank you for reply. Using this method can solve my current problem and it works for every case. But I want to control the scheme in the code directly something like this:


Code:
template<class Type>
 
tmp<ddtScheme<Type>> ddtScheme<Type>::New
 
(
 
    const fvMesh& mesh,
 
    Istream& schemeData
 
)
 
{


 
 
    const word schemeName(schemeData);
 
 
 
    auto* ctorPtr = IstreamConstructorTable(schemeName);
 
 
 

return ctorPtr(mesh, schemeData);
 
}

The ddtScheme is created by reading the fvScheme file. I would like to create the ddtScheme manually and switch different schemes flexibly.
Michael@UW 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
Patankar CFD FORTRAN 90 Code FVM siddiquesil Main CFD Forum 19 October 25, 2022 05:21
No different caculation speed between serial and openMP code? AnhDL Main CFD Forum 4 May 16, 2020 04:17
Design Integration with CFD? John C. Chien Main CFD Forum 19 May 17, 2001 15:56
What is the Better Way to Do CFD? John C. Chien Main CFD Forum 54 April 23, 2001 08:10
Numerical schemes in PHOENICS code Hafsia Phoenics 5 September 13, 2000 04:45


All times are GMT -4. The time now is 11:41.