Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Sander, Oliver
dune-gfe
Commits
9f9c9574
Commit
9f9c9574
authored
16 years ago
by
Oliver Sander
Committed by
sander@PCPOOL.MI.FU-BERLIN.DE
16 years ago
Browse files
Options
Downloads
Patches
Plain Diff
use the BoundaryPatch iterator
[[Imported from SVN: r2421]]
parent
ea40f9d7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/averageinterface.hh
+19
-42
19 additions, 42 deletions
src/averageinterface.hh
with
19 additions
and
42 deletions
src/averageinterface.hh
+
19
−
42
View file @
9f9c9574
...
@@ -449,23 +449,15 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
...
@@ -449,23 +449,15 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>
>
nodalWeights
(
interface
.
numVertices
());
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>
>
nodalWeights
(
interface
.
numVertices
());
nodalWeights
=
0
;
nodalWeights
=
0
;
typename
GridType
::
template
Codim
<
0
>
::
LevelI
terator
eI
t
=
in
dexSet
.
template
begin
<
0
,
Dune
::
All_Partition
>
();
typename
BoundaryPatch
<
GridType
>
::
i
terator
i
t
=
in
terface
.
begin
();
typename
GridType
::
template
Codim
<
0
>
::
LevelI
terator
e
E
ndIt
=
in
dexSet
.
template
end
<
0
,
Dune
::
All_Partition
>
();
typename
BoundaryPatch
<
GridType
>::
i
terator
endIt
=
in
terface
.
end
();
for
(;
eIt
!=
eEndIt
;
++
eIt
)
{
for
(;
it
!=
endIt
;
++
it
)
{
typename
GridType
::
template
Codim
<
0
>
::
Entity
::
LevelIntersectionIterator
nIt
=
eIt
->
ilevelbegin
();
typename
GridType
::
template
Codim
<
0
>
::
Entity
::
LevelIntersectionIterator
nEndIt
=
eIt
->
ilevelend
();
for
(;
nIt
!=
nEndIt
;
++
nIt
)
{
if
(
!
interface
.
contains
(
*
eIt
,
nIt
))
continue
;
const
Dune
::
LagrangeShapeFunctionSet
<
ctype
,
field_type
,
dim
-
1
>&
baseSet
const
Dune
::
LagrangeShapeFunctionSet
<
ctype
,
field_type
,
dim
-
1
>&
baseSet
=
Dune
::
LagrangeShapeFunctions
<
ctype
,
field_type
,
dim
-
1
>::
general
(
nI
t
->
intersectionGlobal
().
type
(),
1
);
=
Dune
::
LagrangeShapeFunctions
<
ctype
,
field_type
,
dim
-
1
>::
general
(
i
t
->
intersectionGlobal
().
type
(),
1
);
const
Dune
::
ReferenceElement
<
double
,
dim
>&
refElement
=
Dune
::
ReferenceElements
<
double
,
dim
>::
general
(
eIt
->
type
());
const
Dune
::
ReferenceElement
<
double
,
dim
>&
refElement
=
Dune
::
ReferenceElements
<
double
,
dim
>::
general
(
it
->
inside
()
->
type
());
// four rows because a face may have no more than four vertices
// four rows because a face may have no more than four vertices
Dune
::
FieldVector
<
double
,
4
>
mu
(
0
);
Dune
::
FieldVector
<
double
,
4
>
mu
(
0
);
...
@@ -475,23 +467,23 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
...
@@ -475,23 +467,23 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
for
(
int
j
=
0
;
j
<
3
;
j
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
mu_tilde
[
i
][
j
]
=
0
;
mu_tilde
[
i
][
j
]
=
0
;
for
(
int
i
=
0
;
i
<
nI
t
->
intersectionGlobal
().
corners
();
i
++
)
{
for
(
int
i
=
0
;
i
<
i
t
->
intersectionGlobal
().
corners
();
i
++
)
{
const
Dune
::
QuadratureRule
<
double
,
dim
-
1
>&
quad
const
Dune
::
QuadratureRule
<
double
,
dim
-
1
>&
quad
=
Dune
::
QuadratureRules
<
double
,
dim
-
1
>::
rule
(
nI
t
->
intersectionGlobal
().
type
(),
dim
-
1
);
=
Dune
::
QuadratureRules
<
double
,
dim
-
1
>::
rule
(
i
t
->
intersectionGlobal
().
type
(),
dim
-
1
);
for
(
size_t
qp
=
0
;
qp
<
quad
.
size
();
qp
++
)
{
for
(
size_t
qp
=
0
;
qp
<
quad
.
size
();
qp
++
)
{
// Local position of the quadrature point
// Local position of the quadrature point
const
Dune
::
FieldVector
<
double
,
dim
-
1
>&
quadPos
=
quad
[
qp
].
position
();
const
Dune
::
FieldVector
<
double
,
dim
-
1
>&
quadPos
=
quad
[
qp
].
position
();
const
double
integrationElement
=
nI
t
->
intersectionGlobal
().
integrationElement
(
quadPos
);
const
double
integrationElement
=
i
t
->
intersectionGlobal
().
integrationElement
(
quadPos
);
// \mu_i = \int_t \varphi_i \ds
// \mu_i = \int_t \varphi_i \ds
mu
[
i
]
+=
quad
[
qp
].
weight
()
*
integrationElement
*
baseSet
[
i
].
evaluateFunction
(
0
,
quadPos
);
mu
[
i
]
+=
quad
[
qp
].
weight
()
*
integrationElement
*
baseSet
[
i
].
evaluateFunction
(
0
,
quadPos
);
// \tilde{\mu}_i^j = \int_t \varphi_i \times (x - x_0) \ds
// \tilde{\mu}_i^j = \int_t \varphi_i \times (x - x_0) \ds
Dune
::
FieldVector
<
double
,
dim
>
worldPos
=
nI
t
->
intersectionGlobal
().
global
(
quadPos
);
Dune
::
FieldVector
<
double
,
dim
>
worldPos
=
i
t
->
intersectionGlobal
().
global
(
quadPos
);
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
{
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
{
...
@@ -511,8 +503,8 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
...
@@ -511,8 +503,8 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
// Set up matrix
// Set up matrix
for
(
int
i
=
0
;
i
<
baseSet
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
baseSet
.
size
();
i
++
)
{
int
faceIdxi
=
refElement
.
subEntity
(
nI
t
->
numberInSelf
(),
1
,
i
,
dim
);
int
faceIdxi
=
refElement
.
subEntity
(
i
t
->
numberInSelf
(),
1
,
i
,
dim
);
int
subIndex
=
globalToLocal
[
indexSet
.
template
subIndex
<
dim
>(
*
eIt
,
faceIdxi
)];
int
subIndex
=
globalToLocal
[
indexSet
.
template
subIndex
<
dim
>(
*
it
->
inside
()
,
faceIdxi
)];
nodalWeights
[
subIndex
]
+=
mu
[
i
];
nodalWeights
[
subIndex
]
+=
mu
[
i
];
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
...
@@ -524,8 +516,6 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
...
@@ -524,8 +516,6 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
}
}
}
}
}
//printmatrix(std::cout, constraints, "jacobian", "--");
//printmatrix(std::cout, constraints, "jacobian", "--");
...
@@ -588,41 +578,30 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
...
@@ -588,41 +578,30 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
#if 1
#if 1
Dune
::
FieldVector
<
double
,
3
>
outputForce
(
0
),
outputTorque
(
0
);
Dune
::
FieldVector
<
double
,
3
>
outputForce
(
0
),
outputTorque
(
0
);
eIt
=
indexSet
.
template
begin
<
0
,
Dune
::
All_Partition
>();
for
(
it
=
interface
.
begin
();
it
!=
endIt
;
++
it
)
{
eEndIt
=
indexSet
.
template
end
<
0
,
Dune
::
All_Partition
>();
for
(;
eIt
!=
eEndIt
;
++
eIt
)
{
typename
GridType
::
template
Codim
<
0
>
::
Entity
::
LevelIntersectionIterator
nIt
=
eIt
->
ilevelbegin
();
typename
GridType
::
template
Codim
<
0
>
::
Entity
::
LevelIntersectionIterator
nEndIt
=
eIt
->
ilevelend
();
for
(;
nIt
!=
nEndIt
;
++
nIt
)
{
if
(
!
interface
.
contains
(
*
eIt
,
nIt
))
continue
;
const
Dune
::
LagrangeShapeFunctionSet
<
double
,
double
,
dim
-
1
>&
baseSet
const
Dune
::
LagrangeShapeFunctionSet
<
double
,
double
,
dim
-
1
>&
baseSet
=
Dune
::
LagrangeShapeFunctions
<
double
,
double
,
dim
-
1
>::
general
(
nI
t
->
intersectionGlobal
().
type
(),
1
);
=
Dune
::
LagrangeShapeFunctions
<
double
,
double
,
dim
-
1
>::
general
(
i
t
->
intersectionGlobal
().
type
(),
1
);
const
Dune
::
QuadratureRule
<
double
,
dim
-
1
>&
quad
const
Dune
::
QuadratureRule
<
double
,
dim
-
1
>&
quad
=
Dune
::
QuadratureRules
<
double
,
dim
-
1
>::
rule
(
nI
t
->
intersectionGlobal
().
type
(),
dim
-
1
);
=
Dune
::
QuadratureRules
<
double
,
dim
-
1
>::
rule
(
i
t
->
intersectionGlobal
().
type
(),
dim
-
1
);
const
Dune
::
ReferenceElement
<
double
,
dim
>&
refElement
=
Dune
::
ReferenceElements
<
double
,
dim
>::
general
(
eIt
->
type
());
const
Dune
::
ReferenceElement
<
double
,
dim
>&
refElement
=
Dune
::
ReferenceElements
<
double
,
dim
>::
general
(
it
->
inside
()
->
type
());
for
(
size_t
qp
=
0
;
qp
<
quad
.
size
();
qp
++
)
{
for
(
size_t
qp
=
0
;
qp
<
quad
.
size
();
qp
++
)
{
// Local position of the quadrature point
// Local position of the quadrature point
const
Dune
::
FieldVector
<
double
,
dim
-
1
>&
quadPos
=
quad
[
qp
].
position
();
const
Dune
::
FieldVector
<
double
,
dim
-
1
>&
quadPos
=
quad
[
qp
].
position
();
const
double
integrationElement
=
nI
t
->
intersectionGlobal
().
integrationElement
(
quadPos
);
const
double
integrationElement
=
i
t
->
intersectionGlobal
().
integrationElement
(
quadPos
);
// Evaluate function
// Evaluate function
Dune
::
FieldVector
<
double
,
dim
>
localPressure
(
0
);
Dune
::
FieldVector
<
double
,
dim
>
localPressure
(
0
);
for
(
size_t
i
=
0
;
i
<
baseSet
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
baseSet
.
size
();
i
++
)
{
int
faceIdxi
=
refElement
.
subEntity
(
nI
t
->
numberInSelf
(),
1
,
i
,
dim
);
int
faceIdxi
=
refElement
.
subEntity
(
i
t
->
numberInSelf
(),
1
,
i
,
dim
);
int
subIndex
=
indexSet
.
template
subIndex
<
dim
>(
*
eIt
,
faceIdxi
);
int
subIndex
=
indexSet
.
template
subIndex
<
dim
>(
*
it
->
inside
()
,
faceIdxi
);
localPressure
.
axpy
(
baseSet
[
i
].
evaluateFunction
(
0
,
quadPos
),
localPressure
.
axpy
(
baseSet
[
i
].
evaluateFunction
(
0
,
quadPos
),
pressure
[
subIndex
]);
pressure
[
subIndex
]);
...
@@ -633,14 +612,12 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
...
@@ -633,14 +612,12 @@ void computeAveragePressure(const Dune::FieldVector<double,GridType::dimension>&
outputForce
.
axpy
(
quad
[
qp
].
weight
()
*
integrationElement
,
localPressure
);
outputForce
.
axpy
(
quad
[
qp
].
weight
()
*
integrationElement
,
localPressure
);
// Sum up the total torque \int (x - x_0) \times f dx
// Sum up the total torque \int (x - x_0) \times f dx
Dune
::
FieldVector
<
double
,
dim
>
worldPos
=
nI
t
->
intersectionGlobal
().
global
(
quadPos
);
Dune
::
FieldVector
<
double
,
dim
>
worldPos
=
i
t
->
intersectionGlobal
().
global
(
quadPos
);
outputTorque
.
axpy
(
quad
[
qp
].
weight
()
*
integrationElement
,
outputTorque
.
axpy
(
quad
[
qp
].
weight
()
*
integrationElement
,
crossProduct
(
worldPos
-
crossSection
.
r
,
localPressure
));
crossProduct
(
worldPos
-
crossSection
.
r
,
localPressure
));
}
}
}
}
}
outputForce
-=
resultantForce
;
outputForce
-=
resultantForce
;
...
...
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