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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
7bc8d0db
Commit
7bc8d0db
authored
2 years ago
by
Axelle Drouard
Browse files
Options
Downloads
Patches
Plain Diff
Change of the angles calculation for Neumann BC
parent
5b1d4ca1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scheme/ScalarNodalScheme.cpp
+43
-3
43 additions, 3 deletions
src/scheme/ScalarNodalScheme.cpp
with
43 additions
and
3 deletions
src/scheme/ScalarNodalScheme.cpp
+
43
−
3
View file @
7bc8d0db
...
@@ -313,6 +313,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -313,6 +313,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
const
NodeValuePerCell
<
const
TinyVector
<
Dimension
>>&
Cjr
=
mesh_data
.
Cjr
();
const
NodeValuePerCell
<
const
TinyVector
<
Dimension
>>&
Cjr
=
mesh_data
.
Cjr
();
const
auto
is_boundary_node
=
mesh
->
connectivity
().
isBoundaryNode
();
const
auto
is_boundary_node
=
mesh
->
connectivity
().
isBoundaryNode
();
const
auto
is_boundary_face
=
mesh
->
connectivity
().
isBoundaryFace
();
const
auto
&
node_to_face_matrix
=
mesh
->
connectivity
().
nodeToFaceMatrix
();
const
auto
&
node_to_face_matrix
=
mesh
->
connectivity
().
nodeToFaceMatrix
();
const
auto
&
face_to_node_matrix
=
mesh
->
connectivity
().
faceToNodeMatrix
();
const
auto
&
face_to_node_matrix
=
mesh
->
connectivity
().
faceToNodeMatrix
();
...
@@ -320,6 +321,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -320,6 +321,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
const
auto
&
node_local_numbers_in_their_cells
=
mesh
->
connectivity
().
nodeLocalNumbersInTheirCells
();
const
auto
&
node_local_numbers_in_their_cells
=
mesh
->
connectivity
().
nodeLocalNumbersInTheirCells
();
const
CellValue
<
const
double
>
Vj
=
mesh_data
.
Vj
();
const
CellValue
<
const
double
>
Vj
=
mesh_data
.
Vj
();
const
auto
&
node_to_cell_matrix
=
mesh
->
connectivity
().
nodeToCellMatrix
();
const
auto
&
node_to_cell_matrix
=
mesh
->
connectivity
().
nodeToCellMatrix
();
const
auto
&
nl
=
mesh_data
.
nl
();
const
NodeValue
<
const
bool
>
node_is_neumann
=
[
&
]
{
const
NodeValue
<
const
bool
>
node_is_neumann
=
[
&
]
{
NodeValue
<
bool
>
compute_node_is_neumann
{
mesh
->
connectivity
()};
NodeValue
<
bool
>
compute_node_is_neumann
{
mesh
->
connectivity
()};
...
@@ -409,6 +411,35 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -409,6 +411,35 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
return
compute_node_is_corner
;
return
compute_node_is_corner
;
}();
}();
const
NodeValue
<
const
bool
>
node_is_angle
=
[
&
]
{
NodeValue
<
bool
>
compute_node_is_angle
{
mesh
->
connectivity
()};
compute_node_is_angle
.
fill
(
false
);
parallel_for
(
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
if
(
is_boundary_node
[
node_id
])
{
const
auto
&
node_to_face
=
node_to_face_matrix
[
node_id
];
TinyVector
<
Dimension
>
n1
=
zero
;
TinyVector
<
Dimension
>
n2
=
zero
;
for
(
size_t
i_face
=
0
;
i_face
<
node_to_face
.
size
();
++
i_face
)
{
FaceId
face_id
=
node_to_face
[
i_face
];
if
(
is_boundary_face
[
face_id
])
{
if
(
l2Norm
(
n1
)
==
0
)
{
n1
=
nl
[
face_id
];
}
else
{
n2
=
nl
[
face_id
];
}
}
if
(
n1
!=
n2
)
{
compute_node_is_angle
[
node_id
]
=
true
;
}
}
}
});
return
compute_node_is_angle
;
}();
const
NodeValue
<
const
TinyVector
<
Dimension
>>
exterior_normal
=
[
&
]
{
const
NodeValue
<
const
TinyVector
<
Dimension
>>
exterior_normal
=
[
&
]
{
NodeValue
<
TinyVector
<
Dimension
>>
compute_exterior_normal
{
mesh
->
connectivity
()};
NodeValue
<
TinyVector
<
Dimension
>>
compute_exterior_normal
{
mesh
->
connectivity
()};
compute_exterior_normal
.
fill
(
zero
);
compute_exterior_normal
.
fill
(
zero
);
...
@@ -429,6 +460,10 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -429,6 +460,10 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
return
compute_exterior_normal
;
return
compute_exterior_normal
;
}();
}();
// for (NodeId node_id = 0; node_id < mesh->numberOfNodes(); ++node_id) {
// std::cout << node_id << " " << exterior_normal[node_id] << "\n";
//};
const
FaceValue
<
const
double
>
mes_l
=
[
&
]
{
const
FaceValue
<
const
double
>
mes_l
=
[
&
]
{
if
constexpr
(
Dimension
==
1
)
{
if
constexpr
(
Dimension
==
1
)
{
FaceValue
<
double
>
compute_mes_l
{
mesh
->
connectivity
()};
FaceValue
<
double
>
compute_mes_l
{
mesh
->
connectivity
()};
...
@@ -459,11 +494,16 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -459,11 +494,16 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
for
(
size_t
i_node
=
0
;
i_node
<
face_nodes
.
size
();
++
i_node
)
{
for
(
size_t
i_node
=
0
;
i_node
<
face_nodes
.
size
();
++
i_node
)
{
const
NodeId
node_id
=
face_nodes
[
i_node
];
const
NodeId
node_id
=
face_nodes
[
i_node
];
if
(
not
node_is_dirichlet
[
node_id
])
{
if
(
not
node_is_dirichlet
[
node_id
])
{
if
(
node_is_angle
[
node_id
])
{
compute_node_boundary_values
[
node_id
]
+=
value_list
[
i_face
]
*
std
::
abs
(
dot
(
nl
[
face_id
],
exterior_normal
[
node_id
]));
}
else
{
compute_node_boundary_values
[
node_id
]
+=
value_list
[
i_face
]
*
mes_l
[
face_id
];
compute_node_boundary_values
[
node_id
]
+=
value_list
[
i_face
]
*
mes_l
[
face_id
];
sum_mes_l
[
node_id
]
+=
mes_l
[
face_id
];
sum_mes_l
[
node_id
]
+=
mes_l
[
face_id
];
}
}
}
}
}
}
}
}
else
if
constexpr
(
std
::
is_same_v
<
T
,
DirichletBoundaryCondition
>
)
{
}
else
if
constexpr
(
std
::
is_same_v
<
T
,
DirichletBoundaryCondition
>
)
{
const
auto
&
face_list
=
bc
.
faceList
();
const
auto
&
face_list
=
bc
.
faceList
();
const
auto
&
value_list
=
bc
.
valueList
();
const
auto
&
value_list
=
bc
.
valueList
();
...
@@ -487,7 +527,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -487,7 +527,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
boundary_condition
);
boundary_condition
);
}
}
for
(
NodeId
node_id
=
0
;
node_id
<
mesh
->
numberOfNodes
();
++
node_id
)
{
for
(
NodeId
node_id
=
0
;
node_id
<
mesh
->
numberOfNodes
();
++
node_id
)
{
if
((
not
node_is_dirichlet
[
node_id
])
&&
(
node_is_neumann
[
node_id
]))
{
if
((
not
node_is_dirichlet
[
node_id
])
&&
(
node_is_neumann
[
node_id
])
and
not
node_is_angle
[
node_id
]
)
{
compute_node_boundary_values
[
node_id
]
/=
sum_mes_l
[
node_id
];
compute_node_boundary_values
[
node_id
]
/=
sum_mes_l
[
node_id
];
}
else
if
((
not
node_is_neumann
[
node_id
])
&&
(
node_is_dirichlet
[
node_id
]))
{
}
else
if
((
not
node_is_neumann
[
node_id
])
&&
(
node_is_dirichlet
[
node_id
]))
{
compute_node_boundary_values
[
node_id
]
/=
sum_mes_l
[
node_id
];
compute_node_boundary_values
[
node_id
]
/=
sum_mes_l
[
node_id
];
...
...
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