Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-mmdg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hörl, Maximilian
dune-mmdg
Commits
97ec2519
Commit
97ec2519
authored
Apr 6, 2020
by
Hörl, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
[bugfix] interface basis is now calculated using a Householder matrix
parent
6bb72ad0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/mmdg/mmdg.hh
+49
-23
49 additions, 23 deletions
dune/mmdg/mmdg.hh
with
49 additions
and
23 deletions
dune/mmdg/mmdg.hh
+
49
−
23
View file @
97ec2519
...
@@ -41,7 +41,7 @@ public:
...
@@ -41,7 +41,7 @@ public:
Base
::
A
->
compress
();
Base
::
A
->
compress
();
Dune
::
InverseOperatorResult
result
;
Dune
::
InverseOperatorResult
result
;
Dune
::
UMFPack
<
Matrix
>
solver
(
*
Base
::
A
);
Dune
::
UMFPack
<
Matrix
>
solver
(
*
Base
::
A
);
//TODO: ilu0bicgSTAB, cg (ilo0, ssor), gmres
solver
.
apply
(
Base
::
d
,
Base
::
b
,
result
);
solver
.
apply
(
Base
::
d
,
Base
::
b
,
result
);
//write solution to a vtk file
//write solution to a vtk file
...
@@ -832,36 +832,46 @@ private:
...
@@ -832,36 +832,46 @@ private:
}
}
}
}
//returns a basis of the interface coordinate system
//returns an orthonormal basis of the interface coordinate system
//2d: tau = [ normal[1],
InterfaceBasis
interfaceFrame
(
Coordinate
normal
)
const
// -normal[0] ]
//3d: tau_1 ~ [ normal[1] + normal[2], tau_2 ~ [ -normal[1],
// -normal[0], normal[0] + normal[2]
// -normal[0] ], -normal[1] ]
InterfaceBasis
interfaceFrame
(
const
Coordinate
&
normal
)
const
{
{
InterfaceBasis
iBasis
;
//find a standard unit vector e_k with k such that |a[k]| != 1
int
k
=
0
;
for
(
int
i
=
0
;
i
<
dim
-
1
;
i
++
)
for
(;
k
<
dim
;
k
++
)
{
Coordinate
tau
(
0.0
);
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
{
{
if
(
j
==
i
)
if
(
std
::
abs
(
normal
[
k
])
<
0.9
)
{
{
continue
;
normal
[
k
]
-=
1
;
break
;
}
}
tau
[
i
]
+=
normal
[
j
];
tau
[
j
]
=
-
normal
[
i
];
}
}
if
constexpr
(
dim
!=
2
)
//regard the unit vector v := (normal - e_k) / norm(normal - e_k)
normal
/=
normal
.
two_norm
();
//calculate the Householder matrix H(v) = Id - 2*v*v^T
CoordinateMatrix
householderMatrix
(
0.0
);
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
{
tau
/=
tau
.
two_norm
()
;
householderMatrix
[
i
][
i
]
=
1.0
;
}
}
iBasis
[
i
]
=
tau
;
householderMatrix
-=
2.0
*
outerProduct
(
normal
);
//the Householder transformation fulfills the property
// H(v) * e_k = +/- normal
//since H(v) is orthonormal, an (orthonormal) interface basis is now
//given by the columns H(v) * e_j with j != k
InterfaceBasis
iBasis
;
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
if
(
i
!=
k
)
{
iBasis
[(
k
>
i
)
?
i
:
i
-
1
]
=
householderMatrix
[
i
];
}
}
}
return
iBasis
;
return
iBasis
;
...
@@ -953,6 +963,22 @@ private:
...
@@ -953,6 +963,22 @@ private:
return
mu
*
mu0
*
2.0
*
(
1.0
+
dim
);
return
mu
*
mu0
*
2.0
*
(
1.0
+
dim
);
}
}
//returns the outer product v * v^T of the vector v
const
CoordinateMatrix
outerProduct
(
const
Coordinate
&
v
)
const
{
CoordinateMatrix
vv
;
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
{
vv
[
i
][
j
]
=
v
[
i
]
*
v
[
j
];
}
}
return
vv
;
}
};
};
#endif
#endif
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