# How to solve 3D heat equation with Neumann B.C

I'm trying to solve the 3D heat equation on a cuboid to know if all the perimetric surfaces of a Cuboid achieve the desired temperature of a 873K on deadline time of 2 hours. i have convection on all the surfaces (Neumman B.C), except on the bottom on which i have conduction by a known heat flux (Neumman B.C). I tried the next code:

k = 25.5;(*W/(m K)*)
Rho = 7800;(*(kg/m3)*)
c = 500;(*J/(kg K)*)
sig = 5.67*10^-8;(*W/(m^2 K^4)*)
h = 6.98;(*W/(m^2K)*)
Q = 12000(*KW*);
Reg = ImplicitRegion[-0.2 <= x <= 0.2 && -0.7 <= y <= 0.7 && 0 <= z <= 0.3, {x, y, z}];
op = Rho c Derivative[1, 0, 0, 0][u][t, x, y, z] -
k Laplacian[u[t, x, y, z] , {x, y, z}];
BC2 = NeumannValue[-((h*100)/k ) - (0.7 sig (100)^4)/
k , (z == 0.3) || (x == -0.2) || (x == 0.2) || (y == -0.7) || (y == 0.7)]
+NeumannValue[Q/k, z == 0 ]
uifHeat = NDSolveValue[{op == BC2, u[0, x, y, z] == 298},
u, {t, 0, 360}, {x, y, z} ∈ Reg];
Labeled[Plot3D[uifHeat[#, x, y, 0.3], {x, -0.2, 0.2}, {y, -0.7, 0.7}],
"t=" <> ToString[#]] & /@ Range[0, 360, 120]


i get the next error:

No places were found on the boundary where Coordinate  was True, so \
NDSolveFEMBoundaryCondition[{Neumann \
,{1,1},{CompiledFunction[{10,10.2,5568},{_Real,_Real,_Real},{{3,0,0},{\
3,0,1},{3,0,2},{3,2,0}},{{{{-27.5282}},{3,2,0}}},{0,0,3,0,1},{{1}},\
Function[{x,y,z},{{-27.5282}},Listable],Evaluate]}},Coordinate \
,CompiledFunction[{10,10.2,5568},{_Real,_Real,_Real},{{3,0,0},{3,0,1},\
{3,0,2},{2,0,0}},{<<1>>},<<1>>,{{19,0,3},<<49>>,<<11>>},Function[{x,y,\
z},Block[{Compile$16,Compile$25},Compile$16=-x;Compile$25=-y;\
Boole[<<1>>]],Listable],Evaluate],NeumannValue[-27.52819607843137,z==\
0.3||x==-0.2||x==0.2||y==-0.7||y==0.7]] will effectively be \
ignored. >>
Input value {-0.199971,-0.6999,0.3} lies outside the range of data in  the    interpolating function. Extrapolation will be used. >>


and this graphics: what am i doing wrong?

After getting some help i entered a few changes, I'm trying to use Finite Element Method by meshing the region. i changed the bottom Neumann B.C to Dirichlet B.C, but still getting a interpolation error on the boundary lines of the upper surface:

Needs["NDSolveFEM"]
k = 25.5;(*W/(m K)*)
Rho = 7800;(*(kg/m3)*)
c = 500;(*J/(kg K)*)
sig = 5.67*10^-8;(*W/(m^2 K^4)*)
h = 6.98;(*W/(m^2K)*)
Q = 12000(*KW*);
Reg = ImplicitRegion[-0.2 <= x <= 0.2 && -0.7 <= y <= 0.7 && 0 <= z <= 0.3 {x, y, z}];
M = ToElementMesh[Reg];
M["Wireframe"]
op = Rho c Derivative[1, 0, 0, 0][u][t, x, y, z] -
k Laplacian[u[t, x, y, z] , {x, y, z}];
IC = u[0, x, y, z] == 298;
BC1 = DirichletCondition[u[t, x, y, z] == 873, z == 0];
BC2 = NeumannValue[-((h 100)/k) - (0.7 sig 100^4)/k, (z > 0)];
uifHeat = NDSolveValue[{op == BC2, u[0, x, y, z] == 298},
u, {t, 0, 360}, {x, y, z} ∈M];
Labeled[Plot3D[uifHeat[#, x, y, 0.3], {x, -0.2, 0.2}, {y, -0.7, 0.7}],
"t=" <> ToString[#]] & /@ Range[0, 7200, 1800]


the error:

"Input value {-0.199971,-0.6999,0.3} lies outside the range of data \
in the interpolating function. Extrapolation will be used."
"Further output of "InterpolatingFunction dmval", will be suppressed during this calculation."

• Firstly, it would seem that BC1 has not been defined. I assume this is an initial condition? Feb 21 '16 at 15:23
• the initial condition is already in 'unifheat' <u[0, x, y, z] == 298> . BC1 was Dirichlet B.C which i changed to Neumann BC. @drN Feb 21 '16 at 15:31

The following produces what appears to be the results. Note that the undefined BC1 had to be removed, whether or not the initial condition was specified in some other way.

BC2 = NeumannValue[-((h*100)/k ) - (0.7 sig (100)^4)/k , z > 0] +
NeumannValue[Q/k, z == 0 ]
uifHeat = NDSolveValue[{op == BC2, u[0, x, y, z] == 298},
u, {t, 0, 360}, {x, y, z} ∈ Reg] • Thank you @bbgodfrey. about the neumann B.C: NeumannValue[((h*100)/k ) - (0.7 sig (100)^4)/k , z > 0] isn't it apply convection on all the surfaces above z>0, and not only the perimeter surfaces that define the cuboid? Feb 21 '16 at 16:27
• @M It applies NeumannValue on all spatial surfaces of the cuboid except z == 0. What other surfaces are you thinking of? Feb 21 '16 at 19:23
• the question is are the convection apply on all the layers besides the envelope surfaces, like the inside layers of z: 0<z<3, ant not only on z=0 and etc. Feb 22 '16 at 9:34
• i am still getting the extrapolation error on the boundary lines: "Input value {-0.199971,-0.6999,0.3} lies outside the range of data \ in the interpolating function. Extrapolation will be used." why the interpolation fails on the boundary lines? Feb 22 '16 at 10:36
• @MaximKozminov The NeumannValue boundary conditions are applied only at the real boundaries, not the interior. You can safely ignore the `Extrapolation message. Feb 22 '16 at 14:03