Skip to main content

All Questions

Filter by
Sorted by
Tagged with
6 votes
2 answers
437 views

Time integration of first-order ODE with higher-order information

Suppose I wish to derive a numerical integrator for the first-order ODE $$x'(t)=F(x(t)).$$ By differentiating both sides of the expression in $t$, I can write a second-order relation also satisfied ...
1 vote
1 answer
123 views

Solving TOV equations that describes neutron stars in modified f(R, T) gravity

Sorry for the long post, tldr at bottom. I'm trying to use standard RK4 code in C/C++ to solve a coupled system of 2 modified TOV equations in f(R,T) gravity and reproduce some of the results of this ...
1 vote
1 answer
256 views

Coupled Partial Differential Equations

I'm trying to solve the following system of coupled differential equations, the two-temperature model for $e$ = electrons and $l$ = lattice. $$ \rho_{e}C_{p,e}\frac{\partial T_{e}}{\partial t} = k_{e}\...
0 votes
0 answers
38 views

Finite differences stability issue for PDE

Lets say I have the following centered space (x, first index) forward time (t, second index) scheme for a coupled system of partial DEs: $$u[j, k+1] = u[j, k] - \frac{\Delta t} {2 \cdot \Delta x} \...
1 vote
1 answer
101 views

Moving least square method in finite volume method

Consider a differntial equation like : $\nabla .(\nabla u)=cte$, using finite volume method we can write $\int\nabla .(\nabla u) dv =\int n.(\nabla u) dA $. Here we want to use the moving least square ...
1 vote
0 answers
45 views

On reproducing the Poincare section figure in a paper by Sato, Akiyama and Doyne Farmer

This is a repost of a question I posted on MathOverflow, but was suggested to post here due to relevance. I am trying to reproduce Figure 1 in the paper "Chaos in learning a simple two-person ...
0 votes
0 answers
128 views

Heat Equation for fast source with FiPy

I'm trying to solve the following differential equation with FiPy, basically laser irradiation on a surface $$ \rho_{s}C_{p,s}\frac{\partial T}{\partial t} = k_{s}\frac{\partial^{2}T}{\partial x^{2}} +...
2 votes
0 answers
71 views

Can I change the coordinates of the problem to avoid dynamic mesh?

I am looking to simulate the velocity field of a fluid around a fish. Fortunately, some analytical functions have been derived for specific cases (e.g., A Generalized Slender-Body Theory for Fish-Like ...
4 votes
1 answer
185 views

Why do different ODE solvers give very different solutions to this problem?

I want to simulate the system defined by the following ordinary differential equations with periodic boundary conditions with $N$ lattice sites \begin{equation} i\frac{d}{dt}\phi_n = (1 + |\phi_n|^2)\...
10 votes
3 answers
2k views

Numerical integration of ODEs: Why does higher accuracy and precision not lead to convergence?

I'm trying to integrate numerically a non-linear ODE that, on paper, is simple (just the damped, forced pendulum), but that, as well known, its dynamics displays a chaotic behavior and is very ...
3 votes
0 answers
70 views

Numerical integration of ODEs: Why does higher accuracy and precision not lead to convergence? [duplicate]

I'm trying to integrate numerically a non-linear ODE that, on paper, is simple (just the damped, forced pendulum), but that, as well known, its dynamics displays a chaotic behavior and is very ...
0 votes
0 answers
38 views

Thermo Hydraulic Mechanical modeling of energy wall slab in Comsol multiphysics

I am currently working on a complex simulation project involving an energy wall slab, and I need assistance in accurately modeling and validating it using COMSOL Multiphysics. Here are the details of ...
1 vote
1 answer
65 views

How to solve three coupled differential equations in python using RK-4 and shooting method? or using solve_bvp?

I am trying to solve three coupled differential equations in Python. I am using RK-4 techniques with Shooting method. I am trying to plot the f and N functions. ...
3 votes
0 answers
53 views

Datasets for inverse heat transfer problems

I was wondering if there is an available, real-life known inverse heat transfer problem dataset to benchmark oneselfs algorithm, as in MNIST for deep learning. Talking about... (well in this case I ...
1 vote
0 answers
50 views

How can I apply a mixed boundary condition to a multi-material heat transfer problem using Crank-Nicolson?

I am working on a mixed material model for a melting material and need to enforce both a Dirichlet and Neumann type condition at the interface. Subject to an external surface heat flux at the top of ...
2 votes
1 answer
218 views

Using Sundials CVODE in MATLAB

I'm currently using ode15s to solve a set of stiff differential equations. I am trying to use the MATLAB profiler to understand the section of the ode solver code which calls BLAS routines. Since the ...
1 vote
1 answer
290 views

Numerically solving the Advection-diffusion equation with no-flux boundary condition leads to violation of mass conservation

I am trying to solve numerically the advection-diffusion equation of the following form $$\frac{\partial C}{\partial t}=\alpha\frac{\partial^2 C}{\partial x^2}+\beta \frac{\partial C}{\partial x}$$ ...
13 votes
2 answers
8k views

Numerical computation of Lyapunov exponent

I'm trying to compute the Lyapunov exponent for a smooth continuous time dynamical system(say, $\dot{\bar{x}} = f(\bar x)$). I using the QR decomposition method. Here are the steps that I follow. ...
3 votes
0 answers
156 views

Galerkin Method - Why does integration-by-parts eliminate need to enforce Neumann boundaries?

I've posted this to MathStackexchange but I figured I'd also post here as well as I have yet to receive an answer on my original post, and that I would be more likely to encounter users of the ...
1 vote
2 answers
121 views

How to handle non bilinear weak form?

I solved the 2D heat equation using the finite element method. It all went well first with the adiabatic case, however problems occured when I introduced cooling with the enviroment. I modeled the ...
1 vote
1 answer
134 views

Can I combine the backward and forward euler methods - simialr to modified euler method?

Constructing Modified Euler Using the same strategy as done in the construction of Modified Euler. Starting from Trapezoidal Method $$y_1 = y_0 + \dfrac{h}{2}\left(f(x_0,y_0) + f(x_1,y_1)\right)$$ ...
0 votes
0 answers
29 views

Help in solving Quintessential scalar field using Steep Potential in cosmology

I am attempting to solve the differential equation $\ddot\phi + 3H\dot\phi + \dfrac{dV}{d\phi} = 0.$ For $V(\phi) = V_{0}e^{-\lambda\phi}$, where $V_{0} = 0.7$, $\lambda = 0.1$ and $V'(\phi) = \dfrac{...
1 vote
1 answer
112 views

Numerical method for space fractional derivative in 1 dimension

I am very new to the subject of fractional derivatives which arise while characterizing the anomalous transport of passive scalar in turbulence. I have found an equation of the following form, to ...
0 votes
0 answers
72 views

Solving coupled 2nd-order differential equation

I would appreciate it if you could help me solve the following coupled equation numerically $$ [-\frac{1}{2} \partial_r^2 + v_0(r) -E]\psi_{\ell} + v_1(r) \psi_{1-\ell}(r) = 0, $$ where $\ell = 0 , 1$ ...
0 votes
0 answers
88 views

Unable to solve numerically this system of differential equation

I'm trying to obtain the graph of x(y) from the following system : Therefore I tried to solve this system using an Euler Method : ...
1 vote
1 answer
210 views

Best finite difference scheme in 2D for the mixed derivative

The are good methods to deduce finite difference schemes for derivatives of functions of one variable. But how to get a good one for the mixed derivative of a function of two variables $u=u(x,y)$, ...
1 vote
0 answers
126 views

How to vectorise numerical differentiation

I have a 2-D matrix with 2 spatial coordinates and I want to be able to vectorise the process of numerically differentiating with respect to its 2 coordinates, rather than just looping along the rows ...
2 votes
1 answer
213 views

Numerical calculation of Lyapunov exponents using SciPy's built-in solve_ivp

I have previously successfully implemented the QR decomposition method in MATLAB to calculate Lyapunov exponents for Lorenz equations. See here. This method integrates the stacked system, i.e. the ...
2 votes
1 answer
411 views

Where am I making a mistake in solving the heat equation using the spectral method (Chebyshev's differentiation matrix)?

I would like to numerically solve the following heat equation problem: $$ u_t = \Bigg(2{a \over l}\Bigg)^2 u_{xx} \tag 1$$ $$ x \in [ -1, 1 ] \tag 2$$ $$ u(x, 0) = 0 \tag 3$$ $$ u(1, t) = A \sin \Bigg(...
1 vote
1 answer
143 views

Step size constraint in Euler backward

I am dealing with an assignment in MATLAB. It has to do with 'self-driving' cars which are driving in-front/behind eachother. Assuming M cars on a single-lane road, each car adjusts its speed based on ...
1 vote
1 answer
225 views

Differential equation for radioactive cooling in fortran

Today I'm trying to evaluate this differential equation for internal energy in a gas in Fortran: $$ \frac{du}{dt} = - \frac{n_H^2}{\rho}\frac{\Lambda}{n_H^2} $$ Where nH is the density of hydrogen in ...
1 vote
0 answers
47 views

Implementation of operator splitting method for Wigner equation

I am dealing with the integro-differential equation for Wigner function, $$\frac{\partial f}{\partial t}+p\frac{\partial f}{\partial x}+\\+\frac{1}{\chi}\left\{\int_{-\pi}^{+\pi}dy\,\int_{-\infty}^{+\...
1 vote
0 answers
155 views

FEM for nonlinear first-order ODE

Currently I am trying to solve nonlinear Ricatti equation using FEM (Matlab language): $$\frac{d r(z)}{dz} = i k(z) r(z) + \frac{i k(z)}{2}(\epsilon(z) - 1)(1 + r(z))^2$$ $z = [-h/2, h/2]$ and $r(-h/2)...
1 vote
2 answers
141 views

Is there any way to reduce an RK4 method's dependence on step size?

I am working in the sphere of orbital simulations, where orbital trajectories are computed using the differential equations describing gravity. Due to the great timescales of orbits, a step size of ...
1 vote
1 answer
72 views

Why does a two-body simulation result in no change of the y-component?

I've been attempting to create a model of a heliocentric orbit based on Newton's law of gravitation: $$ \frac{d^2 \vec r}{dt^2} = -\frac{GM}{|r|^2} \hat r $$ This is what I have so far: ...
3 votes
2 answers
928 views

Python bifurcation diagram of seasonally forced epidemiological models

TL:DR How can one implement a bifurcation diagram of a seasonally forced epidemiological model such as SEIR (susceptible, exposed, infected, recovered) in Python? I already know how to implement the ...
2 votes
2 answers
979 views

Numerical implementation of ODE differs largely from analytical solution

I am trying to solve the ODE of a free fall including air resistance. I therefore defined my ODE as: def f(v, g, k, m): return g - k/m * v**2 which in my ...
4 votes
1 answer
687 views

Is my differential equation solving code wrong?

I am trying to simulate LLG equation without damping. The equation is $$\frac{d\vec{m}}{dt} = \vec{m}\times\vec{H}$$ I am solving in spherical coordinates as LLG equation is known to have problems in ...
1 vote
0 answers
39 views

How does the time needed for force propagation increase with the discretization (using symplectic Euler schemes)?

I am trying to model a physical system by (lets say the system is a long deformable object, on which I can apply forces). It can be described by Cosserat Rod theory and discretized, by modelling it ...
0 votes
1 answer
110 views

Computing discrete laplacian matrix for mesh fairing

I asked this question on the math stack exchange and got an answer, but I am just as utterly confused as before. My fundamental goal is to actually construct the matrix, that is, a series of steps I ...
2 votes
2 answers
2k views

Problems solving 2D heat equation using physics-informed neural networks

I am trying to solve 2D heat equation using the physics-informed neural networks approach. The training loss is decreasing, but my final network outputs make no sense. I am using Python/Pytorch. 2D ...
3 votes
1 answer
231 views

First derivative central differences with reflecting boundary conditions

I have the following problem in 1-D: \begin{equation} \partial_t u(t,x) = v(x)\partial_x u(t,x) + \kappa(x) \partial_{xx} u(t,x),\,x\in\Omega;\quad \partial_{\nu}u(t,x) = 0, \,x\in\partial\Omega. \end{...
1 vote
0 answers
79 views

Solving perturbed Einstein Boltzmann equations using RK4

I'm trying to learn to numerically solve the perturbed Boltzmann-Einstein equations in cosmology using the RK4 method. These are the equations: $$\dot{\Theta}_{r,0}+k\Theta_{r,1}=-\dot{\Phi}$$ $$\dot{\...
1 vote
1 answer
314 views

Euler's Method for fast moving particle trajectory

I'm trying to figure out how a magnet affects the trajectory of a particle travelling near the speed of light downwards toward the ground. The equation for the force of the magnetic field is pretty ...
0 votes
0 answers
61 views

Algorithm for 1-dimensional minimal surfaces

Consider a set of points. For simplicity, let's say that those are 2D points (although the problem works in higher dimensions as well). The goal is to find the minimum possible length of a connected 1-...
0 votes
0 answers
108 views

What is the difference between approximations of mixed derivative and how to implement it

currently I am solving 2D nonlinear second order differential equation containing mixed derivative. I started searching how to descretisize it and found two formulas for 4th order approximation. First ...
1 vote
1 answer
339 views

Why does scipy Conjugate Gradient solver fail to converge for non-steady heat equation using Crank-Nicolson method

Could someone please explain why my implementation of the Crank-Nicolson method applied to the non-steady heat equation won't converge? There shouldn't be any nonlinear aspects to my implementation ...
3 votes
3 answers
795 views

Is there a Python version of the ODE tool pplane?

This is the same question as this one, except for Python instead of Mathematica. Basically, the MATLAB software PPLANE is a staple in ODE courses. Is there a Python equivalent? I don't know much about ...
2 votes
2 answers
557 views

Solving IVP backward in time via python

I'm having difficulty solving an initial value problem (IVP) in Python backwards in time. The code is at the end of this post. First, please let me state my simplified problem. The forward IVP is ...
0 votes
1 answer
489 views

computing Lyapunov exponents numerically

I am trying to compute numerically the Lyapunov exponents of an ODE. I follow the method described in Parker, Chua "Practical Numerical Algorithms for Chaotic systems" There is also relevant ...

1
2 3 4 5 6