0
$\begingroup$

I'm trying to solve a PDE using NDSolve.

cfun = NDSolveValue[pde, c, {t, 0, tEnd}, 
   DirichletCondition[c[t, x] == 5, x == 0], {x} \[Element] mesh];

I get the following error while trying to specify the boundary condition for a time-dependent problem.

NDSolveValue::dvlen: The function c[t,x] does not have the same number of arguments as independent variables (3).

Could someone please help me with this?

notebook

code reference

EDIT:

Complete code:

Needs["NDSolve`FEM`"]
region = Line[{{0}, {100}}];
includePoints = {{10}, {20}, {30}, {40}, {50}};
mesh = ToElementMesh[region, "IncludePoints" -> includePoints, 
  "MaxCellMeasure" -> 0.0008]
vars = {c[t, x], t, {x}};
RegularizedDeltaPoint[g_, X_List, Xs_List] := 
 Piecewise[{{Times @@ Thread[1/(4 g) (1 + Cos[\[Pi]/(2 g) (X - Xs)])],
     And @@ Thread[RealAbs[X - Xs] <= 2 g]}, {0, True}}]
Subscript[h, mesh] = Sqrt[Min[mesh["MeshElementMeasure"]]];
Subscript[gamma, reg] = Subscript[h, mesh]/2;
temp = RegularizedDeltaPoint[Subscript[gamma, reg], {x}, 
   includePoints[[1]]];
parameters = {kappa -> {{910}}, v1 -> 162, 
   gamma -> Subscript[gamma, reg], Qp -> 1.5};
pde = {Derivative[1, 0][c][t, x] + 
      Inactive[
        Div][(-kappa).Inactive[Grad][
         c[t, x], {x}], {x}] + {v1}.Inactive[Grad][c[t, x], {x}] + 
      Qp*RegularizedDeltaPoint[gamma, {x}, {10}] == 0, 
    c[0, x] == 1} /. parameters;

tEnd = 2;
cfun = NDSolveValue[pde, c, {t, 0, tEnd}, 
   DirichletCondition[c[t, x] == 5, x == 0], {x} \[Element] mesh];

The issue is when I include the DirichletCondition[c[t, x] == 5, x == 0]. I want to fix the left boundary (i.e. x=0) at a value of c = 5 at all time, t, and specify the Neumann boundary condition at the right boundary.

$\endgroup$
7
  • $\begingroup$ Please post your code about pde and c. $\endgroup$
    – cvgmt
    Jun 19 at 13:00
  • 2
    $\begingroup$ Questions on StackExchange sites are expected to be self-contained, and avoid relying on external links as much as possible. Readers should still be able to understand your question 10 years later. Therefore, please construct a minimal (!) example, and include it in your post. Do not link to an external notebook. $\endgroup$
    – Szabolcs
    Jun 19 at 13:13
  • $\begingroup$ @cvgmt Could you please check the edit. $\endgroup$
    – Natasha
    Jun 19 at 14:12
  • 1
    $\begingroup$ The DirichletCondition should be the list of equations like cfun = NDSolveValue[{pde, DirichletCondition[c[t, x] == 5, x == 0]}, c, {t, 0, tEnd}, {x} \[Element] mesh]. $\endgroup$
    – Tim Laska
    Jun 19 at 14:51
  • 1
    $\begingroup$ The default NeumannValue is zero. If you want some other value, add it to the RHS of the PDE. For example, look here. $\endgroup$
    – Tim Laska
    Jun 19 at 15:27

Your Answer

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

Browse other questions tagged or ask your own question.