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
940241bd
Commit
940241bd
authored
15 years ago
by
Jonathan Lambrechts
Browse files
Options
Downloads
Patches
Plain Diff
dg : replace 0Outcondition by OutsideValueCondition
parent
8b1cde97
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Solver/dgConservationLaw.cpp
+12
-7
12 additions, 7 deletions
Solver/dgConservationLaw.cpp
Solver/dgConservationLaw.h
+1
-1
1 addition, 1 deletion
Solver/dgConservationLaw.h
Solver/dgMainTest.cpp
+8
-4
8 additions, 4 deletions
Solver/dgMainTest.cpp
with
21 additions
and
12 deletions
Solver/dgConservationLaw.cpp
+
12
−
7
View file @
940241bd
#include
"dgConservationLaw.h"
#include
"dgConservationLaw.h"
#include
"function.h"
#include
"function.h"
class
dgBoundaryCondition
0
Out
:
public
dgBoundaryCondition
{
class
dgBoundaryConditionOut
sideValue
:
public
dgBoundaryCondition
{
dgConservationLaw
&
_claw
;
dgConservationLaw
&
_claw
;
std
::
string
_outsideValueFunctionName
;
class
term
:
public
dataCacheDouble
{
class
term
:
public
dataCacheDouble
{
dataCacheMap
cacheMapRight
;
// new cacheMap to pass to the Riemann solver
dataCacheMap
cacheMapRight
;
// new cacheMap to pass to the Riemann solver
dataCacheDouble
&
solutionRight
;
dataCacheDouble
&
solutionRight
;
dataCacheDouble
&
solutionLeft
;
dataCacheDouble
&
solutionLeft
;
dataCacheDouble
&
outsideValue
;
dataCacheDouble
*
riemannSolver
;
dataCacheDouble
*
riemannSolver
;
dgConservationLaw
&
_claw
;
dgConservationLaw
&
_claw
;
public:
public:
term
(
dgConservationLaw
&
claw
,
dataCacheMap
&
cacheMapLeft
)
:
term
(
dgConservationLaw
&
claw
,
dataCacheMap
&
cacheMapLeft
,
const
std
::
string
outsideValueFunctionName
)
:
solutionRight
(
cacheMapRight
.
provideData
(
"Solution"
)),
solutionRight
(
cacheMapRight
.
provideData
(
"Solution"
)),
solutionLeft
(
cacheMapLeft
.
get
(
"Solution"
,
this
)),
solutionLeft
(
cacheMapLeft
.
get
(
"Solution"
,
this
)),
outsideValue
(
cacheMapLeft
.
get
(
outsideValueFunctionName
,
this
)),
_claw
(
claw
)
_claw
(
claw
)
{
{
riemannSolver
=
_claw
.
newRiemannSolver
(
cacheMapLeft
,
cacheMapRight
);
riemannSolver
=
_claw
.
newRiemannSolver
(
cacheMapLeft
,
cacheMapRight
);
...
@@ -20,18 +23,20 @@ class dgBoundaryCondition0Out : public dgBoundaryCondition {
...
@@ -20,18 +23,20 @@ class dgBoundaryCondition0Out : public dgBoundaryCondition {
void
_eval
()
{
void
_eval
()
{
if
(
_value
.
size1
()
!=
solutionLeft
().
size1
()){
if
(
_value
.
size1
()
!=
solutionLeft
().
size1
()){
//adjust sizes
//adjust sizes
solutionRight
.
set
(
fullMatrix
<
double
>
(
solutionLeft
().
size1
(),
_claw
.
nbFields
()));
_value
=
fullMatrix
<
double
>
(
solutionLeft
().
size1
(),
_claw
.
nbFields
());
_value
=
fullMatrix
<
double
>
(
solutionLeft
().
size1
(),
_claw
.
nbFields
());
}
}
solutionRight
.
set
(
outsideValue
());
for
(
int
i
=
0
;
i
<
_value
.
size1
();
i
++
)
for
(
int
i
=
0
;
i
<
_value
.
size1
();
i
++
)
for
(
int
j
=
0
;
j
<
_value
.
size2
();
j
++
)
for
(
int
j
=
0
;
j
<
_value
.
size2
();
j
++
)
_value
(
i
,
j
)
=
(
*
riemannSolver
)(
i
,
j
*
2
);
_value
(
i
,
j
)
=
(
*
riemannSolver
)(
i
,
j
*
2
);
}
}
};
};
public
:
public
:
dgBoundaryCondition0Out
(
dgConservationLaw
&
claw
)
:
_claw
(
claw
)
{}
dgBoundaryConditionOutsideValue
(
dgConservationLaw
&
claw
,
const
std
::
string
outsideValueFunctionName
)
:
_claw
(
claw
),
_outsideValueFunctionName
(
outsideValueFunctionName
)
{
}
dataCacheDouble
*
newBoundaryTerm
(
dataCacheMap
&
cacheMapLeft
)
const
{
dataCacheDouble
*
newBoundaryTerm
(
dataCacheMap
&
cacheMapLeft
)
const
{
return
new
term
(
_claw
,
cacheMapLeft
);
return
new
term
(
_claw
,
cacheMapLeft
,
_outsideValueFunctionName
);
}
}
};
};
...
@@ -56,8 +61,8 @@ class dgBoundaryCondition0Flux : public dgBoundaryCondition {
...
@@ -56,8 +61,8 @@ class dgBoundaryCondition0Flux : public dgBoundaryCondition {
}
}
};
};
dgBoundaryCondition
*
dgBoundaryCondition
::
new
0
OutCondition
(
dgConservationLaw
&
claw
)
{
dgBoundaryCondition
*
dgBoundaryCondition
::
newOut
sideValue
Condition
(
dgConservationLaw
&
claw
,
const
std
::
string
outsideValueFunctionName
)
{
return
new
dgBoundaryCondition
0
Out
(
claw
);
return
new
dgBoundaryConditionOut
sideValue
(
claw
,
outsideValueFunctionName
);
}
}
dgBoundaryCondition
*
dgBoundaryCondition
::
new0FluxCondition
(
dgConservationLaw
&
claw
)
{
dgBoundaryCondition
*
dgBoundaryCondition
::
new0FluxCondition
(
dgConservationLaw
&
claw
)
{
return
new
dgBoundaryCondition0Flux
(
claw
);
return
new
dgBoundaryCondition0Flux
(
claw
);
...
...
This diff is collapsed.
Click to expand it.
Solver/dgConservationLaw.h
+
1
−
1
View file @
940241bd
...
@@ -17,7 +17,7 @@ class dgBoundaryCondition {
...
@@ -17,7 +17,7 @@ class dgBoundaryCondition {
virtual
~
dgBoundaryCondition
()
{}
virtual
~
dgBoundaryCondition
()
{}
virtual
dataCacheDouble
*
newBoundaryTerm
(
dataCacheMap
&
cacheMapLeft
)
const
=
0
;
virtual
dataCacheDouble
*
newBoundaryTerm
(
dataCacheMap
&
cacheMapLeft
)
const
=
0
;
//a generic boundary condition using the Riemann solver of the conservation Law
//a generic boundary condition using the Riemann solver of the conservation Law
static
dgBoundaryCondition
*
new
0
OutCondition
(
dgConservationLaw
&
claw
);
static
dgBoundaryCondition
*
newOut
sideValue
Condition
(
dgConservationLaw
&
claw
,
const
std
::
string
outsideValueFunctionName
);
static
dgBoundaryCondition
*
new0FluxCondition
(
dgConservationLaw
&
claw
);
static
dgBoundaryCondition
*
new0FluxCondition
(
dgConservationLaw
&
claw
);
};
};
...
...
This diff is collapsed.
Click to expand it.
Solver/dgMainTest.cpp
+
8
−
4
View file @
940241bd
...
@@ -59,17 +59,21 @@ int main(int argc, char **argv){
...
@@ -59,17 +59,21 @@ int main(int argc, char **argv){
}
}
print
(
"init.pos"
,
*
elementGroups
[
0
],
&
sol
(
0
,
0
));
print
(
"init.pos"
,
*
elementGroups
[
0
],
&
sol
(
0
,
0
));
//advection
fullMatrix
<
double
>
advectionSpeed
(
3
,
1
);
fullMatrix
<
double
>
advectionSpeed
(
3
,
1
);
advectionSpeed
(
0
,
0
)
=
0.15
;
advectionSpeed
(
0
,
0
)
=
0.15
;
advectionSpeed
(
1
,
0
)
=
0.05
;
advectionSpeed
(
1
,
0
)
=
0.05
;
advectionSpeed
(
2
,
0
)
=
0.
;
advectionSpeed
(
2
,
0
)
=
0.
;
function
::
add
(
"advectionSpeed"
,
function
::
newFunctionConstant
(
advectionSpeed
));
function
::
add
(
"advectionSpeed"
,
function
::
newFunctionConstant
(
advectionSpeed
));
dgConservationLaw
*
law
=
dgNewConservationLawAdvection
(
"advectionSpeed"
);
dgConservationLaw
*
law
=
dgNewConservationLawAdvection
(
"advectionSpeed"
);
law
->
addBoundaryCondition
(
"Left"
,
dgBoundaryCondition
::
new0OutCondition
(
*
law
));
law
->
addBoundaryCondition
(
"Right"
,
dgBoundaryCondition
::
new0OutCondition
(
*
law
));
fullMatrix
<
double
>
outsideValue
(
1
,
1
);
outsideValue
(
0
,
0
)
=
0
;
function
::
add
(
"outsideValue"
,
function
::
newFunctionConstant
(
outsideValue
));
law
->
addBoundaryCondition
(
"Left"
,
dgBoundaryCondition
::
newOutsideValueCondition
(
*
law
,
"outsideValue"
));
law
->
addBoundaryCondition
(
"Right"
,
dgBoundaryCondition
::
newOutsideValueCondition
(
*
law
,
"outsideValue"
));
law
->
addBoundaryCondition
(
"Top"
,
dgBoundaryCondition
::
new0FluxCondition
(
*
law
));
law
->
addBoundaryCondition
(
"Top"
,
dgBoundaryCondition
::
new0FluxCondition
(
*
law
));
law
->
addBoundaryCondition
(
"Bottom"
,
dgBoundaryCondition
::
new0FluxCondition
(
*
law
));
law
->
addBoundaryCondition
(
"Bottom"
,
dgBoundaryCondition
::
new0FluxCondition
(
*
law
));
...
...
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