Questions tagged [finite-difference-method]
Tag for the usage of "FiniteDifference" Method embedded in NDSolve and implementation of finite difference method (fdm) in mathematica.
152 questions
0
votes
0
answers
158
views
Performance of solving time-fractional convection in a square cavity using finite-difference method
Here we give three tests for the problem of natural convection of air in a rectangular cavity with a Rayleigh number of $Ra=10^4$ and with the time-fractional derivative $\partial_t^{\alpha}$ in the ...
2
votes
1
answer
224
views
Generate a Table for the Onset of Period Doubling for the Sine Map
Below is my Mathematica code to generate the bifurcation diagram of the sine map x_n+1 = rsin(Pix_n) or in this form f(x) = rsin(Pix). (How to isolate the bifurcation points from the sine map's ...
5
votes
2
answers
770
views
IBVP of PDE system deduced from Kirchhoff's rod theory
I am trying to solve the following system of nonlinear PDEs in Mathematica, but I'm encountering difficulties, particularly with defining the initial conditions. Here's the system I am working with:
$$...
0
votes
0
answers
70
views
How to Implement a Free-Boundary Condition on a PDE while still using the Wolfram PDE framework
Standard PDE Discretisation Schema
In order to explain my question, I introduce the context below. Let
$t_i \in \{t_{min}, ..., t_{max}\}$ where $\Delta t = \frac{t_{max}-t_{min}}{m}$
$y_j \in \{y_{...
2
votes
0
answers
76
views
pdetoode for heat equation with Neumman bc without NeumannValue
I want to try pdetoode for solving a heat equation with Neumman bc without using NeumannValue. I modified this code:
...
3
votes
0
answers
98
views
How to use splitting for PDE in NDSolve
I'm studying PDEs that have blowup solutions, such as $$ \frac{\partial u(t,x)}{\partial t} = \Delta u(t,x) + u(t,x)^2 $$ with u=1 on the boundaries and as the initial condition at $t=0$. On a grid ...
7
votes
3
answers
1k
views
Numerical solution of Burgers' equation
I am trying to solve Burgers' equation
$$\frac{\partial u}{\partial t}+u\frac{\partial u}{\partial x}-\frac{1}{100\pi}\frac{\partial^2u}{\partial x^2}=0$$
subject to conditions $u(x,0)=-\sin(\pi x)$ ...
1
vote
1
answer
309
views
Numerical solution for SHE?
I have solved the Swift–Hohenberg equation
...
1
vote
1
answer
351
views
Solving a 6th-Order PDE Numerically?
I try to solve f(x,t) numerically.
Actually, this figure obtained employing pathlength continuation techniques as bundled in auto07p (or more modern pde2path) by Matlab
So any help to NDSolve by ...
2
votes
0
answers
184
views
2D differentiation matrix
NDSolve`FiniteDifferenceDerivative is a very helpful function to calculate numerical derivatives. It is explained in the tutorial The Numerical Method of Lines in ...
6
votes
0
answers
134
views
Bathtub vortex simulation with Mathematica FEM
Bathtub vortex is well known phenomena that can be simulated with numerical methods like FDM described here and FEM described in our paper here. Let consider bath with 2 inlets and one outlet in a ...
1
vote
0
answers
206
views
Nonlinear PDE with a dynamical parameter
I am trying to solve fourth order partial differential equation describing a fluid problem, by using Mathematica. The PDE is provided here as:
$V_{\eta\eta t}=\frac{1}{H}(2\dot H V_{\eta\eta} +\eta\...
8
votes
2
answers
638
views
Boundary condition for heat equation in polar coordinates deduced with L'Hôpital's rule fails for method of lines, but works well for FDM
Update
I manage to find a way that resolves the problem. I'd like not to make this solution public for the moment so other answerers will have more chance to get the bounty. Here's a hint: it's a ...
4
votes
0
answers
244
views
Face-based discrete directional derivative on triangular mesh
For a scalar function $f$ defined on the faces of a triangulated surface $M$, and a vector field $\mathbf{F}$ on its tangent space, is there a built-in or simple way to get the derivative of $f$ in ...
4
votes
0
answers
206
views
Issues in Reproducing Rippling Instability of Graphene using Mathematica from Physical Review B 101, 235428 (2020)
I'm attempting to reproduce the numerical model of the rippling instability of graphene as described in the paper "Physical Review B 101, 235428 (2020)" using Mathematica. Specifically, I'm ...
2
votes
1
answer
225
views
Solving a large number of coupled non-linear equations
I would like to numerically have a solution of the Gross-Pitaevskii equation for an impurity coupled with a 1D weakly interacting bosonic bath, given by:
\begin{align}
i\frac{\partial \phi_0(x,t)}{\...
0
votes
0
answers
186
views
Reaction diffusion equation
I have an issue when I run this code which illustrates the 2D Fisher KPP equation for boundary condition u=0 and initial condition is equal to 1 if (x,y)=(0,0) and0 otherwise , isue finite diffrence ...
1
vote
0
answers
103
views
How to constrain two PDE variables to be the same value on boundary?
I have a 4 pdes for 4 variables: v, v2, ua, and p. I would like to specify that v==v2 on the left and right boundaries at all times. Here are the equations:
I discretise the system using PDEtoODE. ...
2
votes
1
answer
384
views
Finite difference method in 2D [closed]
We look for $u(x, y, t)$ satisfying
$$
\frac{\partial u}{\partial t}=\lambda_1 \frac{\partial^2 u}{\partial x^2}+\lambda_2 \frac{\partial^2 u}{\partial y^2}+\mu u(1-u), \quad t>0, \quad(x, y) \in \...
0
votes
0
answers
81
views
Solving system of coupled pdes with Neuman and Drichlet Bc
I am trying to solve a system of coupled PDEs. However, I have issues assigning initial and boundary values to the unknown field. I have checked and initial values satisfy the boundary conditions, and ...
0
votes
1
answer
259
views
Solving coupled quasi-linear PDEs with boundary conditions
I realized that in this solution, changing one of the boundary conditions makes the answer invalid. I wonder if it is possible to modify the code in this answer to solve the following equations.
$$ \...
6
votes
1
answer
293
views
How do I couple an 1D PDE to a 2D Laplace equation?
Recently I've come across the following system governing the spreading of an evaporating droplet. The height of the droplet $h$ is defined by the following equation
$$\frac{\partial h}{\partial t}=-\...
3
votes
1
answer
233
views
Problem with calculation of Lyapunov exponent
The code given by Chris K for Lyapunov Exponent does not work and gives lot of errors for the dynamical system given in equation(2) of this paper
The dynamical equations:
...
4
votes
1
answer
201
views
Numerical Solution for a Non-Linear Functional Fractional Differential Equation (FFDE)
I tried solve non-linear Functional-Fractional Differential Equation (FFDE) with this method, but it works on only for range: $x\in \{0,1\}$.
I what extend the solution range for example for general ...
4
votes
1
answer
397
views
Two-directional vibration of Euler–Bernoulli beam with Lagrange multiplier
Background
I'm going to investigate a beam-pendulum coupling system (in this question I won't consider the pendulum though), that is, a spherical pendulum is suspended on the tip of a cantilever beam. ...
7
votes
2
answers
495
views
How to improve FDM solver for unsteady viscous flow?
To solve the problem that is discussed in the paper Finite Difference Analysis of Time-Dependent Viscous Nanofluid Flow Between Parallel Plates we developed FDM solver based on the code from the blog ...
2
votes
1
answer
194
views
Method of lines - Dirichlet and mixed BC
I have a dissolution problem to solve with two equations (everything is in dimensionless form - concentration, time and distance - EDIT: that came from the second Fick's law, where the distance was ...
2
votes
2
answers
319
views
Badly conditioned matrix for boundary ODE
I have a coupled boundary ODE with dependent variables $u=u(x)$ and $z=z(x)$,
$$u'' - \frac{1}{z} \left( -3 + u'^2 (3 - c\; e^{-g u} z^4) - 6 u' z' \right) = 0\tag{1}$$
$$z'' + c\; e^{-g u} z^3 (-3 + ...
2
votes
0
answers
240
views
Problem with pdetoode for two coupled PDEs
I tried to adapt a code for a single equation to solve the following system using 'pdetoode'
Updated answer
...
3
votes
1
answer
341
views
Numerical solution of the Richards' equation
I am trying to solve Richards' equation to model fluid flow in soil. The governing partial differential equation, initial condition, and boundary conditions are:
The analytical solution of the problem ...
0
votes
3
answers
183
views
Generalize the code to more variables
I have this code it runs and gives me the solution. How can I make it more compact and If I want it to extend(generalize) it to more variables how can I do it. I had asked a similar question here
(...
5
votes
2
answers
339
views
Crafting a replacement rule to convert derivatives to finite differences
I need to construct a replacement rule to replace (first) derivatives with centered finite differences. What I've got so far is
...
1
vote
1
answer
329
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 ...
6
votes
1
answer
2k
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
372
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
106
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
498
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
235
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 ...
4
votes
1
answer
177
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
269
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 ...
4
votes
1
answer
430
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
341
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
297
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
419
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
112
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
1k
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
89
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
592
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
84
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
225
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 ...