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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
bbc23fb9
Commit
bbc23fb9
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
select time step
parent
0bc9114c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Plugin/StreamLines.cpp
+31
-23
31 additions, 23 deletions
Plugin/StreamLines.cpp
with
31 additions
and
23 deletions
Plugin/StreamLines.cpp
+
31
−
23
View file @
bbc23fb9
// $Id: StreamLines.cpp,v 1.2
5
2007-05-
04 10:45
:0
9
geuzaine Exp $
// $Id: StreamLines.cpp,v 1.2
6
2007-05-
19 16:38
:0
1
geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -46,6 +46,7 @@ StringXNumber StreamLinesOptions_Number[] = {
{
GMSH_FULLRC
,
"nPointsV"
,
GMSH_StreamLinesPlugin
::
callbackV
,
1
},
{
GMSH_FULLRC
,
"MaxIter"
,
NULL
,
100
},
{
GMSH_FULLRC
,
"DT"
,
NULL
,
.1
},
{
GMSH_FULLRC
,
"TimeStep"
,
NULL
,
0
},
{
GMSH_FULLRC
,
"dView"
,
NULL
,
-
1.
},
{
GMSH_FULLRC
,
"iView"
,
NULL
,
-
1.
}
};
...
...
@@ -171,21 +172,21 @@ void GMSH_StreamLinesPlugin::getInfos(char *author, char *copyright,
strcpy
(
copyright
,
"DGR (www.multiphysics.com)"
);
strcpy
(
help_text
,
"Plugin(StreamLines) computes stream lines
\n
"
"from
a vector view `iView' and optionally
\n
"
"
interpolates the scalar
view `
d
View'
on
the
\n
"
"
resulting stream lines. It takes as input a
\n
"
"
grid defined by the 3 points (`X0',`Y0',`Z0')
\n
"
"
(origin),
(`X
1
',`Y
1
',`Z
1
') (
axis of U) and
\n
"
"(`X
2
',`Y
2
',`Z
2
') (axis of
V). The number of points
\n
"
"
that are going to be transported along U and V is
\n
"
"
set with the options `nPointsU' and `nPointsV'.
\n
"
"
Then, we solve the equation DX(t)/dt = V(x,y,z)
\n
"
"
with X(t=0) chosen as the grid and V(x,y,z)
\n
"
"
interpolated on the vector view. The timestep and
\n
"
"
the maximum number of iterations are set with
\n
"
"
the options `MaxIter' and `DT'. The time stepping
\n
"
"
scheme is a RK44
. If `iView' < 0, the
plugin is run
\n
"
"on the current view.
\n
"
"from
the `TimeStep'-th time step of a vector
\n
"
"view `
i
View'
and optionally interpolates
the
\n
"
"
scalar view `dView' on the resulting stream
\n
"
"
lines. The plugin takes as input a grid defined
\n
"
"
by the 3 points
(`X
0
',`Y
0
',`Z
0
') (
origin),
\n
"
"(`X
1
',`Y
1
',`Z
1
') (axis of
U) and (`X2',`Y2',`Z2')
\n
"
"
(axis of V). The number of points that are to
\n
"
"
be transported along U and V is set with the
\n
"
"
options `nPointsU' and `nPointsV'. The equation
\n
"
"
DX(t)/dt=V(x,y,z) is then solved with the initial
\n
"
"
condition X(t=0) chosen as the grid and with V(x,y,z)
\n
"
"
interpolated on the vector view. The time stepping
\n
"
"
scheme is a RK44 with step size `DT' and `MaxIter'
\n
"
"
maximum number of iterations
. If `iView' < 0, the
\n
"
"
plugin is run
on the current view.
\n
"
"
\n
"
"Plugin(StreamLines) creates one new view. This
\n
"
"view contains multi-step vector points if `dView'
\n
"
...
...
@@ -259,6 +260,13 @@ Post_View * GMSH_StreamLinesPlugin::GenerateView(int iView, int dView) const
return
NULL
;
}
int
timestep
=
(
int
)
StreamLinesOptions_Number
[
13
].
def
;
if
(
timestep
<
0
||
timestep
>
v1
->
NbTimeStep
-
1
){
Msg
(
GERROR
,
"Invalid time step (%d) in View[%d]: using step 0 instead"
,
timestep
,
v1
->
Index
);
timestep
=
0
;
}
OctreePost
o
(
v1
);
OctreePost
*
o2
=
NULL
;
...
...
@@ -293,17 +301,17 @@ Post_View * GMSH_StreamLinesPlugin::GenerateView(int iView, int dView) const
// X4 = X + a4 * DT * V(X3)
// X = X + b1 X1 + b2 X2 + b3 X3 + b4 x4
// o.searchVector(X[0], X[1], X[2], val,
0
, &sizeElem);
// o.searchVector(X[0], X[1], X[2], val,
timestep
, &sizeElem);
// double normV = sqrt(val[0]*val[0]+val[1]*val[1]+val[2]*val[2]);
// if (normV==0.0) normV = 1.0;
// double DT = sizeElem / normV ; // CFL = 1 ==> secure
o
.
searchVector
(
X
[
0
],
X
[
1
],
X
[
2
],
val
,
0
);
o
.
searchVector
(
X
[
0
],
X
[
1
],
X
[
2
],
val
,
timestep
);
for
(
int
k
=
0
;
k
<
3
;
k
++
)
X1
[
k
]
=
X
[
k
]
+
DT
*
val
[
k
]
*
a1
;
o
.
searchVector
(
X1
[
0
],
X1
[
1
],
X1
[
2
],
val
,
0
);
o
.
searchVector
(
X1
[
0
],
X1
[
1
],
X1
[
2
],
val
,
timestep
);
for
(
int
k
=
0
;
k
<
3
;
k
++
)
X2
[
k
]
=
X
[
k
]
+
DT
*
val
[
k
]
*
a2
;
o
.
searchVector
(
X2
[
0
],
X2
[
1
],
X2
[
2
],
val
,
0
);
o
.
searchVector
(
X2
[
0
],
X2
[
1
],
X2
[
2
],
val
,
timestep
);
for
(
int
k
=
0
;
k
<
3
;
k
++
)
X3
[
k
]
=
X
[
k
]
+
DT
*
val
[
k
]
*
a3
;
o
.
searchVector
(
X3
[
0
],
X3
[
1
],
X3
[
2
],
val
,
0
);
o
.
searchVector
(
X3
[
0
],
X3
[
1
],
X3
[
2
],
val
,
timestep
);
for
(
int
k
=
0
;
k
<
3
;
k
++
)
X4
[
k
]
=
X
[
k
]
+
DT
*
val
[
k
]
*
a4
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
...
...
@@ -352,8 +360,8 @@ Post_View * GMSH_StreamLinesPlugin::GenerateView(int iView, int dView) const
Post_View
*
GMSH_StreamLinesPlugin
::
execute
(
Post_View
*
v
)
{
int
i
View
=
(
int
)
StreamLinesOptions_Number
[
14
].
def
;
int
d
View
=
(
int
)
StreamLinesOptions_Number
[
1
3
].
def
;
int
d
View
=
(
int
)
StreamLinesOptions_Number
[
14
].
def
;
int
i
View
=
(
int
)
StreamLinesOptions_Number
[
1
5
].
def
;
if
(
iView
<
0
)
iView
=
v
?
v
->
Index
:
0
;
...
...
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