CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   codedFixedValue (https://www.cfd-online.com/Forums/openfoam/247114-codedfixedvalue.html)

Rotidpor January 13, 2023 10:04

codedFixedValue
 
Hello,


I'm looking for a way to use the scalar value given by a surfaceFieldValue function as a fixedValue boundary condition after each iteration. I guess I can use codedFixedValue but I don't know how to write the piece of code that would do that.


As I don't know what to do, I'm trying to code a new BC that would be something like this :


#include "fvCFD.H"
#include "surfaceFields.H"

class fixedSurfaceScalarFieldValue : public fixedValueFvPatchScalarField
{
const surfaceScalarFieldValue& surfaceFieldValue_;

public:
fixedSurfaceScalarFieldValue(const fvPatch& patch, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict)
:
fixedValueFvPatchScalarField(patch, iF),
surfaceFieldValue_(db().lookupObject<surfaceScalar FieldValue>(dict.lookup("functionObject")))
{
// empty
}

scalar value() const
{
return surfaceFieldValue_.value()(patch().Cf(), patch().index());
}
};

makePatchTypeField(fixedSurfaceScalarFieldValue);


All times are GMT -4. The time now is 19:45.