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
6b6e2d40
Commit
6b6e2d40
authored
15 years ago
by
Emilie Marchandise
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
45f08618
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Solver/dgConservationLawPerfectGas.cpp
+10
-6
10 additions, 6 deletions
Solver/dgConservationLawPerfectGas.cpp
Solver/dgSlopeLimiter.cpp
+34
-42
34 additions, 42 deletions
Solver/dgSlopeLimiter.cpp
with
44 additions
and
48 deletions
Solver/dgConservationLawPerfectGas.cpp
+
10
−
6
View file @
6b6e2d40
...
...
@@ -446,26 +446,30 @@ class dgPerfectGasLaw2d::clipToPhysics : public dataCacheDouble {
double
_presMin
,
_rhoMin
;
public:
clipToPhysics
(
dataCacheMap
&
cacheMap
,
double
presMin
,
double
rhoMin
)
:
sol
(
cacheMap
.
get
(
"Sol
ution
"
,
this
))
sol
(
cacheMap
.
get
(
"Sol
ToClip
"
,
this
))
{
_presMin
=
presMin
;
_rhoMin
=
rhoMin
;
_value
=
fullMatrix
<
double
>
(
cacheMap
.
getNbEvaluationPoints
(),
4
);
};
void
_eval
()
{
const
int
n
QP
=
sol
().
size1
();
for
(
size_t
k
=
0
;
k
<
n
QP
;
k
++
){
const
int
n
Dofs
=
sol
().
size1
();
for
(
size_t
k
=
0
;
k
<
n
Dofs
;
k
++
){
_value
(
k
,
0
)
=
sol
(
k
,
0
);
_value
(
k
,
1
)
=
sol
(
k
,
1
);
_value
(
k
,
2
)
=
sol
(
k
,
1
);
_value
(
k
,
3
)
=
sol
(
k
,
3
);
if
(
sol
(
k
,
0
)
<
_rhoMin
)
if
(
sol
(
k
,
0
)
<
_rhoMin
){
//printf("CL: clip rho min =%g \n", _rhoMin);
_value
(
k
,
0
)
=
_rhoMin
;
}
double
rhoV2
=
sol
(
k
,
1
)
*
sol
(
k
,
1
)
+
sol
(
k
,
2
)
*
sol
(
k
,
2
);
rhoV2
/=
sol
(
k
,
0
);
const
double
p
=
(
GAMMA
-
1
)
*
(
sol
(
k
,
3
)
-
0.5
*
rhoV2
);
if
(
p
<
_presMin
)
if
(
p
<
_presMin
)
{
_value
(
k
,
3
)
=
_presMin
/
(
GAMMA
-
1
)
+
0.5
*
rhoV2
;
//printf("CL: clip pres min =%g \n ", _value(k,3));
}
}
}
};
...
...
This diff is collapsed.
Click to expand it.
Solver/dgSlopeLimiter.cpp
+
34
−
42
View file @
6b6e2d40
...
...
@@ -13,8 +13,8 @@ bool dgSlopeLimiter::apply ( dgDofContainer &solution,
//TODO: make this more general
dgGroupOfFaces
*
group
=
fGroups
[
0
];
fullMatrix
<
double
>
&
solleft
=
solution
.
getGroupProxy
(
0
);
//*(solution._dataProxys[0]);
fullMatrix
<
double
>
&
solright
=
solution
.
getGroupProxy
(
0
);
//*(solution._dataProxys[0]);
fullMatrix
<
double
>
&
solleft
=
solution
.
getGroupProxy
(
0
);
fullMatrix
<
double
>
&
solright
=
solution
.
getGroupProxy
(
0
);
int
nbFields
=
_claw
->
nbFields
();
int
totNbElems
=
solution
.
getNbElements
();
...
...
@@ -92,48 +92,40 @@ bool dgSlopeLimiter::apply ( dgDofContainer &solution,
}
}
/*
// --- CLIPPING: check unphysical values
dataCacheMap cacheMap(group->getNbNodes());
dgGroupOfElements* group = eGroups[0];
fullMatrix<double> &solGroup = solution.getGroupProxy(0);
dataCacheDouble &solutionE = cacheMap.provideData("Solution");
solutionE.set(fullMatrix<double>(group.getNbNodes(),nbFields));
dataCacheElement &cacheElement = cacheMap.getElement();
for
(
int
iG
=
0
;
iG
<
eGroups
.
size
();
iG
++
){
dgGroupOfElements
*
egroup
=
eGroups
[
iG
];
fullMatrix
<
double
>
&
solGroup
=
solution
.
getGroupProxy
(
iG
);
dataCacheMap
cacheMap
(
egroup
->
getNbNodes
());
//nbdofs for each element
dataCacheDouble
&
solutionE
=
cacheMap
.
provideData
(
"SolToClip"
);
solutionE
.
set
(
fullMatrix
<
double
>
(
egroup
->
getNbNodes
(),
nbFields
));
//e.g 3x4 for perfect gas
dataCacheDouble
*
solutionEClipped
=
_claw
->
newClipToPhysics
(
cacheMap
);
for (int iElement=0 ; iElement<group->getNbElements() ;++iElement) {
cacheElement.set(group.getElement(iElement));
dataCacheElement
&
cacheElement
=
cacheMap
.
getElement
();
for
(
int
iElement
=
0
;
iElement
<
egroup
->
getNbElements
()
;
++
iElement
)
{
cacheElement
.
set
(
egroup
->
getElement
(
iElement
));
solutionE
.
setAsProxy
(
solGroup
,
iElement
*
nbFields
,
nbFields
);
for (int iPt =0; iPt< group->getNbNodes(); iPt++) {
solutionE.set((*solutionEclipped)());
}
}
delete solutionEClipped;
solutionE
.
set
((
*
solutionEClipped
)());
*/
//#if 0
// double rhomin = 1.e-3;
// double presmin= 1.e-3;
// for (int iElement=0;iElement<totNbElems;iElement++){
// fullMatrix<double> solElem;
// solElem.setAsProxy(solleft, nbFields*iElement, nbFields );
// double min = 1.e-3;
// solElem.setAsProxy(solGroup, nbFields*iElement, nbFields );
// for (int k=0;k< solElem.size1() ;k++){
// if (solElem(k,0) < rhomin) {
// solElem(k,0) = rhomin;
// }
// double rhoV2 = 0;
// for (int j=0;j<2;j++) {
// double rhov = solElem(k,j+1);
// rhoV2 += rhov*rhov;
// }
// if (solElem(k,0) < min) solElem(k,0) = min;
// double rhoV2 = solElem(k,1)*solElem(k,1)+solElem(k,2)*solElem(k,2);
// rhoV2 /= solElem(k,0);
// const double p = (1.4-1)*solElem(k,3) - 0.5*(1.4-1)* rhoV2;
// if (p < presmin) {
// solElem(k,3) = 0.5 *rhoV2 + presmin / (1.4-1);
// }
// const double p = (1.4-1)*(solElem(k,3) - 0.5* rhoV2);
// if (p < 1.e-3) solElem(k,3) = 0.5 *rhoV2 + min / (1.4-1);
// }
// }
//#endif
}
delete
solutionEClipped
;
}
return
true
;
...
...
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