NURBS3DVolumeCylindrical.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2007-2019 PCOpt/NTUA
9 Copyright (C) 2013-2019 FOSS GP
10 Copyright (C) 2019 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28\*---------------------------------------------------------------------------*/
29
32#include "pointMesh.H"
33#include "pointPatchField.H"
34#include "pointPatchFieldsFwd.H"
35
36// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37
38namespace Foam
39{
40
43 (
47 );
48}
49
50
51// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
52
54(
55 const vector& localSystemCoordinates
56) const
57{
58 vector cartesianCoors
59 (
60 localSystemCoordinates.x()*cos(localSystemCoordinates.y()),
61 localSystemCoordinates.x()*sin(localSystemCoordinates.y()),
62 localSystemCoordinates.z()
63 );
64 cartesianCoors += origin_;
65
66 return cartesianCoors;
67}
68
69
71(
72 label globalPointIndex
73)
74{
75 const vector& localCoors = localSystemCoordinates_[globalPointIndex];
76 tensor transformTensor
77 (
78 cos(localCoors.y()), -localCoors.x()*sin(localCoors.y()), 0,
79 sin(localCoors.y()), localCoors.x()*cos(localCoors.y()), 0,
80 0, 0, 1
81 );
82
83 return transformTensor;
84}
85
86
88(
89 const vectorField& cartesianPoints
90)
91{
92 forAll(cartesianPoints, pI)
93 {
94 const vector point(cartesianPoints[pI] - origin_);
95 vector cylindricalCoors(Zero);
96
97 const scalar R(Foam::sqrt(sqr(point.x()) + sqr(point.y())));
98 const scalar theta(atan2(point.y(), point.x()));
99 cylindricalCoors.x() = R;
100 cylindricalCoors.y() = theta;
101 cylindricalCoors.z() = cartesianPoints[pI].z();
102 localSystemCoordinates_[pI] = cylindricalCoors;
103 }
104
105 pointVectorField cylindricalCoors
106 (
108 (
109 "cylindricalCoors" + name_,
110 mesh_.time().timeName(),
111 mesh_,
114 ),
115 pointMesh::New(mesh_),
117 );
118 cylindricalCoors.primitiveFieldRef() = localSystemCoordinates_;
119 cylindricalCoors.write();
120}
121
122
123// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
124
126(
127 const dictionary& dict,
128 const fvMesh& mesh,
129 bool computeParamCoors
130)
131:
132 NURBS3DVolume(dict, mesh, computeParamCoors),
133 origin_(dict.get<vector>("origin"))
134{
136 writeCps("cpsBsplines" + mesh_.time().timeName());
137 if (computeParamCoors)
138 {
140 }
141}
142
143
144// ************************************************************************* //
#define R(A, B, C, D, E, F, K, M)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
Calculation of adjoint based sensitivities at wall faces.
void updateLocalCoordinateSystem(const vectorField &cartesianPoints)
Update coordinates in the local system based on the cartesian points.
vector transformPointToCartesian(const vector &localCoordinates) const
Transform a point from its coordinate system to a cartesian system.
tensor transformationTensorDxDb(label globalPointIndex)
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
Definition: NURBS3DVolume.H:76
const fvMesh & mesh_
Definition: NURBS3DVolume.H:83
const pointVectorField & getParametricCoordinates()
Get parametric coordinates.
void writeCps(const fileName &="cpsFile", const bool transform=true) const
const fvMesh & mesh() const
Get mesh.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1083
virtual bool write(const bool valid=true) const
Write using setting from DB.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
Namespace for OpenFOAM.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sin(const dimensionedScalar &ds)
vector point
Point is a vector.
Definition: point.H:43
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
dimensionedScalar sqrt(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
dimensionedScalar cos(const dimensionedScalar &ds)
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
A non-counting (dummy) refCount.
Definition: refCount.H:59