instruction
stringlengths
43
28.1k
Background I am decomposing (and then operating on) a symmetric positive definite matrix (a covariance matrix) as part of a larger system. Dimensions range from O(10) to O(300). The covariance matrices have reasonably dimensioned diagonal elements (i.e. do not differ by too many orders of magnitude), but are very stron...
Are there packages for numerical optimization in julia or python, or in any other system for scientific computing, capable of taking into account the discontinuity of gradient at the minimum point? Functions that I need to minimize have form $$ F(X) = \mbox{max}(f_1(X), \ldots, f_n(X)) $$ where $f_i(X)$ are smooth func...
I am trying to formulate an optimization problem where the decision variable is an index of the input array as part of the formulation. For example, I have the following term (this is simplified): $A[ max_t ( \alpha[t] * t ) ] $ A is an input 1D-array $\alpha[t]$ is the integer decision variable So my questions are...
Suppose $A$ is an $m\times n$ matrix with $\operatorname{Tr}(AA^T)=1$. Let $\sigma_i$ be the vector of singular values of $A$. How would I cheaply estimate the following quantity? $$\rho(A)=\sum_i \sigma_i^4$$ Motivation: $1/\rho(A)$ is a measure of "effective rank" of $AA^T$, a numerically stable alternative to algeb...
shape functions are the basis functions that interpolate a function in a subdomain using polynomials. linear interpolation is probably the most convenient approach which results in so-called "tent" functions. a combination of tent functions gives any desired piecewise linear interpolation. The idea can be generalized t...
currently I am solving 2D nonlinear second order differential equation containing mixed derivative. I started searching how to descretisize it and found two formulas for 4th order approximation. First one is just kronecker product of first derivatives $D_x\otimes D_y$. Here is fist question: what is resulting order of ...
Could someone please explain why my implementation of the Crank-Nicolson method applied to the non-steady heat equation won't converge? There shouldn't be any nonlinear aspects to my implementation but scipy's sparse conjugate gradient solver won't seem to converge even when I ramp up the maxiter parameter to 1000. Sci...
The (generalized) eigenvalue problems with a multiple eigenvalue are the ill-posed ones. I have two questions that should be simple for experts: (1) Is the eigenvalue problem much more sensitive to errors for matrices with a cluster of eigenvalues close to each other or for matrices with multiple eigenvalues? (https://...
I am applying a central Finite Difference scheme in space and an implicit Euler scheme in time on a variant of the 2d Burgers equation, of the form:$$u_t + uu_x + uu_y = \nu(u_{xx} + u_{yy})$$ where $u$ is an unknown variable that depends on x,y and t, and $u_t,u_x,u_y$ are the single derivatives of $u$ with respect to...
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 algorithm is completely symmetrical, which I believe means there is a 1:1 relationship between any possible input and o...
Intro and disclaimer: this question concerns developing a career in Scientific Computing in industry, starting from an (applied) mathematics background, say an MSc. It definitely arises from my current, personal situation but I think that formulated as is, it is not opinion based and can help also other people. I am ba...
I'm reading this set of notes on numerical stability of the diffusion equation. I can't seem to derive equation (7.17) from the previous equation. I've tried using $\sin^2(\theta)=\frac{1-\cos(2\theta)}{2}$, I've tried looking for the maximum using the first order optimality conditions. I'm missing a trick. Any help wo...
In computational plasma physics, one often faces problems with extremely high transport anisotropy, 1e6 and more, since transport along the magnetic field is much faster than across. To deal with this in numerical simulations, the common practice is to align the computational grid with the magnetic field, i.e., using g...
The short of it: How can I port bind an interactive transient PBS session to the head node and then port bind the head node to my local machine? So, a chain of port bind of three machines. More details: Disclaimer: I am not totally sure if I understand the minutiae of the differences between port binding and forwarding...
Consider a set of points. For simplicity, let's say that those are 2D points (although the problem works in higher dimensions as well). The goal is to find the minimum possible length of a connected 1-dimensional curve, such that it passes through all the points. Intuitively, the curve will consist of straight lines bu...
I'm trying to build a simple physic simulation with Verlet intergration, which I'm currently implementing as such: tmp = currentPosition currentPosition = currentPosition * 2 - this->previousPosition + acceleration * timeStep * timeStep previousPosition = tmp acceleration = Vector2(0, 0) ...
I have heard that one should avoid varying all parameters in a GSA by the same amount (e.g., 10%, 25% etc.) because it suggests that uncertainty is the same for all parameters. This makes sense to me if we have decent estimates of uncertainty for all the input parameters. However, what happens if there are many paramet...
I am trying to build a Python code that solves a set of coupled differential equations which will be spatially discretized by the method of lines advancing in time. I am planning to use solve_ivp. In my problem, the conservation of species includes the product of gas density and mass fraction of species in the time der...
I have been doing a lot of self-study on numerically solving PDEs so that I can solve system of linear and nonlinear Advection-Diffusion-Reaction (ADR) systems on complex meshes. I have been watching some wonderful videos by Qiqi Wang, as well as reading the books by Langtangen and by Larson and Bengzon. I have also us...
this may be irrelevant for people who need fast code. But for me it's just the opposite -- i.e. in the specific situations when I know that the extra time allows me to make my calculations more accurate, I'm willing to wait for 5 minutes to modify a 1-minute sound file (I'm not joking). My question has two parts. Conv...
Note: This is my first question on stackexchange; please tell me if I'm doing something incorrectly. I am trying to calculate a series of a 2D integrals in Python with an integrand that has several highly localized peaks. I've been using scipy.integrate.dblquad. However, repeatedly evaluating this integral for a series...
Is there a general procedure to detect if in a system of m-nonlinear equations (also non polynomial) of n-unknowns some of the equations are redundant? Can the rank of the Jacobian matrix tell me something? The systems I handle is usually underdetermined, so m is less or equal to n. How I numerically solve the system: ...
Hi this is my first question on the platform so feel free to comment if I have a mistake regarding the question. I'm working on an ellipse detection scheme in which I have markers consisted of 3 concentric circles. I'm able to find the inner and outer circles via fitEllipse method and some thresholding techniques in...
I'm having a program to compute the solution for a fluid-structure interaction model (blood and blood vessel walls) using FEM in MATLAB. The program is running fine but the function that I'm representing doesn't look too well. The differences between the values are too big and the function looks quite spiky. Here are ...
In finite element textbooks there are error estimate inequalities like $e<~h^p$ or $e<~N^{-p/d}$, where h is the FE length scale, d the # of dimensions, p the FE order, N the # of DOFs. Are these only valid for linear PDEs? If not, are these valid for all well defined PDEs with good regularity?
I have the following problem in 1-D: \begin{equation} \partial_t u(t,x) = v(x)\partial_x u(t,x) + \kappa(x) \partial_{xx} u(t,x),\,x\in\Omega;\quad \partial_{\nu}u(t,x) = 0, \,x\in\partial\Omega. \end{equation} I use the standard 3-point stencil for $\partial_{xx}$: $\frac{1}{h^2}\begin{bmatrix} 1 & -2 & 1 \end{bmatrix...
Disclaimer: I previously posted this on SO, but though it would be more relevant for scicomp. The original post has been deleted. I have been trying to recreate the functionality provided by MATLABs ordschur function by calling LAPACK directly (MATLAB uses LAPACKS dtrsen function to do its computation). More specifical...
I am working on fitting analytical curves to experimental data obtained in real viscoelastic tests (in fact, static creep tests). The setting of the problem is: the experimental data I have is a set of data points $(t_{i},y_{i})$ sampled equidistantly in time (i.e., $t_{i+1}=t_{i} + \Delta t$, in which $\Delta t$ is f...
Hi I have a problem to calculate lowest eigenvalue in non-symmetric matrix using Arpack, because my matrix is very complicated and even I have a lot of trouble to made a matrix - vector multiplication. But the Arpack can calculate only the largest magnitude with the simple matrix - vector multiplication, what I know to...
I've heard that matrix is inversion is unstable whereas the SVD is stable. Now, if $A$ is an invertible matrix, then its SVD is $$ A = USV^T $$ Then wouldn't it's inverse just be $$ A^{-1} = (USV^T)^{-1} = VS^{-1}U^T $$ If the inverse is computed this way, why would it lose stability? Because of the multiplications? ...
What could be the best way to implement the roller constraint in finite element code, i.e. constraint of the type $$\mathbf{u} \cdot \mathbf{n} = 0$$ I plan to enforce it in the weak sense by incorporating $$\int_\Gamma \lambda \mathbf{u} \cdot \mathbf{n} \, dA$$ into the weak form. However, it needs to define the Lagr...
I would like to calculate derivative of a given function ( a 1D array) using Array. Here is the code import numpy as np import matplotlib.pyplot as plt Lleft=-np.pi Lright=np.pi L=Lright-Lleft nx = 128 dx=L/nx x = np.linspace(start=Lleft, stop=Lright-dx, num=nx) u0=np.sin(x) #initial_profile uhat = (1 / nx) * np.ff...
Suppose the metric is abs(a-b) <= rtol * max(abs(a), abs(b)) i.e. math.isclose with atol=0. The default for float64 is rtol=1e-9. numpy.allclose uses rtol=1e-5. Both 1e-9 and 1e-5 make sense to me for float64, depending on application - former for stricter equality, latter for engineeresque "good enough". What I seek ...
I have a masters in maths and have been working in industry for a couple of years. Since I specialized more towards pure maths during my studies (theoretical PDEs), I have found myself needing to pick up many computational skills when I started working. Now, I have gained an interest in computational problem solving an...
I have a binary quadratic program with a convex objective function, of the form, \begin{align} \text{minimize}\;\;& x^tAx+b^tx\\ \text{subject to}\;\;& x_i\in\{0,1\} \end{align} where $A$ is positive semidefinite. I've played around a bit with semidefinite relaxations of this problem, but after some empirical testing, ...
It is straightforward to solve the eigenproblem $$\hat{k}^2 \psi = E\psi$$using a finite-difference method. But what about$$\hat{k}^2 \psi = E(1+\alpha E)\psi$$I know it is possible to first solve the case where $\alpha = 0$ and then work out $E$ by solving the quadratic equation $\alpha E^2 + E - E' = 0$. But is it po...
I am looking for AMR/re-meshing software (structured grids would suffice) that is NOT based on quad-octrees, i.e., a fixed refinement rate of 2 but (ideally) something user defined, i.e., ratios of 1.2, 1.5, ... of coarse to fine. Of course, this is a bit more complicated than the standard quad/octree styles, since (fo...
Matrices that achieve the worst case $\rho_n = 2^{n-1}$ element growth in LU factorization with partial pivoting are known; see e.g. Theorem 9.7 in Higham, Nicholas J., Accuracy and stability of numerical algorithms., Philadelphia, PA: SIAM. xxx, 680 p. (2002). ZBL1011.65010. Similar element growth bounds are known for...
From the book "Understanding the Finite Element Method" by Mark S. Gockenbach (Chapter 7), there is stated an integral: $$ \int_{T_k} \kappa \nabla \phi_i \cdot \nabla\phi_j. $$ for a triangle denoted $T_k$. The gradient $\phi_i$ is denoted as: $$\nabla \phi_i = \begin{bmatrix} b_i \\ c_i \end{bmatrix} {on} \hphantom a...
I'm simulating an electromagnetic wave that has a real and imaginary part. Something like: $$ E(x,t) = A(x,t) e^{-i(\omega t - k x)} $$ Where $A(x,t)$ is some complex amplitude. Then taking the physical intensity: $$ I(x,t) \propto |E(x,t)|^2 = A(x,t)\cdot A(x,t)^* = |A(x,t)|^2 $$ Now then if I take the FFT of a bunch...
A number of numerical problems are easy to solve when condition number $\kappa$ of the problem is low. For instance, conjugate gradient descent complexity scales as $O(\sqrt{\kappa})$. However "condition number" is numerically unstable, becoming meaningless for large problems a system that's well conditioned for all ...
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 with startFrom latestTime; and writeInterval 0.01; in the controlDict, it started printing out many intermediate time r...
I'm not a mathematician, so sorry if I miss some obvious stuff. I'm trying to develop a bot for StarCraft 2, in particular the army control for it. For every army of the enemy, I want to find the minimal possible combination of my units that will be able to defeat it. For example, if I have 20 marines, 10 tanks, and 10...
I have a non-convex region (may contain holes). I want to: Fill region with rectangles No restriction on size or number of rectangles Maximize the area occupied by rectangles Minimize number of rectangles Avoid rectangle overlap Have rectangle axes aligned with bounding box's axes Are there standard heuristic approac...
Suppose we have a fourth-order parabolic PDE $$\partial_t u + a(t)\Delta( \Delta u) - div( b(x,t)\nabla u) =0$$ We split the equation into two second-order equations by introducing $w = \Delta u$ thus $$\partial_t u + a(t) \Delta w - div(b(x,t)\nabla u) =0$$ $$-\Delta u + w =0$$ I discretise the first equation as $$ \...
I'm looking for the "official" name(s) for a procedure for optimizing a convex loss function over a convex subset. This seems to be a default/naïve algorithm that folks come up with before learning the various barrier/penalty methods. I've seen things vaguely like this re-implemented a few times, from first principles ...
I am solving for a dynamic linear elasticity problem: \begin{equation} \dfrac{\partial^2 u}{\partial^2 t} - \nabla \cdot \sigma = f \end{equation} where $ u \in R^2 $ with sufficient BCs and initial values both on $ u $ and it's time derevative. After dicritization with FEM I get the standard: \begin{equation} M \dd...
In Finite Element Analysis, one requires to approximate the solution in terms of basis functions. My questions is, which method in general is better? by 'better', I mean which involves less number of unknowns to yield a certain accuracy? Let the solution of the problem be continuous and smooth in the domain of interest...
I am trying to solve a problem in python using scipy's solve_ivp. The system of ODEs I am trying to solve is for coupled where I am solving for two time-dependent variables: f and T. The derivative of T is in the following format: $$ \frac{dT}{dt}=g(t)+\frac{T}{f} \times \frac{df}{dt} $$ Where $g(t)$ is some function (...
I'm trying to understand the approach described in these questions: How to efficiently implement Dirichlet boundary conditions in global sparse finite element stiffnes matrices How to apply non zero Dirichlet boundary condition in finite elements? While I understand what's happening, I don't understand why the approach...
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{\Theta}_{r,1}+\frac{k}{3}\Theta_{r,0}=\frac{-k}{3}\Phi $$ $$\dot{\delta}+ikv=-3\dot{\Phi}$$ $$\dot{v}+\frac{\dot{a}}{a}v...
The aim is to construct symmetric Laplacian matrix $L$ for 2D square domain. I have the following discretization of second derivatives on non-uniform grid (will skip the steps of derivation, any textbook works). velocity vectors $u$ and $v$ are defined on cell faces, $x_i$ corresponds to $u_{i+mk}$, where m is amount o...
Some context of what I am trying to do: I am trying to implement a function that uses the heat method to calculate geodesic distances in a tetrahedral mesh, and I want to calculate the distances for multiple possible starting points. The final part of the heat method is to calculate a solution of $Lu = b$, where $b$ is...
I have a 3D vector field and I want to extract its divergence-free part (also called transverse component), using the Helmholtz decomposition. In principle, this can be done in the Fourier space, as illustrated here in the proof (and also reported here). I wrote this Python function, implementing this straightforward c...
Consider the finite element discretisation of a general second order linear differential equation, with mixed boundary conditions at the end. The boundary conditions are given as $\alpha_0u'(0)+\beta_0u(0)=\gamma_0$ and $\alpha_1u'(1)+\beta_1u(1)=\gamma_1$. Where $u$ is the dependent variable and the domain is $(0,1)$...
According to this link, All eigenpairs of large sparse symmetric matrix. The guy @Baranas seems to have given a very confident answer about solving the whole Eigen spectrum. May I know if anyone has any suggestions on what he is talking about or suggestions on what software to use (currently thinking about SLEPc) that ...
Given some function f(x) and a set of points A representing a linestring (or polygonal chain), I am searching for the point on this linestring that minimizes f(x). An iterative approach would be to do gradient descent and use the linestring direction for linesearch. However, I want to find a non-iterative solution. How...
I am trying to move completely open source. One of the things my research group does is cohesive zone modelling using traction separation laws, which I currently implement in ABAQUS. How easy would it be to write my own code for this? Our geometry is very simple, just two beams which we assume are linear elastic. Are t...
I'm typically using FEM for solid mechanics problems and when I look into performing fluid-structure interaction, I saw they use FV or SPH method for the fluid domain. I'm not an expert in fluid simulation but considering the Navier-Stokes pdes, I can see that they can well be discretized by FEM. Regardless of the inst...
Given a bivariate polynomial system with variables $(x, y, z)$ like (1) $ f_1 = x * a_1 + y * a_2 + z * a_3 = 0 $ (2) $ f_2 = x * a_4 + y * a_5 + z * a_6 = 0$ (3) $ f_3 = x^2 + y^2 - 1 = 0$ how do I determine the solutions/roots numerically? So far, I found out that I can reformulate the equation system into a matrix a...
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{\varphi}{\varepsilon}\right) d x$$ then after some operations we get **Theorem 3.**4 The temporal variation of $E$ given by th...
Consider an ODE system $$\dot x = f(t, x), \quad x(0) = \xi.$$ A collocation method to solve this ODE (1) assumes that $x$ can be approximated as a polynomial $x(t) \approx \sum_kx_kp_k(t)$ and (2) chooses the coefficients $\{x_k\}$ so that the initial condition is satisfied and so that the ODE is exact at some finite ...
I would like to make a table of values of (for example) Stirling numbers of the second kind. Is there any program that calculates those values from the reucurrence relation or combinatorial definition? Stirling number of the second kind S(n,k) is the number of ways to partition a set of n objects into k non-empty subse...
A function $f$ is strictly convex if $$f((1 - \lambda)x + \lambda y) \le (1 - \lambda)f(x) + \lambda f(y)$$ with equality if and only if $x$ and $y$ are equal. This implies that the second derivative of $f$ is positive-definite. A strongly convex function is one where we also have strictly positive lower bounds on the ...
Hello Computational Science community, I am working on modeling a dynamic system that involves homeostatic regulation in Python and I could use some guidance on how to implement it. Here's a brief overview of the problem: Background: I'm trying to simulate a biological system where different metabolites (chemical speci...
Question: How much would a simplified feed model in an EM simulation alter an antenna's directivity and the E-field phase reading when compared to using a more complicated/realistic feed model? I am simulating a set of custom metal pieces using MATLAB antenna toolbox (MATLAB uses Method of Moments). Originally, I wish ...
I asked this on the Physics site, but it fits much better here, and I now can ask a more specific question. For the scope of the problem, I have a 250-mL bottle filled with pure water and a sampling line at the bottom slowly draining the bottle to analyze, say 2.5 mL/min. The bottle is on the order of 10 cm high. Since...
I would like to make a table of values of a sequence similar to Stirling numbers of the first kind and for the Stirling numbers of the first kind. Stirling numbers of the first kind $c(n,k)$ satisfy the following polynomial relation: $$x(x+1)(x+1)...(x+n-1)=\sum_{k=0}^{n} c(n, k) x^k$$ What is the code in Python that c...
I have small dense square matrices for which I would like to compute the inverse by singular value decomposition, or equivalently solve the eigenvalue problem. While there are many direct methods for the solution or inverse of square matrices (eg gaussian elimination or LU decomposition) there is no such thing for the ...
Do any Density Functional Theory (DFT) codes (for example, QE ABINIT, Fleur, ....) provide the availability of getting the density of states (DOS) which produced by each iteration of the Self-Consistent Loop? If no, so, how can I get them? Thanks in advance!
There are some great libraries with linear solvers for sparse matrices - SuiteSparse is the obvious one. The methods work on sparse matrices with scalar entries. However, often in optimization problems, the matrices consist of dense sub-blocks within a sparse structure. Are there any solver libraries that define block ...
The leapfrog.cpp is an implementation of leapfrog integration algorithm where f() function is being integrated: leapfrog.cpp #include <cmath> #include <vector> struct Particle { double x, y, z; // positions double vx, vy, vz; // velocities }; // Function to calculate f(x, y, z) void f(const Particle& particl...
I am reading up on deep learning and I am trying to understand the backpropagation methods in python nanograd. See; https://github.com/rasmusbergpalm/nanograd This is a method for computing the gradient, however I cannot seem to decode what is going on here. Can anyone help me understand this? Maybe by running through ...
I have a complex monte-carlo cashflow model that traditionally uses the finite difference (FD) method to calculate its derivative at any given point. To improve model performance, I coded forward-mode automatic differentiation (AD) to directly calculate the cashflow derivative. The model is significantly faster using A...
My problem in brief: in some situations, the Runge Kutta 4th order method (RK4) doesn't seem to give 4th order improvement when using a smaller time step. I wonder how this worse-than-expected result can be explained. Consider two identical massive steel spherical balls with radius $R$. The values of the relevant prope...
We are looking for a code to list all maximal bicliques in bipartite graphs efficiently, as we want to run it on (large and sparse) graphs, with up to roughly a million nodes and edges in no more that a few hours. In the literature, we know this fast implementation which implements the algorithm presented in "Efficient...
I would like some tips in figuring out a good algorithm to find the solution of the following system. Let $\theta$ be a constant in $(0,1)$, let $i,l=1,...,N$, let $a_{l}$ and $b_{i,l}$ be some constants with $a_l \in (0,1)$ and $b_{i,l}>0$ for all $i,l$. Consider the following system of equations in unknowns $z_{1},.....
Suppose that I have a function of, say, three parameters, $f(p_1,p_2,p_3)$ whose output is a field(s) (e.g. velocity field) and is dependent on some real-valued parameters (e.g. viscosity, density, temperature). This function $f$ is computed by some pde solver and is expensive to compute and store. I want to compute $f...
The first routine instantiates numAtoms number of atoms and distributes them in a 6*6*6 grid. The second routine populates the atoms with initial velocities. I want to write a unit test for this routine. Can you give me some ideas on how to do it? NOTE: I know how to write unit tests using GTest. That is not the issue....
I wrote this minimal example to examine the Leapfrog integration algorithm. However, I am not sure it is the correct algorithm, and the listing is giving the correct output. Is this the Leapfrog algorithm? NOTE: I am using the Lennard-Jones system. NOTE-2: I am using C#. using System; public class Vec3 { public do...
% Example1a % % This script demonstrates the use of the Fem code to % solve the BVP % % -div(k*grad u)=f in Omega, % u=g on Gamma_1, % k*du/dn=h on Gamma_2. % % Here Omega is the unit square, Gamma_1 consists of % the top and left edges of the square and Gamma_2 is...
Integration Algorithms The Verlet leapfrog algorithm is an economical version of the basic algorithm, in that it needs to store only one set of positions and one set of velocities for the atoms, and is even simpler to program. The equations defining this algorithm are as follows: ${{v_{{n}+{\frac{1}{2}}}}} = v_{{n}-...
I'm testing libraries for numerical computing and time they take to calculate SVD. During testing I encountered an issue for which I don't have an answer. I generated 2 matrices: random tall matrix using Matlab with function randi([10,50],6000000,6) matrix of the same shape combining vectors with very different ranges...
In Abaqus, there is an option NLGEOM to turn on the geometrical nonlinearity. But I'm not clear what it does specifically. Because it also works with UMAT written for small strain formulation, i.e. using infinitesimal strain and return Cauchy stress. For NLGEOM, does it take in Green-Lagrange strain and convert the Cau...
I was wondering whether there is a closed formula for the eigenvalues and eigenvectors of the discretized Laplacian in (edit) $[0,1]^n$ with a uniform grid, using what I imagine is a $2n+1$ stencil. Furthermore, I was wondering whether there is some existing material on how to create random weighted sparse (graph) Lapl...
I have a set of sparse matrices modulo 2 (i.e systems of equations in the format "a XOR b XOR ... XOR c = 0 or 1" compressed by me into reduced row echelon form). This is a rather large set (1 million matrices). Some of them interact with each other. For example if a matrix contains the row "a XOR b = 0" and another "a...
I am staring intently at this paper by Botsch and Kobbelt. In particular, I want to make the matrix specified in equation 5. I am trying to understand the specific computations I must instruct a computer to produce the matrix. The firs thing I tried is to check both wikipedia and this book (Appendix A.1) in both cases ...
Lennard-Jones force can be computed in two different ways: Version #1: Here, the force computation is a self-contained routine. Vec3 lj_force(const Vec3& r) { double r_mag = std::sqrt(r.x * r.x + r.y * r.y + r.z * r.z); double s_over_r = sigma / r_mag; double s_over_r6 = s_over_r * s_over_r * s_over_r * s_o...
It seems that proving the statement given in the question https://math.stackexchange.com/questions/4601532/a-pen-and-paper-proof-for-a-matrix-implication is difficult analytically. I was thinking what sort of different computational approaches we can take to show that the conjecture is true ? The conjecture is as follo...
I have to build a bilayer using a structure obtained in a previous MD simulation. In the structure, some chains of the molecules cross the simulation box as shown below. I added water layers to the structure as below. Since some of the structure parts are oriented out of the box, I would like to know whether doing the ...
I am searching for a library that can perform adaptive mesh refinement (AMR) on large distributed unstructured meshes. For now, the cells are high-order quads/hexa. I was looking into p4est, which is well-maintained and scales well. I am completely new to AMR, but as far I understood, the forest in p4est consists of on...
Suppose, I have the following listing for a barebone MD simulation: #include <iostream> #include <vector> #include <cmath> #include <random> #include <fstream> typedef double real; // Constants for Argon constexpr real epsilon = 119.8; // Depth of the potential well (in K) constexpr real sigma = 3.405; // Dista...
Part 1, but I'll repeat here. This time we'll move the top boundary. I have a container of water with initial volume $V_0$ and height $L$, open at the top which receives a constant mass flux $\phi$. A sampling line is placed in the container all the way to the bottom which drains the container at some rate $f$. This me...
I am aiming at developing a simulation software mostly aimed at reactive fluid flows applications. Here are a simplified list of points to drive the initial choices (code structure, libraries...): I aim at implementing high-order finite-volume schemes, e.g. WENO5 I aim at using high-order time integrators, fully-impli...
I'm interested in examples of very effective methods in scientific computing that are the sum or naive combination of very ineffective or bad ones.
I asked this question on the math stack exchange and got an answer, but I am just as utterly confused as before. My fundamental goal is to actually construct the matrix, that is, a series of steps I can tell an actual computer to build it up. The gist of it is that there is a 2004 paper called "An Intuitive Framework f...
The Lennard-Jones potential is typically expressed mathematically as: $$ V(r) = 4 \varepsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6} \right] $$ where: $V(r)$ represents the potential energy as a function of the distance $r$ between two particles or molecules. $\varepsilon$ is the...
hello I am trying to numerical simulate the band structure of the one-dimensional periodic arm chair edge states, I use the pybinding model to construct and simulate the arm chair edge states, because we need to use a 4-site lattice to construct the arm chair edges, I believe this causer some problem with the later ca...
Consider a one-parameter family of matrices $A(q)\in \mathbb{R}^{n\times n}$, $q\in\mathbb{R}$. For my applications, $n$ is typically between $5$ and $50$ and $A(q)$ is generally dense, so direct methods for obtaining the entire spectrum of $A(q)$ are applicable and not too expensive. I would like to analyze the eigenv...
I understand the computational implementation of the PC and PI bcs in cartesian case. In terms of the magnetic field components for PI, we have $B_x = B_y = B_z = 0$, and for PC, we have $\partial_x B_x = \partial_x B_y = \partial_x B_z = 0$, given that $x$ is the normal direction to the boundary. Let's say you have a ...