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
e7406d6f
Commit
e7406d6f
authored
3 years ago
by
Axelle Drouard
Browse files
Options
Downloads
Patches
Plain Diff
Fix corner detection
parent
4ed7dac0
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
+56
-51
56 additions, 51 deletions
src/scheme/ScalarNodalScheme.cpp
with
56 additions
and
51 deletions
src/scheme/ScalarNodalScheme.cpp
+
56
−
51
View file @
e7406d6f
...
@@ -306,38 +306,38 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -306,38 +306,38 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
if
(
is_boundary_node
[
node_id
])
{
if
(
is_boundary_node
[
node_id
])
{
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
const
auto
&
node_local_number_in_its_cell
=
node_local_numbers_in_their_cells
.
itemArray
(
node_id
);
for
(
size_t
i_cell
=
0
;
i_cell
<
node_to_cell
.
size
();
++
i_cell
)
{
for
(
size_t
i_cell
=
0
;
i_cell
<
node_to_cell
.
size
();
++
i_cell
)
{
const
unsigned
int
i_node
=
node_local_number_in_its_cell
[
i_cell
];
const
CellId
cell_id
=
node_to_cell
[
i_cell
];
const
CellId
cell_id
=
node_to_cell
[
i_cell
];
const
auto
&
cell_nodes
=
cell_to_node_matrix
[
cell_id
];
const
auto
&
cell_nodes
=
cell_to_node_matrix
[
cell_id
];
const
NodeId
prev_node_id
=
cell_to_node_matrix
[
cell_id
][(
node_id
-
1
)
%
cell_nodes
.
size
()];
const
NodeId
prev_node_id
=
cell_to_node_matrix
[
cell_id
][(
i_node
-
1
)
%
cell_nodes
.
size
()];
const
NodeId
next_node_id
=
cell_to_node_matrix
[
cell_id
][(
node_id
+
1
)
%
cell_nodes
.
size
()];
const
NodeId
next_node_id
=
cell_to_node_matrix
[
cell_id
][(
i_node
+
1
)
%
cell_nodes
.
size
()];
if
(
is_boundary_node
[
prev_node_id
]
and
is_boundary_node
[
next_node_id
])
{
if
(
is_boundary_node
[
prev_node_id
]
and
is_boundary_node
[
next_node_id
])
{
compute_node_is_corner
[
node_id
]
=
true
;
compute_node_is_corner
[
node_id
]
=
true
;
}
}
}
}
}
}
});
});
return
compute_node_is_corner
;
return
compute_node_is_corner
;
}();
}();
const
NodeValue
<
const
TinyVector
<
Dimension
>>
exterior_normal
=
[
&
]
{
const
NodeValue
<
const
TinyVector
<
Dimension
>>
exterior_normal
=
[
&
]
{
NodeValue
<
TinyVector
<
Dimension
>>
compute_exterior_normal
;
NodeValue
<
TinyVector
<
Dimension
>>
compute_exterior_normal
{
mesh
->
connectivity
()}
;
parallel_for
(
compute_exterior_normal
.
fill
(
zero
);
mesh
->
numberOfNodes
()
,
PUGS_LAMBDA
(
NodeId
node_id
)
{
for
(
NodeId
node_id
=
0
;
node_id
<
mesh
->
numberOfNodes
()
;
++
node_id
)
{
compute_exterior_normal
[
node_id
]
=
zero
;
if
(
is_boundary_node
[
node_id
])
{
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
const
auto
&
node_local_number_in_its_cell
=
node_local_numbers_in_their_cells
.
itemArray
(
node_id
);
const
auto
&
node_local_number_in_its_cell
=
node_local_numbers_in_their_cells
.
itemArray
(
node_id
);
for
(
size_t
i_cell
=
0
;
i_cell
<
node_to_cell
.
size
();
++
i_cell
)
{
for
(
size_t
i_cell
=
0
;
i_cell
<
node_to_cell
.
size
();
++
i_cell
)
{
const
CellId
cell_id
=
node_to_cell
[
i_cell
];
const
CellId
cell_id
=
node_to_cell
[
i_cell
];
const
unsigned
int
i_node_loc
=
node_local_number_in_its_cell
[
cell_id
];
const
unsigned
int
i_node
=
node_local_number_in_its_cell
[
i_cell
];
compute_exterior_normal
[
node_id
]
+=
Cjr
(
cell_id
,
i_node_loc
);
compute_exterior_normal
[
node_id
]
+=
Cjr
(
cell_id
,
i_node
);
}
const
double
norm_exterior_normal
=
l2Norm
(
compute_exterior_normal
[
node_id
]);
compute_exterior_normal
[
node_id
]
*=
1.
/
norm_exterior_normal
;
}
}
}
compute_exterior_normal
[
node_id
]
=
1.
/
l2Norm
(
compute_exterior_normal
[
node_id
])
*
compute_exterior_normal
[
node_id
];
});
return
compute_exterior_normal
;
return
compute_exterior_normal
;
}();
}();
...
@@ -352,8 +352,8 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -352,8 +352,8 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
}();
}();
const
NodeValue
<
const
double
>
node_boundary_values
=
[
&
]
{
const
NodeValue
<
const
double
>
node_boundary_values
=
[
&
]
{
NodeValue
<
double
>
compute_node_boundary_values
;
NodeValue
<
double
>
compute_node_boundary_values
{
mesh
->
connectivity
()}
;
NodeValue
<
double
>
sum_mes_l
;
NodeValue
<
double
>
sum_mes_l
{
mesh
->
connectivity
()}
;
compute_node_boundary_values
.
fill
(
0
);
compute_node_boundary_values
.
fill
(
0
);
sum_mes_l
.
fill
(
0
);
sum_mes_l
.
fill
(
0
);
for
(
const
auto
&
boundary_condition
:
boundary_condition_list
)
{
for
(
const
auto
&
boundary_condition
:
boundary_condition_list
)
{
...
@@ -376,11 +376,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -376,11 +376,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
}
}
}
}
}
}
for
(
NodeId
node_id
=
0
;
node_id
<
mesh
->
numberOfNodes
();
++
node_id
)
{
if
((
not
node_is_dirichlet
[
node_id
])
&&
(
node_is_neumann
[
node_id
]))
{
compute_node_boundary_values
[
node_id
]
/=
sum_mes_l
[
node_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
();
...
@@ -399,15 +395,17 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -399,15 +395,17 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
}
}
}
}
}
}
for
(
NodeId
node_id
=
0
;
node_id
<
mesh
->
numberOfNodes
();
++
node_id
)
{
if
((
not
node_is_neumann
[
node_id
])
&&
(
node_is_dirichlet
[
node_id
]))
{
compute_node_boundary_values
[
node_id
]
/=
sum_mes_l
[
node_id
];
}
}
}
}
},
},
boundary_condition
);
boundary_condition
);
}
}
for
(
NodeId
node_id
=
0
;
node_id
<
mesh
->
numberOfNodes
();
++
node_id
)
{
if
((
not
node_is_dirichlet
[
node_id
])
&&
(
node_is_neumann
[
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
]))
{
compute_node_boundary_values
[
node_id
]
/=
sum_mes_l
[
node_id
];
}
}
return
compute_node_boundary_values
;
return
compute_node_boundary_values
;
}();
}();
...
@@ -416,7 +414,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -416,7 +414,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
CellValue
<
const
TinyMatrix
<
Dimension
>>
cell_kappajb
=
cell_k_bound
->
cellValues
();
CellValue
<
const
TinyMatrix
<
Dimension
>>
cell_kappajb
=
cell_k_bound
->
cellValues
();
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
node_kappar
=
[
&
]
{
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
node_kappar
=
[
&
]
{
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa
;
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa
{
mesh
->
connectivity
()}
;
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
kappa
[
node_id
]
=
zero
;
kappa
[
node_id
]
=
zero
;
...
@@ -434,7 +432,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -434,7 +432,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
}();
}();
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
node_kapparb
=
[
&
]
{
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
node_kapparb
=
[
&
]
{
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa
;
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa
{
mesh
->
connectivity
()}
;
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
kappa
[
node_id
]
=
zero
;
kappa
[
node_id
]
=
zero
;
...
@@ -452,41 +450,45 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -452,41 +450,45 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
}();
}();
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
node_betar
=
[
&
]
{
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
node_betar
=
[
&
]
{
NodeValue
<
TinyMatrix
<
Dimension
>>
beta
;
NodeValue
<
TinyMatrix
<
Dimension
>>
beta
{
mesh
->
connectivity
()}
;
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
const
auto
&
node_local_number_in_its_cell
=
node_local_numbers_in_their_cells
.
itemArray
(
node_id
);
const
auto
&
node_local_number_in_its_cell
=
node_local_numbers_in_their_cells
.
itemArray
(
node_id
);
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
beta
[
node_id
]
=
zero
;
beta
[
node_id
]
=
zero
;
for
(
size_t
j
=
0
;
j
<
node_to_cell
.
size
();
++
j
)
{
for
(
size_t
i_cell
=
0
;
i_cell
<
node_to_cell
.
size
();
++
i_cell
)
{
const
CellId
J
=
node_to_cell
[
j
];
const
CellId
cell_id
=
node_to_cell
[
i_cell
];
const
unsigned
int
R
=
node_local_number_in_its_cell
[
j
];
const
unsigned
int
i_node
=
node_local_number_in_its_cell
[
i_cell
];
beta
[
node_id
]
+=
tensorProduct
(
Cjr
(
J
,
R
),
xr
[
node_id
]
-
xj
[
J
]);
beta
[
node_id
]
+=
tensorProduct
(
Cjr
(
cell_id
,
i_node
),
xr
[
node_id
]
-
xj
[
cell_id
]);
}
}
});
});
return
beta
;
return
beta
;
}();
}();
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
kappar_invBetar
=
[
&
]
{
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
kappar_invBetar
=
[
&
]
{
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa_invBeta
;
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa_invBeta
{
mesh
->
connectivity
()}
;
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
if
(
not
node_is_corner
[
node_id
])
{
kappa_invBeta
[
node_id
]
=
node_kappar
[
node_id
]
*
inverse
(
node_betar
[
node_id
]);
kappa_invBeta
[
node_id
]
=
node_kappar
[
node_id
]
*
inverse
(
node_betar
[
node_id
]);
}
});
});
return
kappa_invBeta
;
return
kappa_invBeta
;
}();
}();
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
kapparb_invBetar
=
[
&
]
{
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
kapparb_invBetar
=
[
&
]
{
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa_invBeta
;
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa_invBeta
{
mesh
->
connectivity
()}
;
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
if
(
not
node_is_corner
[
node_id
])
{
kappa_invBeta
[
node_id
]
=
node_kapparb
[
node_id
]
*
inverse
(
node_betar
[
node_id
]);
kappa_invBeta
[
node_id
]
=
node_kapparb
[
node_id
]
*
inverse
(
node_betar
[
node_id
]);
}
});
});
return
kappa_invBeta
;
return
kappa_invBeta
;
}();
}();
const
NodeValue
<
const
TinyVector
<
Dimension
>>
sum_Cjr
=
[
&
]
{
const
NodeValue
<
const
TinyVector
<
Dimension
>>
sum_Cjr
=
[
&
]
{
NodeValue
<
TinyVector
<
Dimension
>>
compute_sum_Cjr
;
NodeValue
<
TinyVector
<
Dimension
>>
compute_sum_Cjr
{
mesh
->
connectivity
()}
;
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
...
@@ -502,7 +504,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -502,7 +504,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
}();
}();
const
NodeValue
<
const
TinyVector
<
Dimension
>>
v
=
[
&
]
{
const
NodeValue
<
const
TinyVector
<
Dimension
>>
v
=
[
&
]
{
NodeValue
<
TinyVector
<
Dimension
>>
compute_v
;
NodeValue
<
TinyVector
<
Dimension
>>
compute_v
{
mesh
->
connectivity
()}
;
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
compute_v
[
node_id
]
=
node_kapparb
[
node_id
]
*
exterior_normal
[
node_id
];
});
PUGS_LAMBDA
(
NodeId
node_id
)
{
compute_v
[
node_id
]
=
node_kapparb
[
node_id
]
*
exterior_normal
[
node_id
];
});
...
@@ -510,20 +512,23 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -510,20 +512,23 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
}();
}();
const
NodeValuePerCell
<
const
double
>
theta
=
[
&
]
{
const
NodeValuePerCell
<
const
double
>
theta
=
[
&
]
{
NodeValuePerCell
<
double
>
compute_theta
;
NodeValuePerCell
<
double
>
compute_theta
{
mesh
->
connectivity
()};
parallel_for
(
// parallel_for(
mesh
->
numberOfCells
(),
PUGS_LAMBDA
(
CellId
cell_id
)
{
// mesh->numberOfCells(), PUGS_LAMBDA(CellId cell_id) {
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
->
numberOfCells
();
++
cell_id
)
{
const
auto
&
cell_nodes
=
cell_to_node_matrix
[
cell_id
];
const
auto
&
cell_nodes
=
cell_to_node_matrix
[
cell_id
];
for
(
size_t
i_node
=
0
;
i_node
<
cell_nodes
.
size
();
++
i_node
)
{
for
(
size_t
i_node
=
0
;
i_node
<
cell_nodes
.
size
();
++
i_node
)
{
const
NodeId
node_id
=
cell_nodes
[
i_node
];
const
NodeId
node_id
=
cell_nodes
[
i_node
];
std
::
cout
<<
"node_id = "
<<
node_id
<<
"
\n
"
;
compute_theta
(
cell_id
,
i_node
)
=
dot
(
inverse
(
node_betar
[
node_id
])
*
Cjr
(
cell_id
,
i_node
),
v
[
node_id
]);
compute_theta
(
cell_id
,
i_node
)
=
dot
(
inverse
(
node_betar
[
node_id
])
*
Cjr
(
cell_id
,
i_node
),
v
[
node_id
]);
}
}
});
}
// });
return
compute_theta
;
return
compute_theta
;
}();
}();
const
NodeValue
<
const
double
>
sum_theta
=
[
&
]
{
const
NodeValue
<
const
double
>
sum_theta
=
[
&
]
{
NodeValue
<
double
>
compute_sum_theta
;
NodeValue
<
double
>
compute_sum_theta
{
mesh
->
connectivity
()}
;
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
node_id
];
const
auto
&
node_to_cell
=
node_to_cell_matrix
[
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