Questions tagged [finite-difference-method]

Tag for the usage of "FiniteDifference" Method embedded in NDSolve and implementation of finite difference method (fdm) in mathematica.

Filter by
Sorted by
Tagged with
2
votes
1answer
120 views

Symbolic solution of an iterative system

I am not an expert in Mathematica. I want to keep off from tedious calculation I want to solve (in symbolic sens) this system: $\quad AU^{j+1}+BU^{j}=F^{j}$ where: $*$ ${U}^{j}$ a $(N;1)$ vector $\...
2
votes
1answer
78 views

Error in the solution of PDE with NDsolve and method of lines [closed]

I am trying to solve a system of the partial differential equation with the help of NDSolve and method of lines. Mathematica code for the above-described problem is ...
8
votes
1answer
201 views

Nonlinear elasticity PDE in Mathematica 12

Mathematica 12, Windows 10. I am trying to solve a PDE in one spatial dimension $R$ and time $t$. I need a solution for displacement $r(R,t)$, radial Cauchy stress $T_{RR}(R,t)$, and radial growth $\...
0
votes
0answers
34 views

Getting the form of a recursively defined function [duplicate]

Here is my iterative relationship: ...
1
vote
2answers
78 views

Testing the accuracy of numerically computed derivatives

I am calculating approximate derivatives by using NDSolve`FiniteDifferenceDerivative, so this works: ...
1
vote
0answers
58 views

Noisy numerical finite difference calculated by NDSolve`FiniteDifferenceDerivative [closed]

I met a problem when playing with the numerical difference provided by mathematica. My aim is to test the accuracy of the high-order numerical derivative. The code is below ...
1
vote
1answer
58 views

Elimination of numerical error in initial data

Elimination of numerical error in initial data can be crucial for its subsequent evolution. In the following simple example ...
2
votes
1answer
58 views

TemporalDiscretization in MethodOfLines

When solving ODE's one can use options like MaxStepFraction to control the number of grid points. When solving PDE's ...
0
votes
1answer
119 views

PDE-DirichletCondition needs to be linear

I am trying to solve the following multi-field problem in MMA 12, however, this probelm cannot be solved, i.e., error: DirichletCondition [...] needs to be linear. I attached the code here: <...
2
votes
1answer
204 views

Solving multi-field problems in MMA 11.3

Based on the PDE model proposed by @Schumacher Solving a second order coupled PDE system, the one dimensional multi-field Problem I would like to solve such benchmark test: namely: u(x): ...
1
vote
1answer
124 views

Solving IDE system using FDM based on NDSolve`FiniteDifferenceDerivative

I wanted to solve the following system of integro-differential equations (IDEs) using finite difference method (FDM). $y_1''(t)+t^2y_1(t)-y_2''(t)+\int\limits_0^t[(t-x)y_1(x)+y_2(x)]\mathrm{d}x=(2+t^...
3
votes
0answers
145 views

PDE with strange boundary conditions

What is the right way to solve the following equation from scratch under mathematica: $$\begin{aligned} u_t(t,x)-u_{xx}(t,x)&=f(t,x), &(t,x) &\in (0,1)\times (0,1),\\(u_t(t,x)-u_{x}(t,x))\...
1
vote
1answer
89 views

Solidification Problems in MMA

can we define such intial value and BCs for a solidification problem in MMA using Finite Element: 1.) initial value:=1 for a plate 2.) in this plate we have to define dirichlet bcs for a whole ...
1
vote
1answer
65 views

Random intial conditions using finite element method

How can we define the initial value for Cahn-Hilliard problem (links) using FEM in MMA? Complete test code (I am using MIXED formulation for C1 Problem): ...
18
votes
3answers
387 views

Generate coefficient array from general formula of linear equation system

This is a problem coming out in the implementation of finite difference method (FDM). Here is a toy example. Suppose we want to solve the boundary value problem (BVP) $$y''(x)=\sin(x),\ y(0)=0,\ y(...
6
votes
2answers
227 views

Solving linear coupled PDEs by FDM

I am trying to solve some linear, coupled PDEs for perturbative analysis (first order in time, 3rd order in space), for which I then plan to take the global spatial maxima of their magnitudes and plot ...
4
votes
1answer
318 views

Solution of Burgers equation with some initial data

Consider the Burgers equation $$\partial_t u + \partial_x\left(u^2/2 \right) = 0, \quad u(0, x) = u_0(x).$$ eq = D[u[t, x], t] + D[u[t,x]^2/2, x] == 0 How ...
8
votes
3answers
471 views

New things and limitations in Version 12 numerical differential equation solver?

This question is intended to be a place to summarize users' exemplary experience in solving differential equation with the NDSolve family in MMA’s latest version 12....
6
votes
2answers
510 views

Numerical methods to solve a continuity equation

What numerical methods can be used to study the initial value problem for the continuity equation where $ u = u(t, x) $ $$ u_t + \nabla\cdot(\boldsymbol b u) = 0, \qquad t \in [0,T], \quad x=(x_1,x_2)...
3
votes
2answers
324 views

NDSolve error in 2-D heat equation

I'm trying to solve the following PDE by Mathematica in 2-D case in the unit disk using polar cordinates, where $\Omega$ is a bounded domain of $\mathbb{R}^n$, $\Gamma =\partial \Omega$ is the ...
10
votes
1answer
255 views

FiniteElement v.s. TensorProductGrid: which is reliable for Schrödinger equation with periodic b.c.?

This is a problem comes up in the discussion under this post and I think it's worth starting a new question for it. I suspect the underlying issue is the same as in this post, but not sure. Consider ...
1
vote
1answer
108 views

Solution of differential equation and then draw a graph

I have two differential equations: $da/dt = a (.3 a^{-3} + .7)^{1/2}$ and $d \tau /dt = 1/a$. The initial conditions are $t = 0$; $a = 1$ and $\tau = 0$, respectively. How can I solve the ...
1
vote
1answer
180 views

How can solve this partial differential equation (PDE) and plot?

How can plot and solve this partial differential equation in mathematica? $$ K \frac{\partial^2 T}{\partial x^2}- h (T-T_m) = \frac{\partial T}{\partial t} $$ $ Tm = 25 $ $ k= 47 $ $ h= 1.5 $ ...
8
votes
1answer
442 views

Solve PDEs with finite difference scheme by modifying NDSolve-based solver

Motivation As discussed here, NDSolve uses different difference orders for various spatial derivatives and the implicit design could cause trouble in certain cases....
2
votes
1answer
187 views

Using NIntegrate in Finite Difference Derivative method

I'm trying to solve a second order differential equation using the code given by @xzczd here which is based on this. What this ...
9
votes
1answer
253 views

How to find the differentiation matrix based on FEM?

Assume that I have a non-equidistant grid of $n$ nodes, as follows: ClearAll["Global`*"]; n = 10; SeedRandom[123]; nx = Sort@RandomReal[{-1, 6}, n] If I want to ...
10
votes
2answers
604 views

Stiff BVP of nonlinear ODE, alternative/ enhancement to shooting method

Question: I have been trying to solve this coupled ODE set. \begin{align} ( \frac{ \mu^2}{B} +1 ) \Phi^2 + \frac{1}{A} {\Phi^{\prime 2}} + \frac{1}{2}\lambda \Phi^4 - \frac{A'}{r A^...
5
votes
1answer
149 views

How to control DifferenceOrder in NDEigenvalue for an ODE?

I am trying to solve the eigenvalue problem of a 1st-order ODE system using NDEigenvalue. It should be finite difference method for ODE. And I want to tune the the ...
2
votes
1answer
160 views

Oscillations on solution of finite difference equation

In a previous post on the solution of an ODE with a boundary conditon at infinty I had some excelent help from xzczd and am now returning with a further problem along the same lines. I have used the ...
1
vote
1answer
101 views

How to invert Differences[list, order] with order >1?

Differences order 1 can be invert using FoldList[], but does not work with higher orders. For Example ...
4
votes
1answer
568 views

Schemes for nonlinear advection equation

I am working in the traffic flow problem using the Lighthill-Whitham-Richards model together with the Greenshields equation. The equation of that model is this: $$ \frac{\partial\rho}{\partial t}+v_{...
3
votes
2answers
326 views

Why ODE's naive finite difference matrix works well for different boundary conditions

We know finite difference method (FDM) can replace $y''(x)$ as $\frac{1}{h^2}[y(x+h)+y(x-h)-2y(x)]$ or so. The naive way to write down the matrix of the differential operator is like the following, ...
2
votes
0answers
471 views

Derivative of list of points: DifferentiatorFilter versus DerivativeFilter

I need to calculate the derivative from a list of experimental points. Mathematica has two functions which seem to do this: DifferentiatorFilter and DerivativeFilter. Which one is better for ...
1
vote
0answers
68 views

Optimizing finding the offset diagonals for a 2D Finite Difference Method

It is possible to collapse a conventional 2D PDE (in our case the Schrödinger equation) into one dimension by having each set of points be taken as a one dimensional list of $n$ lattice points and the ...
2
votes
1answer
304 views

2D inhomogeneous biharmonic equation with wedged edge

I'm solving bending of rectangular plate while, boundary conditions are I have found similar problem solved: datavoreconsulting.com/programming-tips/numerically-solving-pdes-mathematica-finite-...
3
votes
0answers
541 views

NDSolve`FiniteDifferenceDerivative how does it work? [closed]

I'm referring to Paritosh Mokhasi's blog post, where he uses, along with some other things, the...let's call it a function (?)... NDSolve`FiniteDifferenceDerivative. I was able to use it exactly the ...
2
votes
0answers
224 views

Solving nonlinear diffusion equation by NDSolve

I have checked all issues regarding to solving nonlinear PDE numerically. I however try to solve following equation via NDSolve function and get some troubles. And this is my code for above-...
1
vote
2answers
218 views

NDSolve problem

I am trying to solve numerically this differential equation s := NDSolve[{y''[x] + ω[x]*y[x] - 1/(y[x])^3 == 0, y[0] == 1, y'[0] == 0.3}, y, {x, 0, 10}] where <...
1
vote
1answer
170 views

Eigenvalues of 3D Laplacian on a spherical segment

To study the change in Laplacian eigenvalues on a spherical segment, I constructed a table of spherical segments using the code from here. I discretized the output using ...
3
votes
0answers
144 views

Coupled parabolic differential equations with time delay

Is it possible for NDSolve to solve delay partial differential equations with simple Neumann boundary conditions? An example I have is as below: ...
5
votes
1answer
645 views

Heat equation with nonlinear boundary condition involving time-derivative

The governing equation is shown as follows: I first try to employ the NDSolve, but it seems that Mathematica can not handle the fourth boundary condition. ...
7
votes
3answers
358 views

What is the best way to track the gradient to a local minimum?

Given a function of multiple variables, and some initial conditions, I would like an efficient way to track the gradient to the local minimum of that function. Two options spring to mind — to either ...
0
votes
0answers
326 views

Poisson equation with numerical right hand side

I run into the following problem. Linear Poisson equation works OK, eg, ...
4
votes
1answer
316 views

Laplace equation in a gapped rectangular domain with finite difference method

I have a situation that is shown by this picture: For this situation I have this code. ...
7
votes
1answer
702 views

Free Convective Heat Transfer of Non-Newtonian Power Law Fluids from a Vertical Plate

I am trying to solve a set of PDEs mentioned in this paper with NDSolve but facing quite a few issues. The PDE system is: ...
2
votes
0answers
439 views

Robin conditions using Finite Difference [closed]

I'm trying to solve the drift-diffusion equation $$\frac{\partial\rho}{\partial t} = \frac{\partial^2 \rho}{\partial x^2} + \frac{\partial \rho}{\partial x} \rho(x,t)$$ using a finite difference ...
0
votes
1answer
230 views

Why do I get this nonsensical result for NDSolve with a delay-differential-algebraic system?

I have the following delay-differential-algebraic system: \begin{align} c(t) =& \kappa\min (1, \tfrac{\beta}{\alpha} a(t)), \tag{1a}\\ a(t) =& \left\{ \begin{array}{lcl} \frac{\alpha}{\...
1
vote
0answers
304 views

FDM - Fluid Flow tutorial

I was reading a very nice post: http://blog.wolfram.com/2013/07/09/using-mathematica-to-simulate-and-visualize-fluid-flow-in-a-box/ But i am stuck for hours at the point where the author writes: <...
1
vote
0answers
164 views

Solving lengthy higher order pde using finite difference

I am attempting to solve a very massive pde (latex expression given below). I have done some work with finite difference before for relatively simple equations (like heat diffusion or the wave ...
7
votes
2answers
529 views

Updating a parameter each time step within a Finite Difference scheme?

So I am solving a PDE for a function $h(\theta,t)$ via finite difference scheme. The PDE has a function $Q$ in it, which I wish to update each time step depending on where $h$ lies. Firstly, let us ...