### heat & mass transfer - additive manufacturing modeling with fenics

268
views
0
5 months ago by
Hi everybody,

I wish to simulate an additive manufacturing process with FEniCS. I have some trouble to model the changing geometry due to the mass additition. Is there some examples of kill/birth of elements, or activation / desactivation strategies with FEniCS ? Maybe other technics suits more to the FEniCS way of thinking.

Alexandre.
Community: FEniCS Project
Can you be more specific about your model details or give some references? Maybe you could use a level set strategy instead.
written 4 months ago by Miguel

1
4 months ago by

Here you can find a very simple example of modeling of a powder bed additive manufacturing process. No attention is paid to the modeling of boundary conditions, which are very simple, and only linear transient thermique is implemented.

from fenics import *
parameters["allow_extrapolation"] = True
#
t=0.
tfin=1.
nt=100
dt=tfin/nt
#number of layr
nc=10
# number of elemnts in a layer
nec=3
#number of elements
nm=nec*nc
#
mesh=RectangleMesh(Point(0.,0.),Point(1.,1.), nm,nm)
Vsol=FunctionSpace(mesh,'CG',1)
Tsol=Function(Vsol)
# Initialize mesh function for interior domains
domains = CellFunction("size_t", mesh)
domains.set_all(0)
# Initialize mesh function for boundary domains
boundaries = FacetFunction("size_t", mesh)
boundaries.set_all(0)

# Define Dirichlet boundary (x = 0 or x = 1)
def base_plate(x,on_boundary):
return (x[1] < DOLFIN_EPS ) and on_boundary
T0 = Constant(0.0)
# indicate the being build layer number
i=0
#heat sources
f = Constant(0.)
Q = Expression('10.*(x[1]>1.*(i-1)/nc)',i=i,nc=nc,degree=1)

file = File("FA_simple.pvd")
while t < tfin:
#update time
t+=dt
i_new=min(int(mt.floor(t/tfin*nc)), nc-1)+1
#add a layer if it s the right time
if i <> i_new:
i=i_new
class Part(SubDomain):
def inside(self, x, on_boundary):
return (x[1] < (i+1.)/nc + DOLFIN_EPS)
part=Part()
part.mark(domains,1)
#
restrictedmesh=SubMesh(mesh,part)

Vr=FunctionSpace(restrictedmesh,'CG',1)

# Define boundary condition
bc1 = DirichletBC(Vr, T0, base_plate)
# Define variational problem
T = TrialFunction(Vr)
v = TestFunction(Vr)
# initial condition
try:
T_=project(Temp,Vr)
t_=Temp
T_=Function(Vr)
except :
T_=Function(Vr)
# Variational problem
# transient heat equation
L= + f*v*dx + T_*v/dt*dx+Q*v*ds
Temp=Function(Vr)
solve(a == L, Temp, bc1)
Tsol.assign(Temp)
file << (Tsol,t)
​

As you can see, layer addition is modeled with remeshing on line 49.

First, I not satisifed with the field transfer on line 60. Indeed, I get a temperature field which is not what I'm expecting. I'd expect to have the T unchanged in the domain which was already active and to have T=T0 on the new layer. But I don't know to do this.

Second, I'm not a big fan of this remeshing techniques, although it is popular in the littérature. I have the feelings it does not belongs to FEniCS way of thinking. I guess that instead of remeshing during layer addition, it's possible to work on the variationnal form instead. I Google a bit but found nothing on additive manufacturing process with FeniCS. However, I'm sure people working on others physics have already tackle open systems with FEniCS. If they can share ideas or piece of codes, il would be of great help.