mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
SRFModel: Changes origin to be user-input rather than hard-coded to (0 0 0)
Updated tutorials
This commit is contained in:
@ -2,7 +2,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) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -59,6 +59,7 @@ Foam::SRF::SRFModel::SRFModel
|
|||||||
),
|
),
|
||||||
Urel_(Urel),
|
Urel_(Urel),
|
||||||
mesh_(Urel_.mesh()),
|
mesh_(Urel_.mesh()),
|
||||||
|
origin_("origin", dimLength, lookup("origin")),
|
||||||
axis_(lookup("axis")),
|
axis_(lookup("axis")),
|
||||||
SRFModelCoeffs_(subDict(type + "Coeffs")),
|
SRFModelCoeffs_(subDict(type + "Coeffs")),
|
||||||
omega_(dimensionedVector("omega", dimless/dimTime, vector::zero))
|
omega_(dimensionedVector("omega", dimless/dimTime, vector::zero))
|
||||||
@ -80,6 +81,9 @@ bool Foam::SRF::SRFModel::read()
|
|||||||
{
|
{
|
||||||
if (regIOobject::read())
|
if (regIOobject::read())
|
||||||
{
|
{
|
||||||
|
// Re-read origin
|
||||||
|
lookup("origin") >> origin_;
|
||||||
|
|
||||||
// Re-read axis
|
// Re-read axis
|
||||||
lookup("axis") >> axis_;
|
lookup("axis") >> axis_;
|
||||||
axis_ /= mag(axis_);
|
axis_ /= mag(axis_);
|
||||||
@ -96,6 +100,12 @@ bool Foam::SRF::SRFModel::read()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::dimensionedVector& Foam::SRF::SRFModel::origin() const
|
||||||
|
{
|
||||||
|
return origin_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::vector& Foam::SRF::SRFModel::axis() const
|
const Foam::vector& Foam::SRF::SRFModel::axis() const
|
||||||
{
|
{
|
||||||
return axis_;
|
return axis_;
|
||||||
@ -144,7 +154,7 @@ Foam::SRF::SRFModel::Fcentrifugal() const
|
|||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
omega_ ^ (omega_ ^ mesh_.C())
|
omega_ ^ (omega_ ^ (mesh_.C() - origin_))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -163,7 +173,11 @@ Foam::vectorField Foam::SRF::SRFModel::velocity
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<vectorField> tfld =
|
tmp<vectorField> tfld =
|
||||||
omega_.value() ^ (positions - axis_*(axis_ & positions));
|
omega_.value()
|
||||||
|
^ (
|
||||||
|
(positions - origin_.value())
|
||||||
|
- axis_*(axis_ & (positions - origin_.value()))
|
||||||
|
);
|
||||||
|
|
||||||
return tfld();
|
return tfld();
|
||||||
}
|
}
|
||||||
@ -183,7 +197,8 @@ Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const
|
|||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
omega_ ^ (mesh_.C() - axis_*(axis_ & mesh_.C()))
|
omega_
|
||||||
|
^ ((mesh_.C() - origin_) - axis_*(axis_ & (mesh_.C() - origin_)))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -75,6 +75,9 @@ protected:
|
|||||||
//- Reference to the mesh
|
//- Reference to the mesh
|
||||||
const fvMesh& mesh_;
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
|
//- Origin of the axis
|
||||||
|
dimensionedVector origin_;
|
||||||
|
|
||||||
//- Axis of rotation, a direction vector which passes through the origin
|
//- Axis of rotation, a direction vector which passes through the origin
|
||||||
vector axis_;
|
vector axis_;
|
||||||
|
|
||||||
@ -149,6 +152,9 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Return the origin of rotation
|
||||||
|
const dimensionedVector& origin() const;
|
||||||
|
|
||||||
//- Return the axis of rotation
|
//- Return the axis of rotation
|
||||||
const vector& axis() const;
|
const vector& axis() const;
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
SRFModel rpm;
|
SRFModel rpm;
|
||||||
|
|
||||||
|
origin (0 0 0);
|
||||||
axis (0 0 1);
|
axis (0 0 1);
|
||||||
|
|
||||||
rpmCoeffs
|
rpmCoeffs
|
||||||
|
|||||||
@ -17,7 +17,8 @@ FoamFile
|
|||||||
|
|
||||||
SRFModel rpm;
|
SRFModel rpm;
|
||||||
|
|
||||||
axis ( 0 0 1 );
|
origin (0 0 0);
|
||||||
|
axis (0 0 1);
|
||||||
|
|
||||||
rpmCoeffs
|
rpmCoeffs
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user