Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
c5e13607
Commit
c5e13607
authored
7 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
improved symmetry BC's code. Not yet satisfactory.
parent
fd010b49
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main.cpp
+4
-3
4 additions, 3 deletions
src/main.cpp
src/scheme/AcousticSolver.hpp
+11
-20
11 additions, 20 deletions
src/scheme/AcousticSolver.hpp
src/scheme/BoundaryCondition.hpp
+20
-12
20 additions, 12 deletions
src/scheme/BoundaryCondition.hpp
with
35 additions
and
35 deletions
src/main.cpp
+
4
−
3
View file @
c5e13607
...
...
@@ -129,9 +129,10 @@ int main(int argc, char *argv[])
std
::
vector
<
BoundaryConditionHandler
>
bc_list
;
{
// quite dirty!
SymmetryBoundaryCondition
*
sym_bc0
=
new
SymmetryBoundaryCondition
(
std
::
vector
<
unsigned
int
>
({
0u
}));
std
::
shared_ptr
<
SymmetryBoundaryCondition
>
bc0
(
sym_bc0
);
SymmetryBoundaryCondition
<
MeshType
::
dimension
>*
sym_bc0
=
new
SymmetryBoundaryCondition
<
MeshType
::
dimension
>
(
std
::
vector
<
unsigned
int
>
({
0u
}),
TinyVector
<
1
>
(
-
1
));
std
::
shared_ptr
<
SymmetryBoundaryCondition
<
1
>>
bc0
(
sym_bc0
);
bc_list
.
push_back
(
BoundaryConditionHandler
(
bc0
));
PressureBoundaryCondition
*
pres_bc1
...
...
This diff is collapsed.
Click to expand it.
src/scheme/AcousticSolver.hpp
+
11
−
20
View file @
c5e13607
...
...
@@ -174,29 +174,20 @@ private:
break
;
}
case
BoundaryCondition
::
symmetry
:
{
const
SymmetryBoundaryCondition
&
symmetry_bc
=
dynamic_cast
<
const
SymmetryBoundaryCondition
&>
(
handler
.
boundaryCondition
());
const
Rdd
I
=
identity
;
const
Kokkos
::
View
<
const
unsigned
int
**>
face_cells
=
m_connectivity
.
faceCells
();
const
Kokkos
::
View
<
const
unsigned
short
**>
face_cell_local_face
=
m_connectivity
.
faceCellLocalFace
();
const
Kokkos
::
View
<
const
Rd
**>
njr
=
m_mesh_data
.
njr
();
Kokkos
::
parallel_for
(
symmetry_bc
.
numberOfFaces
(),
KOKKOS_LAMBDA
(
const
int
&
l_number
)
{
// quite ugly: node/faces are melt in a bad way... at least works in 1d...
const
int
l
=
symmetry_bc
.
faceList
()[
l_number
];
assert
(
m_connectivity
.
faceNbCells
()
==
1
);
const
unsigned
int
j
=
face_cells
(
l
,
0
);
const
unsigned
int
L
=
face_cell_local_face
(
l
,
0
);
const
SymmetryBoundaryCondition
<
dimension
>&
symmetry_bc
=
dynamic_cast
<
const
SymmetryBoundaryCondition
<
dimension
>&>
(
handler
.
boundaryCondition
());
const
Rd
&
n
=
njr
(
j
,
L
);
const
Rd
&
n
=
symmetry_bc
.
outgoingNormal
();
const
Rdd
I
=
identity
;
const
Rdd
nxn
=
tensorProduct
(
n
,
n
);
const
Rdd
P
=
I
-
nxn
;
m_Ar
(
l
)
=
P
*
m_Ar
(
l
)
*
P
+
nxn
;
m_br
(
l
)
=
P
*
m_br
(
l
);
Kokkos
::
parallel_for
(
symmetry_bc
.
numberOfNodes
(),
KOKKOS_LAMBDA
(
const
int
&
r_number
)
{
const
int
r
=
symmetry_bc
.
nodeList
()[
r_number
];
assert
(
m_connectivity
.
nodeNbCells
()
==
1
);
m_Ar
(
r
)
=
P
*
m_Ar
(
r
)
*
P
+
nxn
;
m_br
(
r
)
=
P
*
m_br
(
r
);
});
break
;
}
...
...
This diff is collapsed.
Click to expand it.
src/scheme/BoundaryCondition.hpp
+
20
−
12
View file @
c5e13607
...
...
@@ -72,31 +72,39 @@ public:
~
PressureBoundaryCondition
()
=
default
;
};
template
<
size_t
dimension
>
class
SymmetryBoundaryCondition
:
public
BoundaryCondition
{
private:
const
size_t
m_number_of_faces
;
Kokkos
::
View
<
unsigned
int
*>
m_face_list
;
public:
typedef
TinyVector
<
dimension
,
double
>
Rd
;
private:
Kokkos
::
View
<
unsigned
int
*>
m_node_list
;
const
Rd
m_outgoing_normal
;
public:
const
size_t
&
numberOfFaces
()
const
const
Rd
&
outgoingNormal
()
const
{
return
m_number_of_faces
;
return
m_outgoing_normal
;
}
size_t
numberOfNodes
()
const
{
return
m_node_list
.
size
();
}
const
Kokkos
::
View
<
const
unsigned
int
*>
fac
eList
()
const
const
Kokkos
::
View
<
const
unsigned
int
*>
nod
eList
()
const
{
return
m_
fac
e_list
;
return
m_
nod
e_list
;
}
SymmetryBoundaryCondition
(
const
std
::
vector
<
unsigned
int
>&
faces
)
SymmetryBoundaryCondition
(
const
std
::
vector
<
unsigned
int
>&
nodes
,
const
Rd
&
outgoing_normal
)
:
BoundaryCondition
(
BoundaryCondition
::
symmetry
),
m_n
umber_of_faces
(
fac
es
.
size
()),
m_
face_list
(
"faces_list"
,
m_number_of_faces
)
m_n
ode_list
(
"node_list"
,
nod
es
.
size
()),
m_
outgoing_normal
(
outgoing_normal
)
{
Kokkos
::
parallel_for
(
m_n
umber_of_faces
,
KOKKOS_LAMBDA
(
const
int
&
f
){
m_
fac
e_list
[
f
]
=
fac
es
[
f
];
Kokkos
::
parallel_for
(
m_n
ode_list
.
size
()
,
KOKKOS_LAMBDA
(
const
int
&
f
){
m_
nod
e_list
[
f
]
=
nod
es
[
f
];
});
}
...
...
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