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
3544d208
Commit
3544d208
authored
9 years ago
by
Jean-François Remacle
Browse files
Options
Downloads
Patches
Plain Diff
2D boundary layers now are ablt take into account axis of symmetry
parent
4e9fea86
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Mesh/Field.cpp
+100
-59
100 additions, 59 deletions
Mesh/Field.cpp
Mesh/Field.h
+1
-0
1 addition, 0 deletions
Mesh/Field.h
Mesh/meshGEdge.cpp
+37
-5
37 additions, 5 deletions
Mesh/meshGEdge.cpp
with
138 additions
and
64 deletions
Mesh/Field.cpp
+
100
−
59
View file @
3544d208
...
@@ -2249,18 +2249,54 @@ void BoundaryLayerField::removeAttractors()
...
@@ -2249,18 +2249,54 @@ void BoundaryLayerField::removeAttractors()
update_needed
=
true
;
update_needed
=
true
;
}
}
void
BoundaryLayerField
::
setupFor1d
(
int
iE
)
{
if
(
faces_id_saved
.
empty
()
&&
edges_id_saved
.
empty
()
&&
faces_id_saved
.
empty
()
){
faces_id_saved
=
faces_id
;
edges_id_saved
=
edges_id
;
nodes_id_saved
=
nodes_id
;
}
nodes_id
.
clear
();
edges_id
.
clear
();
faces_id
.
clear
();
bool
found
=
std
::
find
(
edges_id_saved
.
begin
(),
edges_id_saved
.
end
(),
iE
)
!=
edges_id_saved
.
end
();
if
(
!
found
)
{
GEdge
*
ge
=
GModel
::
current
()
->
getEdgeByTag
(
iE
);
GVertex
*
gv0
=
ge
->
getBeginVertex
();
found
=
std
::
find
(
nodes_id_saved
.
begin
(),
nodes_id_saved
.
end
(),
gv0
->
tag
())
!=
nodes_id_saved
.
end
();
if
(
found
)
nodes_id
.
push_back
(
gv0
->
tag
());
GVertex
*
gv1
=
ge
->
getEndVertex
();
found
=
std
::
find
(
nodes_id_saved
.
begin
(),
nodes_id_saved
.
end
(),
gv1
->
tag
())
!=
nodes_id_saved
.
end
();
if
(
found
)
nodes_id
.
push_back
(
gv1
->
tag
());
}
// printf("edge %d %d nodes added\n",iE,nodes_id.size());
// getchar();
removeAttractors
();
}
void
BoundaryLayerField
::
setupFor2d
(
int
iF
)
void
BoundaryLayerField
::
setupFor2d
(
int
iF
)
{
{
if
(
1
||
faces_id
.
size
()){
/* preprocess data in the following way
/* preprocess data in the following way
remove GFaces from the attarctors (only used in 2D)
remove GFaces from the attarctors (only used in 2D)
for edges and vertices
for edges and vertices
*/
*/
if
(
!
faces_id_saved
.
size
()){
if
(
faces_id_saved
.
empty
()
&&
edges_id_saved
.
empty
()
&&
faces_id_saved
.
empty
()
){
faces_id_saved
=
faces_id
;
faces_id_saved
=
faces_id
;
edges_id_saved
=
edges_id
;
edges_id_saved
=
edges_id
;
nodes_id_saved
=
nodes_id
;
nodes_id_saved
=
nodes_id
;
}
}
nodes_id
.
clear
();
nodes_id
.
clear
();
edges_id
.
clear
();
edges_id
.
clear
();
faces_id
.
clear
();
faces_id
.
clear
();
...
@@ -2313,7 +2349,6 @@ void BoundaryLayerField::setupFor2d(int iF)
...
@@ -2313,7 +2349,6 @@ void BoundaryLayerField::setupFor2d(int iF)
// printf("face %d %d BL Edges\n", iF, (int)edges_id.size());
// printf("face %d %d BL Edges\n", iF, (int)edges_id.size());
removeAttractors
();
removeAttractors
();
}
}
}
void
BoundaryLayerField
::
setupFor3d
()
void
BoundaryLayerField
::
setupFor3d
()
{
{
...
@@ -2339,7 +2374,9 @@ double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge
...
@@ -2339,7 +2374,9 @@ 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
;
// AttractorField *cc;
// 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
){
...
@@ -2349,11 +2386,15 @@ double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge
...
@@ -2349,11 +2386,15 @@ double BoundaryLayerField::operator() (double x, double y, double z, GEntity *ge
dist
=
cdist
;
dist
=
cdist
;
}
}
}
}
if
(
dist
>
thickness
*
ratio
)
return
1.e22
;
current_distance
=
dist
;
current_distance
=
dist
;
// const double dist = (*field) (x, y, z);
// const double dist = (*field) (x, y, z);
// current_distance = dist;
// current_distance = dist;
const
double
lc
=
dist
*
(
ratio
-
1
)
+
hwall_t
;
double
lc
=
dist
*
(
ratio
-
1
)
+
hwall_n
;
// double lc = hwall * pow (ratio, dist / hwall);
// double lc = hwall_n;
// double lc = hwall_n * pow (ratio, dist / hwall_t);
return
std
::
min
(
hfar
,
lc
);
return
std
::
min
(
hfar
,
lc
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Mesh/Field.h
+
1
−
0
View file @
3544d208
...
@@ -182,6 +182,7 @@ class BoundaryLayerField : public Field {
...
@@ -182,6 +182,7 @@ class BoundaryLayerField : public Field {
return
std
::
find
(
nodes_id
.
begin
(),
nodes_id
.
end
(),
iV
)
!=
nodes_id
.
end
();
return
std
::
find
(
nodes_id
.
begin
(),
nodes_id
.
end
(),
iV
)
!=
nodes_id
.
end
();
}
}
void
computeFor1dMesh
(
double
x
,
double
y
,
double
z
,
SMetric3
&
metr
);
void
computeFor1dMesh
(
double
x
,
double
y
,
double
z
,
SMetric3
&
metr
);
void
setupFor1d
(
int
iE
);
void
setupFor2d
(
int
iF
);
void
setupFor2d
(
int
iF
);
void
setupFor3d
();
void
setupFor3d
();
void
removeAttractors
();
void
removeAttractors
();
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshGEdge.cpp
+
37
−
5
View file @
3544d208
...
@@ -78,12 +78,34 @@ static double smoothPrimitive(GEdge *ge, double alpha,
...
@@ -78,12 +78,34 @@ static double smoothPrimitive(GEdge *ge, double alpha,
static
double
F_LcB
(
GEdge
*
ge
,
double
t
)
static
double
F_LcB
(
GEdge
*
ge
,
double
t
)
{
{
BoundaryLayerField
*
blf
=
0
;
#if defined(HAVE_ANN)
FieldManager
*
fields
=
ge
->
model
()
->
getFields
();
Field
*
bl_field
=
fields
->
get
(
fields
->
getBoundaryLayerField
());
blf
=
dynamic_cast
<
BoundaryLayerField
*>
(
bl_field
);
#endif
GPoint
p
=
ge
->
point
(
t
);
GPoint
p
=
ge
->
point
(
t
);
return
BGM_MeshSize
(
ge
,
t
,
0
,
p
.
x
(),
p
.
y
(),
p
.
z
());
double
lc
=
BGM_MeshSize
(
ge
,
t
,
0
,
p
.
x
(),
p
.
y
(),
p
.
z
());
if
(
blf
){
double
lc2
=
(
*
blf
)(
p
.
x
(),
p
.
y
(),
p
.
z
()
,
ge
);
// printf("p %g %g lc %g\n",p.x(),p.y(),lc2);
lc
=
std
::
min
(
lc
,
lc2
);
}
return
lc
;
}
}
static
double
F_Lc
(
GEdge
*
ge
,
double
t
)
static
double
F_Lc
(
GEdge
*
ge
,
double
t
)
{
{
BoundaryLayerField
*
blf
=
0
;
#if defined(HAVE_ANN)
FieldManager
*
fields
=
ge
->
model
()
->
getFields
();
Field
*
bl_field
=
fields
->
get
(
fields
->
getBoundaryLayerField
());
blf
=
dynamic_cast
<
BoundaryLayerField
*>
(
bl_field
);
#endif
GPoint
p
=
ge
->
point
(
t
);
GPoint
p
=
ge
->
point
(
t
);
double
lc_here
;
double
lc_here
;
...
@@ -98,6 +120,12 @@ static double F_Lc(GEdge *ge, double t)
...
@@ -98,6 +120,12 @@ static double F_Lc(GEdge *ge, double t)
else
else
lc_here
=
BGM_MeshSize
(
ge
,
t
,
0
,
p
.
x
(),
p
.
y
(),
p
.
z
());
lc_here
=
BGM_MeshSize
(
ge
,
t
,
0
,
p
.
x
(),
p
.
y
(),
p
.
z
());
if
(
blf
){
double
lc2
=
(
*
blf
)(
p
.
x
(),
p
.
y
(),
p
.
z
()
,
ge
);
// printf("p %g %g lc %g\n",p.x(),p.y(),lc2);
lc_here
=
std
::
min
(
lc_here
,
lc2
);
}
SVector3
der
=
ge
->
firstDer
(
t
);
SVector3
der
=
ge
->
firstDer
(
t
);
const
double
d
=
norm
(
der
);
const
double
d
=
norm
(
der
);
...
@@ -115,6 +143,8 @@ static double F_Lc_aniso(GEdge *ge, double t)
...
@@ -115,6 +143,8 @@ static double F_Lc_aniso(GEdge *ge, double t)
bool
blf
=
false
;
bool
blf
=
false
;
#endif
#endif
printf
(
"coucou
\n
"
);
GPoint
p
=
ge
->
point
(
t
);
GPoint
p
=
ge
->
point
(
t
);
SMetric3
lc_here
;
SMetric3
lc_here
;
...
@@ -397,11 +427,12 @@ static void filterPoints (GEdge*ge) {
...
@@ -397,11 +427,12 @@ static void filterPoints (GEdge*ge) {
void
meshGEdge
::
operator
()
(
GEdge
*
ge
)
void
meshGEdge
::
operator
()
(
GEdge
*
ge
)
{
{
BoundaryLayerField
*
blf
=
0
;
#if defined(HAVE_ANN)
#if defined(HAVE_ANN)
FieldManager
*
fields
=
ge
->
model
()
->
getFields
();
FieldManager
*
fields
=
ge
->
model
()
->
getFields
();
BoundaryLayerField
*
blf
=
0
;
Field
*
bl_field
=
fields
->
get
(
fields
->
getBoundaryLayerField
());
Field
*
bl_field
=
fields
->
get
(
fields
->
getBoundaryLayerField
());
blf
=
dynamic_cast
<
BoundaryLayerField
*>
(
bl_field
);
blf
=
dynamic_cast
<
BoundaryLayerField
*>
(
bl_field
);
if
(
blf
)
blf
->
setupFor1d
(
ge
->
tag
());
#else
#else
bool
blf
=
false
;
bool
blf
=
false
;
#endif
#endif
...
@@ -476,7 +507,7 @@ void meshGEdge::operator() (GEdge *ge)
...
@@ -476,7 +507,7 @@ void meshGEdge::operator() (GEdge *ge)
N
/=
CTX
::
instance
()
->
mesh
.
lcFactor
;
N
/=
CTX
::
instance
()
->
mesh
.
lcFactor
;
}
}
else
{
else
{
if
(
CTX
::
instance
()
->
mesh
.
algo2d
==
ALGO_2D_BAMG
||
blf
){
if
(
CTX
::
instance
()
->
mesh
.
algo2d
==
ALGO_2D_BAMG
/*
|| blf
*/
){
a
=
Integration
(
ge
,
t_begin
,
t_end
,
F_Lc_aniso
,
Points
,
a
=
Integration
(
ge
,
t_begin
,
t_end
,
F_Lc_aniso
,
Points
,
CTX
::
instance
()
->
mesh
.
lcIntegrationPrecision
);
CTX
::
instance
()
->
mesh
.
lcIntegrationPrecision
);
}
}
...
@@ -491,7 +522,7 @@ void meshGEdge::operator() (GEdge *ge)
...
@@ -491,7 +522,7 @@ void meshGEdge::operator() (GEdge *ge)
SVector3
der
=
ge
->
firstDer
(
pt
.
t
);
SVector3
der
=
ge
->
firstDer
(
pt
.
t
);
pt
.
xp
=
der
.
norm
();
pt
.
xp
=
der
.
norm
();
}
}
a
=
smoothPrimitive
(
ge
,
sqrt
(
CTX
::
instance
()
->
mesh
.
smoothRatio
),
Points
);
//
a = smoothPrimitive(ge, sqrt(CTX::instance()->mesh.smoothRatio), Points);
N
=
std
::
max
(
ge
->
minimumMeshSegments
()
+
1
,
(
int
)(
a
+
1.99
));
N
=
std
::
max
(
ge
->
minimumMeshSegments
()
+
1
,
(
int
)(
a
+
1.99
));
}
}
...
@@ -517,6 +548,7 @@ void meshGEdge::operator() (GEdge *ge)
...
@@ -517,6 +548,7 @@ void meshGEdge::operator() (GEdge *ge)
}
}
}
}
//printFandPrimitive(ge->tag(),Points);
//printFandPrimitive(ge->tag(),Points);
// if the curve is periodic and if the begin vertex is identical to
// if the curve is periodic and if the begin vertex is identical to
...
...
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