[Contents] [TitleIndex] [WordIndex

Finite Volumes in Scilab

Introduction

The goal of this page is to present the finite volume tools which are available in the Scilab environment.

The PDE block in XCos

This block is an implementation of several numerical schemes (Finite Elements (1st and 2nd order), Finite Differences (1st and 2nd order), Finite Volumes (1st order)) to solve mono dimensional PDE (Partial Differential Equation) within SCICOS. The mathematical framwork was restricts in PDEs linear scalars with maximum order 2 in time and space. The goal is to provide engineers and physicists with an easy to use toolbox in SCICOS that will let them graphically describe the PDE to be solved. A decision system selects the most efficient numerical scheme depending on the type of the PDE and runs the solvers.

The author is EADS-CCR 2005-01-16.

The block can manage the following discretization methods:

The boundary conditions are :

The feature is based on a set of macros, within the PDE directory of the scicos_blocks module. This module manages sparse matrices.

The reference seems to be "Finite element, An introduction", Vol. 1 by E.Becker, G.Carey, and J.Oden.

The functions are:

The Allaire - Coquel course

This course is devoted to hyperbolic systems of conservation laws, the most famous example of which is gaz dynamic (fully studied in details during the course). Both theoretical and numerical aspects are emphasized during each class of three hours. There are therefore a double table of contents which are followed in parallel.

See also "Quelques programmes informatiques qui ont servi à illustrer le polycopié" (HTML).

The Boyer codes

Un petit code de calcul 1D et 2D en scilab illustrant différents schémas de volumes finis pour les problèmes de type Darcy. Ce code a été développé avec S. Krell à des fins pédagogiques à l'occasion des journées numériques de Lille 2010.

Rupture d'un barrage

"Rupture d'un barrage", Hecketsweiler Adrien, Kray Marie, Vernier Claire, Avril 2007

On cherche à simuler un écoulement d'eau suite à la rupture d'un barrage dans le cas 1D. Il faut donc considérer la hauteur et la vitesse de l'eau. Pour cela, on utilise comme inconnues les fonctions :

h(x, t) pour la hauteur
u(x, t) pour la vitesse

où x est la variable d'espace et t est la variable du temps. De la même façon, on modélise la topographie du sol par la fonction a(x). On veut déterminer h et u à partir d'un système de deux équations physiques.

//**********************************************************//
// Rupture d'un barrage : Cas de la Topographie Plate
//
//
en dimension 1
//
//**********************************************************//

// I]. Variables et paramètres :
// =========================

g=9.81;
t0=100;

// 1). Paramètres en espace :
// ----------------------
xmin=-1;
xmax=1;
N=100;               //nombre de mailles
p=(xmax-xmin)/N;     //pas en espace
x=(xmin+p*(1:N))/t0; //vecteur d'espace
B=int(N/2);          //position du barrage


// 2). Paramètres en temps :
// ---------------------
tmin=0;
tmax=40;
cfl=0.7;

// 3). Variables conservatives et flux numériques :
// --------------------------------------------
w=zeros(N,2); //w=(h,hu)
w1=zeros(N,2); //w Euler
h=zeros(N,1); //hauteur de l'eau
u=zeros(N,1); //vitesse de l'écoulement
f=zeros(N,2); //f(w)
f2=zeros(N,2); //f (i+1/2) à t=tn

// II]. Initialisation des vecteurs :
//=============================
for i=1:N;
if i<=B then
w(i,1)=2; w1(i,1)=w(i,1);
w(i,2)=0; w1(i,2)=w(i,2);
f(i,1)=w(i,2);
f(i,2)=(w(i,2)^2)/w(i,1)+g*(w(i,1)^2)/2;
else
w(i,1)=1; w1(i,1)=w(i,1);
w(i,2)=0; w1(i,2)=w(i,2);
f(i,1)=w(i,2);
f(i,2)=(w(i,2)^2)/w(i,1)+g*(w(i,1)^2)/2;
end;
end;

// III]. Résolution numérique par le schéma de Rusanov :
// ===============================================

t=tmin;
while(t < tmax )

// 1). Détermination du pas de temps :
// -------------------------------
vmax=0;
for i=2:N-1;
c=sqrt(g*w(i,1));
v1=abs(w(i,2)/w(i,1)-c);
v2=abs(w(i,2)/w(i,1)+c);

//condition de stabilité

vmax=max(vmax,v1);
vmax=max(vmax,v2);

end;

tau=cfl*p/vmax; // tau= pas de temps

// 2). Calcul du flux numérique f(i+1/2) :
// -----------------------------------
for i=1:N-1;
m1=abs(w(i,2)/w(i,1)-sqrt(g*w(i,1)));
m2=abs(w(i,2)/w(i,1)+sqrt(g*w(i,1)));
m3=abs(w(i+1,2)/w(i+1,1)-sqrt(g*w(i+1,1)));
m4=abs(w(i+1,2)/w(i+1,1)+sqrt(g*w(i+1,1)));
s=max(m1,m2,m3,m4);

f2(i,1) = 1/2*( f(i,1) + f(i+1,1) ) - s/2*( w(i+1,1) - w(i,1) );
f2(i,2) = 1/2*( f(i,2) + f(i+1,2) ) - s/2*( w(i+1,2) - w(i,2) );
end;

// 3). Schéma d'Euler :
// ----------------
for i=2:N-1;
w1(i,1)= w(i,1) -tau/p*(f2(i,1)-f2(i-1,1));
w1(i,2)= w(i,2) -tau/p*(f2(i,2)-f2(i-1,2));
end;

for i=1:N;
w(i,1)=w1(i,1);
w(i,2)=w1(i,2);
f(i,1)=w(i,2);
f(i,2)=(w(i,2)^2)/w(i,1)+g*(w(i,1)^2)/2;
h(i)=w(i,1);
u(i)=w(i,2)/w(i,1);
end;

t=t+0.05;

// 4). Tracé du résultat :
// -------------------

clf(0);
plot2d(x,h)
plot2d(x,u);
end;

Finite volumes in Scilab by Chiavassa

Finite volumes in Matlab by Recktenwald

http://web.cecs.pdx.edu/~gerry/class/ME448/codes/

This page contains links to MATLAB codes used to demonstrate the finite difference and finite volume methods. These are simple codes applied to simple problems, hence the adjective "Toy". The toy finite volume codes can handle non-uniform meshes and non-uniform material properties. Not all sample problems exercise these features.

The codes are contained in Zip archives. The documentation is in PDF. The code were written from 2003 to 2008.

The author is Gerald Recktenwald, Associate Professor and Chair Mechanical and Materials Engineering Dept, Portland State University

Finite volumes in Matlab by Sanders

The author is Brett F. Sanders, Professor Civil and Environmental Engineering, University of California, Irvine.

On this page are a few basic codes that may be of interest to students of computational hydraulics. These codes have been developed for instructional and research purposes, and have been shared with students of my graduate courses in the past.

In principle, it should be easy to translate them into Scilab.

The Matlab codes by Randall Leveque

These Matlab codes are given for the book "Finite Difference Methods for Ordinary and Partial Differential Equations" :

In principle, it should be easy to translate them into Scilab.

The CLAWPACK library

CLAWPACK is a software package designed to compute numerical solutions to hyperbolic partial differential equations using a wave propagation approach.

In principle, it should be feasible to make the link between Scilab and Python.

The Matlab solvers by Shampine

Hyperbolic PDEs

Source: http://faculty.smu.edu/shampine/current.html

We have developed software in MATLAB to solve initial-boundary value problems for first order systems of hyperbolic partial differential equations (PDEs) in one space variable x and time t. We allow PDEs of three general forms, viz.

and we allow general boundary conditions. Solving PDEs of this generality is not routine and the success of our software is not assured. On the other hand, it is very easy to use and has performed well on a wide variety of problems. Provided here is a manuscript about this work and the solver itself. A revised version of the manuscript has appeared as Solving Hyperbolic PDEs in Matlab, Appl. Numer. Anal. & Comput. Math., 2 (2005) 346-358. Accompanying the solver are many examples.

See also

References


2022-09-08 09:27