externalCoupledTemperatureMixedFvPatchScalarField Class Reference

This boundary condition provides a temperature interface to an external application. Values are transferred as plain text files, where OpenFOAM data is written as: More...

Inheritance diagram for externalCoupledTemperatureMixedFvPatchScalarField:
Collaboration diagram for externalCoupledTemperatureMixedFvPatchScalarField:

Public Member Functions

 TypeName ("externalCoupledTemperature")
 Runtime type information. More...
 
 externalCoupledTemperatureMixedFvPatchScalarField (const fvPatch &, const DimensionedField< scalar, fvMesh > &, const dictionary &)
 Construct from patch, internal field and dictionary. More...
 
 externalCoupledTemperatureMixedFvPatchScalarField (const externalCoupledTemperatureMixedFvPatchScalarField &, const fvPatch &, const DimensionedField< scalar, fvMesh > &, const fieldMapper &)
 Construct by mapping given. More...
 
 externalCoupledTemperatureMixedFvPatchScalarField (const externalCoupledTemperatureMixedFvPatchScalarField &)=delete
 Disallow copy without setting internal field reference. More...
 
 externalCoupledTemperatureMixedFvPatchScalarField (const externalCoupledTemperatureMixedFvPatchScalarField &, const DimensionedField< scalar, fvMesh > &)
 Copy constructor setting internal field reference. More...
 
virtual tmp< fvPatchScalarFieldclone (const DimensionedField< scalar, fvMesh > &iF) const
 Construct and return a clone setting internal field reference. More...
 
virtual ~externalCoupledTemperatureMixedFvPatchScalarField ()
 Destructor. More...
 
virtual void evaluate (const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
 Evaluate the patch field. More...
 
virtual void transferData (OFstream &os) const
 Transfer data for external source. More...
 
virtual void write (Ostream &) const
 Write. More...
 

Protected Member Functions

virtual void writeHeader (OFstream &os) const
 Write header to transfer file. More...
 

Detailed Description

This boundary condition provides a temperature interface to an external application. Values are transferred as plain text files, where OpenFOAM data is written as:

    # Patch: <patch name>
    <magSf1> <value1> <qDot1> <htc1>
    <magSf2> <value2> <qDot2> <htc2>
    <magSf3> <value3> <qDot3> <htc2>
    ...
    <magSfN> <valueN> <qDotN> <htcN>

and received as the constituent pieces of the `mixed' condition, i.e.

    # Patch: <patch name>
    <value1> <gradient1> <valueFraction1>
    <value2> <gradient2> <valueFraction2>
    <value3> <gradient3> <valueFraction3>
    ...
    <valueN> <gradientN> <valueFractionN>

Data is sent/received as a single file for all patches from the directory

    $FOAM_CASE/<commsDir>

At start-up, the boundary creates a lock file, i.e..

    OpenFOAM.lock

... to signal the external source to wait. During the boundary condition update, boundary values are written to file, e.g.

    <fileName>.out

The lock file is then removed, instructing the external source to take control of the program execution. When ready, the external program should create the return values, e.g. to file

    <fileName>.in

... and then re-instate the lock file. The boundary condition will then read the return values, and pass program execution back to OpenFOAM.

Usage
Property Description Required Default value
commsDir communications directory yes
file transfer file name yes
waitInterval interval [s] between file checks no 1
timeOut time after which error invoked [s] no 100*waitInterval
calcFrequency calculation frequency no 1
log log program control no no

Example of the boundary condition specification:

        <patchName>
        {
            type            externalCoupledTemperature;
            commsDir        "$FOAM_CASE/comms";
            file            data;
            calcFrequency   1;
        }
See also
mixedFvPatchField externalCoupledMixedFvPatchField
Source files

Definition at line 164 of file externalCoupledTemperatureMixedFvPatchScalarField.H.

Constructor & Destructor Documentation

◆ externalCoupledTemperatureMixedFvPatchScalarField() [1/4]

externalCoupledTemperatureMixedFvPatchScalarField ( const fvPatch p,
const DimensionedField< scalar, fvMesh > &  iF,
const dictionary dict 
)

Construct from patch, internal field and dictionary.

Definition at line 44 of file externalCoupledTemperatureMixedFvPatchScalarField.C.

◆ externalCoupledTemperatureMixedFvPatchScalarField() [2/4]

◆ externalCoupledTemperatureMixedFvPatchScalarField() [3/4]

Disallow copy without setting internal field reference.

◆ externalCoupledTemperatureMixedFvPatchScalarField() [4/4]

Copy constructor setting internal field reference.

Definition at line 69 of file externalCoupledTemperatureMixedFvPatchScalarField.C.

◆ ~externalCoupledTemperatureMixedFvPatchScalarField()

Member Function Documentation

◆ writeHeader()

void writeHeader ( OFstream os) const
protectedvirtual

Write header to transfer file.

Definition at line 33 of file externalCoupledTemperatureMixedFvPatchScalarField.C.

References Foam::endl().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "externalCoupledTemperature"  )

Runtime type information.

◆ clone()

virtual tmp<fvPatchScalarField> clone ( const DimensionedField< scalar, fvMesh > &  iF) const
inlinevirtual

Construct and return a clone setting internal field reference.

Definition at line 217 of file externalCoupledTemperatureMixedFvPatchScalarField.H.

◆ evaluate()

void evaluate ( const Pstream::commsTypes  commsType = Pstream::commsTypes::blocking)
virtual

Evaluate the patch field.

Definition at line 187 of file externalCoupledTemperatureMixedFvPatchScalarField.C.

References Foam::evaluate().

Here is the call graph for this function:

◆ transferData()

◆ write()

void write ( Ostream os) const
virtual

Write.

Definition at line 196 of file externalCoupledTemperatureMixedFvPatchScalarField.C.

References Foam::vtkWriteOps::write().

Here is the call graph for this function:

The documentation for this class was generated from the following files: