Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
ddaafc81
Commit
ddaafc81
authored
6 years ago
by
Fanny CHOPOT
Browse files
Options
Downloads
Patches
Plain Diff
correction T initial et ajout membre source pour kidder avec k non cst
parent
c5b7fccb
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main.cpp
+13
-8
13 additions, 8 deletions
src/main.cpp
src/scheme/FiniteVolumesDiffusion.hpp
+36
-11
36 additions, 11 deletions
src/scheme/FiniteVolumesDiffusion.hpp
src/scheme/FiniteVolumesEulerUnknowns.hpp
+1
-1
1 addition, 1 deletion
src/scheme/FiniteVolumesEulerUnknowns.hpp
with
50 additions
and
20 deletions
src/main.cpp
+
13
−
8
View file @
ddaafc81
...
@@ -275,7 +275,7 @@ int main(int argc, char *argv[])
...
@@ -275,7 +275,7 @@ int main(int argc, char *argv[])
// ETAPE 2 DU SPLITTING - DIFFUSION
// ETAPE 2 DU SPLITTING - DIFFUSION
double dt_diff = 0.9*finite_volumes_diffusion.diffusion_dt(rhoj, kj, cj);
double dt_diff = 0.9*finite_volumes_diffusion.diffusion_dt(rhoj, kj,
nuj,
cj);
double t_diff = t-dt_euler;
double t_diff = t-dt_euler;
if (dt_euler <= dt_diff) {
if (dt_euler <= dt_diff) {
...
@@ -283,7 +283,7 @@ int main(int argc, char *argv[])
...
@@ -283,7 +283,7 @@ int main(int argc, char *argv[])
finite_volumes_diffusion.computeNextStep(t_diff, dt_diff, unknowns);
finite_volumes_diffusion.computeNextStep(t_diff, dt_diff, unknowns);
} else {
} else {
while (t > t_diff) {
while (t > t_diff) {
dt_diff = 0.9*finite_volumes_diffusion.diffusion_dt(rhoj, kj, cj);
dt_diff = 0.9*finite_volumes_diffusion.diffusion_dt(rhoj, kj,
nuj,
cj);
if (t_diff+dt_diff > t) {
if (t_diff+dt_diff > t) {
dt_diff = t-t_diff;
dt_diff = t-t_diff;
}
}
...
@@ -567,6 +567,7 @@ int main(int argc, char *argv[])
...
@@ -567,6 +567,7 @@ int main(int argc, char *argv[])
std::cout << "* " << rang::style::underline << "Erreur L infini rho" << rang::style::reset
std::cout << "* " << rang::style::underline << "Erreur L infini rho" << rang::style::reset
<< ": " << rang::fgB::green << error2 << rang::fg::reset << " \n";
<< ": " << rang::fgB::green << error2 << rang::fg::reset << " \n";
*/
double
error
=
0.
;
double
error
=
0.
;
error
=
finite_volumes_diffusion
.
error_L2_u
(
unknowns
,
tmax
);
error
=
finite_volumes_diffusion
.
error_L2_u
(
unknowns
,
tmax
);
...
@@ -579,14 +580,18 @@ int main(int argc, char *argv[])
...
@@ -579,14 +580,18 @@ int main(int argc, char *argv[])
std
::
cout
<<
"* "
<<
rang
::
style
::
underline
<<
"Erreur L infini u"
<<
rang
::
style
::
reset
std
::
cout
<<
"* "
<<
rang
::
style
::
underline
<<
"Erreur L infini u"
<<
rang
::
style
::
reset
<<
": "
<<
rang
::
fgB
::
green
<<
error4
<<
rang
::
fg
::
reset
<<
"
\n
"
;
<<
": "
<<
rang
::
fgB
::
green
<<
error4
<<
rang
::
fg
::
reset
<<
"
\n
"
;
*/
/*
double
error3
=
0.
;
double
error3
=
0.
;
error3 = finite_volumes_diffusion.error_L2_E(unknowns);
error3
=
finite_volumes_diffusion
.
error_L2_E
(
unknowns
,
tmax
);
std
::
cout
<<
"* "
<<
rang
::
style
::
underline
<<
"Erreur L2 E"
<<
rang
::
style
::
reset
std
::
cout
<<
"* "
<<
rang
::
style
::
underline
<<
"Erreur L2 E"
<<
rang
::
style
::
reset
<<
": "
<<
rang
::
fgB
::
green
<<
error3
<<
rang
::
fg
::
reset
<<
"
\n
"
;
<<
": "
<<
rang
::
fgB
::
green
<<
error3
<<
rang
::
fg
::
reset
<<
"
\n
"
;
*/
double
error5
=
0.
;
error5
=
finite_volumes_diffusion
.
error_Linf_E
(
unknowns
,
tmax
);
std
::
cout
<<
"* "
<<
rang
::
style
::
underline
<<
"Erreur L infini E"
<<
rang
::
style
::
reset
<<
": "
<<
rang
::
fgB
::
green
<<
error5
<<
rang
::
fg
::
reset
<<
"
\n
"
;
std
::
cout
<<
"* "
<<
rang
::
style
::
underline
<<
"Resultat conservativite rho E temps = 0"
<<
rang
::
style
::
reset
std
::
cout
<<
"* "
<<
rang
::
style
::
underline
<<
"Resultat conservativite rho E temps = 0"
<<
rang
::
style
::
reset
<<
": "
<<
rang
::
fgB
::
green
<<
c
<<
rang
::
fg
::
reset
<<
"
\n
"
;
<<
": "
<<
rang
::
fgB
::
green
<<
c
<<
rang
::
fg
::
reset
<<
"
\n
"
;
...
...
This diff is collapsed.
Click to expand it.
src/scheme/FiniteVolumesDiffusion.hpp
+
36
−
11
View file @
ddaafc81
...
@@ -441,7 +441,7 @@ public:
...
@@ -441,7 +441,7 @@ public:
// ajout second membre pour kidder (k = x)
// ajout second membre pour kidder (k = x)
//uj[j][0] += (dt*inv_mj[j])*Vj(j)*(t/((50./9.)-t*t));
//uj[j][0] += (dt*inv_mj[j])*Vj(j)*(t/((50./9.)-t*t));
//Ej[j] -= (dt*inv_mj[j])*Vj(j)*((2.*xj[j][0]*t*t)/(((50./9.)-t*t)*((50./9.)-t*t)));
//Ej[j] -= (dt*inv_mj[j])*Vj(j)*((2.*xj[j][0]*t*t)/(((50./9.)-t*t)*((50./9.)-t*t))
-(6*xj[j][0]+3.)/(100*(1-t*t/(50/9))*(1-t*t/(50/9)))
);
});
});
...
@@ -468,13 +468,13 @@ public:
...
@@ -468,13 +468,13 @@ public:
const
Kokkos
::
View
<
const
double
*>
Vj
=
m_mesh_data
.
Vj
();
const
Kokkos
::
View
<
const
double
*>
Vj
=
m_mesh_data
.
Vj
();
//
double pi = 4.*std::atan(1.);
double
pi
=
4.
*
std
::
atan
(
1.
);
double
err_u
=
0.
;
double
err_u
=
0.
;
double
exact_u
=
0.
;
double
exact_u
=
0.
;
for
(
size_t
j
=
0
;
j
<
m_mesh
.
numberOfCells
();
++
j
)
{
for
(
size_t
j
=
0
;
j
<
m_mesh
.
numberOfCells
();
++
j
)
{
//exact_u = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.2); // solution exacte cas test k constant
//exact_u = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.2); // solution exacte cas test k constant
//
exact_u = std::sin(pi*xj[j][0])*std::exp(-
0.2
); // solution exacte cas test k non constant
exact_u
=
std
::
sin
(
pi
*
xj
[
j
][
0
])
*
std
::
exp
(
-
t
);
// solution exacte cas test k non constant
exact_u
=
-
(
xj
[
j
][
0
]
*
t
)
/
((
50.
/
9.
)
-
t
*
t
);
// kidder
//
exact_u = -(xj[j][0]*t)/((50./9.)-t*t); // kidder
err_u
+=
(
exact_u
-
uj
[
j
][
0
])
*
(
exact_u
-
uj
[
j
][
0
])
*
Vj
(
j
);
err_u
+=
(
exact_u
-
uj
[
j
][
0
])
*
(
exact_u
-
uj
[
j
][
0
])
*
Vj
(
j
);
}
}
err_u
=
std
::
sqrt
(
err_u
);
err_u
=
std
::
sqrt
(
err_u
);
...
@@ -500,8 +500,8 @@ public:
...
@@ -500,8 +500,8 @@ public:
return
err_rho
;
return
err_rho
;
}
}
/*
double error_L2_E(UnknownsType& unknowns) {
double
error_L2_E
(
UnknownsType
&
unknowns
,
const
double
&
t
)
{
Kokkos
::
View
<
double
*>
Ej
=
unknowns
.
Ej
();
Kokkos
::
View
<
double
*>
Ej
=
unknowns
.
Ej
();
...
@@ -514,13 +514,13 @@ public:
...
@@ -514,13 +514,13 @@ public:
double
exact_E
=
0.
;
double
exact_E
=
0.
;
for
(
size_t
j
=
0
;
j
<
m_mesh
.
numberOfCells
();
++
j
)
{
for
(
size_t
j
=
0
;
j
<
m_mesh
.
numberOfCells
();
++
j
)
{
//exact_E = (-(std::cos(pi*xj[j][0])*std::cos(pi*xj[j][0]))+(std::sin(pi*xj[j][0])*std::sin(pi*xj[j][0])))*0.5*(std::exp(-4.*pi*pi*0.2)-1.) + 2.;
//exact_E = (-(std::cos(pi*xj[j][0])*std::cos(pi*xj[j][0]))+(std::sin(pi*xj[j][0])*std::sin(pi*xj[j][0])))*0.5*(std::exp(-4.*pi*pi*0.2)-1.) + 2.;
exact_E = ((xj[j][0]*pi*pi*0.5)*(std::sin(pi*xj[j][0])*std::sin(pi*xj[j][0]) - std::cos(xj[j][0]*pi)*std::cos(pi*xj[j][0])) - pi*0.5*std::sin(pi*xj[j][0])*std::cos(pi*xj[j][0]))*(std::exp(-2.*
0.2
)-1.) + 2.;
exact_E
=
((
xj
[
j
][
0
]
*
pi
*
pi
*
0.5
)
*
(
std
::
sin
(
pi
*
xj
[
j
][
0
])
*
std
::
sin
(
pi
*
xj
[
j
][
0
])
-
std
::
cos
(
xj
[
j
][
0
]
*
pi
)
*
std
::
cos
(
pi
*
xj
[
j
][
0
]))
-
pi
*
0.5
*
std
::
sin
(
pi
*
xj
[
j
][
0
])
*
std
::
cos
(
pi
*
xj
[
j
][
0
]))
*
(
std
::
exp
(
-
2.
*
t
)
-
1.
)
+
2.
;
err_E
+=
(
exact_E
-
Ej
[
j
])
*
(
exact_E
-
Ej
[
j
])
*
Vj
(
j
);
err_E
+=
(
exact_E
-
Ej
[
j
])
*
(
exact_E
-
Ej
[
j
])
*
Vj
(
j
);
}
}
err_E
=
std
::
sqrt
(
err_E
);
err_E
=
std
::
sqrt
(
err_E
);
return
err_E
;
return
err_E
;
}
}
*/
// Calcul erreur entre solution analytique et solution numerique en norme L infini (max)
// Calcul erreur entre solution analytique et solution numerique en norme L infini (max)
// (quand la solution exacte est connue)
// (quand la solution exacte est connue)
...
@@ -555,11 +555,13 @@ public:
...
@@ -555,11 +555,13 @@ public:
const
Kokkos
::
View
<
const
Rd
*>
xj
=
m_mesh_data
.
xj
();
const
Kokkos
::
View
<
const
Rd
*>
xj
=
m_mesh_data
.
xj
();
double
exacte
=
-
(
xj
[
0
][
0
]
*
t
)
/
((
50.
/
9.
)
-
t
*
t
);
double
pi
=
4.
*
std
::
atan
(
1.
);
double
exacte
=
std
::
sin
(
pi
*
xj
[
0
][
0
])
*
std
::
exp
(
-
t
);
double
erreur
=
std
::
abs
(
exacte
-
uj
[
0
][
0
]);
double
erreur
=
std
::
abs
(
exacte
-
uj
[
0
][
0
]);
for
(
size_t
j
=
1
;
j
<
m_mesh
.
numberOfCells
();
++
j
)
{
for
(
size_t
j
=
1
;
j
<
m_mesh
.
numberOfCells
();
++
j
)
{
exacte
=
-
(
xj
[
j
][
0
]
*
t
)
/
((
50.
/
9.
)
-
t
*
t
);
exacte
=
std
::
sin
(
pi
*
xj
[
j
][
0
])
*
std
::
exp
(
-
t
);
if
(
std
::
abs
(
exacte
-
uj
[
j
][
0
])
>
erreur
)
{
if
(
std
::
abs
(
exacte
-
uj
[
j
][
0
])
>
erreur
)
{
erreur
=
std
::
abs
(
exacte
-
uj
[
j
][
0
]);
erreur
=
std
::
abs
(
exacte
-
uj
[
j
][
0
]);
}
}
...
@@ -568,6 +570,29 @@ public:
...
@@ -568,6 +570,29 @@ public:
return
erreur
;
return
erreur
;
}
}
// Calcul erreur entre solution analytique et solution numerique en norme L infini (max)
// (quand la solution exacte est connue)
double
error_Linf_E
(
UnknownsType
&
unknowns
,
const
double
&
t
)
{
Kokkos
::
View
<
double
*>
Ej
=
unknowns
.
Ej
();
const
Kokkos
::
View
<
const
Rd
*>
xj
=
m_mesh_data
.
xj
();
double
pi
=
4.
*
std
::
atan
(
1.
);
double
exacte
=
((
xj
[
0
][
0
]
*
pi
*
pi
*
0.5
)
*
(
std
::
sin
(
pi
*
xj
[
0
][
0
])
*
std
::
sin
(
pi
*
xj
[
0
][
0
])
-
std
::
cos
(
xj
[
0
][
0
]
*
pi
)
*
std
::
cos
(
pi
*
xj
[
0
][
0
]))
-
pi
*
0.5
*
std
::
sin
(
pi
*
xj
[
0
][
0
])
*
std
::
cos
(
pi
*
xj
[
0
][
0
]))
*
(
std
::
exp
(
-
2.
*
t
)
-
1.
)
+
2.
;
double
erreur
=
std
::
abs
(
exacte
-
Ej
[
0
]);
for
(
size_t
j
=
1
;
j
<
m_mesh
.
numberOfCells
();
++
j
)
{
exacte
=
((
xj
[
j
][
0
]
*
pi
*
pi
*
0.5
)
*
(
std
::
sin
(
pi
*
xj
[
j
][
0
])
*
std
::
sin
(
pi
*
xj
[
j
][
0
])
-
std
::
cos
(
xj
[
j
][
0
]
*
pi
)
*
std
::
cos
(
pi
*
xj
[
j
][
0
]))
-
pi
*
0.5
*
std
::
sin
(
pi
*
xj
[
j
][
0
])
*
std
::
cos
(
pi
*
xj
[
j
][
0
]))
*
(
std
::
exp
(
-
2.
*
t
)
-
1.
)
+
2.
;
if
(
std
::
abs
(
exacte
-
Ej
[
j
])
>
erreur
)
{
erreur
=
std
::
abs
(
exacte
-
Ej
[
j
]);
}
}
return
erreur
;
}
// Verifie la conservativite de E
// Verifie la conservativite de E
...
...
This diff is collapsed.
Click to expand it.
src/scheme/FiniteVolumesEulerUnknowns.hpp
+
1
−
1
View file @
ddaafc81
...
@@ -456,7 +456,7 @@ public:
...
@@ -456,7 +456,7 @@ public:
});
});
Kokkos
::
parallel_for
(
m_mesh
.
numberOfCells
(),
KOKKOS_LAMBDA
(
const
int
&
j
){
Kokkos
::
parallel_for
(
m_mesh
.
numberOfCells
(),
KOKKOS_LAMBDA
(
const
int
&
j
){
m_Tj
[
j
]
=
2.
-
0.5
*
std
::
sin
(
pi
*
xj
[
j
][
0
])
*
std
::
sin
(
pi
*
xj
[
j
][
0
]);
// k = x
m_Tj
[
j
]
=
m_ej
[
j
];
});
});
// Conditions aux bords de Dirichlet sur T et nu
// Conditions aux bords de Dirichlet sur T et nu
...
...
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