Skip to main content

differential equations - Two-dimensional catenary in Mathematica


I'm working in Mathematica to plot a 2-d catenary in Euclidean space according to this Math Stack Exchange Link, specified with a square Dirichlet boundary condition.


Here's what I've coded using Mathematica, followed by an error I receive. My goal was to set the surface integral to 1.5 because it's gotta be at least 1 if it's a sagging surface pinned at edges on a $1\times 1$ square.


NDSolve[

{ (-(D[u[x,y],x,x]+D[u[x,y],y,y])*(u[x,y]+λ)) == 1
, Integrate[
( 1+D[u[x,y],x]+D[u[x,y],y] )^(1/2) ∈ RectangularPolygon[4],x,y]==1.5
, DirichletCondition[u[x, y] == 0, True]
}
, u
, {x, y} ∈ RegularPolygon[4]
]



NDSolve: There are fewer dependent variables, {u[x,y]}, than equations, so the system is overdetermined



I think this is conditionally stable, so I've worked to provide a fair approximation of a stable error. If I omit the surface integral line, I'm told that NDSolve doesn't deal with non-linear coefficients. I was told elsewhere that this nonlinearity error is a hint that more detail is needed.




OK, I took a stab at improving the translation. I've got a coefficient array error that NDSolve can't parse, but it's closer to the problem statement. Surface integral not included yet.


NDSolve[
{
Sqrt[1+Norm[Grad[u[x,y],{x,y}]]^2 ]*Div[Grad[u[x,y],{x,y}]/Sqrt[1+Norm[Grad[u[x,y],{x,y}]]^2 ] ,{x,y}]==1/(u[x,y]+1),
DirichletCondition[u[x, y] == 0, True]
},

u,
{x, y} ∈ RegularPolygon[4]
]



image of chamois cloth




The trouble with this problem is that a physical analog is basically impossible. Any two-dimensional approximation of a heavy surface, such as a sheet of chain male, introduces anisotropy and also costs a lot. A sheet of chamois was used to get a first stab, but, as shown, it seems to have something different going on in the corners.


Work done by @xzczd below shows a shape more like the Laplacian over a similar domain, possessing the similar, albeit less-pronounced, re-entrant geometry along a geodesic from the peak to the vertex (see here; Google image result).


What I'll probably need to do is generate a .CSV file with this and then hand-prototype a form from which I can cast a concrete part. CNC foam is a nice option for a daydream, but it costs about \$1500 x 2 where I'm at in the US Midwest. Rather than shell out the cash on something that might melt at cone 10 (pottery term), I may be better off measuring a grid of sticks, draping plaster gauze cloth over the peaks and smoothing subsequent dollops of hydrocal thereover with an eye on a printout to capture detail. I feign no skill at anticipating a successful method here, as I've not worked on something this big before.



It could come in handy that this surface looks like the native "dome" feature offered in SolidWorks, but, without sufficient documentation regarding the algorithm therein used, and also with there already being discrepancies between the Laplacian already looking 10% off from the @xzczd, I'm likely to err on the side of extra elbow grease and precision. If we've got the right math here, why use anything else?


A note on the picture above; chamois cloth (used wet as shown) stretches as it's comprised of, basically, an epidermal sponge, so there's probably some heat energy (and a smidge of elastic energy) absorbing the gravitational potential that deprives the final shape of any proximity to a more truthful catenary surface.


Dope work, all. Thanks to @xzczd.




Foam board


@xzczd - This is a 38% scale prototype I'm making. If I can find affordable CNC service I'll use it, otherwise I'll make a pantograph and scale this up using a drill holding a ball mill following a ball stylus that runs over this form like a cam/template.


The ribs shown were generated using your Mathematica code modified a bit to output a $10 \times 10$ grid of points. I'm working with half of the shape at first (which is what you see). The next step will be to add the remaining webbing-like shapes that I've made from card stock.


Thank you - I think this is the first time in the history I've learned that I've seen this shape be made. I hope it works.




Been seeing similar shapes on domes for a few weeks now so doubt the immediate above.



Progress pics below. One shows a gauze cloth attempt that failed, but the next shows how I got to make the slip cast mold from solid plaster (similar in concept to the gauze cloth but without the cloth—two thin shells were made by pouring nearly-cured plaster slurry over the yellow papier mache and polyurethane master, then those two shells were joined with another thick overlay of plaster).


Current state, leather hard. Slip cast the main body and added hand built clay handles. Drying slowly now then firing and then testing. God help us all with the picture upload.


It’s probably 50-80% accurate. One big issue will be that the analytical surface is what I started with for the mold—the final shell thickness isn’t built in. If I get another chance I’ll do it, but for this moment I just want to know if I can cast something this large and then transport it to the field in one piece. If not, I may have to use castable refractory or try another approach.


enter image description here


enter image description here


enter image description hereenter image description here



Answer



I won't say it's easy to solve.


"I'm told that NDSolve doesn't deal with non-linear coefficients. " Yes, currently NDSolve cannot deal with nonlinear stationary PDE, so let's turn to finite difference method (FDM) to discretize $$\sqrt{1+|\nabla u|^2}\ \nabla\cdot{}\frac{\nabla u}{\sqrt{1+|\nabla u|^2}}=\frac{1}{u+\lambda}$$. I'll use pdetoae for the generation of difference equations.


To take the constraint $$\int_{\Omega}\sqrt{1+|\nabla u|^2}dx=A$$ into consideration, I'll use trapezoidal rule to discretize it to a algebraic equation and solve it together with those difference equations.



points = 24;
{bL, bR} = domain = {0, 1};
grid = Array[# &, points, domain];
grad = Grad[#, {x, y}] &;
div = Div[#, {x, y}] &;
A = 3/2;
With[{u = u[x, y]}, sqrt = Sqrt[1 + grad[u].grad[u]];
eq = sqrt div[grad[u]/sqrt] (u + λ) == 1;
{bc@x, bc@y} = Table[u == 0 /. var -> b, {var, {x, y}}, {b, domain}]];
sqrtfunc = Function[{x, y}, #] &@sqrt;

difforder = 2;
(* Definition of pdetoae isn't included in this post,
please find it in the link above. *)
ptoafunc = pdetoae[u[x, y], {grid, grid}, difforder];
del = #[[2 ;; -2]] &;
ae = del /@ del@ptoafunc[eq];
aebc@x = del /@ ptoafunc[bc@x];
aebc@y = ptoafunc[bc@y];
rule = Flatten /@ (Outer[sqrtfunc, grid, grid] -> ptoafunc[sqrt]) // Thread;
trap[value_, grid_: grid] := 1/2 Differences[grid] (Most@value + Rest@value) // Total;

int = trap[Function[y, trap[Function[x, sqrtfunc[x, y]] /@ grid]] /@ grid] /. rule;
solfuncguess[x_, y_] := 0; λguess = 1/3;
solrule = FindRoot[{ae, aebc /@ {x, y}, int == A},
Append[Flatten[#, 1] &@
Table[{u[x, y], solfuncguess[x, y]}, {x, grid}, {y,
grid}], {λ, λguess}], MaxIterations -> 1000]; // AbsoluteTiming
(* {35.472657, Null} *)
solfunc = ListInterpolation[
Partition[Most[solrule][[All, -1]], points], {domain, domain}];
solrule // Last

(* λ -> 0.555491 *)

NIntegrate[sqrt /. u -> solfunc, {x, bL, bR}, {y, bL, bR}]
(* 1.51602 *)
Plot3D[{solfunc[x, y]}, {x, 0, 1}, {y, 0, 1}]

Mathematica graphics






  1. The achieved $A$ value isn't perfect, to achieve a better $A$, better initial guess is probably needed, which seems not to be that easy to find for this problem.




  2. Guys read my relevant posts before (Well, will there be any?) may feel surprised that I'm not using Gauss-Legendre quadrature formula for numeric integration this time, that's because, with Gauss-Legendre quadrature formula, the solution never converges to a reasonable position. I don't know why.




  3. Honestly speaking I'm not 100% sure if the solution above is reliable.




Comments

Popular posts from this blog

plotting - Filling between two spheres in SphericalPlot3D

Manipulate[ SphericalPlot3D[{1, 2 - n}, {θ, 0, Pi}, {ϕ, 0, 1.5 Pi}, Mesh -> None, PlotPoints -> 15, PlotRange -> {-2.2, 2.2}], {n, 0, 1}] I cant' seem to be able to make a filling between two spheres. I've already tried the obvious Filling -> {1 -> {2}} but Mathematica doesn't seem to like that option. Is there any easy way around this or ... Answer There is no built-in filling in SphericalPlot3D . One option is to use ParametricPlot3D to draw the surfaces between the two shells: Manipulate[ Show[SphericalPlot3D[{1, 2 - n}, {θ, 0, Pi}, {ϕ, 0, 1.5 Pi}, PlotPoints -> 15, PlotRange -> {-2.2, 2.2}], ParametricPlot3D[{ r {Sin[t] Cos[1.5 Pi], Sin[t] Sin[1.5 Pi], Cos[t]}, r {Sin[t] Cos[0 Pi], Sin[t] Sin[0 Pi], Cos[t]}}, {r, 1, 2 - n}, {t, 0, Pi}, PlotStyle -> Yellow, Mesh -> {2, 15}]], {n, 0, 1}]

plotting - Plot 4D data with color as 4th dimension

I have a list of 4D data (x position, y position, amplitude, wavelength). I want to plot x, y, and amplitude on a 3D plot and have the color of the points correspond to the wavelength. I have seen many examples using functions to define color but my wavelength cannot be expressed by an analytic function. Is there a simple way to do this? Answer Here a another possible way to visualize 4D data: data = Flatten[Table[{x, y, x^2 + y^2, Sin[x - y]}, {x, -Pi, Pi,Pi/10}, {y,-Pi,Pi, Pi/10}], 1]; You can use the function Point along with VertexColors . Now the points are places using the first three elements and the color is determined by the fourth. In this case I used Hue, but you can use whatever you prefer. Graphics3D[ Point[data[[All, 1 ;; 3]], VertexColors -> Hue /@ data[[All, 4]]], Axes -> True, BoxRatios -> {1, 1, 1/GoldenRatio}]

plotting - Mathematica: 3D plot based on combined 2D graphs

I have several sigmoidal fits to 3 different datasets, with mean fit predictions plus the 95% confidence limits (not symmetrical around the mean) and the actual data. I would now like to show these different 2D plots projected in 3D as in but then using proper perspective. In the link here they give some solutions to combine the plots using isometric perspective, but I would like to use proper 3 point perspective. Any thoughts? Also any way to show the mean points per time point for each series plus or minus the standard error on the mean would be cool too, either using points+vertical bars, or using spheres plus tubes. Below are some test data and the fit function I am using. Note that I am working on a logit(proportion) scale and that the final vertical scale is Log10(percentage). (* some test data *) data = Table[Null, {i, 4}]; data[[1]] = {{1, -5.8}, {2, -5.4}, {3, -0.8}, {4, -0.2}, {5, 4.6}, {1, -6.4}, {2, -5.6}, {3, -0.7}, {4, 0.04}, {5, 1.0}, {1, -6.8}, {2, -4.7}, {3, -1.