Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dolfin_warp
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.6.
Show more breadcrumbs
Martin Genet
dolfin_warp
Commits
769f59d7
Commit
769f59d7
authored
8 years ago
by
Martin Genet
Browse files
Options
Downloads
Patches
Plain Diff
sol_folder is now working_folder in compute_strains
parent
a2292f90
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compute_strains.py
+15
-15
15 additions, 15 deletions
compute_strains.py
plot_strains.py
+11
-1
11 additions, 1 deletion
plot_strains.py
with
26 additions
and
16 deletions
compute_strains.py
+
15
−
15
View file @
769f59d7
...
@@ -20,9 +20,9 @@ import dolfin_dic as ddic
...
@@ -20,9 +20,9 @@ import dolfin_dic as ddic
################################################################################
################################################################################
def
compute_strains
(
def
compute_strains
(
sol
_folder
,
working
_folder
,
sol
_basename
,
working
_basename
,
sol
_ext
=
"
vtu
"
,
working
_ext
=
"
vtu
"
,
ref_frame
=
None
,
ref_frame
=
None
,
disp_array_name
=
"
displacement
"
,
disp_array_name
=
"
displacement
"
,
defo_grad_array_name
=
"
DeformationGradient
"
,
defo_grad_array_name
=
"
DeformationGradient
"
,
...
@@ -59,28 +59,28 @@ def compute_strains(
...
@@ -59,28 +59,28 @@ def compute_strains(
mesh_w_local_basis
=
None
mesh_w_local_basis
=
None
n_sector_ids
=
0
n_sector_ids
=
0
sol
_filenames
=
glob
.
glob
(
sol
_folder
+
"
/
"
+
sol
_basename
+
"
_[0-9]*.
"
+
sol
_ext
)
working
_filenames
=
glob
.
glob
(
working
_folder
+
"
/
"
+
working
_basename
+
"
_[0-9]*.
"
+
working
_ext
)
sol
_zfill
=
len
(
sol
_filenames
[
0
].
rsplit
(
"
_
"
,
1
)[
-
1
].
split
(
"
.
"
)[
0
])
working
_zfill
=
len
(
working
_filenames
[
0
].
rsplit
(
"
_
"
,
1
)[
-
1
].
split
(
"
.
"
)[
0
])
if
(
verbose
):
print
"
sol
_zfill =
"
+
str
(
sol
_zfill
)
if
(
verbose
):
print
"
working
_zfill =
"
+
str
(
working
_zfill
)
n_frames
=
len
(
sol
_filenames
)
n_frames
=
len
(
working
_filenames
)
if
(
verbose
):
print
"
n_frames =
"
+
str
(
n_frames
)
if
(
verbose
):
print
"
n_frames =
"
+
str
(
n_frames
)
if
(
write_strains
):
if
(
write_strains
):
strain_file
=
open
(
sol
_folder
+
"
/
"
+
sol
_basename
+
"
-strains.dat
"
,
"
w
"
)
strain_file
=
open
(
working
_folder
+
"
/
"
+
working
_basename
+
"
-strains.dat
"
,
"
w
"
)
strain_file
.
write
(
"
#t Err_avg Err_std Ecc_avg Ecc_std Ell_avg Ell_std Erc_avg Erc_std Erl_avg Erl_std Ecl_avg Ecl_std
\n
"
)
strain_file
.
write
(
"
#t Err_avg Err_std Ecc_avg Ecc_std Ell_avg Ell_std Erc_avg Erc_std Erl_avg Erl_std Ecl_avg Ecl_std
\n
"
)
if
(
write_strains_vs_radius
):
if
(
write_strains_vs_radius
):
strain_vs_radius_file
=
open
(
sol
_folder
+
"
/
"
+
sol
_basename
+
"
-strains_vs_radius.dat
"
,
"
w
"
)
strain_vs_radius_file
=
open
(
working
_folder
+
"
/
"
+
working
_basename
+
"
-strains_vs_radius.dat
"
,
"
w
"
)
strain_vs_radius_file
.
write
(
"
#t rr Err Ecc Ell Erc Erl Ecl
\n
"
)
strain_vs_radius_file
.
write
(
"
#t rr Err Ecc Ell Erc Erl Ecl
\n
"
)
if
(
write_binned_strains_vs_radius
):
if
(
write_binned_strains_vs_radius
):
binned_strain_vs_radius_file
=
open
(
sol
_folder
+
"
/
"
+
sol
_basename
+
"
-binned_strains_vs_radius.dat
"
,
"
w
"
)
binned_strain_vs_radius_file
=
open
(
working
_folder
+
"
/
"
+
working
_basename
+
"
-binned_strains_vs_radius.dat
"
,
"
w
"
)
binned_strain_vs_radius_file
.
write
(
"
#t rr Err Ecc Ell Erc Erl Ecl
\n
"
)
binned_strain_vs_radius_file
.
write
(
"
#t rr Err Ecc Ell Erc Erl Ecl
\n
"
)
if
(
ref_frame
is
not
None
):
if
(
ref_frame
is
not
None
):
ref_mesh_filename
=
sol
_folder
+
"
/
"
+
sol
_basename
+
"
_
"
+
str
(
ref_frame
).
zfill
(
sol
_zfill
)
+
"
.
"
+
sol
_ext
ref_mesh_filename
=
working
_folder
+
"
/
"
+
working
_basename
+
"
_
"
+
str
(
ref_frame
).
zfill
(
working
_zfill
)
+
"
.
"
+
working
_ext
ref_mesh
=
myvtk
.
readUGrid
(
ref_mesh
=
myvtk
.
readUGrid
(
filename
=
ref_mesh_filename
,
filename
=
ref_mesh_filename
,
verbose
=
verbose
)
verbose
=
verbose
)
...
@@ -91,7 +91,7 @@ def compute_strains(
...
@@ -91,7 +91,7 @@ def compute_strains(
farray_F0
=
ref_mesh
.
GetCellData
().
GetArray
(
defo_grad_array_name
)
farray_F0
=
ref_mesh
.
GetCellData
().
GetArray
(
defo_grad_array_name
)
for
k_frame
in
xrange
(
n_frames
):
for
k_frame
in
xrange
(
n_frames
):
mesh_filename
=
sol
_folder
+
"
/
"
+
sol
_basename
+
"
_
"
+
str
(
k_frame
).
zfill
(
sol
_zfill
)
+
"
.
"
+
sol
_ext
mesh_filename
=
working
_folder
+
"
/
"
+
working
_basename
+
"
_
"
+
str
(
k_frame
).
zfill
(
working
_zfill
)
+
"
.
"
+
working
_ext
mesh
=
myvtk
.
readUGrid
(
mesh
=
myvtk
.
readUGrid
(
filename
=
mesh_filename
,
filename
=
mesh_filename
,
verbose
=
verbose
)
verbose
=
verbose
)
...
@@ -120,7 +120,7 @@ def compute_strains(
...
@@ -120,7 +120,7 @@ def compute_strains(
verbose
=
verbose
)
verbose
=
verbose
)
myvtk
.
writeUGrid
(
myvtk
.
writeUGrid
(
ugrid
=
mesh
,
ugrid
=
mesh
,
filename
=
sol
_folder
+
"
/
"
+
sol
_basename
+
"
_
"
+
str
(
k_frame
).
zfill
(
sol
_zfill
)
+
"
.
"
+
sol
_ext
,
filename
=
working
_folder
+
"
/
"
+
working
_basename
+
"
_
"
+
str
(
k_frame
).
zfill
(
working
_zfill
)
+
"
.
"
+
working
_ext
,
verbose
=
verbose
)
verbose
=
verbose
)
if
(
write_strains
)
or
(
write_strains_vs_radius
)
or
(
write_binned_strains_vs_radius
):
if
(
write_strains
)
or
(
write_strains_vs_radius
)
or
(
write_binned_strains_vs_radius
):
...
@@ -195,8 +195,8 @@ def compute_strains(
...
@@ -195,8 +195,8 @@ def compute_strains(
if
(
plot_strains
):
if
(
plot_strains
):
ddic
.
plot_strains
(
ddic
.
plot_strains
(
working_folder
=
sol
_folder
,
working_folder
=
working
_folder
,
working_basenames
=
[
sol
_basename
],
working_basenames
=
[
working
_basename
],
suffix
=
None
,
suffix
=
None
,
verbose
=
verbose
)
verbose
=
verbose
)
...
...
This diff is collapsed.
Click to expand it.
plot_strains.py
+
11
−
1
View file @
769f59d7
...
@@ -87,12 +87,22 @@ set xrange [0:'''+str(n_frames)+''']
...
@@ -87,12 +87,22 @@ set xrange [0:'''+str(n_frames)+''']
elif
(
comp_name
==
"
radial-circumferential
"
):
k_comp
=
3
elif
(
comp_name
==
"
radial-circumferential
"
):
k_comp
=
3
elif
(
comp_name
==
"
radial-longitudinal
"
):
k_comp
=
4
elif
(
comp_name
==
"
radial-longitudinal
"
):
k_comp
=
4
elif
(
comp_name
==
"
circumferential-longitudinal
"
):
k_comp
=
5
elif
(
comp_name
==
"
circumferential-longitudinal
"
):
k_comp
=
5
if
(
k_comp
==
0
):
plotfile
.
write
(
'''
\
set key bottom
'''
)
else
:
plotfile
.
write
(
'''
\
set key top
'''
)
plotfile
.
write
(
'''
\
plotfile
.
write
(
'''
\
set ylabel
"'''
+
comp_name
+
'''
strain (%)
"
set ylabel
"'''
+
comp_name
+
'''
strain (%)
"
'''
)
'''
)
if
(
"
-
"
in
comp_name
):
if
(
"
-
"
in
comp_name
):
plotfile
.
write
(
'''
\
plotfile
.
write
(
'''
\
set yrange [-
1
0:
1
0]
set yrange [-
2
0:
2
0]
'''
)
'''
)
else
:
else
:
...
...
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