Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
25147d7
Edited version of project to build it successfully
bialger Aug 3, 2024
0e5b2ac
Added new ODE solvers
bialger Aug 3, 2024
a237253
Added properly configured chemical properties
bialger Aug 4, 2024
0b5dfcd
Merge pull request #1 from EclipseRE/ode-solvers
bialger Aug 4, 2024
54c1971
Updated bashrc for cantera
bialger Aug 4, 2024
50ab551
Added thermophysics code
bialger Aug 4, 2024
b3308d6
Added cantera solver
bialger Aug 4, 2024
8e7ca84
Fixed tabs instead of spaces in MAKE options file
bialger Aug 4, 2024
ff4a4e3
Merge pull request #2 from EclipseRE/ode-solvers
bialger Aug 4, 2024
6ea7785
Fixes in bashrc for cantera lib path
bialger Aug 6, 2024
d4b3d60
Massive options update: added proper library and sources for Cantera
bialger Aug 6, 2024
ff3955f
Fixed errors in OpenFOAM-Cantera code
bialger Aug 6, 2024
fb43ff2
Merge pull request #3 from EclipseRE/ode-solvers
bialger Aug 6, 2024
1f60855
Added yaml gri30 and uncommented cantera usage
bialger Aug 7, 2024
9bf2623
Added canteraChemistryReader.C to build files
bialger Aug 7, 2024
017d8c4
Fixed some files that determine allowed types of configurations
bialger Aug 7, 2024
9840e4b
Massive tabulation fix
bialger Aug 7, 2024
a8a6c08
Merge pull request #4 from EclipseRE/ode-solvers
bialger Aug 7, 2024
d8e8690
Massive options refactoring: Cantera linked to all executables
bialger Aug 10, 2024
6dba518
Updated bashrc to use Cantera shell config
bialger Aug 10, 2024
632628a
Added CVODES files to compilation file list
bialger Aug 10, 2024
526e5ca
Fixed example task
bialger Aug 10, 2024
4fb5339
Edited bashrc to make it user-independent
bialger Aug 10, 2024
804e28b
Merge pull request #5 from EclipseRE/ode-solvers
bialger Aug 10, 2024
af9ecbf
Updated gitignore to ignore all tutorial computation results
bialger Aug 11, 2024
751e536
Removed remained computation results
bialger Aug 11, 2024
f24a9e4
Update bashrc
bialger Nov 25, 2024
5588fea
Merge pull request #6 from EclipseRE/ode-solvers
bialger Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,23 @@ doc/Doxygen/DTAGS

# Ignore the test directory
/tutorialsTest

#Ignore all tutorial files that are not configs, resources or scripts
/tutorials

!Allwmake
!Alltest
!Allclean
!Allrun
!*.yaml
!*.cti
!*Properties

!/tutorials/resources/

!/tutorials/**/system/
!/tutorials/**/0/

!/tutorials/**/constant/*reaction*
!/tutorials/**/constant/*thermo*

135 changes: 135 additions & 0 deletions applications/solvers/CTreactingFoam/CTreactingFoam.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.

Application
reactingFoam

Description
Solver for combustion with chemical reactions.

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "turbulentFluidThermoModel.H"
#include "psiReactionThermo.H"
#include "CombustionModel.H"
#include "multivariateScheme.H"
#include "pimpleControl.H"
#include "pressureControl.H"
#include "fvOptions.H"
#include "localEulerDdtScheme.H"
#include "fvcSmooth.H"
#include "reactingMixture.H"
#include "thermoPhysicsTypes.H"


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "postProcess.H"

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "createFieldRefs.H"

turbulence->validate();

if (!LTS)
{
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.run())
{
#include "readTimeControls.H"

if (LTS)
{
#include "setRDeltaT.H"
}
else
{
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
}

runTime++;

Info<< "Time = " << runTime.timeName() << nl << endl;

#include "rhoEqn.H"

while (pimple.loop())
{
#include "UEqn.H"
#include "YEqn.H"
#include "EEqn.H"

// --- Pressure corrector loop
while (pimple.correct())
{
if (pimple.consistent())
{
#include "pcEqn.H"
}
else
{
#include "pEqn.H"
}
}

if (pimple.turbCorr())
{
turbulence->correct();
}
}

rho = thermo.rho();

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

#include "LewisNumber.H"

Info<< "End\n" << endl;

return 0;
}


// ************************************************************************* //
47 changes: 47 additions & 0 deletions applications/solvers/CTreactingFoam/EEqn.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
volScalarField tempT = T;
volScalarField& he = thermo.he();

fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
+ (
he.name() == "e"
? fvc::div
(
fvc::absolute(phi/fvc::interpolate(rho), U),
p,
"div(phiv,p)"
)
: -dpdt
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
Qdot
+ fvOptions(rho, he)
);

forAll(Y, k)
{
EEqn -= fvc::laplacian(turbulence->alphaEff()*hsi[k], Y[k]);
EEqn -= fvc::div(J[k], hsi[k], "div(Ji,hsi)");
}

EEqn.relax();

fvOptions.constrain(EEqn);

EEqn.solve();

fvOptions.correct(he);

thermo.correct();

Info << "min/max(T) = "
<< min(T).value() << ", " << max(T).value() << endl;
// update oldT for CoDAC
//oldT = tempT;
}


26 changes: 26 additions & 0 deletions applications/solvers/CTreactingFoam/LewisNumber.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*OFstream LewisNumber
(
"LewisNumber.dat"
);

LewisNumber
<< "species" << " Lewis Number" << endl;

forAll(mesh.cells(), celli)
{
if ( abs( T[celli]-max(T).value() ) < 1.0e-20 )
{
forAll (Y, k)
{
scalar Diff = dynamic_cast<const reactingMixture<gasHThermoPhysics>&>
(composition).D(p, T, Y)[k][celli];
if (Diff > 1.0e-20)
{
scalar Lewis = thermo.alpha()[celli]/Diff;
LewisNumber
<< k << tab << tab << Lewis << endl;
}

}
}
}*/
3 changes: 3 additions & 0 deletions applications/solvers/CTreactingFoam/Make/files
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CTreactingFoam.C

EXE = $(FOAM_APPBIN)/CTreactingFoam
39 changes: 39 additions & 0 deletions applications/solvers/CTreactingFoam/Make/options
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude \
-I$(WM_CANTERA_DIR) \
-I$(WM_CANTERA_DIR)/cantera \
-I$(WM_CANTERA_DIR)/cantera/kinetics \
-I$(WM_CANTERA_DIR)/cantera/base \
-I$(WM_CANTERA_DIR)/cantera/transport \
-I$(WM_CANTERA_DIR)/cantera/thermo \
-I$(WM_CANTERA_DIR)/cantera/ext \
-I$(WM_CANTERA_DIR)/cantera/ext/fmt

EXE_LIBS = \
-L$(FOAM_USER_LIBBIN) \
-lfiniteVolume \
-lmeshTools \
-lsampling \
-lturbulenceModels \
-lcompressibleTransportModels \
-lspecie \
-lfluidThermophysicalModels \
-lODE \
-lchemistryModel \
-lreactionThermophysicalModels \
-lcompressibleTurbulenceModels \
-lfvOptions \
-lcombustionModels \
-L$(CANTERA_LIB_PATH) \
-lcantera_shared
25 changes: 25 additions & 0 deletions applications/solvers/CTreactingFoam/UEqn.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Solve the Momentum equation

MRF.correctBoundaryVelocity(U);

tmp<fvVectorMatrix> tUEqn
(
fvm::ddt(rho, U) + fvm::div(phi, U)
+ MRF.DDt(rho, U)
+ turbulence->divDevRhoReff(U)
==
fvOptions(rho, U)
);
fvVectorMatrix& UEqn = tUEqn.ref();

UEqn.relax();

fvOptions.constrain(UEqn);

if (pimple.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));

fvOptions.correct(U);
K = 0.5*magSqr(U);
}
Loading