⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 psn_1d.h

📁 Finite Volume Poisson PDE Solver
💻 H
字号:
/*psn_lib/psn_1d.h*/
/***********************************************************************
    Finite Volume Poisson PDE Solver: C-Library & Matlab Toolbox
    Implements numerical solution of Poisson PDE
    in 2D  Cartesian and Cylindrical coordinates

    Copyright (C) 2004 Igor Kaufman
    Copyright (C) 2004 Lancaster University, UK

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


    Author's email: i.kaufman@lancaster.ac.uk

    APPLICATION    : 1D POISSON SOLVER
    VERSION        : 1.0
************************************************************************/
/*17.01.04*/

#ifndef PSN_1D
#define PSN_1D
/*
Poisson1D Solver routines with mixed boundary conditions:
d^2 u / dx^2 = v  for  xl <= x <= xh
alpha_l u + beta_l du/dx = gamma_l  at x=xl
alpha_h u + beta_h du/dx = gamma_h  at x=xh
Arrays u and v assumed to be of extent N+2.
Now, ith elements of arrays correspond to
x_i = xl + i * dx    i=0,N+1
Here, dx = (xh - xl) / (N+1) is grid spacing.

Linear system is solving with psn_solve_tridiag

Code source: http://farside.ph.utexas.edu/teaching/329/lectures/node79.html

*/

typedef struct {
   int N;          //Number of grid cells
   int mode;       //
   int grid;       //Grid: 0-standard, 1 - centered
   double x[2];    //
   double alpha[2];
   double beta[2];
   double gamma[2];
   PSN_VECTOR v;
   PSN_VECTOR e;
   PSN_VECTOR u;
   PSN_VECTOR a;
   PSN_VECTOR b;
   PSN_VECTOR c;

} psn_1d_struct;

int psn_1d_struct_init(psn_1d_struct *pst, int N);
int psn_1d_struct_free(psn_1d_struct *pst);

//Main function for 1D
int psn_1d_solver(psn_1d_struct *pst);



#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -