Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103590773
darmadi2.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Mar 3, 05:19
Size
1 KB
Mime Type
text/x-python
Expires
Wed, Mar 5, 05:19 (1 d, 13 h)
Engine
blob
Format
Raw Data
Handle
24620337
Attached To
R11910 Additive Manufacturing Work
darmadi2.py
View Options
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 13 15:24:42 2021
@author: ekinkubilay
"""
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
fenics
import
*
import
os
#read the mesh
mesh
=
Mesh
(
'../Part_geometry/mesh/layer_004.xml'
)
velocity
=
1
t
=
0.1
alpha
=
1
upper
=
velocity
**
2
*
t
/
(
4
*
alpha
)
upper_limit
=
np
.
min
([
upper
,
5
])
lower_limit
=
0
V
=
velocity
/
(
2
*
alpha
)
N
=
20
points
=
mesh
.
coordinates
()
source
=
np
.
zeros
(
np
.
shape
(
mesh
.
coordinates
()))
source
[:]
=
np
.
array
([
-
1.8
,
0
,
4
])
disp
=
source
-
points
R_squared
=
(
disp
*
disp
)
.
sum
(
1
)
R
=
np
.
sqrt
(
R_squared
)
u
=
R
*
V
def
integrate
(
func
,
u
,
R
,
lower
,
upper
):
B
=
np
.
ones
(
N
)
B
[
1
:
-
1
:
2
]
=
4
B
[
2
:
-
1
:
2
]
=
2
w
=
np
.
linspace
(
lower
,
upper
,
N
)
integral_value
=
B
.
dot
(
func
(
u
,
w
,
R
))
return
integral_value
*
(
upper
-
lower
)
/
(
3
*
N
)
N
=
20
def
temperature_function
(
w
,
u
,
R
):
return
np
.
exp
(
-
w
-
((
u
**
2
)
/
(
4
*
w
))
-
R
*
V
)
/
(
w
**
1.5
)
def
flux_function
(
w
,
u
,
R
):
return
np
.
exp
(
-
w
-
((
u
**
2
)
/
(
4
*
w
))
-
R
*
V
)
/
(
w
**
2.5
)
delta_T
=
np
.
zeros
(
len
(
points
))
for
i
,
j
in
enumerate
(
points
):
delta_T
[
i
]
=
integrate
(
temperature_function
,
u
[
i
],
R
[
i
],
lower_limit
,
upper_limit
)
q
=
np
.
zeros
(
len
(
points
))
for
i
,
j
in
enumerate
(
points
):
if
boundary_markers
[
i
]
!=
4
:
np
.
savetxt
(
"temp_increase.txt"
,
delta_T
)
Event Timeline
Log In to Comment