The 2024 Developer Survey results are live! See the results

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

465 questions
Filter by
Sorted by
Tagged with
43 views

### What techniques are there to take averages and errors in a Monte Carlo simulation in C? Can my code be improved?

I'm trying to perform a Monte Carlo simulation in C and these are the steps I'm following: We assume an infinite reservoir compound of CO and NO molecules with partial pressures 𝑦CO and 𝑦NO(= 1 − 𝑦...
• 1
278 views

### Asking advice for implementation of Conservative Finite Difference Scheme for numerically solving Gross-Pitaevskii equation

I am trying to numerically solve the Gross-Pitaevskii equation for an impurity coupled with a one-dimensional weakly-interacting bosonic bath, given by (in dimensionless units): \begin{align} i \frac{\...
• 21
1 vote
44 views

### Mathematica Package for validating effective string theory solution

I am asking for Mathematica package that given an input of: symmetric matrix $G_{\mu\nu}$, antisymmetric matrix $B_{\mu\nu}$ and a scalar function $\Phi$ will check whether it is a solution to the one-...
30 views

### Covariant Euler-Lagrange Computation - Mathematica

Does anybody know of a software (or software package) that can solve the Euler-Lagrange equations for a manifestly-covariant field Lagrangian density? Mathematica has a "Variational Methods" ...
33 views

### Help needed in generating a list of radii

I am trying to generate a list of radii between two given points (0 and 1 in this example). Below is my code in Python to generate the list. ...
56 views

### Why is Magnetic Susceptibility not showing the expected transition in 2D&3D Ising Model?

I'm trying to code the Ising Model with the metropolis algorithm to study the ferromagnetic-paramagnetic transitions. The code seems to work ; the equilibration happens. While equilibrating, the ...
1 vote
30 views

### Monte-Carlo metropolis algorithm for Ising model

I am using the Monte-Carlo metropolis algorithm to simulate the Ising model. Since the convergence is slow near $T_c$, I am looking for a method to speed up the problem. What I did was instead of ...
• 71
122 views

### Different Results for Double Pendulum

In this study, (Hidden Fractals in the Dynamics of the Compound Double Pendulum) the authors provide various fliptime fractals (of a double pendulum) for different length combinations. However, when I ...
• 121
65 views

### Exact Riemann Solver for Multi-Component 1D Euler Model

I am concerned looking for an exact Riemann solver for compressible 1D multi-component Euler equations, supplied with the ideal gases equation of state and under the assumptions: Mechanical ...
• 11
286 views

### Why do my satellites fall out of orbit?

I have set up Newtonian Gravity in my Game Engine, allowing me to simulate the gravitational attraction between celestial bodies. I have the following variables defined: ...
• 121
31 views

### Problems performing 1D-FDTD for dispersive dielectric uisng lorentz model in Julia

So I am trying to model a dispersive dielectric using the Lorentz model in Julia, more specifically I am trying to obtain the frequency-dependent reflectivity of the material. I am ultimately trying ...
103 views

### How to properly compute a differential cross section?

I'm currently in the process of computing a differential cross-section for the scattering of a 420 MeV electron by an O-16 nucleus (with a Wood-Saxon charge distribution). The problem is that the ...
• 21
82 views

### Non-dimensionalizing the Ideal MHD System

Non-dimensionalization is a really frustrating topic for me, and I imagine many others, because in school it was glossed over while being really important to implementing a simulation. I'm writing a ...
1 vote
87 views

### Regarding the difference between Metropolis-Hastings and Wolff algorithm (synchronous vs asynchronous) applied to Ising Model?

I am trying to self-learn concepts at the intersection of physics and programming. When reading up on the Ising Model, I find that the typical programming tutorial (such as this one) covers the ...
422 views

### How to leverage the GPU for parallel 3-body problem computations

I have a 3-body simulation which must run millions of times. As far as I know, the GPU shines when it gets to preform simple operations on huge matrices/arrays. Currently I'm debugging and running my ...
• 41
169 views

### Redefining velocity field to make it divergence free on the grid level

I am currently working with convection equation $\frac{\partial C}{\partial t}+u\frac{\partial C}{\partial x}+v\frac{\partial C}{\partial y}=0$. I assume that the velocity field is incompressible i.e. ...
• 173
104 views

### How to minimize a numerical integration in python?

I need some help to minimize a numerical integration. It's about a classical problem in physics (hydrogen atom). It can be solved analytically but I need to solve it numerically in Python. We have an ...
197 views

### Speeding up 3 body problem acceleration calculation

I want to find optimizations to my code for the 3BP, and more specifically computing accelerations. I'm using a data-driven approach, so I have a bodies structure ...
• 41
80 views

• 193
1 vote
79 views

• 273
124 views

### Issues with Simulating the Orbits of Mars and Earth using MATLAB and Runge-Kutta Method

I'm trying to simulate the orbits of Mars and Earth in MATLAB using the 4th order Runge-Kutta method for numerical integration. However, the orbits appear as straight lines rather than the expected ...
62 views

### Reverse engineering phase shift and numerical damping

I've been trying to validate the physics behind a particle system framework, but I'm having some difficulties. A particle system is a set of lumped masses connected by spring-damper elements. Linear ...
42 views

### 1 dimensional simulation of gravity fails

In 1D the force of gravity does not diminish with distance however here I use 1D to mean the point mass only moves in a line in 3D space, with the other mass stationary at the origin. I started by ...
84 views

### Best approach to simulating dynamics on networks

I have been recently getting into the field of various processes on networks. For example, stochastic processes like percolation, Ising models, various statistical-physics models; or deterministic ...
• 123