How to solve inconsistent equation dimensions in Mathematica

30 Views Asked by At

Using the heat equation and Neumann Values in mathematica I've been trying to visualise heat diversions in 2D. The code used is here : Needs["NDSolveFEM"] Clear["Global`*"]

(Define the spatial domain as a square[0,1] x[0,1]) domain = Rectangle[{0, 0}, {1, 1}];

(Create a mesh for the 2D spatial domain) mesh = ToElementMesh[domain, "MaxCellMeasure" -> 0.01];

(Define your temperature distribution at t=0 as an interpolation
function
) fI = Interpolation[ Flatten[Table[{{x, y}, 20}, {x, 0, 1, 0.1}, {y, 0, 1, 0.1}], 1]];

(Define the heat conduction equation in 2D) eqn = D[T[t, x, y], t] - Laplacian[T[t, x, y], {x, y}] == 0;

(Set initial condition) IC = T[0, x, y] == 20;

(Set up Neumann boundary conditions to simulate insulation in 2D
using NeumannValue
) BC = {NeumannValue[0, True]};

NDSolve[{eqn == BC, IC}, T, {t, 0, 20}, {x, y} [Element] mesh]

But I keep getting the same error : error message obtained while running the program on the latest version of Mathematica

I've tried to remove the {} around the NeumannValue as I assume it's causing the error but I only obtain a singular matrix which can't solve the equation. Even Chat-GPT crashed while trying to explain the error. All help is appreciated !

0

There are 0 best solutions below