All Questions

Filter by
Sorted by
Tagged with
1
vote
0answers
71 views

Finite element (1D) for steady state non-linear problem

I need to solve with linear finite elements the equation $$\frac{\partial }{\partial x}\Bigl(\text{sgn}(x) u \Big) +\frac{\partial}{\partial x} \Bigl[ \sqrt{u} \frac{\partial u}{\partial x} \Bigr] =0$...
0
votes
1answer
99 views

FEM does not match exact solution

I am trying to solve : $$-u''(x) + u(x) = \sin(2\pi x)\, ,\quad 0<x<1\, ,$$ $t>0$, with $u(0) = u(1) = 0$. That has as exact solution $$u(x) = \frac{\sin(2\pi x)}{1 + 4\pi^2}\, .$$ But the ...
0
votes
0answers
15 views

Implicit methods for variable coefficients based on equations of state

For example I have an equation that goes something like $ \partial_t \rho = -\nabla\cdot (\rho u) + \nabla \cdot(D(\rho, T) \nabla \rho) + \rho_s $ ($\rho, \rho_s, u, T$ are coupled with a few other ...
0
votes
0answers
21 views

Can finite-differencing methods be used for a function that doesn't have an explicit formula?

If a function doesn't have an explicit formula, and we don't know how smooth it is, can we use finite differences to compute its derivative? Would that make sense, or do people use finite differences ...
11
votes
1answer
1k views

How to avoid catastrophic cancellation?

I have the following formula that I need to rewrite in order to avoid catastrophic cancellation. $$y =\sqrt{\frac{1}{2}(1-\sqrt{1-x^{2})}}$$ As $x$ becomes smaller $\sqrt{1-x^{2}}$ approaches $1$ so ...
3
votes
0answers
49 views

When is it easy to invert a sparse matrix?

When is it easy to invert a sparse matrix? Specifically, I'm wondering about the cases in which matrix inversion has similar cost to sparse matrix multiplication, hence much lower cost than full ...
0
votes
1answer
45 views

Coding up Newton's method for a mapping from R^2 to R — the Jacobian wouldn't be invertible

I'm trying to code up in Matlab a multivariable Newton's method, for a mapping from R^2 to R, but the Jacobian would be a 2x1 matrix, not square, so it wouldn't be invertible. Does this mean that ...
1
vote
0answers
44 views

How do I apply BDF2 in a STRANG splitting

I have a 3D diffusion equation that I want to solve using a time splitting (2D+1D). Assume that $A$ is the 2D discrete diffusion operator and $B$ is the 1D discrete diffusion operator. I want to use a ...
3
votes
1answer
179 views

Poisson image blending artifacts

I am trying to implement Poisson image blending as in the paper Poisson Image Editing. This is the task of filling in a masked region of an image by minimizing $$\min_f\int_\Omega \left | \nabla f - \...
0
votes
0answers
23 views

FEM solution becoming wider as number of nodes increase

My FEM scheme uses a 4-node quadrilateral element with bilinear shape functions. The simple problem I'm solving is. $\nabla ^2 f = 5$ But as I increase the number of nodes, the plot of the solution ...
3
votes
1answer
109 views

How to find a pair of divisors as close as possible to each other?

For a given integer $n\in\mathbb{N}^*$, I want to find a pair $(x,y)\in{\mathbb{N}^*}^2$ such that $x*y=n$ and $|y-x|$ is as small as possible. A naive algorithm I found is : ...
0
votes
0answers
25 views

How to describe function convergence and function tolerance for numerical root-finding?

I'm currently doing some practice problems on root-finding and am writing up some notes / comments on my code. In my solver code, if my function value is below the tolerance that I've set, should I ...
2
votes
2answers
80 views

Petsc Mat object in class

[Relatively new to Petsc] I am writing an object oriented project and my idea is to have parallel objects when the user constructs the object with MPI arguments. So have member data Mat and fill/...
0
votes
0answers
36 views

Am I computing this complex root correctly? [migrated]

I'm playing numerically with root-finding in Matlab but am a bit rusty with complex roots that come in conjugate pairs -- for polynomials with real coefficients. Am I justifying these steps correctly: ...
1
vote
1answer
89 views

Non-Linear advection diffusion with nondifferetiable advection term

I'm looking at Murray's book: Mathematical biology: an introduction , first volume, pag. 404 In particular, I'm interested to solve the following PDE: $$\partial_t u = \partial_x (\text{sign}(x) u) + \...
1
vote
1answer
73 views

Ill-condioned Linear System and Gaussian Elimination

Suppose that I have a linear system $Ax=b$ such that $A$ is ill-conditioned. Can I say that it is dangerous to find a solution with Gaussian Elimination for this system, or does there exist some class ...
2
votes
1answer
40 views

Solving MX=N where M is structured as a Gaussian 4th-moment tensor

I'm looking to solve numerically the following equation for $(d,d)$ variable $X$, in Einstein summation notation $$M_{ijkl}X_{kl}=N_{ij}$$ Where $M$ is a $(d,d,d,d)$ 4th-moment tensor of random ...
0
votes
0answers
21 views

Library/project on python for solving conjugate heat transfer problems

Can someone recommend a python library that can help me solve heat transfer problems between turbulent fluids and solids? Thanks.
2
votes
2answers
55 views

In a dynamical system, what might be a good reason why periodicity in an object's velocities is important?

I'm studying periodic motions in a dynamical system and, as a newbie, I narrowly think of an object's periodicity in its spatial x-y coordinates, but what might be a good reason why the existence of ...
2
votes
2answers
132 views

1D FEM for nonlinear diffusion coefficient

I want to solve with linear finite elements the equation $$\partial_t u = \partial_{x}(a(u)\partial_xu)$$ in the domain $t \in [0,1]$ and $x \in [-L,L]$. Here $a(u)$ is just a function of $u$. ...
0
votes
0answers
43 views

Simple Finite Volume method for Stokes equations

I'm trying to understand how to implement fluid problems using Finite Volume Elements, for example a simple Finite Volume Elements for the Stokes problem: $-\nu\Delta u+\nabla p =f$ in a bounded ...
1
vote
0answers
59 views

How can I practice multivariable root-finding?

Recently, I've been reading up on various root-finding / optimization algorithms such as the Levenberg-Marquardt method, Gauss-Newton, Conjugate Gradient, trust-region and trust-region-dogleg. I've ...
-4
votes
0answers
16 views

Object Oriented Program -Data types [closed]

Give the appropriate data type of the ff. -100 8000 3.78 1.67f 300000 100000000000L 120 300
1
vote
1answer
103 views

How to calculate the number of floating point operations a task/ process requires? (not FLOP/s, but FLOP)

There have been many papers quoting FLOP to quote the performance of a specific approach in machine learning. For example, We trained two models with different capacities: BlazePose Full (6.9 MFlop, ...
84
votes
17answers
97k views

Is there a high quality nonlinear programming solver for Python?

I have several challenging non-convex global optimization problems to solve. Currently I use MATLAB's Optimization Toolbox (specifically, fmincon() with algorithm=<...
0
votes
0answers
29 views

Split of complex parts in weak form

I am working on a numerical model to simulate the acoustic and elastic wave propagation in frequency domain via the Finite Element Method. Basically, the problem is to solve the Helmholtz equation in ...
1
vote
0answers
45 views

Is there any function to calculate condition number of sparse matrix in Eigen libraray?

The function JacobiSVD and BDCSVD can calcuate condtion number of a dense matrix via singular values. However I need to know condition number of a sparese matrix due to slow computation speed using ...
0
votes
0answers
21 views

Hi I am trying to model a 2D Lug angle using Gmsh 4.6. How can I combine transfinite quad and regular full quad meshes in the following geo file?

I need transfinite mesh a small section of the bolt hole to insert a crack. However, The transfinite mesh and regular full quad mesh seem being incompatible and throwing errors. How can I combine ...
2
votes
1answer
77 views

Efficient solution to a structured symmetric linear system with condition number estimation

I have a real-valued linear system $Hx = b$ where $H$ is symmetric matrix** (not necessarily positive/negative definite) with a very particular structure: $$ H = \begin{bmatrix} D && B \\ B^T &...
0
votes
1answer
52 views

Imposing pressure variation instead of Dirichlet boundary conditions on Finite Element Method

I always see Finite Element codes solving PDE with Dirichlet or Neumann boundary conditions. But, I have a problem now consisting of a straight cylinder with a circular base (a simple 3D tube), with ...
0
votes
0answers
91 views

Solution of Cahn-Hilliard equation

I need to solve the Cahn-Hilliard equation $$\frac{\partial u}{\partial t} = \Delta(f(u) - \epsilon^2\Delta u), \hspace{.5cm}(x, t)\in \Omega\times(0, T],$$ using mixed formulation \begin{equation}\...
10
votes
1answer
189 views

Central differencing scheme for second derivative leads to ill-conditioning

The central difference scheme: $$\frac{d^2u}{dx^2}=\frac{u_{n+1}-2u_i + u_{n-1}}{\Delta x^2}$$ yields a tridiagonal coefficient matrix [1 -2 1]; As the number of points gets larger, this matrix ...
0
votes
0answers
29 views

Why does COMSOL treat a well as a rectangular cube?

I'm trying to learn COMSOL for a graduate research project and am struggling through a flow and transport in 3D tutorial. As such I'm walking through my boundary conditions and trying to figure out if ...
0
votes
0answers
28 views

Reference request: Textbook similar in structure to “Computational Materials Science: An Introduction” by June Lee for Computational Biology

In the Computational Materials Science: An Introduction by June Lee, he discusses molecular dynamics and density functional theory with examples from LAMMPS and QuantumEspresso, and explains LAMMPS ...
0
votes
1answer
66 views

R function or package for carrying out maximum likelihood techniques in random effect models

I am applying optim() function in R to obtain maximum likelihood estimates of the fixed effects and random effects in a model with bivariate random effects. The ...
0
votes
0answers
35 views

How to solve for underlying function from discrete data set containing integral of that function

New to Computational Science, I hope I'm on the right exchange network for this question. I have a time series data set that contains the sum of a source data set representing an exponential decay ...
6
votes
2answers
190 views

Why lattice Boltzmann despite its huge number of mesh points still has worse accuracy in comparison to FEM for calculating wall shear stress?

I'm just doing a very simple experiment. I'm calculating wall shear stress based on Poiseuille flow for a pipe by using lattice Boltzmann method (LBM) and FEM to compare their values with the ...
0
votes
0answers
41 views

How to make fuzzy rules?

I have a dataset with weather factors(rainfall, temperature, humidity etc.) and crop yield. I want to make fuzzy rules. Considering the large number of features, it cannot be done manually by ...
2
votes
3answers
180 views

On the reordering of sparse matrices

I have been reading on different techniques used to reorder sparse matrices to achieve better performance, the most popular being the Cuthill-McKee or Reverse Cuthill-McKee algorithm. Most of those ...
4
votes
1answer
102 views

Accurate and efficient computation of the logarithm of the ratio of two sines

For exploratory work related to special function implementations, I need to compute $\log \frac{\sin y}{\sin x} $, where $0 \le x \le y \le 2x < \frac{\pi}{2}$. Cases with $x \approx y$ in ...
0
votes
0answers
19 views

Show deformed mesh in Comsol

I am using COMSOL Multiphysics 5.2a in order to do thermal, mechanical and thermo-mechanical simulations. Due to a boundary load, my components get deformed which I can simulate very well. However, ...
0
votes
1answer
59 views

3D laplacian operator

I have been unable to find the equivalent of the 5-point stencil finite differences for the Laplacian operator. In 2 dimensions for me it is clear that, using the finite difference method: $$ \nabla_{...
0
votes
0answers
45 views

Norm estimates if adjoints can't be computed

Assume that you have two linear maps $A$ and $V$. For a given $x$ (of appropriate dimension) you can compute $Ax$ numerically, and for any $y$ (of appropriate dimension) you can calculate $V^Ty$ ...
2
votes
1answer
167 views

Givens rotation vs 2x2 Householder reflection

The usual story of Givens rotations vs Householder reflections is that Householder reflections are better if you want to map a long vector to $e_1$, while Givens is better if you want to map a 2-...
1
vote
1answer
53 views

Parity for artificial dissipation term in a finite-difference solution

I have a doubt regarding the signal of the dissipative term in a finite difference solution for an equation of the form $$ \frac{\partial u}{\partial x}+f(x)=0, u(0)=0 $$ In which $f$ is an odd ...
1
vote
1answer
69 views

How to avoid gsl root finder evaluate function outside its domain

When I use the newton's method or hybrid solver in the GSL package to deal with 1-D or multidimensional root solving problems, the code frequently crashes when the solver requests function value ...
2
votes
1answer
144 views

Efficient root finding algorithm for monotonic function

This is my first time asking a question here, so I may not be asking this in the right place. I am trying to find the roots of a monotonic function with as few function evaluations as possible. I ...
0
votes
0answers
31 views

Reference for learning the linear algebra of optimization [closed]

What's a good linear algebra reference for optimization that uses standard linear algebra curriculum topics such as inner products, orthogonality, gram-schmidt? Some of the current material I'm ...
1
vote
1answer
132 views

How to make objective elastic SPH model?

I have implemented a constitutive equation of elastic materials (Hooke's law) in my 3D weakly compressible SPH solver based on [1]. The coding seems to be correct. To verify the implementation I ...
2
votes
1answer
51 views

Understading memory sharing in a GPGPU using a lattice example

I am new in the GPUs world, I used them in Matlab ambient so I didn't need to appreciate the subtleties of these devices. I know that a GPU can be divided into multiprocessors (also called Streaming ...

15 30 50 per page
1
2 3 4 5
181