Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
30 views

How to simulate water, falling under gravity, and impinging on a curved surface, which is kept/present in a domain, containing air?

FEM Software: COMSOL Multiphysics 5.4/5.3a I am attempting to simulate water, flowing out of a hole/slit, at the bottom of a tank (Water Domain) (under the influence of gravity); entering into a ...
0
votes
1answer
51 views

coupled equations with finite difference method

I have these three differential equations in which I need to solve numerically: $$ \frac{dn_0}{dt}= -n_0(t)W_{01}(t) + n_1(t)K_{10} $$ $$ \frac{dn_1}{dt}= -n_1(t)W_{12}(t) - n_1(t)K_{10} + n_2(t)K_{...
-1
votes
0answers
32 views

Numerical Soliton Solutions with velocity

I'm trying to replicate the results on the old Zabusky and Kruskal paper where they have an explicit solution to the KdV equation discretized by (footnote 6, p. 242 of the paper) $$ \begin{equation} ...
5
votes
1answer
47 views

Mass matrix and BDF time integration

I have a system of nonlinear equations on the general form: \begin{align} \mathbf{M}(\bar{y})\dot{\bar{y}} =\bar{f}(\bar{y},t) \end{align} Where $\mathbf{M}(\bar{y})$ is a matrix and $\bar{f}$ is a ...
1
vote
0answers
34 views

Numerically solving a system of parabolic PDEs and 1st order ODEs

I'm trying to solve the following system of differential equations numerically. What are the available finite difference approaches and matlab solvers to solve such a system? Other approaches to solve ...
3
votes
2answers
88 views

How to simulate basic semiconductor models using the Drift-diffusion model on Python?

I'm trying to simulate basic semiconductor models for pedagogical purposes--starting from the Drift-diffusion model. Although I don't want to use an off-the-shelf semiconductor simulator--I'll be ...
2
votes
1answer
85 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 ...
3
votes
2answers
74 views

Computational cost comparison of DNS and SPH

I may be incorrect, but it seems like commercial graphics codes typically use smoothed particle hydrodynamics (SPH) to produce stunning simulations and not continuum based methods. Why is this? Is SPH ...
1
vote
2answers
65 views

Guaranteed equality between binary results with increasing MPI processes

Testing on an MPI scientific code for compressible flow dynamics I noticed that the results may depend on the number of processors used for the calculation. In fact, comparing the binary files they ...
6
votes
1answer
216 views

Putting N hard spheres randomly in given volume

I need to put $N$ spheres with given radius $R$ randomly in a Volume $[-0.5,0.5]^3$, without any overlap of spheres. If I choose values so that all the spheres will occupy ~57% of the total volume, I ...
1
vote
0answers
55 views

Split step Fourier method to solve Schrödinger equation for moving potential

I'm trying to use the excellent Schrodinger Python class by Jake VanderPlas (https://jakevdp.github.io/blog/2012/09/05/quantum-python/) to simulate a wave packet within a moving Gaussian potential. I ...
3
votes
0answers
43 views

Should I expect computational gains using a second-order splitting method here?

I am trying to solve a three-dimensional baroclinic transport problem. The hydrodynamic (three-dimensional shallow water) equations are: \begin{align} \nabla \cdot \vec{v} = 0, \tag{1} \\ \frac{\...
1
vote
2answers
46 views

How to calculate $g_r$ when using the cell method algorithm

I have a self-written MD code in C++. I am simulating atoms using the Langevin dynamics model. I use the linked-cell method to speed up the simulation; as a result, atomic interactions are only ...
1
vote
1answer
39 views

What are the things I should keep in mind before doing an analysis of my gromacs simulation?

I did a liquid argon simulation at 100k. I forgot during analysis that I need to accommodate for the Periodic Boundary Conditions before doing any analysis which included distance. What are other such ...
1
vote
1answer
31 views

Loss of energy when using Roe Solver for solving onedimensional Shallow Water Equations

I have written a Roe solver with Harten entropy fix code in Matlab to numerically solve the one-dimensional Shallow Water Equations. : \begin{eqnarray} \dfrac{\partial h(x,t)}{\partial t} + \dfrac{\...
-2
votes
1answer
149 views

Solving Schrodinger equation numerically

Here is the Schrodinger equation that is to be solved: A 1D hard wall potential in $[0, 1]$. The potential within the potential well is given by a linear combination of Gaussian dips $$v(x) = - \...
0
votes
1answer
64 views

Poincare map for Arnold-Beltrami-Childress Magnetic Field in Python

I want to plot the Poincare map for Arnold-Beltrami-Childress magnetic field for parameters $A=1, B=0.816, C=0.5773$ in Python for the Poincare section $z=0$. Also, I am not able to understand what ...
2
votes
1answer
82 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 ...
4
votes
1answer
67 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 ...
1
vote
0answers
183 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: ...
1
vote
0answers
29 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 ...
5
votes
1answer
129 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 ...
1
vote
1answer
100 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
136 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
68 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
37 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 ...
4
votes
1answer
117 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
72 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
105 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
984 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, ...
0
votes
1answer
148 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
39 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
137 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
955 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 ...
0
votes
2answers
516 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
165 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
62 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
73 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
80 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
39 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
95 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
65 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
45 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=((...
0
votes
1answer
333 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
142 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
84 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
105 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
49 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
220 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 ...
4
votes
0answers
81 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}}\...