I'm trying to numerically solve the following equation


for which -1 $\le$ x $\le$ 1, -1 $\le$ y $\le$ 1, 0 $\le$ t $\le$ 1 with initial condition u(0,x,y)=sin(πxy) and u(t,x,y)=sin(πxy) and D=0.1 and $\vec{v}$ is {y,-x}. I've tried doing the following

eqn2 = Inactive[0.1*Laplacian[u[t, x, y], {t, x, y}] - {y, -x}*Gradient[u[t,x,y],{t, x, y}]]
pdesol = DSolve[{eqn2, u[0, x, y] == Sin[\[Pi] x y], u[t, x, y] == Sin[Pi x y]}, u[t, x, y], {x, -1, 1}, {y, -1, 1}, {t, 0, 1}]

But an error occurs. I have also tried to use NDSolve, but I get the same error, which is, "equation or list of equations expected instead of...". How could I fix this?

  • 2
    $\begingroup$ This question is similar to the one I answered here. $\endgroup$ – Tim Laska Jan 11 at 20:30

As I alluded to in the comments, I described a complete description of setting up a well-formed PDE system for a transient convection-diffusion problem in my answer here 237643.

The workflow for rectangular domain using the HeatTransferPDEComponent is shown in the following:

vars = {u[t, x, y], t, {x, y}};
pars = <|"ThermalConductivity" -> 0.1, 
   "HeatConvectionVelocity" -> {y, -x}|>;
eqn2 = HeatTransferPDEComponent[vars, pars] == 0
dctemp = HeatTemperatureCondition[True, vars, 
  pars, <|"SurfaceTemperature" -> Sin[Pi*x*y]|>]
ic = u[0, x, y] == Sin[Pi*x*y];
Ω = Rectangle[{-1, -1}, {1, 1}];
ufun = NDSolveValue[{eqn2, ic, dctemp}, 
   u, {t, 0, 1}, {x, y} ∈ Ω];
ContourPlot[ufun[0.5, x, y], {x, y} ∈ Ω, 
 ColorFunction -> "TemperatureMap"]



A similar but lower level approach to what Tim suggested is to use DiffisionPDETerm and ConvectionPDETerm

vars = {u[t, x, y], t, {x, y}};
eqn2 = D[u[t, x, y], t] + DiffusionPDETerm[vars, 0.1] + 
    ConvectionPDETerm[vars, {y, -x}] == 0;

Boundary conditions are then:

bc = DirichletCondition[u[t, x, y] == Sin[Pi*x*y], True]

The rest is then the same:

ic = u[0, x, y] == Sin[Pi*x*y];
\[CapitalOmega] = Rectangle[{-1, -1}, {1, 1}];
ufun = NDSolveValue[{eqn2, ic, bc}, 
   u, {t, 0, 1}, {x, y} \[Element] \[CapitalOmega]];
ContourPlot[ufun[0.5, x, y], {x, y} \[Element] \[CapitalOmega], 
 ColorFunction -> "TemperatureMap"]*)

As a side note, you can Activate the PDE as follows:


which is a prerequisite to use DSolve


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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