I would like to simulate heat flux on the surface of 2 MW/m2 acting for a couple of seconds. For that, I introduced the material properties (rho and cp), but how to specify the initial condition?
Ex., model.T = F.HeatTransferProblem(transient=True, initial_condition=320) gives an error. Can someone help me with this?
The docstrings of the class HeatTransferProblem specify the type of the initial_condition argument:
Args:
transient (bool, optional): If True, a transient simulation will
be run. Defaults to True.
initial_condition (festim.InitialCondition, optional): The initial condition.
Only needed if transient is True.
It should be of type festim.InitialCondition.
Consider the following:
import festim as F
import numpy as np
model = F.Simulation()
model.mesh = F.MeshFromVertices(vertices=np.linspace(0, 1, num=1000))
model.settings = F.Settings(
absolute_tolerance=1e-10, relative_tolerance=1e-10, transient=True, final_time=100
)
mat = F.Material(id=1, D_0=1, E_D=0.2, thermal_cond=1, rho=1, heat_capacity=1)
model.materials = mat
model.T = F.HeatTransferProblem(
transient=True, initial_condition=F.InitialCondition(field="T", value=300)
)
model.boundary_conditions = [F.DirichletBC(surfaces=[1, 2], value=400, field="T")]
model.sources = [F.Source(value=100, field="T", volume=1)]
model.dt = F.Stepsize(1)
model.initialise()
model.run()
import matplotlib.pyplot as plt
import fenics as f
f.plot(model.T.T)
plt.show()