1
$\begingroup$

Can anyone help me figure out how to set up a solution for NDSolveValue that incorporates the use of Cylindrical Coordinates. I tried using SetCoordinates[Cylindrical] but it is not working (as in it wont recognize SetCoordinates). I am using version 10.2 so the VectorAnalysis functionality should be included. I am confused as to why it is not working.

edit: adding code

op = ρ c D[T[t, r, z], t] - k/r D[r D[T[t, r, z], r], r] - k D[D[T[t, r, z], z], z] - g; 

Subscript[Γ, D] = {DirichletCondition[T[t, r, z] == Tbl, 
      z == ts + tito + tsl && -reff < r < reff], 
      DirichletCondition[T[t, r, z] == BCr[z], r == -reff && r == reff]};
Subscript[Γ, N] = NeumannValue[0, z == 0 && -reff <= r <= reff];

td = 100;

Temp = NDSolveValue[{op == Subscript[Γ, N], Subscript[Γ, D], 
         T[0, r, z] == ?? }, T, {t, 0, td}, {r, z} ∈ mesh];

edit #2: adding more code (defining variables and calculating initial temperature profile)

reff = .001; ts = .000250; tito = .000005; tsl = .00023;

bmesh = ToBoundaryMesh[
   "Coordinates" -> {{-reff, 0}, {reff, 0}, {reff, ts}, {reff, 
      ts + tito}, {reff, ts + tito + tsl}, {-reff, 
      ts + tito + tsl}, {-reff, ts + tito}, {-reff, ts}}, 
   "BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 
        5}, {5, 6}, {6, 7}, {7, 8}, {8, 1}, {8, 3}, {7, 4}}]}];
mesh = ToElementMesh[bmesh];
bmesh["Wireframe"]
mesh["Wireframe"]

ρs = 3980; ρito = 7120; ρsl = 958;
ks = .035; kito = .011; ksl = .00067;
cs = .75; cito = .25; csl = 4.22;
gs = 0; gito = 2800000; gsl = 0;

ρ = If[0 <= z < ts, ρs, 
   If[ts <= z < ts + tito, ρito, ρsl]];
k =  If[0 <= z < ts, ks, If[ts <= z < ts + tito, kito, ksl]];
c =  If[0 <= z < ts, cs, If[ts <= z < ts + tito, cito, csl]];
g =  If[0 <= z < ts, gs, If[ts <= z < ts + tito, gito, gsl]];

eqn1[z_] = k D[T1[z], z, z] + g; 

Tbl = 100;
Tl[z_] = Tbl;
Subscript[Γ1, D] = 
  DirichletCondition[T1[z] == Tbl, z == ts + tito + tsl];
Subscript[Γ1, N] = NeumannValue[0, z == 0];

BCr = NDSolveValue[{eqn1[z] == Subscript[Γ1, N], 
    Subscript[Γ1, D]}, T1, {z, 0, ts + tito + tsl}, 
   MaxStepSize -> 0.0000000001];

Plot[{BCr[z], VerticalSlider}, {z, 0, ts + tito + tsl}]
BCr[0]
BCr[ts]
BCr[ts + tito]
BCr[ts + tito + tsl]
Plot[BCr[z], {z, ts, ts + tito + tsl}]
Plot[BCr[z], {z, 0, ts}]
Plot[BCr[z], {z, ts, ts + tito}]
Plot[BCr[z], {z, ts + tito, ts + tito + tsl}]
Plot[BCr[z], {z, ts - tito, ts + tito}]
Plot[BCr[z], {z, ts - 2*tito, ts + 3*tito}]
Plot[BCr[z], {z, ts + tito, ts + 3*tito}]
Ti[z_] := Piecewise[{{BCr[z], 0 <= z < ts + tito}, {100, True}}];
Plot[Ti[z], {z, 0, ts + tito + tsl}]
$\endgroup$
10
  • 3
    $\begingroup$ Please provide more information. For instance, what equations are you trying to integrate, and what are the boundary conditions? Express these in Mathematica format, if possible. $\endgroup$
    – bbgodfrey
    Nov 5 '15 at 2:50
  • $\begingroup$ I am trying to solve the heat equation in cylindrical coordinates . I want to solve it for radial boundary conditions where temperature is constant with time and axial boundary conditions that are constant Temperature on one side and constant heat flux on the other side. There are two separate mediums involved to simulate a heated wall condition. Initial conditions include a linear temperature profile in the solid and a constant temperature in the fluid. It is initially discontinuous (fluid temperature not equal to solid wall). Assume no relative motion of the fluid (no convective term). $\endgroup$
    – dowlguest
    Nov 5 '15 at 4:11
  • $\begingroup$ I added the code in the original post as it would not fit in the comment $\endgroup$
    – dowlguest
    Nov 5 '15 at 4:13
  • 2
    $\begingroup$ Putting your code in the question was the right thing to do. I have improved the appearance of the code a bit but not changed it substantively. To proceed, replace ?? by the desired initial condition, replace {r, z} ∈ mesh by {r, -reff, reff}, {z, 0, zmax}, and define the constants that appear in your code. Your challenge here is not cylindrical coordinates per se (although negative r is an issue) but in producing self-consistent code. $\endgroup$
    – bbgodfrey
    Nov 5 '15 at 5:23
  • 1
    $\begingroup$ Please learn more about how to format your code so your question may attract more attention, also, you may want to know how to use @. $\endgroup$
    – xzczd
    Nov 5 '15 at 8:56