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
bb034f8b
Commit
bb034f8b
authored
17 years ago
by
henry
Browse files
Options
Downloads
Patches
Plain Diff
Further tinkering and additional test of the eigenvaues of symmTensors.
parent
951e70cd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
applications/test/tensor/tensorTest.C
+7
-1
7 additions, 1 deletion
applications/test/tensor/tensorTest.C
src/OpenFOAM/primitives/tensor/tensor.C
+9
-9
9 additions, 9 deletions
src/OpenFOAM/primitives/tensor/tensor.C
with
16 additions
and
10 deletions
applications/test/tensor/tensorTest.C
+
7
−
1
View file @
bb034f8b
...
@@ -38,6 +38,12 @@ int main()
...
@@ -38,6 +38,12 @@ int main()
<<
(
eigenVector
(
t6
,
e
[
2
])
&
t6
)
<<
e
[
2
]
*
eigenVector
(
t6
,
e
[
2
])
<<
(
eigenVector
(
t6
,
e
[
2
])
&
t6
)
<<
e
[
2
]
*
eigenVector
(
t6
,
e
[
2
])
<<
endl
;
<<
endl
;
Info
<<
"Check eigenvalues for symmTensor "
<<
eigenValues
(
symm
(
t6
))
-
eigenValues
(
tensor
(
symm
(
t6
)))
<<
endl
;
Info
<<
"Check eigenvectors for symmTensor "
<<
eigenVectors
(
symm
(
t6
))
-
eigenVectors
(
tensor
(
symm
(
t6
)))
<<
endl
;
tensor
t7
(
1
,
2
,
3
,
2
,
4
,
5
,
3
,
5
,
6
);
tensor
t7
(
1
,
2
,
3
,
2
,
4
,
5
,
3
,
5
,
6
);
Info
<<
"Check transformation "
Info
<<
"Check transformation "
...
@@ -49,7 +55,7 @@ int main()
...
@@ -49,7 +55,7 @@ int main()
<<
transform
(
t1
,
st1
)
<<
endl
;
<<
transform
(
t1
,
st1
)
<<
endl
;
vector
v1
(
1
,
2
,
3
);
vector
v1
(
1
,
2
,
3
);
Info
<<
sqr
(
v1
)
<<
endl
;
Info
<<
sqr
(
v1
)
<<
endl
;
Info
<<
symm
(
t7
)
<<
endl
;
Info
<<
symm
(
t7
)
<<
endl
;
Info
<<
twoSymm
(
t7
)
<<
endl
;
Info
<<
twoSymm
(
t7
)
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/primitives/tensor/tensor.C
+
9
−
9
View file @
bb034f8b
...
@@ -185,7 +185,7 @@ vector eigenValues(const tensor& t)
...
@@ -185,7 +185,7 @@ vector eigenValues(const tensor& t)
vector
eigenVector
(
const
tensor
&
t
,
const
scalar
lambda
)
vector
eigenVector
(
const
tensor
&
t
,
const
scalar
lambda
)
{
{
if
(
lambda
<
SMALL
)
if
(
mag
(
lambda
)
<
SMALL
)
{
{
return
vector
::
zero
;
return
vector
::
zero
;
}
}
...
@@ -292,22 +292,22 @@ vector eigenValues(const symmTensor& t)
...
@@ -292,22 +292,22 @@ vector eigenValues(const symmTensor& t)
+
t
.
xy
()
*
t
.
xy
()
*
t
.
zz
()
+
t
.
xx
()
*
t
.
yz
()
*
t
.
yz
();
+
t
.
xy
()
*
t
.
xy
()
*
t
.
zz
()
+
t
.
xx
()
*
t
.
yz
()
*
t
.
yz
();
// If there is a zero root
// If there is a zero root
if
(
mag
(
c
)
<
SMALL
)
if
(
mag
(
c
)
<
1.0e-100
)
{
{
scalar
disc
=
sqr
(
a
)
-
4
*
b
;
scalar
disc
=
sqr
(
a
)
-
4
*
b
;
if
(
disc
>
0
)
if
(
disc
>
=
-
SMALL
)
{
{
scalar
q
=
-
0
.
5
*
(
a
+
sign
(
a
)
*
sqrt
(
disc
));
scalar
q
=
-
0
.
5
*
sqrt
(
max
(
0
.
0
,
disc
));
i
=
0
;
i
=
0
;
ii
=
q
;
ii
=
-
0
.
5
*
a
+
q
;
iii
=
b
/
q
;
iii
=
-
0
.
5
*
a
-
q
;
}
}
else
else
{
{
FatalErrorIn
(
"eigenValues(const
symmT
ensor&)"
)
FatalErrorIn
(
"eigenValues(const
t
ensor&)"
)
<<
"zero and complex eigenvalues in
symmT
ensor: "
<<
t
<<
"zero and complex eigenvalues in
t
ensor: "
<<
t
<<
abort
(
FatalError
);
<<
abort
(
FatalError
);
}
}
}
}
...
@@ -380,7 +380,7 @@ vector eigenValues(const symmTensor& t)
...
@@ -380,7 +380,7 @@ vector eigenValues(const symmTensor& t)
vector
eigenVector
(
const
symmTensor
&
t
,
const
scalar
lambda
)
vector
eigenVector
(
const
symmTensor
&
t
,
const
scalar
lambda
)
{
{
if
(
lambda
<
SMALL
)
if
(
mag
(
lambda
)
<
SMALL
)
{
{
return
vector
::
zero
;
return
vector
::
zero
;
}
}
...
...
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