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

How to add equations to modular solver in openFoam11

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 11, 2023, 19:09
Default How to add equations to modular solver in openFoam11
  #1
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Dear All


I am looking for help, how to add temperature equation or any other equation to InterFoam solver?, i noticed, that now everything is called modular solver and even the name changed to incompressibleVoF.


i know everything is with classes, however, openFoam is improving faster and now i am a bit lost.


Finally the version is OpenFoam11



thanks in advance

Last edited by baezacaljo; September 11, 2023 at 19:11. Reason: typos
baezacaljo is offline   Reply With Quote

Old   September 12, 2023, 00:09
Default
  #2
Member
 
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 13
LongGe is on a distinguished road
Hello baezacaljo

I would add to the class method "thermophysicalPredictor" in "incompressibleVoF.C".
The solver "foamRun" always calls this class method.


OpenFOAM-11/applications/modules/incompressibleVoF
Code:
void Foam::solvers::incompressibleVoF::thermophysicalPredictor()
{}

OpenFOAM-11/applications/solvers/foamRun/foamRun.C
Code:
        // PIMPLE corrector loop
        while (pimple.loop())
        {
            solver.moveMesh();
            solver.fvModels().correct();
            solver.prePredictor();
            solver.momentumPredictor();
            solver.thermophysicalPredictor();
            solver.pressureCorrector();
            solver.postCorrector();
        }
__________________
Our Work: https://www.idaj.co.jp/product/ennovacfd/openfoam_gui/
Powered by Ennova : https://ennova-cfd.com/
Ennova's Channel Partners : http://www.wolfdynamics.com/
LongGe is offline   Reply With Quote

Old   September 12, 2023, 05:41
Default
  #3
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Thank you for your help LongGe

Now I assume I have to copy both folder the one called incompressibleVoF and compile it. And the other other one that contains the solver foamRun.C and compile it, right?

Finally in the controlDict file in solver I have to write myFoamRun, right?


By the way, i was reading the code carefully and the fie incompressibleVoF.C already has


Quote:
void Foam::solvers::incompressibleVoF::thermophysicalPr edictor() {}

and the file incompressibleVoF.H has



Quote:
// Member Functions //- Called at the start of the PIMPLE loop virtual void prePredictor(); //- Construct and solve the energy equation, // convert to temperature // and update thermophysical and transport properties virtual void thermophysicalPredictor();

Hence, i am not getting the code.


is the incompressibleVoF.C and foamRun considering the temperature already?


Best regards

Last edited by baezacaljo; September 12, 2023 at 09:38. Reason: lack of information
baezacaljo is offline   Reply With Quote

Old   September 12, 2023, 18:34
Default
  #4
Member
 
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 13
LongGe is on a distinguished road
Hello

Since "foamRun" is simply a client using the "solver" class, you do not need to make any changes. All you have to do is copy "incompressibleVoF" and create your "yourincompressibleVoF". The controlDict is as follows.

Code:
application     foamRun;
solver          yourincompressibleVoF
foamRun" always calls the class method "thermophysicalPredictor()". This is as I have shown before. The following is the inheritance relation of the "incompressibleVoF" class. The "thermophysicalPredictor" is declared as a pure virtual function in the "fluidSolver" class.

Code:
incompressibleVoF->twoPhaseVoFSolver->twoPhaseSolver->VoFSolver->fluidSolver

virtual void thermophysicalPredictor() = 0;
The class "incompressibleVoF" must implement "thermophysicalPredictor", but "incompressibleVoF" does not solve the temperature, so its implementation is empty. And you will be the one to specifically do this implementation.
__________________
Our Work: https://www.idaj.co.jp/product/ennovacfd/openfoam_gui/
Powered by Ennova : https://ennova-cfd.com/
Ennova's Channel Partners : http://www.wolfdynamics.com/
LongGe is offline   Reply With Quote

Old   September 13, 2023, 19:33
Default
  #5
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Thank you LongGe


So rry for the late reply i was testing and writing the code, look this is what i achieved so far (see attached files), however, in the case of the Make folder and the other two folder, do i have to modify them and then COMPILE THEM? or what to do?


i only modify the folder name from incompressibleVoF to incompressibleVoFTemp and the files stick with the same name incompressibleVoF.C and incompressibleVoF.H but with some modifications.


Thanks in advance
Attached Files
File Type: c incompressibleVoF.C (5.7 KB, 4 views)
File Type: h incompressibleVoF.H (6.0 KB, 4 views)
baezacaljo is offline   Reply With Quote

Old   September 13, 2023, 20:13
Default
  #6
Member
 
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 13
LongGe is on a distinguished road
Hello

You will need to create a new class. I don't think you can just copy it.

For example:

Code:
class incompressibleVoFTemp
:
    public twoPhaseVoFSolver
{

...
...

    //- Runtime type information
    TypeName("incompressibleVoFTemp");
Other changes will need to be made to ctor and dtor as well....
__________________
Our Work: https://www.idaj.co.jp/product/ennovacfd/openfoam_gui/
Powered by Ennova : https://ennova-cfd.com/
Ennova's Channel Partners : http://www.wolfdynamics.com/
LongGe is offline   Reply With Quote

Old   May 3, 2024, 09:42
Default
  #7
Member
 
Join Date: Mar 2015
Posts: 36
Rep Power: 11
K.C. is on a distinguished road
I found this thread via Google and have to admit, that I am facing the same problem.


I copied an existing solver module, modified it and then compiled it into an shared library with .so extension via "wclean" and "wmake libso".
Compilation worked fine, but my new solver class is not available to foamRun


I tried
Code:
foamRun -solver {nameOfMyOwnSolver}
while the .so was declared inside of my controlDict with
Code:
libs("{pathToMyLibrary.so}");


and I also tried

Code:
foamRun -libs '("{pathToMyLibrary.so}")' -solver {nameOfMyOwnSolver}

and my last attempt was to extend the searchPath for libraries with
Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/{absolutePathToMyLibraryFolder}

In all ways foamRun complains with "solvers table is empty"

So how can I declare to foamRun to use my new created solver module?
The




Kind regards,
K.C.
K.C. is offline   Reply With Quote

Reply

Tags
incompressiblevof, interfoam, modular solver, openfoam 11


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
Add mesh refinement to solidDisplacementFoam solver j-avdeev OpenFOAM Programming & Development 0 May 10, 2022 12:39
Error SIGSEGV using VOF and UDF JERC_UTFSM Fluent UDF and Scheme Programming 14 November 7, 2021 23:17
Add a pollutant in simpleFoam solver Gohu8 OpenFOAM Running, Solving & CFD 2 July 19, 2017 03:16
How to add temperature to cavitatingFoam solver chodki-c OpenFOAM 9 September 30, 2010 11:21
Navier-stokes equations and iterative solver?? wuliang Main CFD Forum 2 January 13, 2003 22:28


All times are GMT -4. The time now is 13:59.