ENH: configurable output temperature for externalCoupled mixed T BC (#1072)
- Uses the user-specified value for outputTemperature: { type externalCoupledTemperature; outputTemperture fluid; // or wall; } Otherwises uses 'wall' as a default (for compatibility) and emits a warning. The T.out header now reflects the type of output. Eg, # Values: area Tfluid qDot htc
This commit is contained in:
parent
1116ba803a
commit
550e47629b
@ -95,14 +95,6 @@ externalCoupledMixedFvPatchField
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::externalCoupledMixedFvPatchField<Type>::
|
|
||||||
~externalCoupledMixedFvPatchField()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
@ -146,19 +146,19 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~externalCoupledMixedFvPatchField();
|
virtual ~externalCoupledMixedFvPatchField() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Write header
|
//- Write header
|
||||||
virtual void writeHeader(Ostream&) const;
|
virtual void writeHeader(Ostream& os) const;
|
||||||
|
|
||||||
//- Write data
|
//- Write data
|
||||||
virtual void writeData(Ostream&) const;
|
virtual void writeData(Ostream& os) const;
|
||||||
|
|
||||||
//- Read data
|
//- Read data
|
||||||
virtual void readData(Istream&);
|
virtual void readData(Istream& is);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,6 +28,21 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "fvPatchFieldMapper.H"
|
#include "fvPatchFieldMapper.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
#include "Enum.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
|
||||||
|
outputTemperatureType
|
||||||
|
>
|
||||||
|
Foam::externalCoupledTemperatureMixedFvPatchScalarField::outputTemperatureNames
|
||||||
|
({
|
||||||
|
{ outputTemperatureType::FLUID, "fluid" },
|
||||||
|
{ outputTemperatureType::WALL, "wall" },
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -36,7 +51,14 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeHeader
|
|||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
os << "# Values: magSf T qDot htc" << endl;
|
if (outputTemperature_ == outputTemperatureType::FLUID)
|
||||||
|
{
|
||||||
|
os << "# Values: area Tfluid qDot htc" << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << "# Values: area Twall qDot htc" << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +71,8 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
|||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
externalCoupledMixedFvPatchField<scalar>(p, iF)
|
externalCoupledMixedFvPatchField<scalar>(p, iF),
|
||||||
|
outputTemperature_(outputTemperatureType::WALL)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +85,8 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
|||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
externalCoupledMixedFvPatchField<scalar>(ptf, p, iF, mapper)
|
externalCoupledMixedFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
|
outputTemperature_(ptf.outputTemperature_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -75,8 +99,23 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
//externalCoupledMixedFvPatchField<scalar>(p, iF, dict)
|
//externalCoupledMixedFvPatchField<scalar>(p, iF, dict)
|
||||||
externalCoupledMixedFvPatchField<scalar>(p, iF)
|
externalCoupledMixedFvPatchField<scalar>(p, iF),
|
||||||
|
outputTemperature_(outputTemperatureType::WALL)
|
||||||
{
|
{
|
||||||
|
if (dict.found("outputTemperature"))
|
||||||
|
{
|
||||||
|
outputTemperature_ =
|
||||||
|
outputTemperatureNames.get("outputTemperature", dict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "outputTemperature not specified "
|
||||||
|
<< flatOutput(outputTemperatureNames) << nl
|
||||||
|
<< "using 'wall' as compatibility default" << nl
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (dict.found("refValue"))
|
if (dict.found("refValue"))
|
||||||
{
|
{
|
||||||
// Initialise same way as mixed
|
// Initialise same way as mixed
|
||||||
@ -116,7 +155,8 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
|||||||
const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf
|
const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
externalCoupledMixedFvPatchField<scalar>(ecmpf)
|
externalCoupledMixedFvPatchField<scalar>(ecmpf),
|
||||||
|
outputTemperature_(ecmpf.outputTemperature_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -127,14 +167,8 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
|||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
externalCoupledMixedFvPatchField<scalar>(ecmpf, iF)
|
externalCoupledMixedFvPatchField<scalar>(ecmpf, iF),
|
||||||
{}
|
outputTemperature_(ecmpf.outputTemperature_)
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
|
|
||||||
~externalCoupledTemperatureMixedFvPatchScalarField()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +182,7 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
|
|||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
// Heat flux [W/m2]
|
// Heat flux [W/m2]
|
||||||
scalarField qDot(this->patch().size(), 0.0);
|
scalarField qDot(this->patch().size(), Zero);
|
||||||
|
|
||||||
typedef compressible::turbulenceModel cmpTurbModelType;
|
typedef compressible::turbulenceModel cmpTurbModelType;
|
||||||
|
|
||||||
@ -189,10 +223,11 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
|
|||||||
<< "thermo model to be available" << exit(FatalError);
|
<< "thermo model to be available" << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patch temperature [K]
|
|
||||||
|
// Patch (wall) temperature [K]
|
||||||
const scalarField& Tp(*this);
|
const scalarField& Tp(*this);
|
||||||
|
|
||||||
// Near wall cell temperature [K]
|
// Near wall cell (fluid) temperature [K]
|
||||||
const scalarField Tc(patchInternalField());
|
const scalarField Tc(patchInternalField());
|
||||||
|
|
||||||
// Heat transfer coefficient [W/m2/K]
|
// Heat transfer coefficient [W/m2/K]
|
||||||
@ -200,13 +235,19 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
|
|||||||
|
|
||||||
const Field<scalar>& magSf(this->patch().magSf());
|
const Field<scalar>& magSf(this->patch().magSf());
|
||||||
|
|
||||||
|
const UList<scalar>& Tout =
|
||||||
|
(
|
||||||
|
outputTemperature_ == outputTemperatureType::FLUID
|
||||||
|
? Tc
|
||||||
|
: Tp
|
||||||
|
);
|
||||||
|
|
||||||
forAll(patch(), facei)
|
forAll(patch(), facei)
|
||||||
{
|
{
|
||||||
os << magSf[facei] << token::SPACE
|
os << magSf[facei] << token::SPACE
|
||||||
<< Tp[facei] << token::SPACE
|
<< Tout[facei] << token::SPACE
|
||||||
<< qDot[facei] << token::SPACE
|
<< qDot[facei] << token::SPACE
|
||||||
<< htc[facei] << token::SPACE
|
<< htc[facei] << nl;
|
||||||
<< nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +276,20 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::readData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::externalCoupledTemperatureMixedFvPatchScalarField::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
externalCoupledMixedFvPatchField::write(os);
|
||||||
|
os.writeEntry
|
||||||
|
(
|
||||||
|
"outputTemperature",
|
||||||
|
outputTemperatureNames[outputTemperature_]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -87,6 +87,14 @@ Description
|
|||||||
To be used in combination with the functionObjects::externalCoupled
|
To be used in combination with the functionObjects::externalCoupled
|
||||||
functionObject.
|
functionObject.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
outputTemperature | The output temperature: fluid/wall | yes |
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Note the
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
externalCoupledFunctionObject
|
externalCoupledFunctionObject
|
||||||
mixedFvPatchField
|
mixedFvPatchField
|
||||||
@ -101,6 +109,7 @@ SourceFiles
|
|||||||
#define externalCoupledTemperatureMixedFvPatchScalarField_H
|
#define externalCoupledTemperatureMixedFvPatchScalarField_H
|
||||||
|
|
||||||
#include "externalCoupledMixedFvPatchFields.H"
|
#include "externalCoupledMixedFvPatchFields.H"
|
||||||
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -115,6 +124,24 @@ class externalCoupledTemperatureMixedFvPatchScalarField
|
|||||||
:
|
:
|
||||||
public externalCoupledMixedFvPatchField<scalar>
|
public externalCoupledMixedFvPatchField<scalar>
|
||||||
{
|
{
|
||||||
|
// Data Types
|
||||||
|
|
||||||
|
//- Location for the ouput temperature
|
||||||
|
enum outputTemperatureType
|
||||||
|
{
|
||||||
|
FLUID, //!< Use fluid (cell) temperature
|
||||||
|
WALL //!< Use wall (patch) temperature
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Names for outputTemperatureType
|
||||||
|
static const Enum<outputTemperatureType> outputTemperatureNames;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Location for the ouput temperature
|
||||||
|
enum outputTemperatureType outputTemperature_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -189,19 +216,22 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~externalCoupledTemperatureMixedFvPatchScalarField();
|
virtual ~externalCoupledTemperatureMixedFvPatchScalarField() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Write header
|
//- Write header
|
||||||
virtual void writeHeader(Ostream&) const;
|
virtual void writeHeader(Ostream& os) const;
|
||||||
|
|
||||||
//- Write data
|
//- Write data
|
||||||
virtual void writeData(Ostream&) const;
|
virtual void writeData(Ostream& os) const;
|
||||||
|
|
||||||
//- Read data
|
//- Read data
|
||||||
virtual void readData(Istream&);
|
virtual void readData(Istream& is);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object T;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 1 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 300;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue $internalField;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
inletWalls
|
||||||
|
{
|
||||||
|
type mixed;
|
||||||
|
refValue uniform 250;
|
||||||
|
refGradient uniform 0;
|
||||||
|
valueFraction uniform 1;
|
||||||
|
value uniform 250;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(?i).*walls"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,42 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: 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
|
||||||
|
{
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type flowRateInletVelocity;
|
||||||
|
massFlowRate constant 0.01;
|
||||||
|
rhoInlet 1000; // Guess for rho
|
||||||
|
}
|
||||||
|
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type pressureInletOutletVelocity;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(?i).*walls"
|
||||||
|
{
|
||||||
|
type noSlip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,43 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object alphat;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -1 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(?i).*walls"
|
||||||
|
{
|
||||||
|
type compressible::alphatWallFunction;
|
||||||
|
Prt 0.85;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,47 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: 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 200;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type turbulentMixingLengthDissipationRateInlet;
|
||||||
|
mixingLength 0.005;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue $internalField;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(?i).*walls"
|
||||||
|
{
|
||||||
|
type epsilonWallFunction;
|
||||||
|
Cmu 0.09;
|
||||||
|
kappa 0.41;
|
||||||
|
E 9.8;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,44 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: 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 1;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type turbulentIntensityKineticEnergyInlet;
|
||||||
|
intensity 0.05;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue $internalField;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(?i).*walls"
|
||||||
|
{
|
||||||
|
type kqRWallFunction;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,45 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: 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
|
||||||
|
{
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(?i).*walls"
|
||||||
|
{
|
||||||
|
type nutkWallFunction;
|
||||||
|
Cmu 0.09;
|
||||||
|
kappa 0.41;
|
||||||
|
E 9.8;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,40 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object p;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 1e5;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(?i).*walls"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
|
||||||
|
|
||||||
|
cleanCase0
|
||||||
|
|
||||||
|
rm externalCoupled.control 2> /dev/null
|
||||||
|
|
||||||
|
rm -rf comms
|
||||||
|
### rm -rf VTK
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
81
tutorials/compressible/rhoPimpleFoam/RAS/externalCoupledSquareBendLiq/Allrun
Executable file
81
tutorials/compressible/rhoPimpleFoam/RAS/externalCoupledSquareBendLiq/Allrun
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
|
||||||
|
./Allrun.pre
|
||||||
|
|
||||||
|
unset coupling parallel testCreate
|
||||||
|
|
||||||
|
isTrue -dict controls -entry coupling && coupling=true
|
||||||
|
isTrue -dict controls -entry parallel && parallel=true
|
||||||
|
# isTrue -dict controls -entry testCreate && testCreate=true
|
||||||
|
|
||||||
|
# Remove lock file on interrupt
|
||||||
|
trap '\rm -f comms/OpenFOAM.lock 2>/dev/null' INT
|
||||||
|
|
||||||
|
# Decompose
|
||||||
|
if [ "$parallel" = true ]
|
||||||
|
then
|
||||||
|
runApplication decomposePar
|
||||||
|
|
||||||
|
# ## Can verify parallel operation of createExternalCoupledPatchGeometry
|
||||||
|
if [ "$coupling" = true ] && [ "$testCreate" = true ]
|
||||||
|
then
|
||||||
|
\rm -f log.createExternalCoupledPatchGeometry
|
||||||
|
runParallel createExternalCoupledPatchGeometry \
|
||||||
|
coupleGroup \
|
||||||
|
-commsDir $PWD/comms
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$coupling" = true ]
|
||||||
|
then
|
||||||
|
|
||||||
|
echo "Running with external coupling"
|
||||||
|
|
||||||
|
# Controls
|
||||||
|
cat << CONTROLS >| externalCoupled.control
|
||||||
|
//- Overrides for externalCoupled
|
||||||
|
enabled true;
|
||||||
|
CONTROLS
|
||||||
|
|
||||||
|
# Run OpenFOAM, with externalCoupled enabled
|
||||||
|
if [ "$parallel" = true ]
|
||||||
|
then
|
||||||
|
runParallel $(getApplication) &
|
||||||
|
else
|
||||||
|
runApplication $(getApplication) &
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Simulated external solver
|
||||||
|
runApplication ./externalSolver
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
echo "Running without external coupling"
|
||||||
|
|
||||||
|
# Controls
|
||||||
|
cat << CONTROLS >| externalCoupled.control
|
||||||
|
//- Overrides for externalCoupled
|
||||||
|
enabled false;
|
||||||
|
CONTROLS
|
||||||
|
|
||||||
|
# Run OpenFOAM, with externalCoupled disabled
|
||||||
|
if [ "$parallel" = true ]
|
||||||
|
then
|
||||||
|
runParallel $(getApplication)
|
||||||
|
else
|
||||||
|
runApplication $(getApplication)
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Reconstruct
|
||||||
|
if [ "$parallel" = true ]
|
||||||
|
then
|
||||||
|
runApplication reconstructPar
|
||||||
|
fi
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
|
||||||
|
runApplication blockMesh
|
||||||
|
|
||||||
|
# Restore initial fields
|
||||||
|
restore0Dir
|
||||||
|
|
||||||
|
# Controls
|
||||||
|
unset coupling testCreate
|
||||||
|
isTrue -dict controls -entry coupling && coupling=true
|
||||||
|
isTrue -dict controls -entry testCreate && testCreate=true
|
||||||
|
|
||||||
|
if [ "$coupling" = true ]
|
||||||
|
then
|
||||||
|
runApplication changeDictionary
|
||||||
|
|
||||||
|
# Create coupling geometry
|
||||||
|
runApplication createExternalCoupledPatchGeometry coupleGroup
|
||||||
|
fi
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
@ -0,0 +1,30 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object thermophysicalProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermoType
|
||||||
|
{
|
||||||
|
type heRhoThermo;
|
||||||
|
mixture pureMixture;
|
||||||
|
properties liquid;
|
||||||
|
energy sensibleInternalEnergy;
|
||||||
|
}
|
||||||
|
|
||||||
|
mixture
|
||||||
|
{
|
||||||
|
H2O;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,28 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object turbulenceProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
simulationType RAS;
|
||||||
|
|
||||||
|
RAS
|
||||||
|
{
|
||||||
|
RASModel kEpsilon;
|
||||||
|
|
||||||
|
turbulence on;
|
||||||
|
|
||||||
|
printCoeffs on;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,25 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object controls;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Tutorial controls
|
||||||
|
|
||||||
|
coupling true;
|
||||||
|
|
||||||
|
parallel true;
|
||||||
|
|
||||||
|
testCreate true;
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,214 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
|
||||||
|
# Dummy external solver to communicate with OpenFOAM via externalCoupled
|
||||||
|
# functionObject
|
||||||
|
#
|
||||||
|
# Functionality is hard-coded for particular test case
|
||||||
|
# - it simply return a patch temperature of 500K.
|
||||||
|
# Since the default temperature on the patch is 250K, this can be used
|
||||||
|
# to readily detect if the external values are being used.
|
||||||
|
#
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
action="$1"
|
||||||
|
|
||||||
|
# Check for unassigned variables
|
||||||
|
set -u
|
||||||
|
|
||||||
|
commsDir="comms"
|
||||||
|
patchDir="coupleGroup"
|
||||||
|
fieldName="T"
|
||||||
|
|
||||||
|
lockFile="${commsDir}/OpenFOAM.lock"
|
||||||
|
dataFile="${commsDir}/${patchDir}/${fieldName}"
|
||||||
|
waitSec=5
|
||||||
|
timeOut=100
|
||||||
|
nSteps=1000 # maximum number of time steps. Note: should be more than
|
||||||
|
# number of iterations on the OpenFOAM side
|
||||||
|
|
||||||
|
stopAt=600 # external solver signals OpenFOAM to stop
|
||||||
|
|
||||||
|
refValue1=500
|
||||||
|
refGrad=0
|
||||||
|
valueFraction=1
|
||||||
|
|
||||||
|
# Remove any old junk
|
||||||
|
\rm -f $lockFile 2>/dev/null
|
||||||
|
|
||||||
|
log()
|
||||||
|
{
|
||||||
|
echo "External: $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Create lock file to pass control to OpenFOAM
|
||||||
|
useMaster()
|
||||||
|
{
|
||||||
|
log "creating lock file '${lockFile}'"
|
||||||
|
echo "status=openfoam" >| ${lockFile}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Lock file with special content to stop OpenFOAM master
|
||||||
|
stopMasterNow()
|
||||||
|
{
|
||||||
|
log "writeNow terminate via lock file '${lockFile}'"
|
||||||
|
echo "action=writeNow" >| ${lockFile}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Patch size (inletWalls)
|
||||||
|
nFaces1=$(getNumberOfPatchFaces inletWalls) || exit $?
|
||||||
|
|
||||||
|
|
||||||
|
init()
|
||||||
|
{
|
||||||
|
log "init - creating ${dataFile}.in"
|
||||||
|
cat /dev/null >| "${dataFile}.in"
|
||||||
|
|
||||||
|
# Local face counter, Local refValue
|
||||||
|
local nFaces refValue
|
||||||
|
|
||||||
|
# Patch inletWalls
|
||||||
|
|
||||||
|
nFaces="$nFaces1"
|
||||||
|
refValue="$refValue1"
|
||||||
|
|
||||||
|
log "init - adding $nFaces data elements with refValue $refValue"
|
||||||
|
|
||||||
|
while [ "$nFaces" -gt 0 ]
|
||||||
|
do
|
||||||
|
nFaces=$((nFaces - 1))
|
||||||
|
# Hard-coded output for patch
|
||||||
|
echo "$refValue $refGrad $valueFraction"
|
||||||
|
done >> "${dataFile}.in"
|
||||||
|
|
||||||
|
|
||||||
|
# Verify line count?
|
||||||
|
# log "init ($(wc -l ${dataFile}.in))"
|
||||||
|
|
||||||
|
# Give time for T.in file to flush
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
useMaster
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Calculate average temperature
|
||||||
|
# Extract from:
|
||||||
|
#
|
||||||
|
# ----
|
||||||
|
# # Values: area Twall qDot htc
|
||||||
|
# 6.25e-06 500 3.53296e+06 20884
|
||||||
|
# ----
|
||||||
|
avgTemperature()
|
||||||
|
{
|
||||||
|
local file="$1"
|
||||||
|
local tempType
|
||||||
|
local avg
|
||||||
|
|
||||||
|
tempType=$(sed -ne '1{s/^.* \(T[^ ]*\).*$/\1/p; q}' "$file")
|
||||||
|
avg=$(awk 'BEGIN {area=0; sum=0;}END{print sum/area}{if (/^[0-9]/) {area += $1; sum += ($1 * $2);}}' "$file")
|
||||||
|
|
||||||
|
echo "${file##*/} : $tempType avg=$avg"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
loop()
|
||||||
|
{
|
||||||
|
echo "Executing dummy external solver"
|
||||||
|
|
||||||
|
local totalWait=0
|
||||||
|
local step=0
|
||||||
|
local nFaces refValue
|
||||||
|
|
||||||
|
while [ $step -lt $nSteps ]
|
||||||
|
do
|
||||||
|
if [ -f $lockFile ]
|
||||||
|
then
|
||||||
|
if grep -q "status=done" ${lockFile}
|
||||||
|
then
|
||||||
|
log "found lock file '${lockFile}' with 'status=done' - finished"
|
||||||
|
break
|
||||||
|
elif [ -s $lockFile ]
|
||||||
|
then
|
||||||
|
log "found lock file '${lockFile}' containing '$(< $lockFile)' - waiting"
|
||||||
|
else
|
||||||
|
log "found lock file '${lockFile}' - waiting"
|
||||||
|
fi
|
||||||
|
|
||||||
|
totalWait=$(expr $totalWait + $waitSec)
|
||||||
|
if [ $totalWait -gt $timeOut ]
|
||||||
|
then
|
||||||
|
log "timeout"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
sleep $waitSec
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
totalWait=0
|
||||||
|
step=$(expr $step + 1)
|
||||||
|
log "step $step"
|
||||||
|
log "lock not present - taking control"
|
||||||
|
|
||||||
|
log "sleeping for $waitSec secs to simulate external process"
|
||||||
|
sleep $waitSec
|
||||||
|
|
||||||
|
log "updating ${dataFile}.in from ${dataFile}.out"
|
||||||
|
|
||||||
|
if [ -f "${dataFile}.out" ]
|
||||||
|
then
|
||||||
|
|
||||||
|
avgTemperature "${dataFile}.out"
|
||||||
|
|
||||||
|
cat /dev/null >| "${dataFile}.in"
|
||||||
|
|
||||||
|
# Hard-coded output for patch
|
||||||
|
nFaces="$nFaces1"
|
||||||
|
refValue="$refValue1"
|
||||||
|
|
||||||
|
while [ "$nFaces" -gt 0 ]
|
||||||
|
do
|
||||||
|
nFaces=$((nFaces - 1))
|
||||||
|
echo "$refValue $refGrad $valueFraction"
|
||||||
|
done >> "${dataFile}.in"
|
||||||
|
|
||||||
|
else
|
||||||
|
log "Warning: no such file ${dataFile}.out"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${stopAt:-0}" -eq $step ]
|
||||||
|
then
|
||||||
|
stopMasterNow
|
||||||
|
else
|
||||||
|
useMaster
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Create the comms directory
|
||||||
|
mkdir -p ${commsDir}/${patchDir}
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
|
-once | once)
|
||||||
|
echo "One-shot triggering"
|
||||||
|
init
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
# Tutorial case uses 'initByExternal' option,
|
||||||
|
# so we must provide initial values
|
||||||
|
init
|
||||||
|
|
||||||
|
loop
|
||||||
|
|
||||||
|
log "done"
|
||||||
|
|
||||||
|
# Cleanup. Remove the lock file
|
||||||
|
\rm -f $lockFile 2>/dev/null
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
@ -0,0 +1,119 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object blockMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
scale 0.001;
|
||||||
|
|
||||||
|
vertices
|
||||||
|
(
|
||||||
|
// front-plane: z = +25mm
|
||||||
|
// inlet region
|
||||||
|
( -50 25 25) // pt 0
|
||||||
|
( 0 25 25) // pt 1
|
||||||
|
( -50 75 25) // pt 2
|
||||||
|
( 0 75 25) // pt 3
|
||||||
|
// outlet region
|
||||||
|
( -500 -75 25) // pt 4
|
||||||
|
( 0 -75 25) // pt 5
|
||||||
|
( -500 -25 25) // pt 6
|
||||||
|
( 0 -25 25) // pt 7
|
||||||
|
// bend mid-points
|
||||||
|
( 25 0 25) // pt 8
|
||||||
|
( 75 0 25) // pt 9
|
||||||
|
// back-plane: z = -25mm
|
||||||
|
// inlet region
|
||||||
|
( -50 25 -25) // pt 0 + 10
|
||||||
|
( 0 25 -25) // pt 1 + 10
|
||||||
|
( -50 75 -25) // pt 2 + 10
|
||||||
|
( 0 75 -25) // pt 3 + 10
|
||||||
|
// outlet region
|
||||||
|
( -500 -75 -25) // pt 4 + 10
|
||||||
|
( 0 -75 -25) // pt 5 + 10
|
||||||
|
( -500 -25 -25) // pt 7 + 10
|
||||||
|
( 0 -25 -25) // pt 8 + 10
|
||||||
|
// bend mid-points
|
||||||
|
( 25 0 -25) // pt 8 + 10
|
||||||
|
( 75 0 -25) // pt 9 + 10
|
||||||
|
);
|
||||||
|
|
||||||
|
blocks
|
||||||
|
(
|
||||||
|
hex (0 1 11 10 2 3 13 12) inlet ( 20 20 20) simpleGrading (1 1 1)
|
||||||
|
hex (4 5 15 14 6 7 17 16) outlet (200 20 20) simpleGrading (1 1 1)
|
||||||
|
|
||||||
|
hex (1 8 18 11 3 9 19 13) bend1 ( 30 20 20) simpleGrading (1 1 1)
|
||||||
|
hex (5 9 19 15 7 8 18 17) bend2 ( 30 20 20) simpleGrading (1 1 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
edges
|
||||||
|
(
|
||||||
|
// block 2
|
||||||
|
arc 1 8 ( 17.678 17.678 25)
|
||||||
|
arc 11 18 ( 17.678 17.678 -25)
|
||||||
|
arc 3 9 ( 53.033 53.033 25)
|
||||||
|
arc 13 19 ( 53.033 53.033 -25)
|
||||||
|
// block 3
|
||||||
|
arc 7 8 ( 17.678 -17.678 25)
|
||||||
|
arc 17 18 ( 17.678 -17.678 -25)
|
||||||
|
arc 5 9 ( 53.033 -53.033 25)
|
||||||
|
arc 15 19 ( 53.033 -53.033 -25)
|
||||||
|
);
|
||||||
|
|
||||||
|
boundary
|
||||||
|
(
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
faces
|
||||||
|
(
|
||||||
|
(0 2 12 10)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
faces
|
||||||
|
(
|
||||||
|
(4 6 16 14)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
inletWalls
|
||||||
|
{
|
||||||
|
type wall;
|
||||||
|
faces
|
||||||
|
(
|
||||||
|
// block0
|
||||||
|
( 0 1 3 2 )
|
||||||
|
( 11 10 12 13 )
|
||||||
|
( 0 10 11 1 )
|
||||||
|
( 2 3 13 12 )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
mergePatchPairs
|
||||||
|
(
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// The defaultFaces == outside "walls"
|
||||||
|
defaultPatch
|
||||||
|
{
|
||||||
|
name walls;
|
||||||
|
type wall;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,38 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object changeDictionaryDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
boundary
|
||||||
|
{
|
||||||
|
inletWalls
|
||||||
|
{
|
||||||
|
inGroups (coupleGroup wall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
T
|
||||||
|
{
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inletWalls
|
||||||
|
{
|
||||||
|
type externalCoupledTemperature;
|
||||||
|
// outputTemperature fluid; // fluid|wall
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,65 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Library defines new boundary conditions
|
||||||
|
libs ("libOpenFOAM.so" "libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
application rhoPimpleFoam;
|
||||||
|
|
||||||
|
startFrom startTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 0.5;
|
||||||
|
|
||||||
|
deltaT 2e-3;
|
||||||
|
|
||||||
|
writeControl timeStep;
|
||||||
|
|
||||||
|
writeInterval 10;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
|
writePrecision 6;
|
||||||
|
|
||||||
|
writeCompression off;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
graphFormat raw;
|
||||||
|
|
||||||
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
#include "externalCoupled"
|
||||||
|
|
||||||
|
minMax
|
||||||
|
{
|
||||||
|
type fieldMinMax;
|
||||||
|
libs ("libfieldFunctionObjects.so");
|
||||||
|
fields (T);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,34 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object decomposeParDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
numberOfSubdomains 8;
|
||||||
|
|
||||||
|
method hierarchical;
|
||||||
|
|
||||||
|
simpleCoeffs
|
||||||
|
{
|
||||||
|
n (8 1 1);
|
||||||
|
delta 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
|
hierarchicalCoeffs
|
||||||
|
{
|
||||||
|
n (4 2 1);
|
||||||
|
delta 0.001;
|
||||||
|
order xyz;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,40 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
|
||||||
|
// Control for external coupled simulation
|
||||||
|
externalCoupled
|
||||||
|
{
|
||||||
|
type externalCoupled;
|
||||||
|
libs ("libfieldFunctionObjects.so");
|
||||||
|
log true;
|
||||||
|
|
||||||
|
executeControl timeStep;
|
||||||
|
|
||||||
|
// Directory to use for communication
|
||||||
|
commsDir "<case>/comms";
|
||||||
|
|
||||||
|
// Does external process start first
|
||||||
|
initByExternal true;
|
||||||
|
|
||||||
|
regions
|
||||||
|
{
|
||||||
|
// Region name (wildcards allowed)
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
// Patch or patchGroup
|
||||||
|
coupleGroup
|
||||||
|
{
|
||||||
|
// Fields to output in commsDir
|
||||||
|
writeFields (T);
|
||||||
|
|
||||||
|
// Fields to read from commsDir
|
||||||
|
readFields (T);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enabled or not?
|
||||||
|
#sinclude "<case>/externalCoupled.control"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,58 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object fvSchemes;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ddtSchemes
|
||||||
|
{
|
||||||
|
default Euler;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear;
|
||||||
|
|
||||||
|
limited cellLimited Gauss linear 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
default none;
|
||||||
|
|
||||||
|
div(phi,U) Gauss linearUpwind limited;
|
||||||
|
div(phi,e) Gauss linearUpwind limited;
|
||||||
|
div(phi,epsilon) Gauss linearUpwind limited;
|
||||||
|
div(phi,k) Gauss linearUpwind limited;
|
||||||
|
div(phi,K) Gauss linearUpwind limited;
|
||||||
|
div(phiv,p) Gauss linearUpwind limited;
|
||||||
|
|
||||||
|
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
laplacianSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
interpolationSchemes
|
||||||
|
{
|
||||||
|
default linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
snGradSchemes
|
||||||
|
{
|
||||||
|
default corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,62 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object fvSolution;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
solvers
|
||||||
|
{
|
||||||
|
"rho.*"
|
||||||
|
{
|
||||||
|
solver nthn;
|
||||||
|
}
|
||||||
|
|
||||||
|
"p.*"
|
||||||
|
{
|
||||||
|
solver GAMG;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
|
||||||
|
tolerance 1e-7;
|
||||||
|
relTol 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(U|e|k|epsilon).*"
|
||||||
|
{
|
||||||
|
solver PBiCGStab;
|
||||||
|
preconditioner DILU;
|
||||||
|
|
||||||
|
tolerance 1e-7;
|
||||||
|
relTol 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PIMPLE
|
||||||
|
{
|
||||||
|
nCorrectors 3;
|
||||||
|
nNonOrthogonalCorrectors 0;
|
||||||
|
pMinFactor 0.1;
|
||||||
|
pMaxFactor 1.5;
|
||||||
|
|
||||||
|
transonic no;
|
||||||
|
consistent no;
|
||||||
|
}
|
||||||
|
|
||||||
|
relaxationFactors
|
||||||
|
{
|
||||||
|
equations
|
||||||
|
{
|
||||||
|
".*" 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
Loading…
Reference in New Issue
Block a user