1
$\begingroup$

I can solve the following stationary Darcy problem:

$div(\nabla u)=1$ with $ u = 0 \in \Gamma_d$

<< NDSolve`FEM`
x0 = 40;
y0 = 30;
r = 30;
p = Polygon[{{0, 0}, {75, 0}, {75, 30}, {45, 30}, {35, 40}, {0, 
     40}}];
m = ToElementMesh[p, "MeshOrder" -> 1, MaxCellMeasure -> 10 ];
usol = NDSolve[{ Laplacian[u[ x, y], {x, y}] == 1, 
    DirichletCondition[u[x, y] == 0, True] }, 
   u, {x, y} \[Element] m];
ContourPlot[Evaluate[u[ x, y] /. usol], {x, y} \[Element] m, 
 ColorFunction -> "Temperature", AspectRatio -> Automatic]

enter image description here

But I can't solve the following transient problem

$\frac{\partial u}{\partial t} + div(\nabla u)=t$ with $ u = 0 \in \Gamma_d$

usol = NDSolve[{D[u[t, x, y], t] - Laplacian[u[t, x, y], {x, y}] == t,
     DirichletCondition[u[t, x, 0] == 0, True], u[0, x, y] == 0}, 
   u, {t, 0, 1}, {x, y} \[Element] m];
ContourPlot[Evaluate[u[0.1, x, y] /. usol], {x, y} \[Element] m, 
 ColorFunction -> "Temperature", AspectRatio -> Automatic]

Can anyone help?

$\endgroup$
3
  • 2
    $\begingroup$ Your code at the bottom executes with no errors and returns a plot (v. 12.0.1 on Win10-64). What do you get instead? If you get a result as well, explain what your issue is in detail. $\endgroup$
    – MarcoB
    Commented Jun 27, 2022 at 19:03
  • 1
    $\begingroup$ Check the boundary condition DirichletCondition[u[t, x, 0] == 0, True] . Probably only the boundary of m is of interest, no time dependency! $\endgroup$ Commented Jun 28, 2022 at 10:21
  • $\begingroup$ Did you figure this out? $\endgroup$
    – user21
    Commented Jul 8, 2022 at 9:21

1 Answer 1

1
$\begingroup$

I solved like this:

<< NDSolve`FEM`
x0 = 40;
y0 = 30;
r = 30;
p = Polygon[{{0, 0}, {75, 0}, {75, 30}, {45, 30}, {35, 40}, {0, 
     40}}];
m = ToElementMesh[p, "MeshOrder" -> 1, MaxCellMeasure -> 1];
op = (D[u[t, x, y], t] - Laplacian[u[t, x, y], {x, y}]) - 1
(*ic={u[0,x,y]\[Equal]Evaluate[u[x,y]/.usol]};*)

ic = {u[0, x, y] == 0};
sol = NDSolveValue[{op == 0, 
   DirichletCondition[u[0, x, y] == 0, True], ic}, 
  u, {x, y} \[Element] m, {t, 0, 1000}]
Manipulate[
 ContourPlot[Evaluate[sol[t, x, y]], {x, y} \[Element] m, 
  ColorFunction -> "Temperature", AspectRatio -> Automatic, 
  PlotRange -> All], {t, 0, 1000, 1}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.