Ich habe jetzt folgenden Code. Ohne der letzten Zeile (fett gedruckt) läuft er zumindest schon durch.
code
#{
const fvPatch& boundaryPatch = patch();
const vectorField& Cf = boundaryPatch.Cf();
const vectorField& n = boundaryPatch.nf();
vectorField& field = *this;
const scalar vmin = 25.597;
const scalar vmax = 35;
const scalar dmin = 24.5;
const scalar h = 9;
forAll(Cf, faceI)
{
const scalar x = Cf[faceI].x();
const scalar z = Cf[faceI].z()-33.5;
const scalar distance = pow(x*x+z*z,0.5);
const scalar faceVel = vmin + (distance - dmin) * (vmax - vmin)/h;
field[faceI] = faceVel*n;
}
#};
Mit der letzten Zeile (Zeile 57) entstehen allerdings einige Fehler:
- processor0/0/U/boundaryField/inlet: In Elementfunktion »virtual void Foam::myInletFixedValueFvPatchVectorField::updateCoeffs()«:
- processor0/0/U/boundaryField/inlet:57:17: Fehler: no match for »operator=« (operand types are »Foam::Vector<double>« and »Foam::tmp<Foam::Field<Foam::Vector<double> > >«)
- processor0/0/U/boundaryField/inlet:57:17: Anmerkung: Kandidaten sind:
In file included from /opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/vector.H:39:0,
from /opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/point.H:35,
from /opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/pointField.H:35,
from /opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/edge.H:40,
from /opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/edgeList.H:32,
from /opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
from /opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/primitivePatch.H:35,
from /opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/polyPatch.H:43,
from /opt/OpenFOAM/OpenFOAM-8/src/finiteVolume/lnInclude/fvPatch.H:39,
from /opt/OpenFOAM/OpenFOAM-8/src/finiteVolume/lnInclude/fvPatchField.H:47,
from /opt/OpenFOAM/OpenFOAM-8/src/finiteVolume/lnInclude/fixedValueFvPatchField.H:54,
from /opt/OpenFOAM/OpenFOAM-8/src/finiteVolume/lnInclude/fixedValueFvPatchFields.H:29,
from fixedValueFvPatchFieldTemplate.H:37,
from fixedValueFvPatchFieldTemplate.C:25:
/opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/Vector.H:58:7: Anmerkung: Foam::Vector<double>& Foam::Vector<double>: perator=(const Foam::Vector<double>&)
class Vector
^
/opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/Vector.H:58:7: Anmerkung: keine bekannte Umwandlung für Argument 1 von »Foam::tmp<Foam::Field<Foam::Vector<double> > >« nach »const Foam::Vector<double>&«
/opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/Vector.H:58:7: Anmerkung: Foam::Vector<double>& Foam::Vector<double>: perator=(Foam::Vector<double>&&)
/opt/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/Vector.H:58:7: Anmerkung: keine bekannte Umwandlung für Argument 1 von »Foam::tmp<Foam::Field<Foam::Vector<double> > >« nach »Foam::Vector<double>&&«
make: *** [Make/linux64GccDPInt64Opt/fixedValueFvPatchFieldTemplate.o] Fehler 1
Ich habe versucht bei field[faceI] einen Vektor anzugeben:
const scalar nf_x = n.x();
const scalar nf_z = n.z();
field[faceI] = vector(FaceVel * nf_x, 0, FaceVel * nf_z);
Eine Aufspaltung der normal forces scheint aber nicht zu funktionieren.
Lässt sich das auf diese Art und Weise lösen? Bin für jeden Tipp dankbar.
VG
Patrick