💻 Fortran Source Code Library

We currently offer 172 open-source, production-grade Fortran codes for offline testing. Run calculations locally on your own machine, view code structure, read technical explanations, and download compilation packages including sample input files.

Heat Exchanger Fouling Factor

Core Numerical Engine in Fortran 90 • 31 total downloads

fouling_factor.f90
! =========================================================================
! Source File: fouling_factor.f90
! =========================================================================

program fouling_factor
    implicit none
    integer::fh,fc,iostat_val,i,j
    double precision::Uc,Rf_h,Rf_c,Rf_tot,Ud,CF,OD_pct
    double precision::Rf_vals(10),Ud_ij
    character(len=30)::fname(10),fhname,fcname
    fname(1)='Distilled Water';     Rf_vals(1)=0.00009d0
    fname(2)='River/Lake Water';    Rf_vals(2)=0.00035d0
    fname(3)='Seawater (treated)';  Rf_vals(3)=0.00025d0
    fname(4)='Boiler Feedwater';    Rf_vals(4)=0.00018d0
    fname(5)='Fuel Oil (#6)';       Rf_vals(5)=0.00088d0
    fname(6)='Transformer Oil';     Rf_vals(6)=0.00018d0
    fname(7)='Refrigerant (liquid)';Rf_vals(7)=0.00018d0
    fname(8)='Refrigerant (vapor)'; Rf_vals(8)=0.00035d0
    fname(9)='Steam (clean)';       Rf_vals(9)=0.00009d0
    fname(10)='Exhaust Gas';        Rf_vals(10)=0.00176d0
    read(*,*,iostat=iostat_val) fh; read(*,*,iostat=iostat_val) fc
    read(*,*,iostat=iostat_val) Uc
    if(iostat_val/=0)then;write(*,*)'ERROR: Bad input.';stop;end if
    if(fh<1.or.fh>10)fh=1; if(fc<1.or.fc>10)fc=1; if(Uc<=0)Uc=500.0d0
    fhname=fname(fh); fcname=fname(fc)
    Rf_h=Rf_vals(fh); Rf_c=Rf_vals(fc)
    Rf_tot=Rf_h+Rf_c
    Ud=1.0d0/(1.0d0/Uc+Rf_tot)
    CF=Ud/Uc
    OD_pct=(Uc/Ud-1.0d0)*100.0d0
    write(*,'(A)')'============================================================'
    write(*,'(A)')'   TEMA FOULING FACTOR GUIDE'
    write(*,'(A)')'============================================================'
    write(*,*)
    write(*,'(A)')'--- INPUTS --------------------------------------------------'
    write(*,'(A,A)')       '  Hot-Side Fluid            = ',trim(fhname)
    write(*,'(A,A)')       '  Cold-Side Fluid           = ',trim(fcname)
    write(*,'(A,F10.2,A)') '  Clean U_overall           = ',Uc,' W/(m2.K)'
    write(*,*)
    write(*,'(A)')'--- FOULING RESISTANCES -------------------------------------'
    write(*,'(A,ES12.4,A)')'  Rf_hot                    = ',Rf_h,' m2.K/W'
    write(*,'(A,ES12.4,A)')'  Rf_cold                   = ',Rf_c,' m2.K/W'
    write(*,'(A,ES12.4,A)')'  Rf_total                  = ',Rf_tot,' m2.K/W'
    write(*,*)
    write(*,'(A)')'--- DESIGN COEFFICIENT --------------------------------------'
    write(*,'(A,F10.2,A)') '  U_design (fouled)         = ',Ud,' W/(m2.K)'
    write(*,'(A,F10.4)')   '  Cleanliness Factor CF     = ',CF
    write(*,'(A,F10.2,A)') '  Required Overdesign       = ',OD_pct,' percent'
    write(*,*)
    write(*,'(A)')'--- TEMA FOULING TABLE (Rf in m2.K/W) -----------------------'
    write(*,'(A)',advance='no')'  Fluid                     '
    write(*,'(A)')'   Rf [m2.K/W]'
    write(*,'(A)')'  -----------------------------------------------------------'
    do i=1,10
      write(*,'(A30,2X,ES12.4)') fname(i),Rf_vals(i)
    end do
    write(*,*)
    write(*,'(A)')'--- U_DESIGN MATRIX (selected pairs) ------------------------'
    write(*,'(A)',advance='no')'  Hot\\Cold       '
    do j=1,5; write(*,'(A12)',advance='no') trim(fname(j)); end do
    write(*,*)
    do i=1,5
      write(*,'(A16)',advance='no') trim(fname(i))
      do j=1,5
        Ud_ij=1.0d0/(1.0d0/Uc+Rf_vals(i)+Rf_vals(j))
        write(*,'(F12.1)',advance='no') Ud_ij
      end do
      write(*,*)
    end do
    write(*,*)
    write(*,'(A)')'--- CORRELATIONS USED ---------------------------------------'
    write(*,'(A)')'  U_design = 1/(1/U_clean + Rf_hot + Rf_cold)'
    write(*,'(A)')'  Rf values from TEMA 9th/10th Edition tables.'
end program fouling_factor


Solver Description

Evaluates the effect of fouling resistances on the overall heat transfer coefficient and calculates the required heat exchanger area oversizing margin.

Key Numerical Methods & Architecture

  • Input Redirection: Reads parameters sequentially from standard input (`stdin`) using Fortran sequential read (`read(*,*)`), ensuring modular integration.
  • Modular Design: Formulated using pure mathematical routines, separation of equations from output formatting, and precise numerical solvers (e.g. bisection, Newton-Raphson).
  • Standard Compliant: Written in clean, standards-compliant Fortran 90 to ensure cross-compiler compatibility.

🛠️ Local Compilation

To test this code on your machine, compile the source code file(s) using a standard Fortran compiler (e.g., `gfortran`).

Compilation Command:

gfortran -O3 fouling_factor.f90 -o fouling_factor

Execution Command:

Execute the program by feeding the sample input file into the program using stdin redirection:

fouling_factor < input.txt

📥 Downloads & Local Files

Preview of the required input file (input.txt):

! Hot side fluid preset ID (1=Distilled water, 2=River water, 3=Sea water, 4=Engine coolant, 5=Fuel oil, 6=Steam, 7=Air, 8=Organic solvents, 9=Light hydrocarbons, 10=Exhaust gas)
1
! Cold side fluid preset ID
1
! Clean overall heat transfer coefficient Uc [W/m2-K]
1000.0