Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
7b9db57d
Commit
7b9db57d
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
allow extrusion of 2D boundary layer meshes
parent
bcc30e36
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Mesh/Field.cpp
+29
-36
29 additions, 36 deletions
Mesh/Field.cpp
Mesh/Field.h
+2
-2
2 additions, 2 deletions
Mesh/Field.h
with
31 additions
and
38 deletions
Mesh/Field.cpp
+
29
−
36
View file @
7b9db57d
...
@@ -2199,7 +2199,6 @@ std::string BoundaryLayerField::getDescription()
...
@@ -2199,7 +2199,6 @@ std::string BoundaryLayerField::getDescription()
BoundaryLayerField
::
BoundaryLayerField
()
BoundaryLayerField
::
BoundaryLayerField
()
{
{
hwall_n
=
.1
;
hwall_n
=
.1
;
// hwall_t = .5;
hfar
=
1
;
hfar
=
1
;
ratio
=
1.1
;
ratio
=
1.1
;
thickness
=
1.e-2
;
thickness
=
1.e-2
;
...
@@ -2242,7 +2241,8 @@ void BoundaryLayerField::removeAttractors()
...
@@ -2242,7 +2241,8 @@ void BoundaryLayerField::removeAttractors()
update_needed
=
true
;
update_needed
=
true
;
}
}
void
BoundaryLayerField
::
setupFor1d
(
int
iE
)
{
void
BoundaryLayerField
::
setupFor1d
(
int
iE
)
{
if
(
edges_id_saved
.
empty
()
){
if
(
edges_id_saved
.
empty
()
){
edges_id_saved
=
edges_id
;
edges_id_saved
=
edges_id
;
nodes_id_saved
=
nodes_id
;
nodes_id_saved
=
nodes_id
;
...
@@ -2270,13 +2270,9 @@ void BoundaryLayerField::setupFor1d(int iE) {
...
@@ -2270,13 +2270,9 @@ void BoundaryLayerField::setupFor1d(int iE) {
removeAttractors
();
removeAttractors
();
}
}
void
BoundaryLayerField
::
setupFor2d
(
int
iF
)
void
BoundaryLayerField
::
setupFor2d
(
int
iF
)
{
{
/* preprocess data in the following way
// remove GFaces from the attractors (only used in 2D) for edges and vertices
remove GFaces from the attarctors (only used in 2D)
for edges and vertices
*/
if
(
edges_id_saved
.
empty
()){
if
(
edges_id_saved
.
empty
()){
edges_id_saved
=
edges_id
;
edges_id_saved
=
edges_id
;
nodes_id_saved
=
nodes_id
;
nodes_id_saved
=
nodes_id
;
...
@@ -2285,31 +2281,36 @@ void BoundaryLayerField::setupFor2d(int iF)
...
@@ -2285,31 +2281,36 @@ void BoundaryLayerField::setupFor2d(int iF)
nodes_id
.
clear
();
nodes_id
.
clear
();
edges_id
.
clear
();
edges_id
.
clear
();
// printf("have %d %d\n",faces_id_saved.size(),edges_id_saved.size());
// FIXME :
// NOT REALLY A NICE WAY TO DO IT (VERY AD HOC)
/// FIXME :
// THIS COULD BE PART OF THE INPUT
/// NOT REALLY A NICE WAY TO DO IT (VERY AD HOC)
// OR (better) CHANGE THE PHILOSOPHY
/// THIS COULD BE PART OF THE INPUT
/// OR (better) CHANGE THE PHILOSOPHY
GFace
*
gf
=
GModel
::
current
()
->
getFaceByTag
(
iF
);
GFace
*
gf
=
GModel
::
current
()
->
getFaceByTag
(
iF
);
std
::
list
<
GEdge
*>
ed
=
gf
->
edges
();
std
::
list
<
GEdge
*>
ed
=
gf
->
edges
();
std
::
list
<
GEdge
*>
embedded_edges
=
gf
->
embeddedEdges
();
std
::
list
<
GEdge
*>
embedded_edges
=
gf
->
embeddedEdges
();
ed
.
insert
(
ed
.
begin
(),
embedded_edges
.
begin
(),
embedded_edges
.
end
());
ed
.
insert
(
ed
.
begin
(),
embedded_edges
.
begin
(),
embedded_edges
.
end
());
// printf("face %d has %d edges\n",iF,ed.size());
for
(
std
::
list
<
GEdge
*>::
iterator
it
=
ed
.
begin
();
it
!=
ed
.
end
()
;
++
it
){
for
(
std
::
list
<
GEdge
*>::
iterator
it
=
ed
.
begin
();
it
!=
ed
.
end
()
;
++
it
){
bool
isIn
=
false
;
bool
isIn
=
false
;
int
iE
=
(
*
it
)
->
tag
();
int
iE
=
(
*
it
)
->
tag
();
bool
found
=
std
::
find
(
edges_id_saved
.
begin
(),
edges_id_saved
.
end
(),
iE
)
!=
bool
found
=
std
::
find
(
edges_id_saved
.
begin
(),
edges_id_saved
.
end
(),
iE
)
!=
edges_id_saved
.
end
();
edges_id_saved
.
end
();
// printf("edges %d found %d\n",iE,found);
// this edge is a BL Edge
// this edge is a BL Edge
if
(
found
){
if
(
found
){
std
::
list
<
GFace
*>
fc
=
(
*
it
)
->
faces
();
std
::
list
<
GFace
*>
fc
=
(
*
it
)
->
faces
();
// one only face --> 2D --> BL
int
numf
=
0
;
if
(
fc
.
size
()
<=
1
)
isIn
=
true
;
for
(
std
::
list
<
GFace
*>::
iterator
it
=
fc
.
begin
();
it
!=
fc
.
end
();
it
++
){
if
((
*
it
)
->
meshAttributes
.
extrude
&&
(
*
it
)
->
meshAttributes
.
extrude
->
geo
.
Mode
==
EXTRUDED_ENTITY
){
// ok
}
else
{
numf
++
;
}
}
// one only face, or other faces are extruded --> 2D --> BL
if
(
numf
<=
1
)
isIn
=
true
;
else
{
else
{
Msg
::
Error
(
"Only 2D Boundary Layers are supported (edge %d is adjacet to %d faces"
,
Msg
::
Error
(
"Only 2D Boundary Layers are supported (edge %d is adjacet to %d faces"
,
iE
,
fc
.
size
());
iE
,
fc
.
size
());
...
@@ -2321,7 +2322,7 @@ void BoundaryLayerField::setupFor2d(int iF)
...
@@ -2321,7 +2322,7 @@ void BoundaryLayerField::setupFor2d(int iF)
nodes_id
.
push_back
((
*
it
)
->
getEndVertex
()
->
tag
());
nodes_id
.
push_back
((
*
it
)
->
getEndVertex
()
->
tag
());
}
}
}
}
// printf("face %d %d BL Edges\n", iF, (int)edges_id.size());
removeAttractors
();
removeAttractors
();
}
}
...
@@ -2339,15 +2340,12 @@ double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge
...
@@ -2339,15 +2340,12 @@ double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge
update_needed
=
false
;
update_needed
=
false
;
}
}
double
dist
=
1.e22
;
double
dist
=
1.e22
;
if
(
_att_fields
.
empty
())
return
dist
;
if
(
_att_fields
.
empty
())
return
dist
;
// AttractorField *cc;
for
(
std
::
list
<
AttractorField
*>::
iterator
it
=
_att_fields
.
begin
();
for
(
std
::
list
<
AttractorField
*>::
iterator
it
=
_att_fields
.
begin
();
it
!=
_att_fields
.
end
();
++
it
){
it
!=
_att_fields
.
end
();
++
it
){
double
cdist
=
(
*
(
*
it
))
(
x
,
y
,
z
);
double
cdist
=
(
*
(
*
it
))
(
x
,
y
,
z
);
if
(
cdist
<
dist
){
if
(
cdist
<
dist
){
// cc = *it;
dist
=
cdist
;
dist
=
cdist
;
}
}
}
}
...
@@ -2359,7 +2357,6 @@ double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge
...
@@ -2359,7 +2357,6 @@ double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge
double
lc
=
dist
*
(
ratio
-
1
)
+
hwall_n
;
double
lc
=
dist
*
(
ratio
-
1
)
+
hwall_n
;
// double lc = hwall_n;
// double lc = hwall_n;
// double lc = hwall_n * pow (ratio, dist / hwall_t);
return
std
::
min
(
hfar
,
lc
);
return
std
::
min
(
hfar
,
lc
);
}
}
...
@@ -2402,9 +2399,6 @@ void BoundaryLayerField::operator() (AttractorField *cc, double dist,
...
@@ -2402,9 +2399,6 @@ void BoundaryLayerField::operator() (AttractorField *cc, double dist,
double
x
,
double
y
,
double
z
,
double
x
,
double
y
,
double
z
,
SMetric3
&
metr
,
GEntity
*
ge
)
SMetric3
&
metr
,
GEntity
*
ge
)
{
{
// printf("WHAT THE FUCK\n");
// dist = hwall -> lc = hwall * ratio
// dist = hwall -> lc = hwall * ratio
// dist = hwall (1+ratio) -> lc = hwall ratio ^ 2
// dist = hwall (1+ratio) -> lc = hwall ratio ^ 2
// dist = hwall (1+ratio+ratio^2) -> lc = hwall ratio ^ 3
// dist = hwall (1+ratio+ratio^2) -> lc = hwall ratio ^ 3
...
@@ -2417,8 +2411,7 @@ void BoundaryLayerField::operator() (AttractorField *cc, double dist,
...
@@ -2417,8 +2411,7 @@ void BoundaryLayerField::operator() (AttractorField *cc, double dist,
const
double
ll1
=
dist
*
(
ratio
-
1
)
+
hwall_n
;
const
double
ll1
=
dist
*
(
ratio
-
1
)
+
hwall_n
;
double
lc_n
=
std
::
min
(
ll1
,
hfar
);
double
lc_n
=
std
::
min
(
ll1
,
hfar
);
// const double ll2 = dist*(ratio-1) + hwall_t;
double
lc_t
=
std
::
min
(
lc_n
*
CTX
::
instance
()
->
mesh
.
anisoMax
,
hfar
);
double
lc_t
=
std
::
min
(
lc_n
*
CTX
::
instance
()
->
mesh
.
anisoMax
,
hfar
/*std::min(ll2,hfar)*/
);
lc_n
=
std
::
max
(
lc_n
,
CTX
::
instance
()
->
mesh
.
lcMin
);
lc_n
=
std
::
max
(
lc_n
,
CTX
::
instance
()
->
mesh
.
lcMin
);
lc_n
=
std
::
min
(
lc_n
,
CTX
::
instance
()
->
mesh
.
lcMax
);
lc_n
=
std
::
min
(
lc_n
,
CTX
::
instance
()
->
mesh
.
lcMax
);
...
...
This diff is collapsed.
Click to expand it.
Mesh/Field.h
+
2
−
2
View file @
7b9db57d
...
@@ -149,7 +149,7 @@ class BoundaryLayerField : public Field {
...
@@ -149,7 +149,7 @@ class BoundaryLayerField : public Field {
void
operator
()
(
AttractorField
*
cc
,
double
dist
,
double
x
,
double
y
,
double
z
,
void
operator
()
(
AttractorField
*
cc
,
double
dist
,
double
x
,
double
y
,
double
z
,
SMetric3
&
metr
,
GEntity
*
ge
);
SMetric3
&
metr
,
GEntity
*
ge
);
public:
public:
double
hwall_n
,
/*hwall_t,*/
ratio
,
hfar
,
thickness
,
fan_angle
;
double
hwall_n
,
ratio
,
hfar
,
thickness
,
fan_angle
;
double
current_distance
,
tgt_aniso_ratio
;
double
current_distance
,
tgt_aniso_ratio
;
SPoint3
_closest_point
;
SPoint3
_closest_point
;
int
iRecombine
,
iIntersect
;
int
iRecombine
,
iIntersect
;
...
...
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