Hello everyone,
I am solving the heat equation with the Laplacian expressed in terms of spatially varying thermal conductivities (k_x, k_y and k_z) as shown below:
Can I please request your suggestions on how I may go about assigning the three thermal conductivities to every cell in the assemble loop? The examples I have seen in dealii provide sufficient guidance for a homogeneous problem where k is the same in all three directions per cell.
For example, in the below loop I solve a version of the problem where there are two materials in the domain each with material properties k1 and k2 which I assign based on the cell number contained in the vector geomDef assuming that each cell is homogenous. However, if the cell is anisotropic, how can I set up the condition so that dealii knows the direction in which I am pointing so I can assign the correct thermal conductivity accordingly?
Here is the code
for (const auto& cell : dof_handler.active_cell_iterators())
{
cell_matrix = 0;
cell_rhs = 0;
fe_values.reinit(cell);
for (const unsigned int q_index : fe_values.quadrature_point_indices())
for (const unsigned int i : fe_values.dof_indices())
{
for (const unsigned int j : fe_values.dof_indices())
if (geomDef[curr_cell] == 1)
{
cell_matrix(i, j) +=
(k1 * fe_values.shape_grad(i, q_index) * // assigning k1, thermal conductivity for material 1. Help needed here for allocating the thermal conductivity correctly
fe_values.shape_grad(j, q_index) *
fe_values.JxW(q_index));
}
else
{
cell_matrix(i, j) +=
(k2 * fe_values.shape_grad(i, q_index) * // assigning k2, thermal conductivity for material 2
fe_values.shape_grad(j, q_index) *
fe_values.JxW(q_index));
}
}
}
Thank you in advance for your help with this.
MJ