mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
194 lines
4.9 KiB
C++
194 lines
4.9 KiB
C++
/*--------------------------------*- C++ -*----------------------------------*\
|
|
| ========= | |
|
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
| \\ / O peration | Version: 2.3.0 |
|
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
|
| \\/ M anipulation | |
|
|
\*---------------------------------------------------------------------------*/
|
|
FoamFile
|
|
{
|
|
version 2.0;
|
|
format ascii;
|
|
class dictionary;
|
|
location "system";
|
|
object controlDict;
|
|
}
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
application potentialFoam;
|
|
|
|
startFrom startTime;
|
|
|
|
startTime 0;
|
|
|
|
stopAt endTime;
|
|
|
|
endTime 10;
|
|
|
|
deltaT 0.00125;
|
|
|
|
writeControl timeStep;
|
|
|
|
writeInterval 400;
|
|
|
|
purgeWrite 0;
|
|
|
|
writeFormat ascii;
|
|
|
|
writePrecision 6;
|
|
|
|
writeCompression off;
|
|
|
|
timeFormat general;
|
|
|
|
timePrecision 6;
|
|
|
|
runTimeModifiable true;
|
|
|
|
|
|
functions
|
|
{
|
|
probes1
|
|
{
|
|
type probes;
|
|
|
|
functionObjectLibs ("libsampling.so");
|
|
|
|
dictionary probesDict;
|
|
}
|
|
|
|
volInt
|
|
{
|
|
type cellSource;
|
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
|
enabled true;
|
|
outputControl timeStep;
|
|
log true;
|
|
valueOutput false;
|
|
source all;
|
|
operation volIntegrate;
|
|
|
|
fields
|
|
(
|
|
alphaSt
|
|
);
|
|
}
|
|
|
|
inflow
|
|
{
|
|
type faceSource;
|
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
|
outputControl timeStep;
|
|
log true;
|
|
// Output field values as well
|
|
valueOutput false;
|
|
source in;
|
|
sourceName outlet; // replace patch name!!!
|
|
operation sum;
|
|
|
|
fields
|
|
(
|
|
rho*phi*alpha // maybe fix eqn. for your purpose!!!
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
/*functions
|
|
{
|
|
difference
|
|
{
|
|
// Load the library containing the 'coded' functionObject
|
|
functionObjectLibs ("libutilityFunctionObjects.so");
|
|
type coded;
|
|
// Name of on-the-fly generated functionObject
|
|
redirectType error;
|
|
code
|
|
#{
|
|
// Lookup U
|
|
Info<< "Looking up field U\n" << endl;
|
|
const volVectorField& U = mesh().lookupObject<volVectorField>("U");
|
|
|
|
Info<< "Reading inlet velocity uInfX\n" << endl;
|
|
|
|
scalar ULeft = 0.0;
|
|
label leftI = mesh().boundaryMesh().findPatchID("left");
|
|
const fvPatchVectorField& fvp = U.boundaryField()[leftI];
|
|
if (fvp.size())
|
|
{
|
|
ULeft = fvp[0].x();
|
|
}
|
|
reduce(ULeft, maxOp<scalar>());
|
|
|
|
dimensionedScalar uInfX
|
|
(
|
|
"uInfx",
|
|
dimensionSet(0, 1, -1, 0, 0),
|
|
ULeft
|
|
);
|
|
|
|
Info << "U at inlet = " << uInfX.value() << " m/s" << endl;
|
|
|
|
|
|
scalar magCylinder = 0.0;
|
|
label cylI = mesh().boundaryMesh().findPatchID("cylinder");
|
|
const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI];
|
|
if (cylFvp.size())
|
|
{
|
|
magCylinder = mag(cylFvp[0]);
|
|
}
|
|
reduce(magCylinder, maxOp<scalar>());
|
|
|
|
dimensionedScalar radius
|
|
(
|
|
"radius",
|
|
dimensionSet(0, 1, 0, 0, 0),
|
|
magCylinder
|
|
);
|
|
|
|
Info << "Cylinder radius = " << radius.value() << " m" << endl;
|
|
|
|
volVectorField UA
|
|
(
|
|
IOobject
|
|
(
|
|
"UA",
|
|
mesh().time().timeName(),
|
|
U.mesh(),
|
|
IOobject::NO_READ,
|
|
IOobject::AUTO_WRITE
|
|
),
|
|
U
|
|
);
|
|
|
|
Info<< "\nEvaluating analytical solution" << endl;
|
|
|
|
const volVectorField& centres = UA.mesh().C();
|
|
volScalarField magCentres(mag(centres));
|
|
volScalarField theta(acos((centres & vector(1,0,0))/magCentres));
|
|
|
|
volVectorField cs2theta
|
|
(
|
|
cos(2*theta)*vector(1,0,0)
|
|
+ sin(2*theta)*vector(0,1,0)
|
|
);
|
|
|
|
UA = uInfX*(dimensionedVector(vector(1,0,0))
|
|
- pow((radius/magCentres),2)*cs2theta);
|
|
|
|
// Force writing of UA (since time has not changed)
|
|
UA.write();
|
|
|
|
volScalarField error("error", mag(U-UA)/mag(UA));
|
|
|
|
Info<<"Writing relative error in U to " << error.objectPath()
|
|
<< endl;
|
|
|
|
error.write();
|
|
#};
|
|
}
|
|
}
|
|
*/
|
|
|
|
// ************************************************************************* //
|