Questions tagged [numerics]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

Comparison of convection time - theoretical value vs computed

This is a follow up to my previous post here, I'm solving for convection in 1D $$\frac{\partial C}{\partial t} = - v\frac{\partial C}{\partial x}$$ The discretization of the above equation is ...
0
votes
0answers
29 views

Numerically solving nonlinear parabolic stochastic PDEs

For a project I'm doing, I have to numerically solve a nonlinear parabolic stochastic partial differential equation, of the form $$ u_t = u_{xx} + f(u)(u_x)^2 + a(u) + b(u)W(t, x), $$ where primes ...
1
vote
0answers
38 views

Unsteady diffusion equation with spatial finite elements and Forward Euler in time

I have solved the unsteady diffusion equation using piece-wise linear Finite elements(triangles) for spatial discretisation and Forward Euler for temporal discretisation. I have the following mesh ...
4
votes
1answer
70 views

Parareal for particle simulations

Recently I have stumbled upon this video of M. J. Gander https://www.youtube.com/watch?v=dn5vqN8ezuE and the coresponding notes that he wrote on Time Parallel Time Integration and I find it a quite ...
0
votes
1answer
75 views

Question on comparing the accuracy of numerical schemes

This is a follow up to my previous post here I'm solving the following 1D transport equation . $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$...
-1
votes
0answers
37 views

Tsit5 implementation is super slow and too accurate

I have implemented Tsitouras 5(4) integrator in Python but it is sooo slow and too accurate compared to the tolerance I have set. How do I know it is slow? Because I did also implement Dormand-Prince ...
2
votes
1answer
100 views

Question on how MATLAB's pdepe solver works

I'm solving the following 1D transport equation in MATLAB's pdepe solver. $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$ At the inlet (left ...
4
votes
2answers
111 views

Effect of mesh size on solution curves for a 1D problem

I'm interested in studying the effect of mesh size on the behavior of the solution curves of 1D convection-diffusion problem. $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2} - ...
0
votes
0answers
37 views

Finite difference solution to cylindrical heat equation [closed]

I wish to solve the following PDE: $$\theta\frac{\partial T}{\partial t}=\frac{\kappa}{r}\frac{\partial}{\partial r}\left( r\frac{\partial T}{\partial r}\right)+\dot{Q}$$ With boundary/initial data: $...
2
votes
1answer
91 views

Slope limiting for discontinuous Galerkin (DG) method

I had a question regarding the implementation of the TVB limiter for the RKDG method by Cockburn. I have seen that some implementations of the DG method use normalized Legendre polynomials such that ...
1
vote
0answers
54 views

Conjugacy in Non-linear Conjugate Gradient Descent

In linear conjugate gradient method, our goal is to solve the system of linear equations $$Ax = b$$ where A is a symmetric positive definite matrix, and that is equivalent to finding the minimizer of ...
1
vote
1answer
32 views

How to compute the mean 2D slice of a 3D set of data in MPI

I have a 3D set of data v(i,j,k), and I want to compute the mean 2D slice vmean(i,j) summing up the ...
1
vote
0answers
53 views

How to minimize a integral function using a constant step gradient method in Python?

I am developing a practical work of the following system of ode \begin{align}x'(t) &= k_1h(t) - (k_2+k_3)x(t)\\ y'(t) &= k_3x(t)\end{align} and $z(t) = (1-k_4)(x(t)+y(t))+k_4h(t)$, where $h(...
3
votes
1answer
172 views

log-sum-exp trick for signed/complex numbers

I need to evaluate a sum of values that are on many different orders of magnitude in scale but might be signed. I’ve had great luck with the “log-sum-exp” trick for an unsigned version of my problem, ...
2
votes
0answers
21 views

2-dimensional Gauss-Hermite quadrature in R

A similar question was asked here and the given answer is perfect for a unidimensional integration. I need to make bidimensional integration in R with a Gauss-Hermite quadrature: $$\int_{R^2} h(p1,p2)...
0
votes
0answers
61 views

A name for a numerical phenomena when using numerical methods

I have a nonlinear solver for equation $g= c_1f(x_1,y_1)+c_2f(x_2,y_2)$. Note that $c_1$ is much bigger than $c_2$. So after using Levenberg–Marquardt algorithm, I could only get $x_1$, $y_1$ and $...
1
vote
1answer
56 views

Type of Rosenbrock method by its coefficients

A Fortran code that solves stiff PDE systems contains the following arrays of Rosenbrock-Wanner method coefficients: ...
7
votes
1answer
165 views

evaluating $\coth(x) - 1/x$ for real $x$, on 2 “pieces”

The function $\coth(x) - 1/x$ has a removable singularity at 0. Its Taylor series is: $$ \coth(x) - 1/x = \frac{x}{3} - \frac{x^3}{45} + \frac{2x^5}{945} + \ldots $$ I would like to evaluate the ...
2
votes
1answer
52 views

pdepe or Crank-Nicolson? How much is pdepe good?

I am beginner in MATLAB and similar. I sow and discussed with my professors doing simulations some times: they wrote down a lot of calculus, most of them using Crank-Nicolson Method and so implement ...
0
votes
0answers
64 views

Comparison of diffusion time - theoretical value vs computed

This is a follow up to my previous post I've been trying to compare the diffusion time obtained from theoretical derivation(answered in my previous post) and what is obtained computationally, for a ...
2
votes
1answer
120 views

mesh dependence of numerical adjoint solution

I am solving the steady, two-dimensional adjoint Euler equations, $$A_x^T \partial_x \Psi + A_y^T \partial_y \Psi = 0$$, where $A_x = \partial F_x/\partial U$ and $A_y= \partial F_y/\partial U$ are ...
0
votes
2answers
178 views

What are the most important theorems in computational science? [closed]

I was reading the book: The Finite Element Method: Theory, Implementation, and Applications by Mats Larson and Fredrik Bengzon, in page 140 of this book they say this: "The Lax-Milgram Lemma is one ...
2
votes
0answers
34 views

How to account for a corner node with zero-flux condition at an extrapolated distance

I am trying to implement a numerical solver and am having troubles dealing with boundary conditions, especially in the corners. I have a 2D mesh, and on the left I have a Dirichlet condition, on the ...
14
votes
1answer
983 views

Conserving Energy in Physics Simulation with imperfect Numerical Solver

I am creating a C++ Physics Simulation where I need to move an rigid body through an acting force field. Problem: simulation does not conserve energy. Quesiton: abstractly, how is conservation of ...
2
votes
0answers
31 views

Computing convolution of two characteristic function over a 1D Cartesian mesh

I am trying to compute the convolution of two characteristic functions over a Cartesian mesh. First, I define my Cartesian mesh of the interval $[0,1]$ as follows $$ x_{i} = i \Delta x, i = 0, 1, 2\...
0
votes
0answers
138 views

Ising model simulation offset critical temperature and interal ernergy

I'm writing a code for the Ising model using WHAM (the weighted histogram analysis method),But it seems to produce critical temperature and internal energy wrong. (newest rewritten code is below) <...
1
vote
0answers
53 views

Stably solve transport equation with source term

I am trying to solve a transport equation of the form for the variable $\psi(t,r)$ \begin{equation} \partial_t\psi-\alpha(r)\partial_r\psi-\beta(r)^2\psi-f(t,r)=0 , \end{equation} where I am solving ...
0
votes
1answer
85 views

Solution of thermal analysis using finite element

I want to solve a thermal analysis using finite elements. The governing equation is $$C \frac{dT}{dt}+K T = Q$$. When using backward differencing for time, the resulting equation is quite straight ...
4
votes
1answer
84 views

Modelling flow through pipe networks

I'm trying to educate myself on modelling solute flows through pipe networks. This is a follow up of my previous post here $$\frac{\partial C}{\partial t} = - v\frac{\partial C}{\partial x}$$ While ...
2
votes
1answer
85 views

Does mass balance hold in convective diffusion

I'm trying to understand how convection-diffusion equations are solved in pipe flow modules available in CFD solvers. $$ \frac{\partial C}{\partial t} + \nabla \cdot (\mathbf{v} C) = \nabla \cdot (D \...
0
votes
1answer
71 views

Solving differential equation in Python with discretized variable coefficients

I am trying to solve a differential equation with discretized variable coefficients which are calculated from a time serie. In this case the Runge-Kutta step size is fixed by the frequency in the time ...
3
votes
0answers
65 views

Numerical integration with singularity term

In https://www.johndcook.com/blog/2012/02/21/care-and-treatment-of-singularities, the author explains the subtraction method to get rid of singularities when performing numerical integration. The ...
6
votes
2answers
1k views

Runge-Kutta in the presence of an attractor

Suppose you are solving a system of equations numerically that possesses an attractor (no matter the initial conditions set, all the different solutions will approach a specific set of values that ...
6
votes
0answers
101 views

How to check if my stiffness matrix is correct

I built the stiffness matrix for the Poisson equation on a 2-dimensional domain with the shape of "almost" an octagon, using pyramid basis functions. I used almost to intend the fact that I have an "...
5
votes
2answers
126 views

Is the diffusion equation with Neumann and Dirichlet BCs well-posed?

I am considering the following diffusion equation: $$\frac{\partial f}{\partial t} = \frac{\partial}{\partial x}[D(x,t)\frac{\partial f}{\partial x}]$$ over a grid ...
2
votes
1answer
43 views

Numerical integration of the dataset of a function

The energy equation for a spherically symmetric system is given by $$\mathscr{E}=\frac{v^2(r)}{2}+\frac{c_s^2(r)}{\gamma-1}+\phi(r)$$ where $\mathscr{E}$ is the total energy, $v$ is the velocity of ...
2
votes
1answer
69 views

Defining Current Density in a FEM model (MATLAB)

I'm attempting to solve the Poisson equation in 3D for a magnetic vector potential in the presence of a current source. To validate my code, I'm initially looking to reproduce the model described in ...
-1
votes
1answer
41 views

Integrate using Composite Simpson's rule

In a question, we have been given the speed of a car at time t= 0,2,4,6,.......,20 minutes.But it asks us to approximate the distance travelled by the car in 30 minutes using Composite Simpson's rule. ...
1
vote
1answer
91 views

Solve linear system with Newton-Raphson method

Is it possible to solve a linear matrix system $A x = b$ using the Newton-Raphson method? If yes, how can this be done? More special, how is the derivative build?
-1
votes
1answer
68 views

Recursive Algorithm to Calculate Determinant via Expansion of Minors in C#

I have been recently trying to attempt to write an algorithm in C# that would calculate the determinant of a matrix via recursion using the expansion of minors method. I understand that there are ...
2
votes
0answers
156 views

What exactly is the cause(s) of blow-up for too-large step size in a method like RK4?

I have been working on creating a few home-made numerical methods, and I am using them to visualize text-book problems from my Strogatz dynamics textbook. It feels like a good way to learn numerical ...
0
votes
0answers
24 views

Interpreting results of using no-flux boundary condition

I am solving for solute transport in 1 D. $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2} - v\frac{\partial C}{\partial x}$$ No-flux boundary condition is imposed at both the ...
1
vote
1answer
80 views

Implementing Robin Boundary condition (finite difference)

I'm interested in applying Robin boundary condition to a convection-diffusion problem in 1D. In the following system, $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2} - v\frac{\...
2
votes
0answers
90 views

Extracting FEM matrices in matlab pde toolbox

I am trying to follow the dynamic linear elasticity in Matlab, link here. My goal is to extract the FE Matrices using the function assembleFEMatrices in matlab and solve the resulting system of second-...
-1
votes
1answer
123 views

Imposing periodic boundary condition for linear advection equation - Node problem

I've spent the whole day trying to figure out what is the correct way to impose (and implement) periodic boundary conditions $u(0,t)=u(1,t)$ for all $t>0$ for the simple advection equation $u_t + v ...
0
votes
1answer
88 views

Robin Boundary Condition with Implicit Upwind - Finite Difference Method for 2D Convection-Diffusion Equation

I am trying to solve a problem with 2D Convection-Diffusion equation with U = Concentration ($mg/m^{2}$) using Implicit Upwind Finite Difference Method like this $$ \frac{\partial U}{\partial t} + ...
1
vote
1answer
124 views

Runge-Kutta fourth order method. Integrating backwards

I am using a Runge-Kutta fourth order method to solve numerically the usual equation of motion of a background scalar field in curved spacetime with a quartic potential: $\phi^{''}=-3\left(1+\frac{H^{...
1
vote
1answer
73 views

How to Break Coupled ODEs down to first order for Runge-Kutta

My question might seem a bit simple. I am trying to solve a system of ODEs using Runge-Kutta method. I am having difficulty breaking down the equations into a system of first order ones required ...
2
votes
1answer
63 views

How to robustly and numerically expand a $k$-order polynomial in two variables defined on a polygon domain?

Given a $k$-order polynomial in two variable $p(x, y)$ defined on a polygon domain $K$. And I want to numerically expand it to the following form $$ p(x, y) = c_0 + c_1 x + c_2 y + c_3 x^2 + c_4 xy + ...
1
vote
0answers
51 views

Numerical Method for Equation System of two depending Equation Systems

I am searching a solution method for the following equation system of equation systems: Let $A \in \mathbb{R}^{n \times n}$ be an invertible Matrix, $f, b_1, b_2 \in\mathbb{R}^n$ given vectors and $ ...

1 2 3 4 5 15