OpenFOAM-dev / data /src /fvMeshMovers /fvMotionSolvers /pointPatchFields /derived /angularOscillatingDisplacement /angularOscillatingDisplacementPointPatchVectorField.C
Download data/src/fvMeshMovers/fvMotionSolvers/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 5.42 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/fvMeshMovers/fvMotionSolvers/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/src/fvMeshMovers/fvMotionSolvers/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
-
curl -L -o angularOscillatingDisplacementPointPatchVectorField.C https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/fvMeshMovers/fvMotionSolvers/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
5.42 kB
| /*---------------------------------------------------------------------------*\ | |
| ========= | | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | |
| \\ / O peration | Website: https://openfoam.org | |
| \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation | |
| \\/ M anipulation | | |
| ------------------------------------------------------------------------------- | |
| License | |
| This file is part of OpenFOAM. | |
| OpenFOAM is free software: you can redistribute it and/or modify it | |
| under the terms of the GNU General Public License as published by | |
| the Free Software Foundation, either version 3 of the License, or | |
| (at your option) any later version. | |
| OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| for more details. | |
| You should have received a copy of the GNU General Public License | |
| along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | |
| \*---------------------------------------------------------------------------*/ | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| namespace Foam | |
| { | |
| // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | |
| angularOscillatingDisplacementPointPatchVectorField:: | |
| angularOscillatingDisplacementPointPatchVectorField | |
| ( | |
| const pointPatch& p, | |
| const DimensionedField<vector, pointMesh>& iF, | |
| const dictionary& dict | |
| ) | |
| : | |
| fixedValuePointPatchVectorField(p, iF, dict), | |
| axis_(dict.lookup<vector>("axis", dimless)), | |
| origin_(dict.lookup<vector>("origin", dimensions::length)), | |
| angle0_(dict.lookup<scalar>("angle0", units::radians)), | |
| amplitude_(dict.lookup<scalar>("amplitude", units::radians)), | |
| omega_(dict.lookup<scalar>("omega", units::radians/dimensions::time)) | |
| { | |
| if (!dict.found("value")) | |
| { | |
| updateCoeffs(); | |
| } | |
| if (dict.found("p0")) | |
| { | |
| p0_ = vectorField("p0", dimensions::length, dict, p.size()); | |
| } | |
| else | |
| { | |
| p0_ = p.localPoints(); | |
| } | |
| } | |
| angularOscillatingDisplacementPointPatchVectorField:: | |
| angularOscillatingDisplacementPointPatchVectorField | |
| ( | |
| const angularOscillatingDisplacementPointPatchVectorField& ptf, | |
| const pointPatch& p, | |
| const DimensionedField<vector, pointMesh>& iF, | |
| const fieldMapper& mapper | |
| ) | |
| : | |
| fixedValuePointPatchVectorField(ptf, p, iF, mapper), | |
| axis_(ptf.axis_), | |
| origin_(ptf.origin_), | |
| angle0_(ptf.angle0_), | |
| amplitude_(ptf.amplitude_), | |
| omega_(ptf.omega_), | |
| p0_(mapper(ptf.p0_)) | |
| {} | |
| angularOscillatingDisplacementPointPatchVectorField:: | |
| angularOscillatingDisplacementPointPatchVectorField | |
| ( | |
| const angularOscillatingDisplacementPointPatchVectorField& ptf, | |
| const DimensionedField<vector, pointMesh>& iF | |
| ) | |
| : | |
| fixedValuePointPatchVectorField(ptf, iF), | |
| axis_(ptf.axis_), | |
| origin_(ptf.origin_), | |
| angle0_(ptf.angle0_), | |
| amplitude_(ptf.amplitude_), | |
| omega_(ptf.omega_), | |
| p0_(ptf.p0_) | |
| {} | |
| // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | |
| void angularOscillatingDisplacementPointPatchVectorField::map | |
| ( | |
| const pointPatchVectorField& ptf, | |
| const fieldMapper& mapper | |
| ) | |
| { | |
| const angularOscillatingDisplacementPointPatchVectorField& aODptf = | |
| refCast<const angularOscillatingDisplacementPointPatchVectorField>(ptf); | |
| fixedValuePointPatchVectorField::map(aODptf, mapper); | |
| mapper(p0_, aODptf.p0_); | |
| } | |
| void angularOscillatingDisplacementPointPatchVectorField::reset | |
| ( | |
| const pointPatchVectorField& ptf | |
| ) | |
| { | |
| const angularOscillatingDisplacementPointPatchVectorField& aODptf = | |
| refCast<const angularOscillatingDisplacementPointPatchVectorField>(ptf); | |
| fixedValuePointPatchVectorField::reset(aODptf); | |
| p0_.reset(aODptf.p0_); | |
| } | |
| void angularOscillatingDisplacementPointPatchVectorField::updateCoeffs() | |
| { | |
| if (this->updated()) | |
| { | |
| return; | |
| } | |
| const polyMesh& mesh = this->internalField().mesh()(); | |
| const Time& t = mesh.time(); | |
| scalar angle = angle0_ + amplitude_*sin(omega_*t.value()); | |
| vector axisHat = axis_/mag(axis_); | |
| vectorField p0Rel(p0_ - origin_); | |
| vectorField::operator= | |
| ( | |
| p0Rel*(cos(angle) - 1) | |
| + (axisHat ^ p0Rel*sin(angle)) | |
| + (axisHat & p0Rel)*(1 - cos(angle))*axisHat | |
| ); | |
| fixedValuePointPatchVectorField::updateCoeffs(); | |
| } | |
| void angularOscillatingDisplacementPointPatchVectorField::write | |
| ( | |
| Ostream& os | |
| ) const | |
| { | |
| pointPatchVectorField::write(os); | |
| writeEntry(os, "axis", axis_); | |
| writeEntry(os, "origin", origin_); | |
| writeEntry(os, "angle0", angle0_); | |
| writeEntry(os, "amplitude", amplitude_); | |
| writeEntry(os, "omega", omega_); | |
| writeEntry(os, "p0", p0_); | |
| writeEntry(os, "value", *this); | |
| } | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| makePointPatchTypeField | |
| ( | |
| pointPatchVectorField, | |
| angularOscillatingDisplacementPointPatchVectorField | |
| ); | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| } // End namespace Foam | |
| // ************************************************************************* // | |