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.

Filter by
Sorted by
Tagged with
5
votes
1answer
228 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 ...
2
votes
1answer
109 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 ...
0
votes
1answer
243 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 ...
6
votes
1answer
84 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 ...
2
votes
1answer
65 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 ...
5
votes
1answer
143 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'...
1
vote
0answers
99 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}{...
2
votes
2answers
140 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 (...
1
vote
2answers
2k 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, ...
2
votes
1answer
398 views

Numerical Sensitivity in Density of States of Tight-binding model

I'm working with the tight-binding model, and I'm trying to learn the basics of how to compute the Density of States (DOS) $N(E)$ numerically. The DOS is given by $$N(E) = \frac{1}{N}\sum_k \delta(...
1
vote
0answers
48 views

Jacobian Elements for Coupled Drift-Diffusion System using Vertex-Centered Finite Volume

I'm trying to solve the fully coupled drift-diffusion system using Newton's Method. Although I eventually plan to potentially use a Jacobian-Free Newton-Krylov approach, this is still something that I ...
1
vote
1answer
202 views

Performing a random walk on a lattice that traps the particles

I am trying to solve this problem where we have a 1D-lattice of size 100 and the particle can start from any position in the lattice and moves randomly on it(with equal probability of moving to either ...
7
votes
2answers
1k views

Efficiently finding all (x,y,z) points within certain distance of point P

I am using Python, and I have a Pandas dataframe with hundreds of thousands, if not millions, of $(x,y,z)$ coordinates. I am looking to find an efficient method to index the original dataframe so that ...
1
vote
2answers
1k views

Physics Simulation in C++

OK, I know a bit of C++ (very basic syntax), and I want to do physics simulation in C++, like stuff like (also the things mentioned here): Ripples and waves over a 2-d surface Vibrating string/...
1
vote
1answer
259 views

Can we simulate rigid body motion using finite element analysis?

I was wondering if we could model rigid body motion of bodies using finite element models. Particularly I'm interested to know if we can model motion of objects with no constraints or with some ...
1
vote
1answer
68 views

Defining dimensionless tempearture for Periodic flow systems

Given a flow inside a square duct with constant temperature at the walls $(T_{w1} = T_{w2} = T_w)$ the physical property in terms of temperature that repeats itself in a periodic fashion is the $\...
3
votes
1answer
81 views

Computation of the heat kernel from Brownian motion

This question is rather simple but I have some difficulties to find code. Let us suppose that I wrote a routine, in a given language, that computes the evolution of a particle doing Brownian motion in ...
3
votes
0answers
106 views

Non-reflecting boundary conditions for compressible Navier-Stokes equations

I have some questions about the implementation of non-reflecting OUTFLOW boundary condition for Navier Stokes equations. Following Poinsot, Lele "Boundary Conditions for Direct Simulations of ...
1
vote
0answers
42 views

Huge accelerations in plasma simulation

I'm trying to make a numerical simulation of pulsar magnetosphere using FDTD on a log-spherical Yee lattice for fields and PIC for plasma particles. Field part is working like charm but issue arises ...
3
votes
1answer
107 views

Normalizing a density matrix at each iteration

I need to numerically evolve a density matrix using this formula(Actually I have more terms but right nows I am starting with this and facing problems): $$\dot\rho(t) = -i[H(t), \rho(t)]$$ $H(t)$ is ...
0
votes
1answer
71 views

Help understanding this numerical surface integration technique?

I'm attempting to write a FORTRAN program that calculates the magnetic field, B, at any point outside of a bar magnet. I'm going to use a first order euler scheme, where each side of the bar magnet ...
0
votes
1answer
49 views

Converting acceleration over time to velocity or speed in code

I have acceleration data from a sensor. X Y & Z. I move the senor in the Y axis. Mostly in a straight line. So I ignore x & z. From the sensor documentation 5.2.1 Acceleration output: ax=((...
1
vote
1answer
466 views

Proper boundary conditions for potential flow around cylinder

I am computing the stationary, incompressible, inviscid and irrotational flow around a circular cylinder using a discretization in general coordinates. I derived a PDE and proper boundary conditions ...
1
vote
2answers
152 views

Discussing the energy spectrum of Langevin Dynamics simulation of many atoms

UPDATED I've coded a multiparticle MD simulation in 3D. It is based on Langevin Dynamics, with random impulse and dissipation. I think the program works correctly now? I have attached the plots of ...
1
vote
0answers
98 views

Band structure of nonlinear Schrodinger equation with one dimensional potential

I have a nonlinear Schrodinger equation which reads: $$ \frac{1}{2} \frac{d^2u}{dx^2}+ |u|^2u + V(x)u = -i \frac{du}{dz},$$ where $V(x)=\cos(wx)+ i a \sin(wx)$ and $w$, $a$ are numbers. How to ...
1
vote
2answers
122 views

How to compute forces in multi-particle MD

Suppose we have a system of $N$ particles that interact via the Lennard-Jones potential $$V(r)=V_0\left[\left(\frac{r_0}{r}\right)^{12}-2\ \left(\frac{r_0}{r}\right)^{6}\right].$$ No other forces ...
0
votes
0answers
53 views

Does radioisotope decay affect computer systems?

It is known that there exist a number of radioisotopes of elements commonly used in computer systems. Is the decay of these materials known to affect device performance over time, or is its impact so ...
0
votes
3answers
244 views

Why there are people that still prefer fortran 77 over new versions?

I am reading some notes from a course in numerical analysis for physical sciences and it is my impression that there are still people that prefer Fortran 77 over new version due to the implicit ...
3
votes
0answers
118 views

Crank-Nicolson integrator: oscillations with complex matrix

I'm working on a Real-Time TDDFT implementation and I am currently comparing different propagation schemes for the propagation of the Kohn-Sham wave function, $$ \phi(t+\Delta t) = \hat{\mathcal{U}}\...
1
vote
2answers
2k 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 ...
1
vote
0answers
118 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) ...
2
votes
1answer
5k 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. ...
6
votes
1answer
162 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 ...
6
votes
4answers
197 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 ...
3
votes
1answer
517 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-...
1
vote
0answers
73 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$ ...
4
votes
1answer
113 views

How to force potential boundary conditions in the Yee scheme for solving Maxwell's equations?

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 ...
1
vote
1answer
114 views

Matrix exponential by eigenvectors - implementation issues

I posted a similar question yesterday but I deleted it since I think that I had to reformulate it after some insights. I want to calculate $$ \exp(-i\Delta t\,\mathcal{H}) = V\,\mathrm{diag}(\{\exp(-...
1
vote
0answers
58 views

Dealing with simultaneous collisions in N-body sim

I have written an 2d N-body simulation in Python which allows collisions between the bodies. A body is modeled as a circle whose area is proportional to its mass. Each time the sim advances by one ...
1
vote
0answers
419 views

One Dimensional Schrodinger's Equation solution using Numerov Method

I have been trying to solve Time Independent Schrodinger's equation in one dimension using Numerov Method as discussed in this excellent lecture notes I found on net. The Numerov method can solve an ...
1
vote
2answers
136 views

Computational Physics: Finding the Diffusion Coefficient from the Discretized Diffusion Equation

I'm pretty new to translating simulation to reality so please forgive the perhaps naive approach I'm taking here. If we have a (quasi-2D) experimental video of a certain concentration changing with ...
6
votes
3answers
2k views

Galerkin method: Test functions vs. Basis functions

I'm a novice to finite element and I'm finding quite hard to find the actual difference between Test function(s) and Basis function(s). I would be glad if somone could explain me that and point out ...
3
votes
3answers
108 views

Numerically finding constants of motion

Given a set of ODE's $ \dot{z} = f(z) $ (or discrete time $ z_{t+1} = f(z_t) $), is there a way to numerically find constants of motion? For $ f(z_t) \approx M z_t $, diagonalizing the matrix $ M $ ...
1
vote
1answer
81 views

Oil/Water interface simulation using GROMACS

I would like to perform a decane/water(tip4p) interface simulation using GROMACS to analyse the fluctuation of the interface over a long period of time (50ps - 1ns). Though I have a rough idea on ...
3
votes
2answers
2k views

Calculating partial trace of array in NumPy

A simulation I'm doing requires me to calculate the partial trace of a large density matrix. I am trying to calculate it using tools from numpy, but my code seems to be having some problems. For ...
1
vote
0answers
133 views

Second Quantization in Matlab

This question may be more suited for physics.stackexchange, but I saw this post was recommended for StackOverflow or Computational Science, so I'm asking my question here. I am trying to write a ...
1
vote
0answers
74 views

Finite difference scheme for unconfined aquifer equation

For an unconfined aquifer we have this PDE for the water table position( of course after somehow making the original Boussinesq equation linearized ): $$ \frac{\partial^2(h^2)}{\partial x^2} + \frac{\...
3
votes
2answers
1k views

Why is it not computationally possible to accurately predict the weather that would occur after 14 days?

As per wikipedia, scientists have not been successful to accurately predict the whether which is 2 weeks ahead. Here is the excerpt: The atmosphere is a chaotic system, as a result, small changes ...
1
vote
0answers
208 views

Double Integrating acceleration data to obtain position: 2 Problems

I have a data sample from an accelerometer from my phone (pretty bad accelerometer though). I'm trying to double integrate it in order to obtain the position as a function of time. I'm using a program ...
0
votes
2answers
63 views

Physical meaning behind the choice of the proposal distribution in Markov Chain Monte Carlo (MCMC) methods

Let us consider the conventions on names used in the theoretical derivation of Metropolis-Hastings Monte Carlo as outlined here, for the sake of common nomenclature. What we are building is a step-...