Function1: added 'lookup' Function1

This commit is contained in:
Mattijs Janssens
2024-05-30 10:25:24 +00:00
committed by Andrew Heather
parent 495fa6c577
commit c07997d816
34 changed files with 1456 additions and 28 deletions

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
side
{
type surfaceNormalFixedValue;
refValue uniform -10;
}
inlet
{
type surfaceNormalFixedValue;
refValue uniform -10;
}
outlet
{
type zeroGradient;
}
walls
{
type noSlip;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 14.855;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
side
{
type fixedValue;
value $internalField;
}
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
walls
{
type epsilonWallFunction;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.375;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
side
{
type fixedValue;
value $internalField;
}
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
walls
{
type kqRWallFunction;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
side
{
type fixedValue;
value uniform 0;
}
inlet
{
type fixedValue;
value uniform 0;
}
outlet
{
type zeroGradient;
}
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
side
{
type calculated;
value uniform 0;
}
inlet
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value uniform 0;
}
walls
{
type nutkWallFunction;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 440.15;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
side
{
type fixedValue;
value $internalField;
}
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
walls
{
type omegaWallFunction;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
side
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -5,6 +5,6 @@ cd "${0%/*}" || exit # Run from this directory
cleanCase0
rm -rf constant
rm -rf constant/geometry
#------------------------------------------------------------------------------

View File

@ -11,4 +11,8 @@ cp -f \
runApplication blockMesh
restore0Dir
runApplication $(getApplication)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 1e-05;
// ************************************************************************* //

View File

@ -0,0 +1,31 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
// Tested with kEpsilon, realizableKE, kOmega, kOmegaSST,
// ShihQuadraticKE, LienCubicKE.
RASModel kEpsilon;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -18,12 +18,13 @@ libs (blockMesh);
DebugSwitches
{
// project 1;
// searchableExtrudedCircle 1;
// projectCurve 1;
//project 1;
//searchableExtrudedCircle 1;
//projectCurve 1;
solution 1;
}
application blockMesh;
application simpleFoam;
startFrom startTime;
@ -31,13 +32,13 @@ startTime 0;
stopAt endTime;
endTime 0;
endTime 100;
deltaT 0;
deltaT 1;
writeControl timeStep;
writeInterval 1;
writeInterval 10;
purgeWrite 0;
@ -53,5 +54,63 @@ timePrecision 6;
runTimeModifiable true;
functions
{
relaxationFactor
{
// Convoluted example - control relaxation factor
libs (utilityFunctionObjects);
type coded;
name relaxationFactor;
codeRead
#{
const IOobject io
(
"banana",
mesh().time().constant(),
mesh()
);
auto* ptr = const_cast<objectRegistry&>(io.db()).
findObject<uniformDimensionedScalarField>(io.name());
if (!ptr)
{
Info<< "Registering relaxation factor " << io.name() << endl;
ptr = new uniformDimensionedScalarField
(
io,
dimless,
0.80
);
ptr->store();
}
#};
codeExecute
#{
const IOobject io
(
"banana",
mesh().time().constant(),
mesh()
);
auto& val =
io.db().lookupObjectRef<uniformDimensionedScalarField>
(
io.name()
);
// Ramp a bit
val.value() = min(0.99, val.value()+0.01);
Info<< "Set relaxation factor to " << val << endl;
#};
}
}
// ************************************************************************* //

View File

@ -15,22 +15,49 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{}
{
default steadyState;
}
gradSchemes
{}
{
default Gauss linear;
}
divSchemes
{}
{
default none;
div(phi,U) bounded Gauss linearUpwind grad(U);
turbulence bounded Gauss limitedLinear 1;
div(phi,k) $turbulence;
div(phi,epsilon) $turbulence;
div(phi,omega) $turbulence;
div(nonlinearStress) Gauss linear;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{}
{
default Gauss linear corrected;
}
interpolationSchemes
{}
{
default linear;
}
snGradSchemes
{}
{
default corrected;
}
wallDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -14,5 +14,60 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
tolerance 1e-06;
relTol 0.1;
smoother GaussSeidel;
}
"(U|k|epsilon|omega|f|v2)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0.1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
consistent yes;
residualControl
{
p 1e-2;
U 1e-3;
"(k|epsilon|omega|f|v2)" 1e-3;
}
}
relaxationFactors
{
equations
{
//- Constant relaxation factor
//U 0.9; // 0.9 is more stable but 0.95 more convergent
//- Control relaxation factor through time-based table
//U table
//(
// (0 0.7)
// (100 0.95)
//);
//- Control relaxation factor through registered variable
//- (type uniformDimensionedScalarField) controlled by functionObject
U lookup;
name banana;
".*" 0.95; // 0.9 is more stable but 0.95 more convergent
}
}
// ************************************************************************* //