# 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.

359 questions
Filter by
Sorted by
Tagged with
1answer
129 views

### Do there exist “frameworks” as to how computational scientific experiments claim validity? Scientific method for computed science?

Do there exist "frameworks" as to how computational scientific experiments claim validity? Like "scientific method for computed science"?
1answer
710 views

### Object falling with air resistance using Runge-Kutta

I am not very familiar with differential equations, nor physics in general. I am trying to program an object falling with air resistance with the use of a numerical algorithm called Runge-Kutta. The ...
2answers
120 views

### Generating particles from a distribution function using Monte Carlo

I have been given a 4D ($x, y, v_x, v_y$) distribution function, $f(x,y,v_x, v_y)$, generated by an external code. I want to generate a set of particles from this distribution function, say 10k ...
1answer
159 views

### Calculating the Strange Attractor of the Duffing Oscillator in C++

I am simultaneously trying to learn computational physics methods, chaos, and C++. I think this is the right site for the question, and I apologise if not. I started working through Thijssen's ...
1answer
112 views

### Calculate stable time step DG method for advection-diffusion

For stable time steps for the RKDG method for transport equations we require that $$\Delta t \le \frac{\Delta x CFL}{(2k + 1)|\lambda|},$$ where $\lambda$ is the eigenvalue of our conservation law ...
1answer
115 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 ...
1answer
12k 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. ...
1answer
56 views

### Can 3rd order TVD admit perfect shift for Upwind 1D Advection equation?

I recently coded a 1 stage and 3 stage optimal TVD-RK explicit scheme using eqn 3.3 here http://www.ams.org/journals/mcom/1998-67-221/S0025-5718-98-00913-2/ on the equation Ux+Uy=0, where x and y ...
1answer
81 views

### Is this a proper implementation of point charge dynamics with ODEs

Since learning about point charges in my physics II class this semester, I want to be able to investigate not only the static force and field distributions but the actual trajectories of movement of ...
1answer
106 views

### Monte Carlo Metropolis method - trial step algorithm

I'm working on a Magnetization simulation and writing an algorithm using the metropolis method. I am using a change in energy and a Boltzmann distribution, but, my question is about the trial step. ...
2answers
647 views

### (Fortran) Integrating/summing over complicated 3D domain

I have some function $F(k_x,k_y,k_z)$ that I wish to numerically integrate over a polygon domain - physically, I am integrating over the first Brillouin Zone (BZ) of the FCC lattice (a truncated ...
1answer
156 views

### Inclined plate capacitor grid/ mesh

You can calculate the electric potential over every point in a defined space by solving Laplace's equation. To do this in a computer program you set up an 2-d array/ matrix and loop the internal ...
1answer
82 views

### Changing randomly a unit vector

For studying a spin model on a lattice, I have to generate a random unit vector starting from a pre-exstisting one. There are multiple ways to do it, but the book I use suggests generating a random ...
1answer
92 views

### Best practice for ADTs in computational science with Fortran

I have been writing a software package in Fortran for solution of the Vlasov-Poisson system in 2D2V. I want this software to be useful beyond its current application (e.g. systems with different ...
1answer
80 views

### Effect on methods like Crank-Nicolson of adding a potential term, changing heat equation to Schrodinger equation

I'm studying up on methods for numerically solving the Schrodinger equation. The Schrodinger equation with a zero potential is formally identical to the heat equation in the sense that we just make ...
1answer
211 views

### Numerical calculation of Wannier function in optical lattice

I am working out some optical lattice band structures (example here). I have no issue with setting up the eigenvalue equation: $$H_{jj'}c_{j'}=Ec_{j'}$$ Where $H$ is the tri-diagonal matrix that ...
1answer
108 views

### Fourier spectral method for coordinate transformed heat equation

As the title said, I want to solve a coordinate transformed heat equation using fourier spectral method. In particular, I am interested in transforming an uniform grid into an adaptive non-uniform ...
1answer
273 views

### Langevin equation in 4th order Runge-Kutta

I'm trying to figure out how to translate a piece of code from Velocity Verlet to Runge-Kutta, while treating the time step dependence of the thermal noise correctly. The Langevin equation for my ...
1answer
111 views

### Numerically solving a partial differential equation

I am trying to numerically solve the following PDE, $$\frac{\partial u^A}{\partial t} = c_1\frac{\partial^2 u^A}{\partial^2x} \,,$$ where $c_1$ is a constant. The above can be discretized using the ...
1answer
141 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 ...
2answers
295 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 (...
1answer
97 views

5answers
891 views

### Open source FEM implementation for Windows

I am wondering is there any robust, well-tested, accurate open source FEM solver package for Windows? I would like to use to power the engine of my structural engineering application. The FEM package ...
1answer
152 views

### How does Multi Body Dynamics software work for flexible joints?

I need to model a "fishing rod" in 2 dimensions by joining several "rigid sticks" by flexible/elastic joints. The joints act as plate/torsion springs with different spring constants. The "fishing rod" ...
1answer
732 views

### Second order interpolation scheme

On a grid I am having the values of a physical quantity say for example Temperature, at the E,W,N,S and P node all of them being calculated using a second order discretization scheme. I want a second ...
1answer
60 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 ...
1answer
105 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 ...
1answer
127 views

### Artificial neural networks for Temperature prediction

Imagine I want to consider the temperature for a process given several input varibales. The temperature can be anywhere between 400 and 500 K. Consider I have experimental data to train the network ...
1answer
798 views

### Defining Cauchy principal value in MATLAB (or Scilab/Maple)?

How to define a variable which is an integral involving cauchy principal value inside in any computer programming language? I want to know how to break down the procedure step by step from a ...
1answer
615 views

### Is the Finite Volume Method conservative when the source term depends on the variable?

I trying to do a simulation where there are two quantities, $\Delta\theta(x,t) = \theta(x,t) - \theta_{o}$ and $\Delta\nu(x,t) = \nu(x,t) - \nu_{o}$. These quantities are chemical concentrations ...
1answer
1k views

### Celestial mechanics simulation software? The 'N-Body Problem'

What software or sites might simulate an N-body gravitational problem? Application is related to Klemperer Rosette or Iridium Satellites. Bias for C, C++, PHP, or Java. Nice visuals a big plus. ...
0answers
81 views

### Finding the extrema of a transition probability function for a quantum walker on a graph

The goal Implement some Python code to find the extrema points of a function that is strongly oscillating. The background Let $G$ be a connected graph with $n$ points with Laplacian matrix $L(G)$. We ...
0answers
273 views

### Heisenberg Model python : Specific heat capacity for spin 2

I have the correct plot for specific heat capacity when I am using the formula which is $C_V$ = differentiation of entropy with respect to temperature. However, When I try to calculate $C_V$, by using ...
0answers
46 views

### What is the best methodology for physics simulators of large floating base rigid body systems?

I want to implement a physics simulator for large floating base rigid body systems from scratch. The Rigid Body Dynamics Systems (RBD) should typically have the following characteristics: About ~50 ...
1answer
565 views

### 1-D turbulent energy spectra in homogeneous direction (non-isotropic)

I am trying to compute the one-dimensional energy spectra for my channel-flow simulation. I have already written a post-processing script to achieve this; however, I need to validate my code before ...
0answers
2k views

### Using RK2 Method to solve the simple harmonic oscillator of a horizontal mass on a spring (1D)

Being new to numerical analysis techniques, in particular RK2, I decided the best way to jump in is by using python to solve the well known mass-spring oscillator using RK2 techniques. My problem is ...
1answer
183 views

### How to avoid negative roots with a Newton's method?

I'm currently trying to solve a system of (3) nonlinear equations of (3) variables which are the baryonic density, the isospin asymmetry and and the density of a fluid with the Broyden's method (a ...
0answers
61 views

### How to model pedestrian flow through subway systems?

I'm a New Yorker and take the subways every day. I have a growing interest in understanding the distribution of paths people take on the subways to work every day. I.e. if there are $n$ subway ...
0answers
185 views

### Mass conservation in atmospheric continuity equation numerical solution

My phd project is heavily related to numerical modeling of planetary atmospheres. In particular now I am dealing with a particular expression of the continuity equation, involving a thermodynamic flux....
0answers
82 views

### Numerical error in implementation of iterative algorithm

I am trying to implement (in Python for now) low thrust orbit propagation for spacecraft using universal variables. For a given central body with the gravitational parameter $\mu$ and an orbit with ...
0answers
214 views

### Solving a 3D (almost radial) convolution with FFT

I have a 3D integral that is almost a radial convolution of the form $$\int d^{3}k'h(\mathbf{k'})g(|\mathbf{k-k'}|)$$ and I am looking for a fast and efficient algorithm (e.g. FFT) to solve it ...
0answers
141 views

### Solving Schrodinger's Equation Numerically in a Bunimovich Stadium

I need to solve, as mentioned, Schrodinger's equation in a Bunimovich stadium-shaped infinite potential well with Dirichlet BC Numerically (this isn't possible analytically). In order to do so, I need ...
0answers
302 views

### Implementation of no-slip boundary conditions in lattice Boltzmann method fluid simulation

My faculty advisor recommended that I take a look at the lattice Boltzmann method as an introduction to scientific computing and potentially an undergraduate honors thesis topic. I cooked up a some ...
0answers
71 views

0answers
218 views

### Modeling simple laser induced population transfer via adiabatic passage in python

I'm trying to model adiabatic passage between two levels in a three-level atom interacting with two laser fields using Scipy and Numpy.. I'm not sure if my model is wrong due to my incorrectly ...
0answers
134 views

### Arbitrary Choosing of the Solution Domain - Navier Stokes and Manufactured Solutions

I want to verify a finite-volume solver (SIMPLE-Algorithm) for the incompressible Navier-Stokes equations by using a manufactured solution. I use Dirichlet boundary conditions for the velocity at all ...
0answers
92 views

### Tracking the speed of 2D oscillations on a lattice

I wrote a Monte Carlo simulation of the 2D Lotka-Volterra model on a discrete lattice (with periodic boundary conditions). A video that I produced (which images the system after some number of monte ...
1answer
111 views

### Adjusting Keplerian orbits for thrust with numerical stability

I'm writing a mod for a game that models orbital physics (Kerbal Space Program, or KSP). I'm attempting to model the effects of thrust on spacecraft in certain states where the game only models them ...