Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Placements

Student Reviews


For Business


More

Academic Training

Informative Articles

Find Jobs

We are Hiring!


All Courses

Choose a category

Loading...

All Courses

All Courses

logo

Loading...
Executive Programs
Workshops
For Business

Success Stories

Placements

Student Reviews

More

Projects

Blogs

Academic Training

Find Jobs

Informative Articles

We're Hiring!

phone+91 9342691281Log in
  1. Home/
  2. Amith Ganta/
  3. 2D diffusion equation Upwind scheme using matlab

2D diffusion equation Upwind scheme using matlab

clear all close all clc %% Definig the Problem Domain n_points = 101; dom_length = 1; h = dom_length/(n_points-1); x = 0:h:dom_length; % x domain space y = 0:h:dom_length; % y domain space % Initializing the problem T(1,1:n_points) = 1; T(1:n_points,1) = 1; T_new(1,1:n_points) = 1; T_new(1:n_points,1) = 1; rho = 1; u =…

    • Amith Ganta

      updated on 24 May 2021

    clear all
    close all
    clc
    
    %% Definig the Problem Domain
    n_points = 101;
    dom_length = 1;
    h = dom_length/(n_points-1);
    
    x = 0:h:dom_length; % x domain space
    y = 0:h:dom_length; % y domain space
    
    % Initializing the problem
    T(1,1:n_points) = 1;
    T(1:n_points,1) = 1;
    
    T_new(1,1:n_points) = 1;
    T_new(1:n_points,1) = 1;
    
    rho = 1;
    u = 1;
    v = 1;
    
    gamma = 0.0025;
    P = rho*u*h/gamma;
    
    %% Differencing Scheme
    
    error = 1;
    iterations = 0;
    
    while error > 1e-7
        for i = 2:n_points - 1;
            for j = 2:n_points -1;
                a_E = gamma;
                a_W = gamma + rho*u*h;
                a_N = gamma;
                a_S = gamma + rho*v*h;
                a_P = rho*u*h  + rho*v*h + gamma + gamma + gamma + gamma;
                T_new(i,j) = (a_E*T(i+1,j) + a_W*T(i-1,j) + a_N*T(i,j-1) + a_S*T(i,j+1))/a_P;
            end
        end
         iterations = iterations + 1;
         error = 0;
         for i = 2 : n_points -1;
             for j = 2:n_points - 1;
                 error = error + abs(T(i,j) - T_new(i,j));
             end
         end
         
         T = T_new;
         
    end
    
    
    %% Plotting
    
    x_dom = ((1:n_points)-1).*h;
    y_dom = 1 - ((1:n_points)-1).*h
    [X,Y] = meshgrid(x_dom,y_dom);
    contourf(X,Y,T, 50)
    colorbar
    
    %% Centreline temperature
    
    figure;
    plot(1-y,T(:,(n_points+1)/2),'--o')

     

     

     

     

     

     

     

    Leave a comment

    Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.

    Please  login to add a comment

    Other comments...

    No comments yet!
    Be the first to add a comment

    Read more Projects by Amith Ganta (43)

    Quater car modelling using Matlab

    Objective:

                                                                                      Quarter Car model â€¦

    calendar

    22 Nov 2022 09:11 PM IST

      Read more

      Single cylinder SI engine modelling using GT-Suite

      Objective:

                                                                   Introduction to GT Suite Effective utilization of simulation software with human intelligence is required…

      calendar

      03 Apr 2022 12:50 AM IST

      • CFD
      • GT-POWER
      Read more

      internship formulas

      Objective:

      ∂ωx∂t=[2â‹…a2a2+c2−2â‹…a2a2+b2]⋅ωz⋅ωy+Posin(t)â‹…2â‹…a2a2+b2⋅ωZ+2â‹…a2a2+c2⋅ωy+Posin(t)+Lâ‹…Ï„x∂ωx∂t=[2â‹…a2a2+c2-2â‹…a2a2+b2]⋅ωz⋅ωy+Posin(t)â‹…2â‹…a2a2+b2⋅ωZ+2â‹…a2a2+c2⋅ωy+Posin(t)+Lâ‹…Ï„x   ∂ωy∂t=[2â‹…b2a2+b2−2â‹…b2b2+c2]⋅ωx⋅ωz+Pocos(t)â‹…2â‹…b2a2+b2⋅ωZ−2â‹…b2b2+c2⋅ωx+Pocos(t)+Lâ‹…Ï„y∂ωy∂t=[2â‹…b2a2+b2-2â‹…b2b2+c2]⋅ωx⋅ωz+Pocos(t)â‹…2â‹…b2a2+b2⋅ωZ-2â‹…b2b2+c2⋅ωx+Pocos(t)+Lâ‹…Ï„y…

      calendar

      30 Oct 2021 02:16 PM IST

        Read more

        CI engine modelling of 2019 Chevrolet Silverado Duramax Diesel Engine Using GT Suite

        Objective:

                                                                                 Introduction to CI engines Compression - ignition or diesel engine…

        calendar

        17 Sep 2021 09:30 AM IST

          Read more

          Schedule a counselling session

          Please enter your name
          Please enter a valid email
          Please enter a valid number

          Related Courses

          coursecardcoursetype

          Accelerated Career Program in Embedded Systems (On-Campus) - Powered by NASSCOM

          Recently launched

          0 Hours of Content

          coursecard

          5G Protocol and Testing

          Recently launched

          4 Hours of Content

          coursecard

          Automotive Cybersecurity

          Recently launched

          9 Hours of Content

          coursecardcoursetype

          Pre-Graduate Program in Bioengineering and Medical Devices

          Recently launched

          90 Hours of Content

          coursecardcoursetype

          Pre-Graduate Program in 5G Design and Development

          Recently launched

          49 Hours of Content

          Schedule a counselling session

          Please enter your name
          Please enter a valid email
          Please enter a valid number

                      Do You Want To Showcase Your Technical Skills?
                      Sign-Up for our projects.