# Solving of a heat equation, still running after 5 hour

Posted 6 months ago
1320 Views
|
5 Replies
|
5 Total Likes
|
 Hi, I started this program who resolve a heat equation, after 5 hours of compilation, I stopped it. I don't understand why it takes all this time? Normally the calculations are not complicated at this point, please help me find a solution to this problem: T = 2 \[Pi]; l = \[Pi]; a = 1/100; w1 = Sin; y0 = Identity; (*Définit la fonction indicatrice*) indicator[x_] := Piecewise[{{1, 0 < x < \[Pi]/2}}, 0]; S[t_, f_, x_] := Sum[ Exp[- t n^2] Integrate[f[s] Sin[s n], {s, 0, \[Pi]}] Sin[x n], {n, 5}]; v1[x_] := w1[x] - S[T, y0, x]; L[t_, x_] := S[T - t, v1, x]; Q[x_] := indicator[x] Integrate[L[s, x]^2, {s, T - l, T}]; g1[x_] := a v1[x] + Q[x]; g2[t_, x_] := indicator[x] v1[x] L[t, x]; (*control*) u[t_, x_] := g2[t, x]/g1[x]; **************************************************************************** homogen = D[f[x, t], t] - D[f[x, t], {x, 2}] - indicator[x] u[x, t] == 0; (*données initiales propres *) ic = {f[x, T - l] == y0[x]}; (* Condition aux bord de Dirichlet*) bc = {f[0, t] == 0, f[\[Pi], t] == 0}; (*résolution analytique de l'équation *) sol1 = DSolveValue[{homogen, ic, bc}, f[x, t], {x, 0, \[Pi]}, {t, 0, T}] 
5 Replies
Sort By:
Anonymous User
Anonymous User
Posted 6 months ago
 One rule of the community board is not to post a problem that you have not yet taken effort to solve.homogen, of {homogen,bc,ic} is not defined above. but it still hangs if defined.I think the problem you've posted isn't very clear (for example, what u = g2/g1 entails as far as PDE solving method). I don't see clearly what is is the PDE, IC, BC to be solved, so knowing 'the problem' would require (me) to work some while just to un-cover what is getting solved. What is L? G? S? V? indicator[?] (this is ok if you cite a book page, but without that...) Is this and example from a book like a homework or test question (for credit)? Why does S depend on integrating f[] which is namingly v1[] which is Identity[x]=x, but also not the same f[] as in the PDE representing heat (normally u[] is heat in other books, but u and f are reversed)?. ic = {f[x, T - l] == y0[x]} would mean f[...] = f[...] which contains no new information so is not "an equation", which books call the bc, unless you "happen to know Identity[x] = x" and remember that f is heat and u is the non-homogenous part. I also see that using w1=Sin is possibly obstructive."normally the calculations are not complicated at this point". Could you provide an example of that? If you are saying that is so, then it would be nice to see such a similar example that was not a problem.It appears to me this is a non-homogenous pde problem involving heat equation as solved by heat kernel simplification, convolution, and maybe generalized function, all which are examples to find in a PDE book and possibly use with a duhamel's chapter combined. But the above has linear IC and insulated 0 BC, which may need steady + transient consideration, not typical of example problems of these kind. The piecewise is not a generalized function, so that is out. A series of width 5 (in this situation) is pretty wide and should take minutes to solve always. And because u[] contains a heat kernel like form doesn't necessitate one to use a fourier/guass method: actually that method uses the integral to solve (not NDSolve at all), and your problem has a heat kernel "like" phrase in u[] (which again, most books use u for heat and f for function, you've done the reverse).(use u as heat, f is the non-homogenous part and given, 0 BC, IC is a simple function (just x))In all I would then call it ... "Nonhomogeneous PDE using Eigenfunction Expansions”, type problem (or superimposition / fourier technique). But u[] (and thus f[]), is periodic and needs to be solved "within 0 to Pi domain", u[] may not be expressed in a form for it to work for all x and t ... and what method works does depend on the interval (finite, infinite, one-sided) - I have to think a little harder if it needs to be polar, i would know infinite intervals may work easier with fourier. I think DSolve "does not normally easily solve this problem type". For certain similar problems, in polar form (and this problem might use it), "we can transfer the non-homogeneity from the PDE to the BC", so it's not totally clear without some pre-solving what must be done (if we are forced to consider the bc and u as separate or if infact they could be combined).At any rate, the ways to solve a non-homogenous PDE with BC and IC are many. And that is why(for readers) it would be good to have a more straightforward question. u[] as heat, f[] as a function (not swapped up), clear pde ic bc to be solved (no mystery substitutions and functions unless explicitly called out). Hard enough to do these if we see what we are trying to solve.summary: i am used to seeing this same kind of problem being solved in multiple steps "so that mathematica can solve them (it can't otherwise)", i cannot say if version 12.1 should be able to do them quickly
Posted 6 months ago
 Hello John, I will try to answer your questions, first of all, this code is a personal effort, it's a validation of a controllability result, $u$ is the control that I tried to build a part by part. So what I've tried to do is build the control u in the first part of the code. and add it to the equation in the second part of the code.First, I fixed a function which I call $w1$ after adding the control to the heat equation I will try to calculate the solution of this equation to see if it the solution approaches w1 or no.Now I'm gonna try to define some notation of my code, first of all, the $S$ term: $$S(t)f = \sum_{n = 1}^{\infty} e^{- n^2 t}\langle f, \phi_{n} \rangle \phi_{n}, \ \ f \in L^{2}(0,\pi).$$ it's the representation of a semigroup is an orthonormal basic, as you can see the summation is until infinity, in the code, I just take until 5. (for simplifying calculations). This is the control that I try to build in the first part of the code $$u=G_{T l}^{*}\left(\alpha I+Q_{T l}\right)^{-1} x, \quad \alpha \in(0,1].$$ this is the $Q$ operator $$Q=G G^{*}=\int_{T- l}^{T} S(T-t) B_{\theta} B_{\theta}^{*} S^{*}(T-t) \,\mathrm{d} t.$$ this the operator $G$ $$G_{T}(v) = \int_{T-l}^{T} S(T-s) B_{\theta} v(s) \,\mathrm{d}s.$$ indicator is the indicator function which is equal to 1 in $(0, \ pi / 2)$ and 0 elsewhere.As you can see the construction of the control is not easy, it's very challenging. if it still not clear, please ask any questions you have. Best regards,
Posted 6 months ago
 Solving of a heat equation, still running after 5 hours.