Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fossils
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
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
Boman Romain
fossils
Commits
b979bb3b
Commit
b979bb3b
authored
10 months ago
by
Boman Romain
Browse files
Options
Downloads
Patches
Plain Diff
add basic extractors to cxxfem (to be continued)
parent
0c653107
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2
Extractors
Pipeline
#23981
passed
10 months ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/bonemodel2.py
+47
-0
47 additions, 0 deletions
models/bonemodel2.py
with
47 additions
and
0 deletions
models/bonemodel2.py
+
47
−
0
View file @
b979bb3b
...
...
@@ -64,6 +64,7 @@ def parms(d={}):
]
p
[
'
loads
'
]
=
[]
# additional loads
p
[
'
extractors
'
]
=
[]
# additional extractors
# material properties
p
[
'
Young
'
]
=
17000.
# [MPa] elastic modulus - bone: 17-20 GPa
...
...
@@ -135,6 +136,10 @@ def solve(p={}):
for
fix
in
p
[
'
fixations
'
]:
create_group
(
fix
[
'
nodes
'
],
nods_no
,
nods_pos
,
groups
,
fix
[
'
name
'
])
# create groups of additional extractors
for
extr
in
p
[
'
extractors
'
]:
create_group
(
extr
[
'
nodes
'
],
nods_no
,
nods_pos
,
groups
,
extr
[
'
name
'
])
# --------------------------------------------------------------------------
# print('== ADDING MEDIUM...')
print
(
''
)
...
...
@@ -189,6 +194,7 @@ def solve(p={}):
print
(
'
extracting results...
'
)
print
(
f
'
\t
internal energy =
{
solver
.
int_energy
:
.
3
f
}
N.mm
'
)
# fixations (reaction forces)
for
fix
in
p
[
'
fixations
'
]:
grpname
=
fix
[
'
name
'
]
v
=
np
.
array
(
post
.
probe
(
'
force_vector
'
,
grpname
))
...
...
@@ -198,6 +204,7 @@ def solve(p={}):
print
(
f
'
\t
{
grpname
}
_Fy =
{
v
[
1
]
:
.
3
f
}
N
'
)
print
(
f
'
\t
{
grpname
}
_Fz =
{
v
[
2
]
:
.
3
f
}
N
'
)
# muscle groups
for
name
,
group
in
mgroups
.
items
():
v
=
np
.
array
(
[
0.0
,
0.0
,
0.0
]
)
for
tag
in
group
.
ntags
:
...
...
@@ -206,6 +213,46 @@ def solve(p={}):
print
(
f
'
\t
{
name
}
_Fy =
{
v
[
1
]
:
.
3
f
}
N
'
)
print
(
f
'
\t
{
name
}
_Fz =
{
v
[
2
]
:
.
3
f
}
N
'
)
# additional extractors
var2field
=
{
'
dx
'
:
(
'
X
'
,
'
mm
'
),
'
dy
'
:
(
'
Y
'
,
'
mm
'
),
'
dz
'
:
(
'
Z
'
,
'
mm
'
),
'
sigxx
'
:
(
'
smooth_stress_xx
'
,
'
MPa
'
),
'
sigyy
'
:
(
'
smooth_stress_yy
'
,
'
MPa
'
),
'
sigzz
'
:
(
'
smooth_stress_zz
'
,
'
MPa
'
),
'
sigxy
'
:
(
'
smooth_stress_xy
'
,
'
MPa
'
),
'
sigxz
'
:
(
'
smooth_stress_xz
'
,
'
MPa
'
),
'
sigyz
'
:
(
'
smooth_stress_yz
'
,
'
MPa
'
),
'
epsxx
'
:
(
'
strain_xx
'
,
''
),
'
epsyy
'
:
(
'
strain_yy
'
,
''
),
'
epszz
'
:
(
'
strain_zz
'
,
''
),
'
epsxy
'
:
(
'
strain_xy
'
,
''
),
'
epsxz
'
:
(
'
strain_xz
'
,
''
),
'
epsyz
'
:
(
'
strain_yz
'
,
''
)
}
for
extr
in
p
[
'
extractors
'
]:
# if only one variable is given, convert it to a list
if
isinstance
(
extr
[
'
variables
'
],
str
):
extr
[
'
variables
'
]
=
[
extr
[
'
variables
'
]]
for
var
in
extr
[
'
variables
'
]:
fname
=
f
'
{
extr
[
"
name
"
]
}
_
{
var
}
.tsv
'
grpname
=
extr
[
'
name
'
]
if
var
.
lower
()
in
var2field
:
field
=
var2field
[
var
.
lower
()][
0
]
units
=
var2field
[
var
.
lower
()][
1
]
v
=
np
.
array
(
post
.
probe
(
field
,
grpname
))
np
.
savetxt
(
fname
,
v
,
delimiter
=
'
\t
'
,
header
=
'
value
'
)
if
len
(
v
)
==
1
:
print
(
f
'
\t
{
grpname
}
_
{
var
}
=
{
v
[
0
]
:
.
3
f
}
{
units
}
'
)
else
:
print
(
f
'
\t
{
grpname
}
_
{
var
}
= (
{
len
(
v
)
}
values in
"
{
fname
}
"
)
'
)
else
:
print
(
f
'
unknown variable:
"
{
var
}
"'
)
end_time
=
time
.
perf_counter
()
elapsed_time
=
end_time
-
start_time
print
(
f
'
Total Execution time:
{
elapsed_time
:
.
1
f
}
s
'
)
...
...
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