mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
rCFD solver for turbulent single-phase transport
This commit is contained in:
3
applications/solvers/recSolverTurbTransport/Make/files
Executable file
3
applications/solvers/recSolverTurbTransport/Make/files
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
recSolverTurbTransport.C
|
||||||
|
|
||||||
|
EXE=$(CFDEM_APP_DIR)/recSolverTurbTransport
|
||||||
27
applications/solvers/recSolverTurbTransport/Make/options
Executable file
27
applications/solvers/recSolverTurbTransport/Make/options
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
include $(CFDEM_ADD_LIBS_DIR)/additionalLibs
|
||||||
|
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(CFDEM_OFVERSION_DIR) \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||||
|
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
|
||||||
|
-I$(LIB_SRC)/transportModels \
|
||||||
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||||
|
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \
|
||||||
|
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
|
||||||
|
-I$(CFDEM_SRC_DIR)/recurrence/lnInclude \
|
||||||
|
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/derived/cfdemCloudRec \
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-L$(CFDEM_LIB_DIR)\
|
||||||
|
-lrecurrence \
|
||||||
|
-lturbulenceModels \
|
||||||
|
-lincompressibleTurbulenceModels \
|
||||||
|
-lincompressibleTransportModels \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools \
|
||||||
|
-lfvOptions \
|
||||||
|
-l$(CFDEM_LIB_NAME) \
|
||||||
|
$(CFDEM_ADD_LIB_PATHS) \
|
||||||
|
$(CFDEM_ADD_LIBS)
|
||||||
17
applications/solvers/recSolverTurbTransport/TEq.H
Executable file
17
applications/solvers/recSolverTurbTransport/TEq.H
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
volScalarField alphaEff("alphaEff", turbulence->nu()/Sc + dU2/Sct);
|
||||||
|
|
||||||
|
TEqn =
|
||||||
|
(
|
||||||
|
fvm::ddt(T)
|
||||||
|
+ fvm::div(phiRec, T)
|
||||||
|
- fvm::laplacian(alphaEff, T)
|
||||||
|
==
|
||||||
|
fvOptions(T)
|
||||||
|
);
|
||||||
|
|
||||||
|
TEqn.relax(relaxCoeff);
|
||||||
|
|
||||||
|
fvOptions.constrain(TEqn);
|
||||||
|
|
||||||
|
TEqn.solve();
|
||||||
174
applications/solvers/recSolverTurbTransport/createFields.H
Executable file
174
applications/solvers/recSolverTurbTransport/createFields.H
Executable file
@ -0,0 +1,174 @@
|
|||||||
|
// dummy fields
|
||||||
|
Info<< "\nCreating dummy pressure and density fields\n" << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("p", dimensionSet(1, 2, -2, 0, 0), 1.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
volScalarField rho
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("rho", dimensionSet(1, -3, 0, 0, 0), 1.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
// recurrence fields
|
||||||
|
Info<< "\nCreating recurrence fields.\n" << endl;
|
||||||
|
|
||||||
|
volVectorField URec
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"URec",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
volScalarField U2Rec
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U2Rec",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
// calculated fields
|
||||||
|
Info<< "\nCreating fields subject to calculation\n" << endl;
|
||||||
|
|
||||||
|
volScalarField delta
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"delta",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("delta", dimLength, 0.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
delta.primitiveFieldRef()=pow(mesh.V(),1.0/3.0);
|
||||||
|
delta.write();
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "\ncreating dU2\n" << endl;
|
||||||
|
|
||||||
|
volScalarField dU2
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"dU2",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
sqrt(0.5*mag(U2Rec - magSqr(URec)))*delta*0.094
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(dU2, cellI)
|
||||||
|
{
|
||||||
|
if (U2Rec[cellI]-magSqr(URec[cellI]) < 0.0)
|
||||||
|
{
|
||||||
|
dU2[cellI] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dU2.write();
|
||||||
|
|
||||||
|
Info<< "Calculating face flux field phiRec\n" << endl;
|
||||||
|
surfaceScalarField phiRec
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phiRec",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
linearInterpolate(URec) & mesh.Sf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiRec.write();
|
||||||
|
|
||||||
|
singlePhaseTransportModel laminarTransport(URec, phiRec);
|
||||||
|
|
||||||
|
autoPtr<incompressible::turbulenceModel> turbulence
|
||||||
|
(
|
||||||
|
incompressible::turbulenceModel::New(URec, phiRec, laminarTransport)
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar Sc("Sc", dimless, laminarTransport);
|
||||||
|
dimensionedScalar Sct("Sct", dimless, laminarTransport);
|
||||||
|
|
||||||
|
// create concentration field
|
||||||
|
Info<< "Creating scalar transport field\n" << endl;
|
||||||
|
|
||||||
|
volScalarField T
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"T",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
fvScalarMatrix TEqn(T, dimless*dimVolume/(dimTime));
|
||||||
|
|
||||||
|
scalar relaxCoeff(0.0);
|
||||||
|
|
||||||
|
Info<< "reading clockProperties\n" << endl;
|
||||||
|
|
||||||
|
IOdictionary clockProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"clockProperties",
|
||||||
|
mesh.time().constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
autoPtr<clockModel> myClock
|
||||||
|
(
|
||||||
|
clockModel::New
|
||||||
|
(
|
||||||
|
clockProperties,
|
||||||
|
mesh.time()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
14
applications/solvers/recSolverTurbTransport/readFields.H
Executable file
14
applications/solvers/recSolverTurbTransport/readFields.H
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
recurrenceBase.recM().exportVolScalarField("U2Mean",U2Rec);
|
||||||
|
recurrenceBase.recM().exportVolVectorField("UMean",URec);
|
||||||
|
phiRec=linearInterpolate(URec) & mesh.Sf();
|
||||||
|
|
||||||
|
dU2=sqrt(0.5*mag(U2Rec - magSqr(URec)))*delta*0.094;
|
||||||
|
|
||||||
|
forAll(dU2, cellI)
|
||||||
|
{
|
||||||
|
if (U2Rec[cellI]-magSqr(URec[cellI]) < 0.0)
|
||||||
|
{
|
||||||
|
dU2[cellI] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
113
applications/solvers/recSolverTurbTransport/recSolverTurbTransport.C
Executable file
113
applications/solvers/recSolverTurbTransport/recSolverTurbTransport.C
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
CFDEMcoupling academic - Open Source CFD-DEM coupling
|
||||||
|
|
||||||
|
Contributing authors:
|
||||||
|
Thomas Lichtenegger, Gerhard Holzinger
|
||||||
|
Copyright (C) 2015- Johannes Kepler University, Linz
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of CFDEMcoupling academic.
|
||||||
|
|
||||||
|
CFDEMcoupling academic 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.
|
||||||
|
|
||||||
|
CFDEMcoupling academic 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 CFDEMcoupling academic. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
Turbulent Transport Solver Recurrence
|
||||||
|
|
||||||
|
Description
|
||||||
|
Solves a transport equation for a passive scalar on a single-phase solution
|
||||||
|
for a solver based on recurrence statistics
|
||||||
|
|
||||||
|
Rules
|
||||||
|
Solution data to compute the recurrence statistics from, needs to
|
||||||
|
reside in $CASE_ROOT/dataBase
|
||||||
|
Time step data in dataBase needs to be evenly spaced in time
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "singlePhaseTransportModel.H"
|
||||||
|
#include "turbulentTransportModel.H"
|
||||||
|
#include "fvOptions.H"
|
||||||
|
|
||||||
|
#include "recBase.H"
|
||||||
|
#include "recModel.H"
|
||||||
|
|
||||||
|
#include "clockModel.H"
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "postProcess.H"
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
#include "createControl.H"
|
||||||
|
#include "createFields.H"
|
||||||
|
#include "createFvOptions.H"
|
||||||
|
|
||||||
|
recBase recurrenceBase(mesh);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nCalculating particle trajectories based on recurrence statistics\n" << endl;
|
||||||
|
|
||||||
|
label recTimeIndex(0);
|
||||||
|
scalar recTimeStep_=recurrenceBase.recM().recTimeStep();
|
||||||
|
|
||||||
|
while (runTime.run())
|
||||||
|
{
|
||||||
|
|
||||||
|
myClock().start(1,"Global");
|
||||||
|
|
||||||
|
runTime++;
|
||||||
|
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
myClock().start(2,"fieldUpdate");
|
||||||
|
|
||||||
|
if ( runTime.timeOutputValue() - (recTimeIndex+1)*recTimeStep_ + 1.0e-5 > 0.0 )
|
||||||
|
{
|
||||||
|
Info << "Updating fields at run time " << runTime.timeOutputValue()
|
||||||
|
<< " corresponding to recurrence time " << (recTimeIndex+1)*recTimeStep_ << ".\n" << endl;
|
||||||
|
recurrenceBase.updateRecFields();
|
||||||
|
#include "readFields.H"
|
||||||
|
recTimeIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
myClock().stop("fieldUpdate");
|
||||||
|
|
||||||
|
myClock().start(3,"speciesEqn");
|
||||||
|
#include "TEq.H"
|
||||||
|
myClock().stop("speciesEqn");
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
|
||||||
|
myClock().stop("Global");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
myClock().evalPar();
|
||||||
|
myClock().normHist();
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user