Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
98592dba
Commit
98592dba
authored
Jul 19, 2021
by
Ned Coltman
Browse files
[rans] move neighboridx to function
parent
c651312e
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/freeflow/rans/problem.hh
View file @
98592dba
...
...
@@ -119,7 +119,6 @@ public:
wallElementIdx_
.
resize
(
this
->
gridGeometry
().
elementMapper
().
size
());
wallDistance_
.
resize
(
this
->
gridGeometry
().
elementMapper
().
size
(),
std
::
numeric_limits
<
Scalar
>::
max
());
neighborIdx_
.
resize
(
this
->
gridGeometry
().
elementMapper
().
size
());
cellCenter_
.
resize
(
this
->
gridGeometry
().
elementMapper
().
size
(),
GlobalPosition
(
0.0
));
velocity_
.
resize
(
this
->
gridGeometry
().
elementMapper
().
size
(),
DimVector
(
0.0
));
velocityGradients_
.
resize
(
this
->
gridGeometry
().
elementMapper
().
size
(),
DimMatrix
(
0.0
));
stressTensorScalarProduct_
.
resize
(
this
->
gridGeometry
().
elementMapper
().
size
(),
0.0
);
...
...
@@ -203,35 +202,7 @@ public:
}
}
// search for neighbor Idxs
for
(
const
auto
&
element
:
elements
(
gridView
))
{
unsigned
int
elementIdx
=
this
->
gridGeometry
().
elementMapper
().
index
(
element
);
for
(
unsigned
int
dimIdx
=
0
;
dimIdx
<
dim
;
++
dimIdx
)
{
neighborIdx_
[
elementIdx
][
dimIdx
][
0
]
=
elementIdx
;
neighborIdx_
[
elementIdx
][
dimIdx
][
1
]
=
elementIdx
;
}
for
(
const
auto
&
intersection
:
intersections
(
gridView
,
element
))
{
if
(
intersection
.
boundary
())
continue
;
unsigned
int
neighborIdx
=
this
->
gridGeometry
().
elementMapper
().
index
(
intersection
.
outside
());
for
(
unsigned
int
dimIdx
=
0
;
dimIdx
<
dim
;
++
dimIdx
)
{
if
(
abs
(
cellCenter
(
elementIdx
)[
dimIdx
]
-
cellCenter
(
neighborIdx
)[
dimIdx
])
>
1e-8
)
{
if
(
cellCenter
(
elementIdx
)[
dimIdx
]
>
cellCenter
(
neighborIdx
)[
dimIdx
])
neighborIdx_
[
elementIdx
][
dimIdx
][
0
]
=
neighborIdx
;
if
(
cellCenter
(
elementIdx
)[
dimIdx
]
<
cellCenter
(
neighborIdx
)[
dimIdx
])
neighborIdx_
[
elementIdx
][
dimIdx
][
1
]
=
neighborIdx
;
}
}
}
}
findNeighborIndices_
();
}
/*!
...
...
@@ -384,7 +355,10 @@ public:
{
return
wallDistance_
[
elementIdx
];
}
GlobalPosition
cellCenter
(
const
int
elementIdx
)
const
{
return
cellCenter_
[
elementIdx
];
}
{
const
auto
&
element
=
this
->
gridGeometry
().
element
(
elementIdx
);
return
element
.
geometry
().
center
();
}
unsigned
int
neighborIndex
(
const
int
elementIdx
,
const
int
dimIdx
,
const
int
sideIdx
)
const
{
return
neighborIdx_
[
elementIdx
][
dimIdx
][
sideIdx
];}
...
...
@@ -454,6 +428,39 @@ private:
return
std
::
all_of
(
wallFaceAxis
.
begin
(),
wallFaceAxis
.
end
(),
[
firstDir
=
wallFaceAxis
[
0
]](
auto
dir
){
return
(
dir
==
firstDir
);}
)
;
}
void
findNeighborIndices_
()
{
// search for neighbor Idxs
for
(
const
auto
&
element
:
elements
(
this
->
gridGeometry
().
gridView
()))
{
unsigned
int
elementIdx
=
this
->
gridGeometry
().
elementMapper
().
index
(
element
);
for
(
unsigned
int
dimIdx
=
0
;
dimIdx
<
dim
;
++
dimIdx
)
{
neighborIdx_
[
elementIdx
][
dimIdx
][
0
]
=
elementIdx
;
neighborIdx_
[
elementIdx
][
dimIdx
][
1
]
=
elementIdx
;
}
for
(
const
auto
&
intersection
:
intersections
(
this
->
gridGeometry
().
gridView
(),
element
))
{
if
(
intersection
.
boundary
())
continue
;
unsigned
int
neighborIdx
=
this
->
gridGeometry
().
elementMapper
().
index
(
intersection
.
outside
());
for
(
unsigned
int
dimIdx
=
0
;
dimIdx
<
dim
;
++
dimIdx
)
{
if
(
abs
(
cellCenter
(
elementIdx
)[
dimIdx
]
-
cellCenter
(
neighborIdx
)[
dimIdx
])
>
1e-8
)
{
if
(
cellCenter
(
elementIdx
)[
dimIdx
]
>
cellCenter
(
neighborIdx
)[
dimIdx
])
neighborIdx_
[
elementIdx
][
dimIdx
][
0
]
=
neighborIdx
;
if
(
cellCenter
(
elementIdx
)[
dimIdx
]
<
cellCenter
(
neighborIdx
)[
dimIdx
])
neighborIdx_
[
elementIdx
][
dimIdx
][
1
]
=
neighborIdx
;
}
}
}
}
}
void
calculateCCVelocities_
(
const
SolutionVector
&
curSol
)
{
auto
fvGeometry
=
localView
(
this
->
gridGeometry
());
...
...
@@ -715,7 +722,6 @@ private:
std
::
vector
<
unsigned
int
>
flowDirectionAxis_
;
std
::
vector
<
Scalar
>
wallDistance_
;
std
::
vector
<
unsigned
int
>
wallElementIdx_
;
std
::
vector
<
GlobalPosition
>
cellCenter_
;
std
::
vector
<
std
::
array
<
std
::
array
<
unsigned
int
,
2
>
,
dim
>>
neighborIdx_
;
std
::
vector
<
DimVector
>
velocity_
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment