Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
eda13117
Commit
eda13117
authored
6 years ago
by
Mark OLESEN
Browse files
Options
Downloads
Patches
Plain Diff
STYLE: explicitly use degrees in arcEdge coordinate system (
#1015
)
- safeguard against any change in the default in cylindricalCS
parent
6cd953ff
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C
+23
-25
23 additions, 25 deletions
src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C
src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H
+15
-8
15 additions, 8 deletions
src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H
with
38 additions
and
33 deletions
src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C
+
23
−
25
View file @
eda13117
...
...
@@ -43,15 +43,15 @@ namespace blockEdges
Foam
::
cylindricalCS
Foam
::
blockEdges
::
arcEdge
::
calcAngle
()
{
vector
a
=
p2_
-
p1_
;
vector
b
=
p3_
-
p1_
;
const
vector
a
=
p2_
-
p1_
;
const
vector
b
=
p3_
-
p1_
;
//
f
ind centre of arcEdge
scalar
asqr
=
a
&
a
;
scalar
bsqr
=
b
&
b
;
scalar
adotb
=
a
&
b
;
//
F
ind centre of arcEdge
const
scalar
asqr
=
a
&
a
;
const
scalar
bsqr
=
b
&
b
;
const
scalar
adotb
=
a
&
b
;
scalar
denom
=
asqr
*
bsqr
-
adotb
*
adotb
;
const
scalar
denom
=
asqr
*
bsqr
-
adotb
*
adotb
;
if
(
mag
(
denom
)
<
VSMALL
)
{
...
...
@@ -60,46 +60,46 @@ Foam::cylindricalCS Foam::blockEdges::arcEdge::calcAngle()
<<
abort
(
FatalError
);
}
scalar
fact
=
0
.
5
*
(
bsqr
-
adotb
)
/
denom
;
const
scalar
fact
=
0
.
5
*
(
bsqr
-
adotb
)
/
denom
;
point
centre
=
0
.
5
*
a
+
fact
*
((
a
^
b
)
^
a
);
centre
+=
p1_
;
//
f
ind position vectors w.r.t. the arcEdge centre
vector
r1
(
p1_
-
centre
);
vector
r2
(
p2_
-
centre
);
vector
r3
(
p3_
-
centre
);
//
F
ind position vectors w.r.t. the arcEdge centre
const
vector
r1
(
p1_
-
centre
);
const
vector
r2
(
p2_
-
centre
);
const
vector
r3
(
p3_
-
centre
);
//
f
ind angle
s
//
F
ind angle
(in degrees)
angle_
=
radToDeg
(
acos
((
r3
&
r1
)
/
(
mag
(
r3
)
*
mag
(
r1
))));
//
c
heck if the vectors define an exterior or an interior arcEdge
//
C
heck if the vectors define an exterior or an interior arcEdge
if
(((
r1
^
r2
)
&
(
r1
^
r3
))
<
0
.
0
)
{
angle_
=
360
.
0
-
angle_
;
}
vector
temp
Axis
;
vector
arc
Axis
;
if
(
angle_
<=
180
.
0
)
{
temp
Axis
=
r1
^
r3
;
arc
Axis
=
r1
^
r3
;
if
(
mag
(
temp
Axis
)
/
(
mag
(
r1
)
*
mag
(
r3
))
<
0
.
001
)
if
(
mag
(
arc
Axis
)
/
(
mag
(
r1
)
*
mag
(
r3
))
<
0
.
001
)
{
temp
Axis
=
r1
^
r2
;
arc
Axis
=
r1
^
r2
;
}
}
else
{
temp
Axis
=
r3
^
r1
;
arc
Axis
=
r3
^
r1
;
}
radius_
=
mag
(
r3
);
//
set up and return the lo
cal coordinate system
return
cylindricalCS
(
"arcEdgeCS"
,
centre
,
temp
Axis
,
r1
);
//
The corresponding local cylindri
cal coordinate system
(degrees)
return
cylindricalCS
(
"arcEdgeCS"
,
centre
,
arc
Axis
,
r1
,
true
);
}
...
...
@@ -157,10 +157,8 @@ Foam::point Foam::blockEdges::arcEdge::position(const scalar lambda) const
{
return
p3_
;
}
else
{
return
cs_
.
globalPosition
(
vector
(
radius_
,
lambda
*
angle_
,
0
.
0
));
}
return
cs_
.
globalPosition
(
vector
(
radius_
,
lambda
*
angle_
,
0
.
0
));
}
...
...
This diff is collapsed.
Click to expand it.
src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H
+
15
−
8
View file @
eda13117
...
...
@@ -55,15 +55,23 @@ class arcEdge
{
// Private data
// Begin, mid, end points
point
p1_
,
p2_
,
p3_
;
//- The arc angle (in degrees)
scalar
angle_
;
//- The arc radius
scalar
radius_
;
//- The local cylindrical coordinate system (degrees)
cylindricalCS
cs_
;
// Private Member Functions
//- Calculate the coordinate system, angle and radius
//- Calculate the angle, radius and axis
// \return the coordinate system
cylindricalCS
calcAngle
();
//- No copy construct
...
...
@@ -85,7 +93,8 @@ public:
arcEdge
(
const
pointField
&
points
,
const
label
start
,
const
label
end
,
const
label
start
,
const
label
end
,
const
point
&
pMid
);
...
...
@@ -101,17 +110,15 @@ public:
//- Destructor
virtual
~
arcEdge
()
{}
virtual
~
arcEdge
()
=
default
;
// Member Functions
//- Return the point position corresponding to the curve parameter
// 0 <= lambda <= 1
point
position
(
const
scalar
)
const
;
//- The point corresponding to the curve parameter [0-1]
point
position
(
const
scalar
lambda
)
const
;
//-
Return t
he length of the curve
//-
T
he length of the curve
scalar
length
()
const
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment