cv2DControls.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) 2013-2015 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*----------------------------------------------------------------------------*/
28 
29 #include "cv2DControls.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 Foam::cv2DControls::cv2DControls
34 (
35  const dictionary& controlDict,
36  const boundBox& bb
37 )
38 :
39  dict_(controlDict),
40 
41  motionControl_(controlDict.subDict("motionControl")),
42  conformationControl_(controlDict.subDict("surfaceConformation")),
43 
44  minCellSize_(motionControl_.get<scalar>("minCellSize")),
45  minCellSize2_(Foam::sqr(minCellSize_)),
46 
47  maxQuadAngle_(conformationControl_.get<scalar>("maxQuadAngle")),
48 
49  nearWallAlignedDist_
50  (
51  motionControl_.get<scalar>("nearWallAlignedDist") * minCellSize_
52  ),
53  nearWallAlignedDist2_(Foam::sqr(nearWallAlignedDist_)),
54 
55  insertSurfaceNearestPointPairs_
56  (
57  conformationControl_.get<Switch>
58  (
59  "insertSurfaceNearestPointPairs"
60  )
61  ),
62  mirrorPoints_
63  (
64  conformationControl_.get<Switch>
65  (
66  "mirrorPoints"
67  )
68  ),
69  insertSurfaceNearPointPairs_
70  (
71  conformationControl_.get<Switch>
72  (
73  "insertSurfaceNearPointPairs"
74  )
75  ),
76 
77  objOutput_
78  (
79  motionControl_.getOrDefault<Switch>("objOutput", false)
80  ),
81 
82  meshedSurfaceOutput_
83  (
84  motionControl_.getOrDefault<Switch>("meshedSurfaceOutput", false)
85  ),
86 
87  randomiseInitialGrid_
88  (
89  conformationControl_.get<Switch>("randomiseInitialGrid")
90  ),
91  randomPerturbation_
92  (
93  conformationControl_.get<scalar>("randomPerturbation")
94  ),
95 
96  maxBoundaryConformingIter_
97  (
98  conformationControl_.get<label>("maxBoundaryConformingIter")
99  ),
100 
101  span_
102  (
103  max(mag(bb.max().x()), mag(bb.min().x()))
104  + max(mag(bb.max().y()), mag(bb.min().y()))
105  ),
106  span2_(Foam::sqr(span_)),
107 
108  minEdgeLen_
109  (
110  conformationControl_.get<scalar>("minEdgeLenCoeff") * minCellSize_
111  ),
112  minEdgeLen2_(Foam::sqr(minEdgeLen_)),
113 
114  maxNotchLen_
115  (
116  conformationControl_.get<scalar>("maxNotchLenCoeff") * minCellSize_
117  ),
118  maxNotchLen2_(Foam::sqr(maxNotchLen_)),
119 
120  minNearPointDist_
121  (
122  conformationControl_.get<scalar>("minNearPointDistCoeff")*minCellSize_
123  ),
124  minNearPointDist2_(Foam::sqr(minNearPointDist_)),
125 
126  ppDist_
127  (
128  conformationControl_.get<scalar>("pointPairDistanceCoeff")*minCellSize_
129  )
130 {}
131 
132 
133 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
134 
135 void Foam::cv2DControls::write(Ostream& os) const
136 {
137  os.indentLevel() = 1;
138  os.precision(2);
139  os.flags(ios_base::scientific);
140 
141  os << nl << "Outputting CV2D Mesher controls:" << nl
142  << token::BEGIN_BLOCK << nl
143  << indent << "minCellSize2_ : " << minCellSize2_ << nl
144  << indent << "span_ / span2_ : " << span_ << " / " << span2_ << nl
145  << indent << "maxNotchLen2_ : " << maxNotchLen2_ << nl
146  << indent << "minNearPointDist2_ : " << minNearPointDist2_ << nl
147  << indent << "nearWallAlignedDist2_ : " << nearWallAlignedDist2_ << nl
148  << indent << "ppDist_ : " << ppDist_ << nl
149  << indent << "minEdgeLen2_ : " << minEdgeLen2_ << nl
150  << token::END_BLOCK << endl;
151 }
152 
153 
154 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
155 
156 Foam::Ostream& Foam::operator<<(Ostream& os, const cv2DControls& s)
157 {
158  s.write(os);
159  return os;
160 }
161 
162 
163 
164 // ************************************************************************* //
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::cv2DControls::write
void write(Ostream &os) const
Write controls to output stream.
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
controlDict
runTime controlDict().readEntry("adjustTimeStep"
Definition: debug.C:143
cv2DControls.H
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::token::END_BLOCK
End block [isseparator].
Definition: token.H:128
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::indent
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:320
Foam::scientific
IOstream & scientific(IOstream &io)
Definition: IOstream.H:455
Foam::token::BEGIN_BLOCK
Begin block [isseparator].
Definition: token.H:127
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
y
scalar y
Definition: LISASMDCalcMethod1.H:14