Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An issue with the built-in solver using ultraspherical spectral method #884

Closed
Yiting687691 opened this issue May 18, 2023 · 0 comments
Closed

Comments

@Yiting687691
Copy link

Yiting687691 commented May 18, 2023

I'm trying to solve the following PDE over $x\in \left[-10,\frac {13}{\sqrt{\beta}}\right]$ and $\theta\in \left[0,\pi\right]$ using the ultraspherical spectral method:

$$ \frac {\partial H}{\partial x}+\left(\frac {2}{\beta}\sin^{4} \theta\right)\frac {\partial^{2} H}{\partial \theta^{2}}+\left[\left(x+\frac {2}{\beta}\sin 2\theta\right)\sin^{2}\theta-\cos^{2}\theta\right]\frac {\partial H}{\partial \theta}=0, $$

with boundary condition

$$ \begin{align*} H(x,0)=0, \end{align*} $$

and the approximate asymptotic initial condition

$$ \begin{align*} H\left(\frac {13}{\sqrt{\beta}},\theta\right)=\begin{cases} \Phi\left(\frac {\frac {13}{\sqrt{\beta}}-\cot^{2}\theta}{\sqrt{\left(4/\beta\right)\cot \theta}}\right)\quad &0\leq \theta\leq \pi/2,\\ 1\quad &\pi/2\leq \theta. \end{cases} \end{align*} $$

Here $\Phi$ denotes the standard normal distribution function. Following the sample codes in this Notebook, my code for this problem is the following:

β=2;
dθ = 0 ..π; 
dx = -10 ..13/sqrt(β);
d = dθ×dx;
θ,x = Fun(d);
Dθ = Derivative(d,[1,0]);
Dx = Derivative(d,[0,1]);
Φ = xx -> erf.(xx/sqrt(2))/2 + 0.5;
g = (t) -> Φ( (13/sqrt(β) - cot(t).^2)./sqrt.(4/β * cot.(t)) );
h0 = (t) -> t < pi/2 ? g(t) : 1.0;
u0 = Fun(θ->h0(θ),dθ);
u =\([ldirichlet(dx)⊗I; ldirichlet(dθ)⊗I;
Dx+((2/β)*(sin(θ))^4)*(Dθ^2)+((x+(2/β)*sin(2θ))*sin(θ)^2-cos(θ)^2)*Dθ],
[u0; 0; 0];tolerance=1E-4);

When I run the code, I got the following error:

AssertionError: length(order) == 2

@jishnub provides an updated version:

β=2;
dθ = 0 ..π;
dx = -10 ..13/sqrt(β);
d = dθ×dx;
θ = Fun(dθ);
x = Fun(dx);
Dθ = Derivative(space(θ)) ⊗ I;
Dx = I ⊗ Derivative(space(x));
Φ = xx -> erf.(xx/sqrt(2))/2 + 0.5;
g = (t) -> Φ( (13/sqrt(β) - cot(t).^2)./sqrt.(4/β * cot.(t)) );
h0 = (t) -> t < pi/2 ? g(t) : 1.0;
u0 = Fun(θ->h0(θ),dθ);
u =\([ldirichlet(dx)⊗I; ldirichlet(dθ)⊗I;
Dx + (Multiplication((2/β)*(sin(θ))^4) ⊗ I) * (Dθ^2) +
	(((I ⊗ Multiplication(x)) + (Multiplication((2/β)*sin(2θ)) ⊗ I)) * (Multiplication(sin(θ)^2) ⊗ I)
		- (Multiplication(cos(θ)^2) ⊗ I)) * Dθ],
			[u0; 0; 0];tolerance=1E-4);

which generates the following error message:
Implement Conversion from PiecewiseSpace{Tuple{Chebyshev{IntervalSets.ClosedInterval{Float64}, Float64}, Chebyshev{IntervalSets.ClosedInterval{Float64}, Float64}}, DomainSets.UnionDomain{Float64, Tuple{IntervalSets.ClosedInterval{Float64}, IntervalSets.ClosedInterval{Float64}}}, Float64} to Chebyshev{IntervalSets.ClosedInterval{Float64}, Float64}

I wonder if there are bugs in the code or there are some errors in the solve. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant