Message Boards Message Boards

NDSolveValue::litarg To avoid possible ambiguity, ... dependent variable in DirichletCondition

I've recently returned to using Mathematica after a 20 year break and so much has changed! I am modeling an electric field and I'm struggling with NDSolveValue[] and I'm hoping someone can clarify where I'm lost.

Any help on how to understand and resolve the NDSolveValue[] error would be greatly appreciated.

POSTED BY: David Johnson
4 Replies

I did make a little progress early this morning. After including your change AND redefining the z parameters as

solution = NDSolveVlaue [{pde, boundaryConditions},   
                                 V, 
                                {x, 0, groundLength}, 
                                {y, 0, groundWidth}, 
                                {z, -0.1,  distanceToGround}];

I'm no longer getting the an from NDSolveValue Proceeding on with execution of the code below... the remainder of the code executes without error but unexpectedly does not produce any vector arrows!

electricField = -Grad[solution[x, y, z], {x, y, z}];
VectorPlot3D[ Evaluate[electricField], 
                      {x, 0, groundLength}, 
                      {y, 0, groundWidth}, 
                      {z, -0.1, distanceToGround }, 
                      VectorScale -> {Tiny, Scaled[0.02], None}, 
                      VectorStyle -> Arrowheads[0.02]]
POSTED BY: David Johnson

Thank you for the suggestions however they do not resolve the issue. Using your suggests here is the returned error message.

NDSolveValue::bcnop: No places were found on the boundary where

0.0991<=x<=0.1009&&0.049675<=y<=0.050325&&0.3535<=z<=0.3535

was True, so

DirichletCondition[V==200,0.0991<=x<=0.1009&&0.049675<=y<=0.050325&&0.3535<=z<=0.3535]

will effectively be ignored.

I believe I've properly defined the boundary limits and I've experimented with changing those, but all with no success.

POSTED BY: David Johnson

Re: NDSolveValue::bcnop

Yes, I noted that NDSolve[] didn't work in the 2nd para. and suggested one might try to manually create an ElementMesh with the cuboids as subregions. When NDSolve[] complains about not finding points on the boundary, I think of two things. One, it mishandles the solid region. Two, round-off errors cause the problem.

In any case, I do not know whether generating your own element mesh would solve the problem. This tutorial, https://reference.wolfram.com/language/FEMDocumentation/tutorial/ElementMeshCreation.html, describes how to do it. If you need help, I suggest also asking on mathematica.stackexchange.com, since this discussion has not attracted the sort of expert help you seek.

Re: No vectors

If I remove the options VectorScale -> {Tiny, Scaled[0.02], None} and VectorStyle -> Arrowheads[0.02], I get some vectors. The following shows that the norms of the gradients are quite small, with 3 having an exponent base 10 greater than -8 and most being between -9.6 and -8.6. The variation in scale may be causing the vectors to disappear in the plot. Or maybe it's because VectorScale has been superseded as of version 12.1; see the link. If that is the reason, it would have been polite for Wolfram to have programmed in an error message.

The following shows that V[x, y, z] seems to be a constant 200, plus or minus some numerical error.

Table[(solution[x, y, z] - 200)/200, 
                      {x, 0, groundLength, groundLength/4}, 
                      {y, 0, groundWidth, groundWidth/4}, 
                      {z, -0.1, distanceToGround, (distanceToGround+0.1)/4}] //
                      Flatten // Chop

I figure you will conclude that NDSolve[] is not working properly. But if it is, congrats!

POSTED BY: Michael Rogers

Three things catch my notice, one of which is definitely a problem and the others may not be.

First, the error is because of missing {}:

solution=NDSolveValue[{pde,boundaryConditions} ,V
 ,{x,0,groundLength} ,{y,0,groundWidth} ,{z,0,distanceToGround+0.001}]

Second, I have not seen a Dirichlet condition applied over a solid cuboid. On the boundary, yes. My experience with PDEs is limited, so maybe it's ok. However, the above NDSolve call gives a warning that the Dirichlet conditions are ignored. If you wish to impose the conditions on solid region, I don't know what to suggest. Maybe manually create an ElementMesh with the cuboids as subregions.

Third, your pde contains Abs'[...]. It's possible that NDSolve or the FEM functions handle this, since there is no error message related to it. However, in Mathematica Abs[z] represents the complex absolute value or modulus and is therefore not differentiable. Abs'[...] is undefined. You can use RealAbs[] for the real absolute value, or ComplexExpand[Abs'[-0.0001+z] ] to expand in terms of Sqrt[]; ComplexExpand[pde] will do the whole PDE, which may be preferable.

POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract