SRFModel: Changes origin to be user-input rather than hard-coded to (0 0 0)

Updated tutorials
This commit is contained in:
Henry 2015-04-26 11:28:14 +01:00
parent 0a6ca7ae45
commit 5b1edc73b1
4 changed files with 29 additions and 6 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,6 +59,7 @@ Foam::SRF::SRFModel::SRFModel
),
Urel_(Urel),
mesh_(Urel_.mesh()),
origin_("origin", dimLength, lookup("origin")),
axis_(lookup("axis")),
SRFModelCoeffs_(subDict(type + "Coeffs")),
omega_(dimensionedVector("omega", dimless/dimTime, vector::zero))
@ -80,6 +81,9 @@ bool Foam::SRF::SRFModel::read()
{
if (regIOobject::read())
{
// Re-read origin
lookup("origin") >> origin_;
// Re-read axis
lookup("axis") >> 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
{
return axis_;
@ -144,7 +154,7 @@ Foam::SRF::SRFModel::Fcentrifugal() const
IOobject::NO_READ,
IOobject::NO_WRITE
),
omega_ ^ (omega_ ^ mesh_.C())
omega_ ^ (omega_ ^ (mesh_.C() - origin_))
)
);
}
@ -163,7 +173,11 @@ Foam::vectorField Foam::SRF::SRFModel::velocity
) const
{
tmp<vectorField> tfld =
omega_.value() ^ (positions - axis_*(axis_ & positions));
omega_.value()
^ (
(positions - origin_.value())
- axis_*(axis_ & (positions - origin_.value()))
);
return tfld();
}
@ -183,7 +197,8 @@ Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const
IOobject::NO_READ,
IOobject::NO_WRITE
),
omega_ ^ (mesh_.C() - axis_*(axis_ & mesh_.C()))
omega_
^ ((mesh_.C() - origin_) - axis_*(axis_ & (mesh_.C() - origin_)))
)
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -75,6 +75,9 @@ protected:
//- Reference to the mesh
const fvMesh& mesh_;
//- Origin of the axis
dimensionedVector origin_;
//- Axis of rotation, a direction vector which passes through the origin
vector axis_;
@ -149,6 +152,9 @@ public:
// Access
//- Return the origin of rotation
const dimensionedVector& origin() const;
//- Return the axis of rotation
const vector& axis() const;

View File

@ -17,6 +17,7 @@ FoamFile
SRFModel rpm;
origin (0 0 0);
axis (0 0 1);
rpmCoeffs

View File

@ -17,7 +17,8 @@ FoamFile
SRFModel rpm;
axis ( 0 0 1 );
origin (0 0 0);
axis (0 0 1);
rpmCoeffs
{