Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bfem
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Anne Poot
bfem
Merge requests
!162
Bridge example
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Bridge example
bridge-example
into
master
Overview
0
Commits
4
Pipelines
0
Changes
1
Merged
Anne Poot
requested to merge
bridge-example
into
master
1 year ago
Overview
0
Commits
4
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
df55c13f
Prev
Next
Show latest version
1 file
+
48
−
25
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
df55c13f
Changed figsize dimensions of bridge example superscript
· df55c13f
Anne Poot
authored
1 year ago
gpexamples/gpbridge/superscript.py
+
48
−
25
Options
@@ -7,6 +7,7 @@ from jive.app import main
import
jive.util.proputils
as
pu
from
quickviewer
import
QuickViewer
from
copy
import
deepcopy
from
plotutils
import
create_dat
props
=
pu
.
parse_file
(
'
bridge.pro
'
)
@@ -77,39 +78,53 @@ Phi = globdat['Phi']
err
=
abs
(
u
-
Phi
@
u_coarse
)
err_grad
=
abs
(
eps
-
Phi
@
eps_c
)
QuickViewer
(
u_post
,
globdat
,
title
=
r
'
Posterior mean diplacement ($\bar u$)
'
)
QuickViewer
(
u
,
globdat
,
title
=
r
'
Exact displacement ($u$)
'
)
fig
,
(
ax1
,
ax2
)
=
plt
.
subplots
(
2
,
1
,
tight_layout
=
True
)
QuickViewer
(
err
,
globdat
,
ax
=
ax1
,
title
=
r
'
Discretization error ($|u_f - u_c|$)
'
)
QuickViewer
(
std_u_post
,
globdat
,
ax
=
ax2
,
title
=
r
'
Posterior standard deviation ($\sqrt{\bar \Sigma_{ii}}$)
'
)
# plt.savefig(fname='img/'+props['init']['mesh']['file'].replace('.msh','').replace('beam_', '')+'.pdf')
plt
.
figure
(
figsize
=
(
8
,
2
),
tight_layout
=
True
)
ax
=
plt
.
gca
()
QuickViewer
(
u_post
,
globdat
,
ax
=
ax
,
colorbar
=
False
,
pdf
=
True
,
scale
=
10.0
,
title
=
r
'
Posterior mean displacement ($\mu_u$)
'
)
plt
.
savefig
(
'
img/posterior-mean-state0.pdf
'
)
plt
.
show
()
fig
,
(
ax1
,
ax2
)
=
plt
.
subplots
(
2
,
1
,
tight_layout
=
True
)
QuickViewer
(
err_grad
,
globdat
,
ax
=
ax1
,
comp
=
0
,
title
=
r
'
Discretization error ($|\varepsilon_f^{xx} - \varepsilon_c^{xx}|$)
'
)
QuickViewer
(
std_u_post
,
globdat
,
ax
=
ax
2
,
title
=
r
'
Posterior standard deviation ($\s
qrt{\bar \Sigma_{ii}}
$)
'
)
#
plt.savefig(
fname='img/'+props['init']['mesh']['file'].replace('.msh','').replace('beam_', '')+'
.pdf')
plt
.
figure
(
figsize
=
(
8
,
2
)
,
tight_layout
=
True
)
ax
=
plt
.
gca
(
)
QuickViewer
(
std_u_post
,
globdat
,
ax
=
ax
,
colorbar
=
False
,
pdf
=
True
,
title
=
r
'
Posterior standard deviation ($\s
igma_u
$)
'
)
plt
.
savefig
(
'
img/posterior-std-state0
.pdf
'
)
plt
.
show
()
fig
,
(
ax1
,
ax2
)
=
plt
.
subplots
(
2
,
1
,
tight_layout
=
True
)
QuickViewer
(
err_grad
,
globdat
,
ax
=
ax1
,
comp
=
1
,
title
=
r
'
Discretization error ($|\varepsilon_f^{yy} - \varepsilon_c^{yy}|$)
'
)
QuickViewer
(
std_
u
_post
,
globdat
,
ax
=
ax
2
,
title
=
r
'
Posterior standard deviation ($\s
qrt{\bar \Sigma_{ii}}
$)
'
)
#
plt.savefig(
fname='img/'+props['init']['mesh']['file'].replace('.msh','').replace('beam_', '')+'
.pdf')
plt
.
figure
(
figsize
=
(
8
,
2
)
,
tight_layout
=
True
)
ax
=
plt
.
gca
(
)
QuickViewer
(
std_
eps
_post
,
globdat
,
ax
=
ax
,
colorbar
=
False
,
pdf
=
True
,
title
=
r
'
Posterior standard deviation ($\s
igma_\varepsilon
$)
'
)
plt
.
savefig
(
'
img/posterior-std-strain
.pdf
'
)
plt
.
show
()
QuickViewer
(
std_u_post
,
globdat
,
title
=
r
'
Posterior standard deviation ($\sqrt{\bar \Sigma_{ii}}$)
'
)
for
i
,
sample
in
enumerate
(
samples_u_prior
.
T
[:
3
]):
QuickViewer
(
sample
,
globdat
,
scale
=
10.0
,
title
=
r
'
Prior samples from $u$ (sample {})
'
.
format
(
i
+
1
))
plt
.
figure
(
figsize
=
(
8
,
2
),
tight_layout
=
True
)
ax
=
plt
.
gca
()
QuickViewer
(
sample
,
globdat
,
ax
=
ax
,
colorbar
=
False
,
pdf
=
True
,
scale
=
10.0
,
title
=
r
'
Prior samples from $u$ (sample {})
'
.
format
(
i
+
1
))
plt
.
savefig
(
'
img/samples/prior-state0-{}.pdf
'
.
format
(
i
+
1
))
plt
.
show
()
for
i
,
sample
in
enumerate
(
samples_f_prior
.
T
[:
3
]):
plt
.
figure
(
figsize
=
(
8
,
2
),
tight_layout
=
True
)
ax
=
plt
.
gca
()
QuickViewer
(
sample
,
globdat
,
ax
=
ax
,
colorbar
=
False
,
pdf
=
True
,
title
=
r
'
Prior samples from $f$ (sample {})
'
.
format
(
i
+
1
))
plt
.
savefig
(
'
img/samples/prior-extForce-{}.pdf
'
.
format
(
i
+
1
))
plt
.
show
()
for
i
,
sample
in
enumerate
(
samples_u_post
.
T
[:
3
]):
QuickViewer
(
sample
,
globdat
,
scale
=
10.0
,
title
=
r
'
Posterior samples from $u$ (sample {})
'
.
format
(
i
+
1
))
fine_list
=
[
'
post
'
,
'
r0
'
,
'
r1
'
,
'
r2
'
,
'
r3
'
]
plt
.
figure
(
figsize
=
(
8
,
2
),
tight_layout
=
True
)
ax
=
plt
.
gca
()
QuickViewer
(
sample
,
globdat
,
ax
=
ax
,
colorbar
=
False
,
pdf
=
True
,
scale
=
10.0
,
title
=
r
'
Posterior samples from $u$ (sample {})
'
.
format
(
i
+
1
))
plt
.
savefig
(
'
img/samples/posterior-state0-{}.pdf
'
.
format
(
i
+
1
))
plt
.
show
()
for
i
,
sample
in
enumerate
(
samples_f_post
.
T
[:
3
]):
plt
.
figure
(
figsize
=
(
8
,
2
),
tight_layout
=
True
)
ax
=
plt
.
gca
()
QuickViewer
(
sample
,
globdat
,
ax
=
ax
,
colorbar
=
False
,
pdf
=
True
,
title
=
r
'
Posterior samples from $f$ (sample {})
'
.
format
(
i
+
1
))
plt
.
savefig
(
'
img/samples/posterior-extForce-{}.pdf
'
.
format
(
i
+
1
))
plt
.
show
()
fine_list
=
[
'
r0
'
,
'
r1
'
,
'
r2
'
,
'
r3
'
]
x_dict
=
{}
u_dict
=
{}
@@ -160,12 +175,20 @@ for fineness in fine_list:
plt
.
figure
()
for
fineness
in
fine_list
:
plt
.
plot
(
x_dict
[
fineness
],
u_dict
[
fineness
],
label
=
fineness
)
h_inv
=
2
**
int
(
fineness
[
-
1
])
if
h_inv
==
1
:
label
=
r
'
h = 1
'
else
:
label
=
r
'
$h = \frac{1}{
'
+
str
(
h_inv
)
+
'
}$
'
plt
.
plot
(
x_dict
[
fineness
],
u_dict
[
fineness
],
label
=
label
)
if
fineness
==
'
post
'
:
u_bar
=
np
.
array
(
u_dict
[
fineness
])
std_u_bottom
=
np
.
array
(
std_u_bottom
)
std_u_bottom
[
0
]
=
std_u_bottom
[
-
1
]
=
0
plt
.
fill_between
(
x_dict
[
fineness
],
u_bar
-
2
*
std_u_bottom
,
u_bar
+
2
*
std_u_bottom
,
alpha
=
0.3
)
create_dat
([
x_dict
[
fineness
],
u_dict
[
fineness
]],
[
'
x
'
,
'
u_top
'
],
'
results/
'
+
fineness
+
'
-top
'
)
plt
.
legend
()
plt
.
show
()
Loading