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
0
votes
0
answers
41
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 − 𝑦...
2
votes
1
answer
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{\...
1
vote
0
answers
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-...
0
votes
0
answers
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" ...
0
votes
0
answers
32
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.
...
0
votes
0
answers
55
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
0
answers
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 ...
2
votes
1
answer
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 ...
0
votes
1
answer
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 ...
2
votes
1
answer
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:
...
0
votes
0
answers
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 ...
2
votes
1
answer
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 ...
0
votes
1
answer
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
0
answers
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 ...
2
votes
1
answer
421
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 ...
4
votes
2
answers
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. ...
0
votes
0
answers
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 ...
2
votes
1
answer
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 ...
2
votes
0
answers
80
views
Preventing an Overflow in Exponential Integrating Factor
The following is the Discrete Spectral Vorticity Evolution PDE for incompressible flow:
$$ \frac{\partial \Omega_{pq}}{\partial t} = \nu \left( \frac{\partial^2 \Omega_{pq}}{\partial x^2} + \frac{\...
2
votes
1
answer
191
views
Solving non-linear partial differential equation numerically: $u_{xx}+u_{yy}=\mathrm{e}^{u}$
To start with, I need to solve this partial equation numerically, but I do not know how to do that. If I try a finite difference method, I face a problem that $u_{i,j}$ is also located in exponential, ...
2
votes
1
answer
205
views
Need help with the python code: Calculating Madelung constant CsCl crystal structure
Need help with the code to estimate the Madelung constant for CsCl lattice:
Cs at (0,0,0)
Cl at (0.5, 0.5, 0.5)
Answer: Converged value I am getting is 0.465. ...
4
votes
1
answer
669
views
Is my differential equation solving code wrong?
I am trying to simulate LLG equation without damping. The equation is
$$\frac{d\vec{m}}{dt} = \vec{m}\times\vec{H}$$
I am solving in spherical coordinates as LLG equation is known to have problems in ...
2
votes
2
answers
1k
views
Understanding leapfrog integration algorithm
The leapfrog.cpp is an implementation of leapfrog integration algorithm where f() function is being integrated:
leapfrog.cpp
<...
0
votes
1
answer
77
views
In level set fluid structure interaction method why can we rewrite the elastic force in this form while there is no shear force?
when we consider a Immersed Membrane Without Shear, we can define a regularized elastic energy as $$\mathcal{E}(\varphi)=\int_{\Omega} E(|\nabla \varphi|) \frac{1}{\varepsilon} \zeta\left(\frac{\...
1
vote
0
answers
79
views
Solving perturbed Einstein Boltzmann equations using RK4
I'm trying to learn to numerically solve the perturbed Boltzmann-Einstein equations in cosmology using the RK4 method.
These are the equations:
$$\dot{\Theta}_{r,0}+k\Theta_{r,1}=-\dot{\Phi}$$
$$\dot{\...
0
votes
0
answers
56
views
OpenFOAM- write interval changed after restarting simulation
I am running a pimpleFoam simulation on a supercomputer. I have to submit it as a job which has an allocated time. The simulation I was running ran out of this allocated time. So then I restarted it ...
0
votes
0
answers
158
views
Damping not working in Verlet simulation with absolute constraint
I'm trying to build a simple physic simulation with Verlet intergration, which I'm currently implementing as such:
...
1
vote
1
answer
57
views
Will hashing become vulnerable to quantum computers?
My knowledge of these subjects is reasonable but limited so please correct anything I say that is wrong.
As I understand a hash, with today's technology, is virtually irreversible.
Also, any good hash ...
1
vote
1
answer
310
views
Euler's Method for fast moving particle trajectory
I'm trying to figure out how a magnet affects the trajectory of a particle travelling near the speed of light downwards toward the ground. The equation for the force of the magnetic field is pretty ...
2
votes
0
answers
108
views
How can we symbolically working out $\phi^4$ theory green's function/propagator and consequences in python?
I am having some difficulty calculating Green's function symbolically in Python for $\phi^4$ theory.
The specific rendition of the $\phi^4$ theory I have in mind can be written as follows.
$\mathcal{L}...
0
votes
1
answer
157
views
Lattice Boltzmann method parallelization
I'm learning about the lattice Boltzmann method (LBM) and how it can be parallelized. On Wikipedia, they say, "The LBM was designed from scratch to run efficiently on massively parallel ...
0
votes
0
answers
63
views
What happens at the interface between a solid and a fluid?
I am doing an MPM simulation of water colliding against a solid, I am currently encoding the model for collision forces and I am realising something isn't clicking.
Let us assume the fluid experiences ...
1
vote
1
answer
107
views
Isolating decaying solutions to nonlinear second-order ode
I need to solve a nonlinear ODE of the form
$$
\frac{d^2 y}{dx^2} + \frac{1}{x}\frac{dy}{dx}-\frac{1}{x^2}\sin(y)\cos(y)+\frac{2}{\alpha}\frac{\sin^2(y)}{x}-\sin(y)=0
$$
numerically, subject to the ...
0
votes
2
answers
171
views
Approximating the solution of a non-linear ODE using Python
This is my first time asking a question here, so please tell me if I have made a mistake or if anything is unclear.
I am working on my high school research project on the motion of a ball falling ...
1
vote
0
answers
44
views
Stress and periodic boundary conditions
In the textbook definition of the stress tensor it is defined at each point in space and therefore position dependant.
When three dimensional periodic boundary conditions are used, I have seen it ...
2
votes
0
answers
150
views
How can I incorporate angular momentum in this code?
I'm currently working on the 3-body problem, and I was writing a code to plot the trajectories of all 3 bodies while also manipulating the angular momentum of the system. I found a code online and ...
1
vote
0
answers
31
views
How can the current-voltage relationship of a series of tunneling junctions be most easily computed?
I'm working on a research project with my professor where we're trying to figure out how to determine the necessary semiconductor composition for a solar cell to have a particular bandgap in order to ...
2
votes
2
answers
1k
views
Problems solving 2D heat equation using physics-informed neural networks
I am trying to solve 2D heat equation using the physics-informed neural networks approach. The training loss is decreasing, but my final network outputs make no sense. I am using Python/Pytorch.
2D ...
0
votes
1
answer
132
views
finding weak form of nonlinear differential equation for FEM simulation
The following is the well-known nonlinear differential equation for director's distribution at static equilibrium in liquid crystal displays(LCD). I want to obtain weak form of the given differential ...
0
votes
0
answers
50
views
I encountered some issues simulating the shape transition of silicon clusters using LAMMPS
==
I have been trying to write an input file for lammps to simulate the shape transition of a nanoparticle of silicon using multiple potentials to obtain the best structure, which I will compare with ...
1
vote
0
answers
76
views
What architecture of CNN to solving a image regression problem (case study: solving Poisson equation)?
I've been working on solving Poisson problem using CNN model (you can ignore the Poisson problem part if you not familiar and jump to the image processing/CNN part). More specifically, I am solving ...
0
votes
0
answers
41
views
Energy potential involvign pressure and viscoscity?
Making a really long explanation short. I am looking for an energy density function for an incompressible isotropic fluid that involves both viscoscity and pressure.
The reason is, there is a way to ...
0
votes
0
answers
64
views
Absence of discontinuity in Specific Heat in liquid-gas transition (Based on the Ising Model)
I'm trying to do a model for the transition liquid-gas based on the Ising model and the metropolis algorithm, instead of using values of spins, I'm saying that a cell is occupied by a particle or not. ...
0
votes
0
answers
55
views
Solving a minimization problem without flattening inputs?
I am reading this paper on improving time steps for solving simulation problems:
https://www.math.ucla.edu/~jteran/papers/GSSJT15.pdf
The authors developed this energy function:
$$E(x) = \frac{1}{2\...
0
votes
1
answer
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 ...
0
votes
1
answer
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 ...
0
votes
1
answer
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 ...
2
votes
1
answer
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 ...
0
votes
0
answers
134
views
Adding stability to MPM simulation?
I am writing a 2D implementation of MLS-MPM, I have fluids working perfetly fine, solids technically work as well, at low time steps.
This is the fluid simulation at a large time step:
https://i....
1
vote
0
answers
62
views
Need help implementing finite difference Beam Propagation Method to Solve 2-D Helmholtz equation
I am trying to implement beam propagtion method in a two-dimensional lattice to solve Helmholtz equation by following the scheme given this paper. I am using Matlab for implementation.
The expected ...