Skip to content
/ Fem1D Public

FEM solution of 1D second order differential equation. This package is mainly intended for educational purpose, and it introduces a general concept on discretization, Gauss quadrature, stiffness matrix, boundary conditions, and matrix solution.

License

Notifications You must be signed in to change notification settings

homnath/Fem1D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FEM analysis of 1-D second order ordinary differential equation
-------------------------------------------------------------------------------
This program solves the 1-D second order ordinary differential equation:
a d2u/dx2 + b du/dx + c u = f, u(0) = 0, a du/dx at (x = L) = q
where, both u and f are functions of x only. This package is mainly intended
for educational purpose, and it demonstrates a general concept on the
discretization, Gaussian quadrature, stiffness matrix, boundary conditions,
matrix solution, and modular programming.
-------------------------------------------------------------------------------

CITE AS:
  Gharti, H. N, 2017: FEM analysis of 1-D second order ordinary differential equation
  DOI: 10.13140/RG.2.2.29401.21601

DEVELOPER:
  Hom Nath Gharti
  formerly at Institute of Engineering, Tribhuvan University, Nepal
  formerly at NORSAR, Norway
  Department of Geosciences, Princeton University, USA
  hngharti_AT_gmail_DOT_com 

VERSION:
  Fem1D 1.0.0

HISTORY:
  Oct 24,2006, HNG: original package created
  Apr 25,2017, HNG: modified package 

TODO:
  - make analytical solution more general

COMPILE:
	- go to parent folder
	- type: make

RUN:
	./bin/fem1d input_file
  EXAMPLE:
  ./bin/fem1d ./input/example.fem

INPUT:
  - Input file has the following format:

  #----------------------------------------------------------------------------
  # Define the 1D second order differential equation: 
  # a d2u/dx2 + b du/dx + c u = f, u(0) = 0, a du/dx at (x = L) = q
  # where, both u and f are functions of x only
  a: 1.0  
  b: 0.0
  c: 1.0
  f: 10.0

  # Define mesh
  Length: 10.0
  Number of elements: 4
  Number of nodes per element: 3

  # Define boundary conditions.
  # u0 => u(0) and qL => q(L).
  u0: 0.0
  qL: 10.0

  # Compute and save also the exact result for
  # a=1, b=0, c=-1, f=10, u0=0, qL=10, L=10
  # 1: yes, 0: no
  Compute and save exact result: 1 
  #----------------------------------------------------------------------------
	
  - please see ./input/example.fem file.

OUTPUT:
	- computed and analytical (if pexact=1) results can be plotted using plot.dat
    or plotTP.dat files. "plot.dat" can be plotted using Gnuplot or any 
    spreadsheet applications such as LibreOffice calc and Microsoft Excel.
    The later file can be viewed in TecPlot. 
    Note that analytical result is currently computed precisely for the 
    following parameters: a=1, b=0, c=-1, f=10, u0=0, qL=10, L=10

REFERENCES:

J. N. Reddy, 2005: An Introduction to the Finite Element Method, McGraw-Hill Education, 3rd edition
S. J. Chapman, 2007: Fortran 95/2003 for Scientists & Engineers, McGraw-Hill Education, 3rd Edition

About

FEM solution of 1D second order differential equation. This package is mainly intended for educational purpose, and it introduces a general concept on discretization, Gauss quadrature, stiffness matrix, boundary conditions, and matrix solution.

Resources

License

Stars

Watchers

Forks

Packages

No packages published