Questions tagged [finite-difference-method]
Tag for the usage of "FiniteDifference" Method embedded in NDSolve and implementation of finite difference method (fdm) in mathematica.
123
questions
1
vote
1
answer
79
views
A way to generalize my code for this non linear ODE problem
I am trying to solve the differential equation $y''(x) = y(x)+\sin[y'(x)]$ using "Fixed Point Iteration" over the interval $[0,1].$ Now using central difference method I arrived at the ...
1
vote
0
answers
73
views
Solve system of ODE by fractional finite difference method
I am trying to solve the following system using fractional finite difference method:
where e=0.1, a=1.3, m=0.3, p=10, g=3, k=1 and s1, s2, s3 it was mentioned in this paper that it is calculated ...
7
votes
0
answers
248
views
Code for quasi 1D nozzle flows
The quasi-one-dimensional model describing the flow of compressible gas in rocket nozzles is very common. The corresponding equations have a divergent non dimensional form
$ \frac{\partial \mathbf{U}}...
3
votes
3
answers
229
views
Apply central difference formula to a variable twice
I am working with finite difference methods analytically and I would like to be able to perform operations on subscripted variables.
I would like to generate the following expression by applying a ...
0
votes
0
answers
45
views
Explicit modified midpoint (Gragg smoothing)
In the "StifnessSwitching" method the default numerical scheme for the non-stiff solver is Explicit modified midpoint (Gragg smoothing) with a decreasing step size.
I decided to study the ...
1
vote
1
answer
340
views
Difficulty in solving a differential equation with custom solver for a different initial condition
This is a follow-up question to this previous post by @FLP, in which an interesting system of equations was solved with the useful pdetoode developed by @xzczd. I have tried to solve this problem with ...
5
votes
1
answer
103
views
Spalart-Allmaras turbulence model
In this post Alex gives an implementation of the Spalart-Allmaras turbulence model [1, 2]. The example produces reasonable results, as far as I can tell. However, the implementation Alex uses deviates ...
0
votes
0
answers
54
views
PDE System solves in Cartesian but not in Cylindrical Axisymmetry
As a follow-up to my previous question, I am now solving the same system in axisymmetry.
This introduces a singularity at the origin. Following various posts on solving in cylindrical coordinates, I ...
4
votes
1
answer
88
views
Finite Element analysis: distribution of sine wave over a distance
I am trying to solve the following one-dimensional problem:
(to better understand and extend the FEM for a more complex problem),
...
4
votes
1
answer
173
views
NDSolveValue gives up without warning or solution on PDEtoODE system
I have the following pair of PDEs that I want to solve in the half-space x>=0:
I followed this post to decompose the 4th-order height equation into two 2nd-order ones to respect the hyperbolic ...
0
votes
0
answers
72
views
Finite Difference and LinearSolve
I have two nonlinear second order coupled boundary value ODE whose dependent variables are $u(x)$ and $z(x)$. I want to solve it using the Relaxation method (Finite-Difference), however, I can't ...
4
votes
1
answer
199
views
How To Implement Discrete Fractional Differentiation in Mathematica
This question was borne out of my attempt to answer this question. How to calculate fractional differences of a timeseries?
To recreate this in Matheamatica I wrote this code
...
2
votes
1
answer
207
views
Speeding up NDSolve to reasonable speeds to solve a coupled PDE system
Problem Statement
I am planning to solve a PDE system which consists of a fluid droplet spreading on a non-Newtonian substrate. The system consists of the following equations:
$$\frac{\partial p_1}{\...
5
votes
0
answers
169
views
Resolving singularity in convection-diffusion equation using pdetoode
Building on the system of equations in this post, I attempted to solve an additional convection-diffusion equation describing the concentration of solute in the lens, which affects its spreading.
...
5
votes
1
answer
297
views
NDSolve refuses to initialise when solving an integro-differential equation with custom pdetoode solver scheme
Problem Background
Recently I'm attempting to replicate the result of the following research paper on the Nonlocal description of Evaporating Drops. The equation of motion of a evaporating, spreading ...
-1
votes
1
answer
71
views
Need help with the functions to use for this problem [closed]
Consider the following example. Suppose there is a thin rod which is insulated along its length. Suppose that the temperature is initially zero everywhere, and that the left end is suddenly heated and ...
8
votes
3
answers
747
views
Numerical solution for a non-linear Fractional Differential Equation (FDE)
As shown below, a neat explicit expression is obtained for F=2, however
an exact solution is not present for 1< F < 2.
How do we obtain numerical values for F = 1.5 (for instance)?
There have ...
2
votes
0
answers
53
views
Two small problems on the FiniteDifferenceDerivative in the tutorial?
In the tutorial for FiniteDifferenceDerivative of pseudospectral approximation, there is a nice example. I just show a snapshot
The following line should define $11$ discrete wavenumbers over a ...
5
votes
1
answer
450
views
Error in Attempting Moving Boundary Fluid System
Recently I was attempting to solve a moving boundary fluid system on mathematica, which I have managed to convert into a coupled PDE-ODE system based on this helpful reference over here.
The equations ...
0
votes
0
answers
59
views
How to use Manipulate for Finite Differences
I want to improve my code using the command Manipulate and being able to see the calculus of averages as the indexes l and u are moved. I did a simple example of a 4x4 matrix with the boundary ...
3
votes
1
answer
138
views
Is it possible to solve a differential equation with a user-defined variable mesh in NDSolve?
For some differential equations, its solution may evolve to a cusp, for example, singular behavior. One may want to introduce additional mesh points near the cusp to accurately follow the solution ...
0
votes
1
answer
132
views
Mathematica doesn't solve linear system of equations that emerges from finite difference method [closed]
I want to solve the ODE $$u''(x)+u(x)=e^{-x^2}$$
$$u(0)=u(10)=0$$ using finite difference method.
I divide the interval $[0,10]$ uniformly by $x_i=0+ih$ using step size $h=\frac{10}{11}$.
By ...
2
votes
1
answer
139
views
Solving for Coefficients in a System of Linear Equations Using Mathematica
I'm currently using Matlab to solve a two-dimensional PDE in a rectangular domain using finite differences. Without going into too much detail (although I'd be happy to if necessary), I have the ...
20
votes
1
answer
487
views
3D stable fluids algorithm to simulate transition from laminar to turbulent flow
This algorithm is 3D extension of our 2D algorithm published on this page and here.
We suppose that with this code we can simulate transition from laminar to turbulent flow. In this example we compute ...
5
votes
2
answers
711
views
Numerical solutions of active 1D wave equations
I would like to solve the following PDE with finite difference method. The PDE is from the following paper, (https://arxiv.org/pdf/1911.11823.pdf). I would like to implement the algorithm for the left ...
2
votes
1
answer
202
views
Finite difference method for solving coupled differential equations
I am trying to solve the following coupled differential equations:
$\dot{c}_{1}(t)=-\int_0^t \alpha_{1}(t,s)c_{1}(s)+\beta_{1}(t,s)c_{2}(s)\,ds-\frac{i}{\hbar}\lambda c_2(t)e^{+i(\omega_1-\omega_2) t}$...
0
votes
0
answers
40
views
Mean error of finite differences derivative
I wrote a module that computes the 4-th order finite difference derivative of a function at $N$ equidistant points of an interval and the difference between the exact and numerical value at those ...
0
votes
0
answers
36
views
NDSolve SetDelayed error
I'm trying to calculate the first derivative of a function at a number of points using the 4-th order finite difference matrix, and then multiplying it with the function values at that point. I wrote ...
4
votes
1
answer
197
views
How to solve Coupled a Parabolic and Elliptic PDE in NDSolve?
I want to solve a mixed PDE Parabolic-Elliptic system in 3-dimension (rectangular coordinate), as shown below:
The respective code version with parameters value, boundary and initial conditions is,
<...
7
votes
2
answers
718
views
Finite difference method to solve coupled differential equations
I am trying to solve the following coupled differential equations: $\dot{c}_1(t)=-\int_0^tf(t-s)c_1(s)+g(t-s)c_2(s)ds$, $\dot{c}_2(t)=-\int_0^tg(t-s)c_1(s)+f(t-s)c_2(s)ds$, where $f(t-s)=\frac{\sqrt{2}...
1
vote
0
answers
87
views
solving ordinary coupled differential equation
I have a set of 8 ordinary differential equations containing matrices which I need to solve using initial conditions. I have written the equations in this form:
...
1
vote
1
answer
235
views
NonStandard finite difference for BMBB equation
I am trying to implement the following scheme mentioned in the paper
"NUMERICAL SOLUTIONS OF BENJAMIN-BONA-MAHONY-BURGERS EQUATION VIA
NONSTANDARD FINITE DIFFERENCE SCHEME
"
What is ...
0
votes
1
answer
246
views
Method of lines in a single PDE
After solving this following PDE in NDSolve, now I have to use the method of lines to solve it and then compare the results. I was following the tutorial from Wolfram for Method of lines (https://...
17
votes
1
answer
599
views
Stable fluids code for electromagnetic mixture application
This code has been translated from the original Jos Stam code and improved with some Mathematica functions. It solves problem of viscous incompressible flow with electromagnetic force in a rectangle ...
1
vote
0
answers
57
views
Defining general recurrence expression and extracting coefficient
I'm new to Mathematica and I wish to solve a difference equation which is defined by the relation:
$y_{i-1}-2y_{i} +y_{i+1} = f(x_i,y_i),\\y_0 = a, y_n = b.$.
Where $x_i$ is given for all $i$.
I want ...
3
votes
1
answer
849
views
How to calculate fractional differences of a timeseries?
I have a timeseries I am looking to transform with fractional differences per the following description:
The idea being to retain the essence of stationarity of, say, a log transformed integer series ...
1
vote
1
answer
148
views
Solving the Stefan Problem with WhenEvent
The formulation of the problem:
I tried to solve it with MOL and the method of V.R. Voller:
The script:
...
1
vote
1
answer
125
views
0
votes
1
answer
442
views
Solving System of Equations
I want to solve a huge system of equations which is generated using the Finite-Difference-Method. The Problem with that system is that it is badly conditioned and so ...
6
votes
3
answers
1k
views
Time dependent Schrödinger equation in 2D
I have the following Schrödinger equation in $2D$:
\begin{cases}
\partial_t \Psi(x,t) = V(x,t) \Psi(x,t) \quad x \in [-10,10]^2\\
\Psi(x,0)=\exp( \frac{1}{2} (-x^2+y^2))
\end{cases}
where the ...
1
vote
0
answers
109
views
How do I code an L2 Norm for a Finite Difference Scheme?
I have to compute the L2 norm of a Finite Difference Scheme applied to a second order differential equation. I set up the code to perform the Scheme with n = 20 and n = 200, and my input is
...
5
votes
2
answers
251
views
NonLinear system for chemotaxis
I want to solve the chemotaxis mode, given by the next non-linear system:
It is taken from Murray's book: equation (11.30) at pag. 408
$$\frac{\partial n}{\partial t} = D \frac{\partial^2 n}{\partial ...
2
votes
1
answer
141
views
Solving the PDE $\partial_t u = \partial_x (u^2 \partial_xu)$
I'm trying to use Mathematica to solve the following equation $$\partial_t u = \partial_x (u^2 \partial_xu)$$ with $$u(0,t)=u(1,t)=0$$ and $$u_0(x)=\sin(\pi x)$$ in order to check a numerical method I ...
0
votes
0
answers
101
views
ItoProcess with WhiteNoiseProcess
Is there a way to use ItoProcess with a white noise process, instead of the usual WienerProcess? If I just naively use ...
2
votes
2
answers
271
views
How to solve Nonlinear coupled ODEs using DSolve
I cannot solve such a system of coupled ODEs in MMA 12.1 using DSolve.
i.e. output is equal to the input equations ... (see the attached figure)
Here, each solution is labeled according to the name of ...
5
votes
1
answer
448
views
1-D PDE with nonlinear ODE as boundary condition
Recently, I am trying to solve a 1-D PDE with a nonlinear boundary condition using the function NDSolveValue. However, it seems that MMA (12) cannot solve it directly with some computational issues.
...
3
votes
0
answers
348
views
Problem computing a cylindrical Heat equation with a parameter alpha
i have been struggling to compute a particular instance of cylindrical 3D heat equation.
Here is my code :
...
1
vote
2
answers
2k
views
Finite difference method for 1D wave equation
I want to solve the following 1D wave equation:
utt = uxx with t > 0, 0 <= x <= 5 and ...
1
vote
1
answer
1k
views
Finite difference method for 1D heat equation
I have solve the following 1D heat equation: ut=uxx, t>0,0<=x<=5, with ic=u(x,0)=x^2, and bcs:u(0,t)=2t;u(5,t)=2t+25:
...
0
votes
0
answers
156
views
Problem with definition of boundary problem
My procedure for solving coupled 1 + 1 (spatial + temporal) PDE system:
(Note: I have graphs of the correct solution with which I compare my result. See figure below text.)
1) I determine the ...