Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YAC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
dkrz-sw
YAC
Commits
5de0968f
Commit
5de0968f
authored
6 years ago
by
Rene Redler
Committed by
Moritz Hanke
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
print of average rel err. on demand for some toys
parent
77e6ab88
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/toy_icon_atm.c
+45
-0
45 additions, 0 deletions
examples/toy_icon_atm.c
examples/toy_icon_ocn.c
+45
-0
45 additions, 0 deletions
examples/toy_icon_ocn.c
with
90 additions
and
0 deletions
examples/toy_icon_atm.c
+
45
−
0
View file @
5de0968f
...
...
@@ -400,6 +400,51 @@ int main (int argc, char *argv[]) {
cell_in_patch_err_rel
[
i
]
=
fabs
(
cell_in_patch_err_abs
[
i
]
/
cell_data_field
[
i
]);
}
#define DEBUG
#ifdef DEBUG
double
f1err_1
=
0
.
0
;
double
f1err_100
=
0
.
0
;
int
if1err_1
=
0
;
int
if1err_100
=
0
;
double
f2err_1
=
0
.
0
;
double
f2err_100
=
0
.
0
;
int
if2err_1
=
0
;
int
if2err_100
=
0
;
for
(
int
i
=
0
;
i
<
num_cells
;
++
i
)
{
if
(
cell_in_conserv_err_rel
[
i
]
<
100
.
0
)
{
f1err_1
+=
cell_in_conserv_err_rel
[
i
];
if1err_1
++
;
}
else
{
f1err_100
+=
cell_in_conserv_err_rel
[
i
];
if1err_100
++
;
}
if
(
cell_in_patch_err_rel
[
i
]
<
100
.
0
)
{
f2err_1
+=
cell_in_patch_err_rel
[
i
];
if2err_1
++
;
}
else
{
f2err_100
+=
cell_in_patch_err_rel
[
i
];
if2err_100
++
;
}
}
f1err_1
=
f1err_1
/
(
double
)
if1err_1
;
f2err_1
=
f2err_1
/
(
double
)
if2err_1
;
f1err_100
=
f1err_100
/
(
double
)
if1err_100
;
f2err_100
=
f2err_100
/
(
double
)
if2err_100
;
printf
(
"avg. rel err. for 1st field %f
\n
"
,
f1err_1
);
printf
(
"avg. rel err. for 2nd field %f
\n
"
,
f2err_1
);
printf
(
"extreme avg. rel err. for 1st field %f
\n
"
,
f1err_100
);
printf
(
"extreme avg. rel err. for 2nd field %f
\n
"
,
f2err_100
);
#endif
//----------------------------------------------------------
// write field to vtk output file
//----------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
examples/toy_icon_ocn.c
+
45
−
0
View file @
5de0968f
...
...
@@ -402,6 +402,51 @@ int main (int argc, char *argv[]) {
cell_in_patch_err_rel
[
i
]
=
fabs
(
cell_in_patch_err_abs
[
i
]
/
cell_data_field
[
i
]);
}
#define DEBUG
#ifdef DEBUG
double
f1err_1
=
0
.
0
;
double
f1err_100
=
0
.
0
;
int
if1err_1
=
0
;
int
if1err_100
=
0
;
double
f2err_1
=
0
.
0
;
double
f2err_100
=
0
.
0
;
int
if2err_1
=
0
;
int
if2err_100
=
0
;
for
(
int
i
=
0
;
i
<
num_cells
;
++
i
)
{
if
(
cell_in_conserv_err_rel
[
i
]
<
100
.
0
)
{
f1err_1
+=
cell_in_conserv_err_rel
[
i
];
if1err_1
++
;
}
else
{
f1err_100
+=
cell_in_conserv_err_rel
[
i
];
if1err_100
++
;
}
if
(
cell_in_patch_err_rel
[
i
]
<
100
.
0
)
{
f2err_1
+=
cell_in_patch_err_rel
[
i
];
if2err_1
++
;
}
else
{
f2err_100
+=
cell_in_patch_err_rel
[
i
];
if2err_100
++
;
}
}
f1err_1
=
f1err_1
/
(
double
)
if1err_1
;
f2err_1
=
f2err_1
/
(
double
)
if2err_1
;
f1err_100
=
f1err_100
/
(
double
)
if1err_100
;
f2err_100
=
f2err_100
/
(
double
)
if2err_100
;
printf
(
"avg. rel err. for 1st field %f
\n
"
,
f1err_1
);
printf
(
"avg. rel err. for 2nd field %f
\n
"
,
f2err_1
);
printf
(
"extreme avg. rel err. for 1st field %f
\n
"
,
f1err_100
);
printf
(
"extreme avg. rel err. for 2nd field %f
\n
"
,
f2err_100
);
#endif
//----------------------------------------------------------
// write field to vtk output file
//----------------------------------------------------------
...
...
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