instruction
stringlengths
43
28.1k
Correct me if I'm wrong, but when least squares is used in the computational science community, it's typically not in the context of regression. It could be used to solve for gradients in discretized PDEs and for other things. In these kind contexts, is there any relevance to consider considering statistical aspects su...
I want to create a mesh for a 3D surface with coordinates defined by a parametric function. Is it possible to define this mesh using Gmsh? If it is not possible, what free software do you recommend me?
The FTCS method comes from the discretization of a diffusion PDE like this: $$ a^{2} \frac{u_{i+1}^{k}-2 u_{i}^{k}+u_{i-1}^{k}}{\Delta x^{2}}=\frac{u_{i}^{k+1}-u_{i}^{k}}{\Delta t} $$ If I have the FTCS method in the Finite difference method: $$ u_{i}^{k+1}=r\left(u_{i+1}^{k}+u_{i-1}^{k}\right)+(1-2 r) u_{i}^{k} \qquad...
I recently started to learn OpenMP. Albeit I have developed some intuition I still have some doubts on how to proceed under certain circumstances that are very useful for computational physicists. My question: In molecular simulation is typical to find central forces, $F=F(r)$ where $r = |\vec{r}_i -\vec{r}_j|$ for par...
I am looking for recommendations on matured C++ solver for Linear Sparse Algebra problems. The goal is to select between more or less GPU hardware agnostic libraries/frameworks that can be compiled on both Linux and Windows with quite high control on host-device memory. My current research narrows down to the following...
I am studying an implementation of a 3rd semi-implicit Runge Kutta method (siRK3) from the book by Villadsen & Michelsen (1978), Solution of differential equation models by polynomial approximation, Prentice-Hall. The code expects an analytically evaluated Jacobian matrix $J = \partial F / \partial y$. In the calculati...
Let $\Omega \subset \mathbb{R}$ in a bounded polygon domain and $f:\Omega \to \mathbb{R}$ known function.We split the boundary into two parts $\partial \Omega_{1}$ and $\partial \Omega_{2}$ such that $\partial \Omega =\partial \Omega_{1} \cup \partial \Omega_{2}.$ The elliptic problem of Dirichlet & Neumann conditions...
I am working on implementation of AMR for my finite volume code. Let me use a 2-D mesh to describe my question. Starting with SINGLE initial cell (let the mesh refine level k = 0) as a root of a quad-tree, and keeping splitting the cell into 4, 16, 64... sub-cells for k = 1, 2, 3...during refinement is simple and works...
I came across this post at Cleve's Corner, where he shows that complex step differentiation is more accurate than central differences. The error in both methods is $O(h^2)$. So why exactly does complex step differentiation yield much better results? Is is because the constants hidden in $O(h^2)$ are much better for com...
I have difficulty understanding how to generate a Gaussian random field from Karhunen--Loeve expansion. Precisely, I need to generate a zero-mean field with covariance function $C(x, y)$. We find eigendecomposition of $C(x, y)$ from the equation: $$ \int_0^1 C(x, y)\, e(y)\, \mathrm dy = \lambda \,e(x) $$ I discretize ...
I'm reading Convex Optimization by Boyd and Vandenberghe. This is how they describe Slater's condition: What I don't understand is why it is necessary to enforce that $x$ be in the relative interior of $\mathcal{D}$, where $$ \mathcal{D} := \bigcap_{i = 1}^m \text{dom}(f_i), $$ i.e., it is the intersection of the doma...
In terms of time-step, numerical error in molecular dynamics scales with square, i.e. $error \approx dt^2$. But how it look for numerical precision ? E.g. how much bigger will be numerical error when I use half precision, instead single and single instead double ?
I know that the definition of the Lipschitz continuity is defines as $$||f(y) - f(x)|| \leq L ||y-x||$$ My professor told me that by knowing $f$ we can find constant $L$ using the power iteration method, which essentially computes the maximum eigenvalues. Yet I don't see how definition above is related to searching fo...
I am trying to compute the natural frequency of a cantilevered beam. The Euler-Bernoulli equation reduces to the following problem : $$ v''''=\lambda v, \text{with }, v(0)=0, v'(0)=0, v'''(1)=0,v''(1)=0 $$ where superscript $'$ correspond to derivation. These are the steps to obtain a solution: reduce the problem to...
Note: I previously posted this question to MathStackExchange, but got no attention there. So I'm rewritting and trying over here. Problem summary Given a common¹ set of shape functions defined at master element space $\{\psi_j(\xi,\eta)\}$ and associated to each corner $j$ of that element; We can compute the affine tra...
I want to solve the first-order differential equation $$ \begin{align} \frac{d\alpha}{d\phi} = \frac{\phi \sigma^2 \sin(2d\alpha)+2d\sinh(\sigma^2\alpha \phi)}{-\alpha \sigma^2 \sin(2d\alpha) +2d\cos(2d\alpha)+2d\cosh(\sigma^2\alpha \phi)} \;, \end{align}$$ where $d$ and $\sigma$ are fixed. I can't obtain a soluti...
Every now and then there are questions asked in this site related to the shooting method for boundary value problems (see 1, 2, 3). Nevertheless, in some of the cases that I have seen here, the problem is better solved turning the boundary value problem into an algebraic system directly using a discretization method su...
EDIT: Added another, more suitable, example below. Disclaimer: With edge map I mean an image given as bitmap just consisting of black and white pixels. Short description: Briefly, I'm searching for fast, practical algorithms (or, even better, working implementations) to extract the parameters of (complete, possibly ro...
I'm specifying the 'JPattern', sparsity_pattern in the ode options to speed up the compute time of my actual system. I am sharing a sample code below to show how I set up the system using a toy example. Specifying the JPattern helped me in reducing the compute time from 2 hours to 7 min for my real system. I'd like t...
My problem lies in constraining state variables (look for 23,24,25). I am currently using ODE45 to solve equations and fmincon to find best control variable.How would you go about solving this? Here is my code so far: function ster_6 optionsopt = optimset('Display','iter-detailed','Algorithm','sqp', 'TolFun', 10^(-...
I keep coming across phrases like "highly optimized BLAS kernels" with "architecture-specific optimizations", but have never been able to find what exactly these optimizations are, and how one could go about writing their own architecture-specific optimizations. What is a good way of getting to know different BLAS impl...
I set out to solve the time harmonic Maxwell equation numerically which was discritzed using FEM and with the use of Nedelec elements as basis and test functions. The equation reads: $$ \nabla \times \nabla \times E \, \, - k^2_0E=0 \quad \in \Omega $$ subject to the boundary conditions $$ n \times E =0 \quad \in \Gamm...
SCHRODINGER’S EQUATION $$-ih u_{t}(x,y,z,t) = \frac{h^2}{2m} u_{xx}(x,y,z,t)+ \frac{e^2}{r}u(x,y,z,t)$$ The potential $\frac{e^2}{r}$ is a variable coefficient. So, let’s take the free Schrodinger equation $$-i u_{t}(x,y,z,t) = \frac{1}{2} u_{xx}(x,y,z,t)$$ in three dimensions, where we’ve set $h = m = 1$ and dropped t...
I've recently posted this question. To summarise, I'm dealing with supposedly Symmetric Positive Definite(SPD) matrices, but due to machine-precision they end up not being SPD. In a comment, a user suggested to use the lower triangular portion of the matrix. I would like to be sure in what way we can use that? What al...
The PMMM which stands for parallel matrix-matrix multiplication essentially accelerates the algorithm of the matrix-matrix multiplication of two matrices $A$ and $B$ both of size $n$ so that $C:= AB$. Let us say we have $4$ processors and I wish to know how many words are stored per processor. To my knowledge, since we...
I'm trying to learn how to use finite volume methods and I want to solve a more general case of Stokes' second problem i.e. an infinite half-plane oscillating harmonically with no-slip boundary conditions. I've been following the code from this lecture and changed the boundary conditions to: u[1:-1, 1] = u[1:-1, 2] ...
I'm concerned with trying to determine whether the same computational processes on a Turing computable algorithm can be ascertained for a quantum computer in some form of actual 'metric' for how many resources are utilized by the computer? Is this possible to translate the same complexity to the lowest common denominat...
I am looking at a paper comparing performance of two pricers: same model (based on Monte Carlo simulation) but one implemented on CPU (C++) and one implemented on GPU (Cuda) The paper mentions the time taken to execute N paths (let's say 100k paths) in both cases. Additional information: CPU implementation relies on d...
Good morning everyone. I am working with Python and Pandas. I have two DataFrames, of the following type: df_C = pd.DataFrame(data=[[-3,-1,-1], [5,3,3], [3,3,1], [-1,-1,-3], [-3,-1,-1], [2,3,1], [1,1,1]], columns=['C1','C2','C3']) C1 C2 C3 0 -3 -1 -1 1 5 3 3 2 3 3 1 3 -1 -1 -3 4 -3 -1 -1 5 ...
I posted this question in the astronomy stackexchange. There are no responses, and it was suggested that I pose the question here. The "too long, didn't read" was taken from a comment, and my question is copy-pasted below. TLDR: You're asking about how some kind of classifier might work that accepts a group of traject...
I am trying to get a better understanding of the application of function approximation with machine learning. My question is simple, how does function approximation with ML compare to traditional interpolation methods? EDIT: I had a misunderstanding with interpolation and approximation. My question would be better sui...
Are there techniques to form a Pade approximation (or Pade-like approximation), except force the poles of the rational function to be negative? I am trying to use Pade approximations to extrapolate a curve based on known derivatives of the curve at a point. The Pade approximation usually does much better than a Taylor ...
This blog post describes an algorithm for constructing the finite element global stiffness matrix as two basic steps: [Step 1] Initialize a table with the elements shared by a pair of connected node vertices, as shown below: [Step 2] For each vertex in each element copy the submatrices from the element stiffness matri...
For a scalar variable $u$, the weak form of the following Laplacian: $$\nabla^2 u =0 $$ with the assumption that $v$ vanishes at the boundary is $$\int \nabla v . \nabla u \, d\Omega = 0 $$ which is something you are most probably familiar with, but if $u$ is a vector, I can't seem to get a weak form which is consisten...
It is well known that you can use the algorithm for finding the equilibrium of a Zero-sum game to solve a linear program. In particular, you can take a LP and reduce it to a zero-sum game, and use the famous algorithm for zero sum games proposed by Grigoriadis and Khachiyan. Is this equivalence used in practice, or th...
I am using scipy interpolation to construct a map of two coordinates to two other coordinates --- effectively one set of coordinates are 2D cartesian coordinates (called X and Y), and the other are similar to polar coordinates (radial variable r and angle coordinate t) but with no analytical expressions in term of the ...
I am trying to solve, using the method of lines in Matlab, the wave equation IVP: \begin{cases} \frac{\partial^2 v}{\partial t^2} = \frac{\partial^2 v}{\partial x^2} \\ v(x, 0) = e^{-x^2} & -5\lt x\lt 5 \\ \frac{\partial v}{\partial t}(x, 0) = 0 \\ v(-5, t) = v(5, t) \end{cases} I rewrote the w...
I realize this might be a too general question but here goes nothing: I am trying different re-ordering strategies and checking the fill-in of $A=LU$. I have 2D ($p=1$, $h=1/40$ on $\Omega = [-1,1]^2$) discretizations of the Helmholtz equation and I was genuinely surprised to see Reverse Cuthill-McKee (RCM) outperform ...
For ODEs I have these books: Griffiths, David, Higham, Desmond J., Numerical Methods for Ordinary Differential Equations, 2010 Alfio Quarteroni, Riccardo Sacco, Fausto Saleri, Numerical Mathematics, 2006 I'm looking for references of similar level on the numerical integrations of PDEs. I saw: Evans, G., Blackledge...
I've finally wrapped my head around the advantages and disadvantages of AD/AAD compared to FD and SD, but could someone please explain to me where you'd use AD/AAD in an investment bank/banking generally? If this question has already been answered, feel free to point me in the right direction.
I'm quite new to SDP programming, hence I might not have been able to use the right search terms to find a solution. I try to reformulate an SDP problem to the original form. However a side constraint gives me some headache. Given the problem, where $X$ is a blockmatrix, which can be written like: $$X = \begin{bmatrix}...
I have two 1D grids, each of them is a finite collection of cells, where the cell is defined by the left end and the right end, $[cell]_{i}$=$[x_{i}^{left}$,$x_{i}^{right}$]. I need to find the overlap of these grids, i.e., what cell of grid #1 overlaps with what cell of grid #2, and what is the overlapping area (lengt...
I need to solve a system of linear first order ODEs with boundary conditions in JAVA. I was wondering if any of you know of a JAVA package with the capability of solving a boundary value problems? (i.e. a solver using finite differences or finite elements) The type of equation I want to solve is of the following type: ...
I am solving the Poisson Equation for 2D given by the following expression: $$-\nabla\cdot (k(x,y) \nabla u)=f$$ in a rectangle with Dirichlet conditions on the boundary using Matlab. In principle I have made a code to solve the same problem, but in 1D and the code is as follows: function [U,x]=p1d(n,alpha,beta,a,f)%al...
In John Gustaffson's book The End of Error, he discusses Ulrich Kulisch's exact dot product, which (in double precision) requires a 2100 bit fixed point register which rounds only once after the computation of the dot product is complete. I have found only one statement about how this instruction can be used in numeric...
I have these 3 equations and i want to solve them with numerical methods. so I am using scipy library but I don't know how to solve 3 equations together. R, g, sigma and density are constants. \begin{align} &\frac{d\Phi}{ds} = -\frac{\sin\Phi}{x} + \frac{2}{R} + \frac{\Delta\rho gz}{\sigma}\, ,\\ &\frac{dx}{dx} = \cos\...
This may not be so much of a scientific computing question but more of a MATLAB question, if that is the case, please feel free to close or migrate the question. Root-finding problems are commonly encountered in scientific computing in various shapes and forms; but in this case, the goal is to solve a non-linear time-d...
High dimensional finite difference problems often lead to linear systems of the form $$ A x = b, \qquad A = B_1 \oplus B_2 \oplus \cdots \oplus B_d, $$ where $\oplus$ denotes the Kronecker sum. $B_i \in \mathbb{R}^{n \times n}$ are 1D finite difference matrices, often tridiagonal or pentadiagonal. When $d=2$, for exa...
This is the expression to be derived but I am not getting the exact expression as given in the image. Is the given expression given for the implicit Euler method? Here $N_c = c (\delta t)/h$ and $\tan(\beta_2) = N_c \sin (kh)$.
I have a complex Hermitian matrix of size about $70000\times 70000$. I want about 100 eigenvalues near 0. However, I know that every eigenvalues are two-fold degenerate. I found out that the running time of eigsh is extremely slow (more than 5 times) compared to the situation with no degeneracy. Also, I found out from ...
I would like to ask a question on the stability of BDF2 applied to hyperbolic PDEs. Say I have a hyperbolic equation as $\frac{\partial c}{\partial t} + {\bf U} \cdot {\bf \nabla}c=0$. This system is coupled to the Navier-Stokes equation (the governing equations for $\bf U$) : $\frac{\partial {\bf U}}{\partial t} + {\b...
I am building a quantum circuit simulator using mpi4py. The simulator takes user inputs to build the initial system and quantum gates the system passes through. I can get the code to work if I do not use user inputs and just hard code in the system and gates. However, I cannot figure out how to get the code to work whe...
I have the equation $F(t) = \phi u + \frac{1}{2}\frac{d^2u}{dt^2} + u^3$ and broadly speaking, my task is to calculate the $\phi$ and $u(t)$ such that $F(t) = 0$. I am testing out a new algorithm to do this (and so there are no in-built ways to implement it). This requires calculating the Jacobian of the function. I am...
I'm trying to do a simple implementation to study the advection-diffusion-reaction dynamics in a straight pipe. I have points positioned along the length of the pipe (blue dots in the image above). I came across a blog (link) that explains how a point source is implemented. However, I am not really sure how to adapt i...
I will now explain what I understand to be the process of a finite element mass matrix assembly. I would like a reference which does something similar, or if I am mistaken about the process please let me know. Let $\Omega$ be a bounded domain and let $\lbrace \Omega^{\left(e\right)}\rbrace_{e=1}^{E}$ be disjoint subset...
I have installed Optim1.6.1 package. I would like to solve a system of equations in non linear finite element analysis using constraints as u=1 at certain nodes. u=0 at certain nodes. Typically I find kmat and res as below [kmat,res]=systemmatrices(u,load,boundarycondition,material,constraints) The optimisation syntax ...
I am currently learning nodal DG methods, primarily through the book by Warburton, and am a bit confused on how to handle surface integrals using straight edged elements. On page 187 (and on page 214) of Warburton's book, we have $$ \int_{\partial E_{k}} \mathbf{n} \cdot f_{h} \ell_{i}^{k}(\mathbf{x}) d\mathbf{x}. $$ ...
I am new to GNU Octave 6.2.0 on Linux, and I am trying to use the package 'parallel' to make use of 24 threads on my machine. I have an array (array1) that has about 500,000 rows or values (1 column) and for each member of the array I want to apply a log10 function, like this: test = 10*log10(array1.^2); % this wor...
I have two vectors $r$ and $m$. Both vectors are $N\times1$. A function is calculated as - $F(1:N) = \phi r + (r^3 + rm^2)$ $F(N+1:2N) = \phi m + (m^3+mr^2)$ F1 = (phi*r + r.^3 + r.*m.^2); F2 = (phi*m + m.^3 + m.*r.^2); F = [F1;F2]; I am having trouble calculating the Jacboian for this function. Here's what I did - J...
I am interested in solving the transient advection equation $\left\{\begin{array}{ll}\partial_{t} u+\beta \cdot \nabla u=f & \text { in } \Omega, t>0 \\ u=0 & \text { on } \partial \Omega^{-}, t>0 \\ u(\cdot, 0)=u_{0} & \text { in } \Omega,\end{array}\right.$ with a stabilized FEM formulation (SUPG, GLS or similar), bu...
I am working on a combined contact, bending, and torsion problem. I have data on geometrical points and their instantaneous stress components. However, based on the available data, I have to interpolate the stress values at points where the stress values are not available, i.e., I would like to interpolate the stress v...
I am currently attempting to use FEnICS to solve an electrostatic problem with two materials of different permittivity $\varepsilon_1$ and $\varepsilon_2$ forming an interface: Consider a domain $\Omega_1 \cup \Omega_2 = \Omega $ with $\Gamma_T$, $\Gamma_B$, $\Gamma_R$ and $\Gamma_L$ as the top, bottom, right and left ...
Apologies if this is a bit of a soft, unclear, or opinion-based question. I'm a relatively new PhD student in a (computational) quantum chemistry group. My group develops and maintains a few software packages (mostly for techniques first developed in-group), and this is something in which I am interested, i.e. high-per...
Given numbers $x, y \in \mathbb{R}$ where $$\frac{|y-x|}{|x|}$$ is small, and code that implements the function $f$ with a sequence of arithmetic operations, I would like to compute to high accuracy the finite difference $$ \frac{f(y) - f(x)}{y-x}, $$ which is plagued by cancellation. Is there a variant of automatic di...
I am trying to perform a two-dimensional random walk for a particle, but I am not getting the desired result. The plot produced is a linear plot, which obviously should not have been. Similar code for a one-dimensional gives the desired result. Can someone please suggest where am I making any mistakes? Thanks. import n...
I have a system of PDEs describing atmospheric chemistry and transport. I use finite-differences to make my system of PDEs into a system of ~10,000 ODEs. I then integrate the ODEs forward in time with the CVODE BDF method (from Sundials). For my current discretization of my PDEs, the jacobian is banded (band width = ~2...
Given a large sparse (square) matrix in MATLAB, how can I extract the banded or the block-diagonal parts (of fixed size) of it efficiently? These are useful operations when prototyping and testing preconditioners, or if you want a quick and dirty (but still relatively efficient) preconditioner. Sometimes these approxim...
While looking at step6 of deal.ii tutorials, I decided to try to understand how the constraints coming from hanging nodes are imposed. So I started by watching video lecture 16 by prof. Bangerth As far as I understood: some of the basis functions $\varphi_i$ are now discontinuous, and that's of course a problem as we w...
I'm writing a paper where I am discussing different types of construction heuristics. One type does not change previous decisions when adding new elements to the solution. I'd call them "immutable", as the (partial) solution is immutable during construction. This behavior is known in many (possibly most) construction h...
I am working on a program currently that works out the maximum flow through a network using the Ford-Fulkerson algorithm, and that works fine, however, I need the final flow to meet the constraint that all edges that share a source node must also share the same flow value. (or flow splits evenly between edges from a co...
I have just created a code snippet in Octave/Matlab that aims to create a plot which shows the accuracy of an initial probability vector $\vec{\pi}$ derived from the transition probability matrix $\textbf{P}$ of a Markov chain using its powers ($\textbf{P}^n$). n = 1:10000; tProbs = [0.1 0.5; 0.9 0.5]; iProbs = sum(tPr...
I am interested in solving the equation $$ \begin{aligned} \nabla \cdot\left(\nabla \phi-\frac{\nabla \phi}{|\nabla \phi|}\right) &=0 & & \text { in } \Omega \\ \phi &=0 & & \text { on } \Gamma\left(\phi^{0}\right) \text { and } \\ \nabla \phi \cdot \hat{n} &=\operatorname{sign}\left(\phi^{0}\right) & & \text { on } \p...
I am trying to understand the dyadic operation for a while since I am interested in Elasticity problems. I believe an intuitive understanding (rather than assuming) will give me good problem solving abilities. The following equation is shown in almost all lecture notes on elasticity. However, I don't understand how th...
I was trying to fit some data to a single degree exponential decay function but a*exp(-x*t) and a*exp(-x/t) gives completely different answers with the latter not at all fitting the data well. The code: def func(x, a1, t1, c): return a1 * numpy.exp(-x*t1) + c interp_x = np.arange(low,high+dx,dx) popt, pcov = scipy...
I'm learning how to solve vector-valued problems with deal.II library. In particular, I'm looking at the following introduction from the official website https://www.dealii.org/current/doxygen/deal.II/group__vector__valued.html#VVAlternative Here they write the bilinear form as $$a(\mathbf{u}, \mathbf{v})=\left( \lambd...
This was originally asked on Stackoverflow but instead of migrating it was suggested I repost here and delete that one. I've tried to clarify based on comments there. I'm new to MPI, but I am trying to use it to speed up some code I have. A minimal version of that code is below: program main !! takes a list, then f...
Consider the elastic equation $$- \operatorname{div}(C \nabla \mathbf{u}) = \mathbf{f}$$ as presented in step-8. Here $\mathbf{u}$ is the displacement vector, let's consider the 2d case. As you can see in the setup_system, they impose homogeneous Dirichlet boundary conditions. Then I'd expect to see that the two plots ...
For the past weeks I have been trying to reproduce Agarwala's results but I've been unsuccessful. From this paper I am trying to reproduce the first and last columns of Fig.2, by implementing eq.2; The image below is the crystalline case from the paper: The code is made of two parts mostly: the building of the system ...
I am trying to use Newton's method to get a stationary solution for a system of equations of the following form: $$ \begin{Bmatrix} \frac{\partial x}{\partial t} \\ 0 \end{Bmatrix} = \begin{Bmatrix} f(x, y) \\ g(x, y) \end{Bmatrix} $$ For vectors $x$ and $y$. Due to the nature of the equations I'm trying to solve, the ...
I am in the process if computing the Dual-Weighted Residual (DWR) for a linear PDE with a linear functional but I am struggling with the residual part of the calculation. For example suppose we want to formulate the DWR for a Poisson's equation then the error for a linear functional $J(\cdot)$ is given by $$ J(e) = \su...
For studying a spin model on a lattice, I have to generate a random unit vector starting from a pre-exstisting one. There are multiple ways to do it, but the book I use suggests generating a random displacement vector $\Delta\boldsymbol{S}=\Delta S_{max}(p_1,p_2,p_3)$ with $p_i$ three random numbers in $[-1,1]$ and $\D...
for k=1:len thetaHattt(k)=atan(((Ahat+Rhat)*(1/k11(k)*Bhat-Chat)+Ahat*(Chat-1/k22(k)*Bhat))/((1/k22(k)*(Ahat+Rhat)*(1/k11(k)*Bhat-Chat)+1/k11(k)*Ahat*(Chat-1/k22(k)*Bhat)))); if k<len&&k>1 chatt(k)=Ahat/(k11(k-1)-k11(k))*(sin(thetaHattt(k-1))-sin(thetaHattt(k))-k11(k-1)*cos(thetaHattt(k-1))...
Related to: What are the negatives of using higher order finite diference schemes? Problem: I have some discrete data of a trajectory $x_t$ with errors $\delta x_t$ of a physical system sampled at equal times $\Delta t$ and I want to calculate the derivative of the trajectory, i.e., the velocity $v_t$. I know I can dif...
I have a background in Computational Mechanics but my knowledge remains very user-oriented. What I mean by that is that I have a fairely good knowledge about how to use a commercial engineering simulation software such as Ansys. I also have good understanding on the mechanism on how a simulation works: we have a physic...
I am solving two different ODE whose solutions need to be matched. I am currently doing this by hand, which works great, but I would like to automatise this process. The second ODE takes one of its initial conditions and its initial time from the last values of the first solution. I put a MWE below. Now, I have naively...
I am diagonalizing a sparse matrix of size $153600\times 153600$ via eigsh function. I did not set the tolerance to specific value, so it would be the default value about $2\times 10^{-16}$. However, if I run the same code 3 times, the difference between eigenvalues are much bigger (about $6 \times 10^{-8}$) than this!...
I'm trying to solve the following problem, I had previously opened another discussion for the implementation and well, it seems that it has turned out well, it can be found here. I need to calculate the preconditioned conjugate gradient solution with incomplete Cholesky and Jacobi, for a mesh of n = 500,1000,5000 and 1...
I'm trying to model in FEniCS a steady-state situation in which a coolant fluid flows through a nuclear fluid. There is finite rate of conduction between the two fluids. The simulation should output the steady-state temperature profile for each fluid. The issue I've run into is that I don't know how to get FEniCS to so...
Is it possible to calculate the flow of cash in each period given a certain fixed net present value with a numerical algorithm? I would like to be able to apply a certain weighting that can be applied to the cash flows of each period e.g. 90% will be paid back in the last period, 1/(number of periods-1) in all other pr...
I'm studying error estimators and I need a check on an estimate. In our course, we've been given the following definition of bubble function (in 2D): It's a function defined on a triangle $T$ such that: $b_T \in [0,1]$ $b_T \in H_0^1(T)$ $\exists D \subset T: |D|>0 , b_T \geq \frac{1}{2} \text{ in } D$ Then, professo...
I found this question (linked here) which asks to find what this infinite series converges to $$ \sum_{n=1}^{\infty} \int_0^{\pi} f_n(x) dx $$ where $f_{n+1}(x) = \sin(f_n(x)) $ and $f_1 = \sin(x)$. I actually wrote a few scripts which I figure could be optimized but I'm looking for a better approach or if the type of...
I am looking for the analytical solution of 1-dimensional advection-diffusion equation with several point sources, Q, along the axial length of a cylinder through which the fluid flow occurs. Neumann boundary condition is specified at the outlet and Dirichlet boundary condition at the inlet. $$\frac{\partial C}{\partia...
The mixed form of the elasticity equations is to find the unique critical point of the Hellinger-Reissner functional $$J(u, \sigma) = \int_\Omega\left\{\frac{1}{2}A\sigma : \sigma + u\cdot\left(\nabla\cdot\sigma - f\right)\right\}dx$$ where $u$ is a vector field, $\sigma$ is a symmetric tensor field. The inputs are the...
Hi I am trying to implement a simple plasticity based finite element code. I am not clear how to set up displacement control applied through Lagrange multipliers. In case of a linear problem, I did the following to apply displcament control and it worked. Lets say the energy balance equation in the absence of body forc...
Considering a centered finite difference approximation for the derivative, what is a reasonable approximation for the first and last points?
I need to numerically compute an integral of the following form: $$\int_0^1 \frac{1}{2\pi\sigma^2}\exp\left(-\frac{\|(q_0t^3 + q_1t^2 + q_2t + q_3) - a\|^2}{2\sigma^2}\right)\|3q_0t^2 + 2q_1t + q_2\|\,dt.$$ Here, $q_0,q_1,q_2,q_3,a$ are constant vectors in $\mathbb{R}^2$, and $\sigma$ is real. This comes from the line ...
When it comes to a second-order accurate finite volume discretization of Navier-Stokes equations, which one of the two following rationales is adopted? 1- Second-order accuracy is a direct consequence of how we eliminate higher order terms in the Taylor expansion of all the terms; 2- From the beginning, we assume that ...
For second order elliptic problem \begin{align} -\Delta u=f,\quad in ~~\Omega\\ u=0,\quad on~~ \partial\Omega, \end{align} we have for the Ritz projection for $P_1$ conforming element \begin{align} \|u-R_hu\|_{W^{0,p}}+h\|u-R_hu\|_{W^{1,p}}\leq Ch^2\| u \|_{W^{2,p}},\quad u\in W_0^{1,p}(\Omega)\cap W^{2,p}(\Omega). \en...
The current enterprise server rack has, in most cases, more than 1 CPU socket per board and a bunch of graphics card together with a data processing unit on a single board in a node. Several such nodes in a rack are closely stitched together for data pathways and tightly integrated into the cluster for a tailored appli...
If we use 5-point finite difference approximations in a uniform rectangular grid to solve the Poisson PDE \begin{align} -\Delta u &= f \ \ \text{en} \ \ (0,1)\times (0,1) \label{P1} \\ u &= 0 \ \ \text{en} \ \partial ((0,1)\times (0,1)) \label{P2} \end{align} The Laplacian operator $\nabla^2$ can be written using th...