We’re rewarding the question askers & reputations are being recalculated! Read more.

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
4
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
146 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
78 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
224 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-...
3
votes
1answer
146 views

Reasons to choose LES in stead of RANS models? (turbulence)

In oceanography, is there any particular reason why choosing large eddy simulations in stead of RANS (regardless of the type of flow)? In both cases, 2d simulations would be used (shallow water model)....
1
vote
0answers
112 views

Strange solutions using Finite Element Analysis

I've implemented the Finite Element Method to model the heat transfer between two different materials where one material is surrounded by the other. When I run the model I'm getting some strange ...
1
vote
1answer
285 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 ...
3
votes
1answer
179 views

Resources for solving fluid-structure interaction problems

I would like to get started solving Fluid-Structure interaction problems. I already have some experience with Finite Elements, including my own MATLAB and Julia software packages for developing ...
1
vote
0answers
52 views

Parallelizing molecular simulation with full configuration energy

First, let just me stress that I'm not a an expert in computation chemistry, so now the problem: We have GCMC molecular simulation, in the Grand Canonical ensemble, using the standard metropolis ...
0
votes
1answer
180 views

Euler-Bernoulli beam element versus continuum beam element

I am using OpenSees to model a simply supported beam with a point load in the middle. The model is in consistent units. The beam is made up of bilinear quad elements. I have used 30 elements along the ...
1
vote
1answer
103 views

triple cross prouct of tensor

Im trying to compute a triple cross product of vectors a,b, and c in real space and integrate over the entire space. The result is a term in the hamiltonian for an electronic system so there are ...
1
vote
0answers
227 views

Physics of explosions: just vorticity?

eg 1 2. Is it just vorticity? What's actually happening? (Similar: steam engines, volcanoes, clouds). examples are grid-based, using "vorticity confinement" in Phoenix FD. EDIT Some techniques: "...
2
votes
0answers
926 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 ...
3
votes
0answers
97 views

How can I evaluate the accuracy of my n-body simulation?

I am making an n-body simulation in python. There are many different methods to numerically solve the system of differential equations governing the gravitational interactions between the $n$ ...
2
votes
1answer
88 views

Mysterious Mirroring in Analytical Solution of a delay differential equation (DDE)

I'm struggling now for several weeks with a very bizarre problem with a system of delay differential equations. First, here the system: $$\dot a = 1 - \Theta(b(t-\tau)-\kappa) \,- a(t) \\ \dot b = \,...
2
votes
1answer
169 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 ...
1
vote
1answer
252 views

Higher-order Verlet integration

I'm using a simple version of Verlet integration for a particle–particle interaction system with collisions. At the end of each iteration, I integrate like this: ...
2
votes
1answer
51 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 ...
1
vote
2answers
175 views

Can Runga-Kutta method be used to solve non-linear differential equations?

Consider two-body central force problem in polar co-ordinates $r,θ$. Corresponding 2nd order differential equation is obtained by using conservation of angular momentum. This equation is : $ d^2r/dt^...
0
votes
2answers
328 views

Time step relationship with number of elements or material properties

When looking at the output file of my solver, I have been told that the time-step taken by the solver depends on parameters like the total number of elements and their relative size in my geometry, or ...
1
vote
2answers
102 views

Trotter expansions in ode solver?

Trotter expansions say: $$ e^{A+B} = \lim_{P\to\infty} \big(e^{A/2P} e^{B/P} e^{A/2P} \big)^P. $$ With $P = 2$, it becomes (with high accuracy) $$ e^{A/4} e^{B/2} e^{A/2} e^{B/2} e^{A/4}. $$ Let's ...
1
vote
1answer
224 views

Numerical Free Fall Analysis with RK4

I am trying to calculate real speed and time in free fall of a body. I wrote a code in Fortran and I am trying to improve it by using RK4 method x=time y=total free fall Purple line using: ...
2
votes
0answers
60 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 ...
2
votes
1answer
65 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 ...
1
vote
0answers
43 views

Software suggestion for simulating the stacking of sedimenting rods

I'd like to simulate the following problem: Define some square, horizontal and hard area onto which cylinders (aspect ratio R) sediment. Preferably, the source of cylinders sequentially generates N ...
0
votes
3answers
233 views

What type of computer science/engineering knowledge someone need to have to study graduate level course in compurational physics?

I am wondering if this is the right place to ask this question. I found a related question on stack overflow https://stackoverflow.com/questions/814312/physics-in-computer-science but it was closed. ...
2
votes
1answer
121 views

Why FEM electric analysis gives only access to current density?

A Comsol study using frequency sweep on electric current physics yields only current density as accessible variables. I understand the underlying equation used is Ohm's law, i.e. $$\mathbf{J} = \...
1
vote
0answers
172 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....
0
votes
1answer
235 views

How can an engineering student become a computational scinece expert in a short time [closed]

How can a student with zero computing or programming language knowledge, few engineering mathematics knowledge, understand computational science especially Finite Element Modelling (FEM) from ...
1
vote
1answer
108 views

Finding the lowest $n$ eigenvalues of a band-diagonal Matrix

I have a real sparse matrix of the form $$ \left( \begin{array}{ccc} h_{11} & h_{12} & 0 & h_{14} & & & \\ h_{21} & h_{22} & h_{23} & 0 & h_{25} & & ...
1
vote
3answers
131 views

Solving a small non-symmetric, non-diagonally dominant, and non-sparse system

I want to solve a small (20 $\times$ 20 up to 30$\times$30) system which is not symmetric, not diagonally dominant, and not sparse. Each row contains a modified form of the Legendre coefficient of a ...
1
vote
0answers
63 views

Sensitivity Analysis — Total Variation for a function with categorical arguments?

I have an application in sensitivity analysis of complex system models with moderately nonlinear interactions between arguments Arguments potentially dozens or hundreds in number Arguments mostly ...
14
votes
2answers
274 views

Quality of linear congruential generators for random numbers

I'm doing some simulations of the Langevin equation, for various external forces. Being told that C's rand() from stdlib.h can ...
1
vote
1answer
1k views

Is there an advantage of using a staggered grid over a regular one when combined with high order methods?

The title says is all. This question is in the contest of an incompressible Navier-Stokes solver. Specifically, I am currently working on a new solver while referring myself to an older code for ...
1
vote
2answers
77 views

Should energy be conserved in an N-body simulation where particles don't lose energy in collisions?

In an N-body simulation where forces between particles are attractive and particles do not lose energy on colliding with walls or each other, should energy be conserved? How could it be, with total ...
11
votes
1answer
848 views

Why is leapfrog integration symplectic and RK4 not, if the latter is more accurate?

In a system where energy theoretically should be conserved, the most accurate simulation would conserve energy (as well as giving accurate positions, velocities and etc). RK4 is more accurate than ...
1
vote
0answers
87 views

The Schrodinger equation for time-dependent Hamiltonian after one timestep, taking exponential or use ode solver?

The Schrodinger equation for time-dependent Hamiltonian is $$i\hbar\frac{d}{dt}\psi(t) = H(t)\psi(t) \, .$$ Assuming I knew $\psi(t)$, I want to know $\psi(t+\Delta t)$. Should I take exponential ...
1
vote
1answer
63 views

nodal lines of wave-function $\psi(x,y) = \sin 12x \sin y + (1 + \epsilon) \sin x \sin 12y$

I am trying to reproduce this figure of nodal lines of a wavefunction from this work of Berry $$\psi = \sin 2r\,x \sin y + (1 + \epsilon) \sin x \sin 2r\,y$$ Here the image. The first is $\epsilon = ...
2
votes
1answer
343 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 ...
1
vote
1answer
106 views

What is a good algorithm, and framework, to calculate centres of gravity or mass (cog)?

I'd like to take an photograph, subdivide it into a tesselation, either of squares, or (ideally), hexagons, and then find the centre of gravity (or, if you prefer, centre of mass) of each cell of the ...
1
vote
1answer
116 views

Boundary treatment with higher order methods

I wrote a code which solves the 2D Poisson equation with homogeneous Dirichlet BC everywhere and a source term of -1. I am using the classical Jacobi iteration method. The grid is $N_x \, \mathrm{x} \,...
3
votes
0answers
67 views

Cavity Flow CFD Boundary conditions and strange waves

So I have a PDE that I use to describe how material flows through a volume(2D or 3D). $$\frac{\partial C}{\partial t} + \vec{u} \cdot \nabla C = (D' + D )\nabla^2C$$ Now using finite differences I get ...
1
vote
0answers
73 views

Metropolis algorithm and thermal sine-Gordon model

I try to simulate thermal version of 1D $(x, t)$ sine-Gordon field model. I am interested in finding thermal static solution that minimizes functional of energy $E$: $$E = \int dx \left( \frac{1}{2} \...
2
votes
0answers
76 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 ...
1
vote
0answers
96 views

How to get the eigenvalues of Hamiltonian in an over complete basis

Let $|\psi_i\rangle$, $i=1...N+m$, be a set of overcomplete basis vector in a $N$-dim Hilbert space. The following are known: (Einstein's summation convention assumed) $$\hat{H}|\psi_i\rangle=H_{ji}|\...
1
vote
1answer
343 views

Difficult bug in my 2D Compressible Euler solver

For the past few days, I have been writing a numerical solver for the 2D compressible Euler equations for an ideal gas. My numerical method has been the Local Lax Friedrichs or "Rusanov's method." ...
3
votes
0answers
97 views

Journals that publish theoretical analyses of existing algorithms

In computational physics, the vast majority of papers has the following structure They propose some new algorithm, or improvement to an existing one They give numerical examples, ideally comparing ...
1
vote
2answers
104 views

Definition of inflow boundary in CFD

If $w$ is the vector of conservative variables, $f=f(w)$ the flux function, I think have read somewhere (I can not find it anymore) that the inflow boundary $\Sigma$_ is characterized by: $\Sigma_{-}...