# Questions tagged [computational-physics]

Computational physics is the study and implementation of numerical algorithms to solve problems in physics for which a quantitative theory already exists.

354 questions
Filter by
Sorted by
Tagged with
83 views

### Symplectic Algorithms for Hamilton’s Equations as opposed to just Volume-Preserving

this might be a silly question, but if we’re trying to numerically solve Hamilton’s equations with some discrete scheme, sometimes when the scheme preserves phase space volume (Hamilton’s eqns are ...
900 views

### Which solvers for BVP in python are the best? Is there something better that scipy.integrate.solve_bvp?

I am trying to solve a boundary value problem with Python. I have been using scipy.integrate.solve_bvp but the result that it is giving me is completely wrong. Basically my code is as follows: ...
35 views

### How to numerically transform a 2D Fourier spectrum with arbitrary frequency shift to center frequency?

Suppose $F(u,v)$ is the center frequency Fourier representation of some $f(x,y)$ in 2D. $$f(x,y)=\int\limits_{-\infty}^{\infty}\int\limits_{-\infty}^{\infty}F(u,v)e^{2\pi i (xu+yv)}dudv$$ In ...
856 views

### How is rigid bodies implemented in finite element codes

I am writing a finite element code for structural analysis, and I want to implement rigid bodies. How is this usually done? Say that I have a square mesh, with one half of the mesh being defined rigid ...
114 views

### Simple model of Saturn's rings

I’m trying to figure out how to model the rings of Saturn using a particle system for a gravity simulator that I’m making. Using the code below, I’ve managed to create a, if not perfect, decent ring ...
1k views

### Boole's Rule in python

This is my first post in this forum so please forgive me if it is not the way it should be. My problem is about implementing "Boole's rule" into python. I have succesfully implementet trapezoidal and ...
130 views

### Eigenvalue problems with extremely small gaps

I'm interested in numerically diagonalizing a class of structured, symmetric eigenvalue problems with potentially extremely small eigenvalue gaps. The question I have is how to design a numerically ...
136 views

### Two variables integration matlab

I'm trying to solve physical problem in quantum mechanics of helium atoms, the solution require numerical integration over 2 variables. However when i'm trying to run the next code ...
176 views

### How can I apply Euler's Method to predict a point in time rotating around multiple axis'

I am xposting this from my original stackoverflow question where I was presented with a coding challenge that I have been able to narrow down extensively and I think it lies with Euler's Method. Here'...
128 views

### Finite difference methods for coupled 2nd order nonlinear pdes

I have a system of coupled nonlinear PDEs that I cannot figure out how to solve in a smart way using FDM, so I was hoping someone here might have a clue. The equations go as: \begin{align*} \frac{1}{...
283 views

### Algorithm to generate water flow map, given a terrain

I've posted the same question at GameDev Stack Exchange, but unfortunately I am not getting any response. So I am going to post ( and reword) it here. Hopefully I can get an answer! I have a terrain (...
6k views

### How does one calculate reaction force in FEA?

I wrote a UEL (User Element in Abaqus) for one element and compared to a reference UEL which used standard FEM, where the results agreed satisfactorily, except the reaction force. The stress, strain, ...
1k views

3k views

### Solving the 1D Particle-in-a-Box using C++

I've just finished learning the physics behind the problem and would like to write a program in C++ than can solve the problem. I'm actually stuck at the start. I've quite a bit of research, the ...
204 views

### Solving complicated coupled ODE using RK4/ODE45 in Matlab

I have the following coupled differential equations also known as Guiding Center Approximation. It is used to explain the position- and velocity change of particles (electrons and protons, N = 1000) ...
11k views

### 2D Ising Model in Python

I am trying to calculate the energy, magnetization and specific heat of a two dimensional lattice using the metropolis monte carlo algorithm. ...
207 views

### Pressure definition/convergence issues for the Incompressible Navier-Stokes when using a stabilized P1-P1 finite element formulation

I believe this might be a recurring topic, but i have not found a post that directly related to this issue. I come from a finite volume background and my experience is more with predictor-corrector ...
246 views

### In Matlab, how can I be consistent with units?

I am modeling some aerodynamics equations and am using meters / centimeters, kilograms, and seconds. I've heard that, "matlab doesn't know units". So, how can I make sure that it does? Just ...
785 views

### Numerical propagation of a density matrix using Liouville von Neumann equation

I want to look at time evolution of the density matrices of some, very simple, spin systems, but I am having trouble with my approach. I want to use a simple for-...
76 views

### Numerical scheme to solve Maxwell equations with fixed potential boundaries?

We have a 2D electromagnetic field (in the sense that: $E=(E_x,E_y,0)$, $B=(0,0,B_z)$, and all derivatives with respect to $z$ are $0$), and we are considering a system made up of two walls at $x=-b$ ...
Assume that we have a 2D electromagnetic field (in the sense that: $E=(E_x,E_y,0)$, $B=(0,0,B_z)$, and all derivatives with respect to $z$ are $0$), and that we are considering a system made up of two ...