Computational Fluid Dynamics is the Future
  • Main Page
    • Purpose of Website
    • About Me >
      • My PhD Thesis
      • My Teaching at the American University of the Middle East
      • My Teaching at the University of Sharjah
      • My Books & Codes
      • My CFD Projects
      • My SolidWorks Projects
      • My Family
      • In the Living Memory >
        • Family who contributed to My Personality
        • Lecturers Who Contributed to My Personality
      • Testimonials
    • CFD2012 Blog
    • معلومات عن الموقع
    • Page Contact >
      • Feedback Form
  • Research
    • C++ for Excel
    • Undergrad Stage Advice >
      • Cheat Sheet
      • Dealing with Dyslexia
      • Work/Research Placement
    • Masters Stage Advice >
      • PIV Lab
      • Prototype Modelling Lab
      • Field Trips 2006
      • Fuel Atomization Lab
      • Cardiff Airbus Seminar
      • Research Labs
      • GT Onsite Trips
      • On-Site Visits
    • PhD Stage Advice >
      • CFD Modelling >
        • Online CFD Codes
        • CFD Mandatory Reading List >
          • CFD Book Reviews >
            • Turbulence book Reviews
          • Turbulence Modelling Books
          • Finite Element Reading List
        • Eulerian and Lagrangian Descriptions
        • Multigrid Method
        • Finite Volume Method
        • Quantum Physics
        • Navier-Stokes Equations >
          • Atmospheric
          • CFD Simulation Validation
        • Numerical Methods >
          • Numerical Methods Book Reviews
          • Derivatives of Different Orders
          • Vector Calculus
          • Solvers >
            • Iterative Method
          • Data Structures
        • Grid Classification >
          • Mesh Geneation Book Reviews
          • Delaunay Trangulation
        • Reactive Flows >
          • Anaerobic Digestion
          • Combustion Theory Notes
          • Combustion Book Reviews
          • Swirl Flow and Combustion
          • Combustion Reading List
          • Working with Mixtures
          • Combustion Theory
      • Experimentation for CFD >
        • Diffusion Sensors
        • Experimental Wind Tunnels >
          • Wind Tunnel Walk Around
          • Wind Tunnels Books
      • Design of Experiment
      • Optimization
      • My Teaching Activities
      • Google Scholar Profile
      • Yearly Upgrade Report
      • Attending Regular Seminars >
        • Publication Reading
        • Making a Presentation
        • Research Collaboration Fundamentals >
          • Writting a Publication
          • Trip Planning
      • Supervisor Guidance >
        • Studies Budget >
          • Making a Pause for Your Studies
      • Thesis Writting >
        • Putting Together the Thesis
        • List of Symbols
        • Thesis Abstract
        • Thesis Rational and Finding the Gap
        • Thesis Literature Review
        • Thesis Methodolgy
        • Thesis Hypothesis
        • Thesis Conclusion
        • Thesis Check List
      • Referencing >
        • LaTeX
        • EndNote >
          • Setting Up EndNote with Google
          • EndNote Selecting Reference Method
      • Ideal Image of the VIVA >
        • Dealing with Correction Obstactles
        • Thesis Corrections
    • Postdoc >
      • Whitelee Windfarm
      • Dumbarton Scottish Maritime Museum
      • Meetings and Negotiating
      • Student Recommendations
      • Team Work
      • Writting a Research Proposal
      • Conference Organization
      • Research Networking
      • Supervising Students >
        • Types of PhD students >
          • Mind Mapping
    • Research Trends
    • Photoshop >
      • Inserting Text in Photoshop
      • Using Brush in Photoshop
      • Using Blur in Photoshop
    • Microsoft Office Skills >
      • Flow Chart
      • Microsoft Outlook
      • Making a Poster
      • Power Point
      • Making Gantt Chart
      • Mircosoft Word Thesis Layout >
        • Adding Rear Color in Word
        • Applying a Border Line in Word
        • Steps to Write a Thesis
        • Document Heading
        • Applying Chapter Headings
        • Document Footer
        • Using Text Box
        • Using Quick Parts
      • Microsoft Excel >
        • Reading Data into Excel
    • Jobs Search >
      • Jobs Requirments >
        • Requesting Copy of Reference
        • Work Email Formats
        • Regular Rejection Excuses >
          • Email Job Replies
      • CFD Job Sites >
        • Other Jobs Sites
      • Telephone Job Interview
      • Interview Clothing
  • ANSYS-Flow Modelling
    • ANSYS CFX Tutorials >
      • ANSYS CFX Introductory Tutorials >
        • Boundary Conditions
        • ANSYS CFX Introductory 2
      • ANSYS-CFX Porous Media >
        • ANSYS-CFX Porous Media Models
        • ANSYS-CFX Porous Media Bugs
      • ANSYS CFX Single Domain Wind Turbines >
        • ANSYS CFX Double Domain Wind Turbines
        • Rotating Wind Turbine
        • Wind Turbine Stress Analysis
      • ANSYS-CFX Turbo Machinery >
        • ANSYS-CFX Pump Simulation
        • ANSYS-CFX Turbine Cooling >
          • Steps to Model Gas Turbine Blades
      • ANSYS-CFX Formula One CAR >
        • Car Aerodynamics Books
      • ANSYS-CFX Heat Exchanger >
        • ANSYS-CFX Finned Heat Exchanger
        • Phase Change Heat Exchangers
        • Shell and Tube Heat Exchangers
        • Heat Exchangers Reading List
        • ANSYS CFX Heat Exchanger Tube Wear
        • ANSYS CFX Thermal Radiation
      • ANSYS CFX Combustion >
        • ANSYS-CFX Gas Turbine Combustor
        • ANSYS-CFX Multiphase Combustion Modelling
        • ANSYS CFX Flamelet
      • ANSYS-CFX Spary Modelling >
        • ANSYS-CFX Spray Modelling in Car Engines
        • ANSYS-CFX Resolving Multiphase Interface
        • ANSYS CFX Fluid/Solid Transport
        • ANSYS-CFX Air Assisted Sprays
        • Applying a Function of Time
        • ANSYS CFX Rosin Rammler
        • ANSYS CFX Nukiyama Tanasawa
        • SAUTER MEAN DIAMETER
      • ANSYS Geophysical Simualtions >
        • ANSYS Modelling Terrain
      • ANSYS-CFX Tank Sloshing
      • ANSYS Combustion Engines >
        • Setting up ICE Simulation
        • Applying Radiation in the Engine
      • ANSYS-CFX Pelton Turbine
      • ANSYS Flow Modelling Throttle Valve
      • ANSYS-CFX Immersed Solid
      • ANSYS CFX Changing Airfoil Para
      • ANSYS Flow around Buildings
      • ANSYS CFX Compressible Flows
      • ANSYS CFX Solid Particles
      • ANSYS Horizontal Francis Turbine
      • ANSYS-CFX Kaplan Turbine
      • ANSYS-CFX Hair Dryer
      • Types of Flaps >
        • Wings
    • ANSYS-FLUENT >
      • ANSYS FLUENT Simulation Setup >
        • ANSYS FLUENT Boundary Conditions
      • ANSYS FLUENT UDF
      • ANSYS-FLUENT Heat Exchanger Tutorial
    • ANSYS Design Modeller >
      • Blade Modelling >
        • Modelling a Turbine Blade
        • ANSYS Blade Modelling
        • ANSYS BladeGen Axial Compressor
        • ANSYS BladeGen Centrifugal Compressor
      • ANSYS Design Modeler Operations
      • ANSYS Design Modeler Boolean Operations
      • Design Modeller for Turbo Machinery
    • ANSYS CFX Meshing >
      • ICEM >
        • ICEM Introductory Tutorials
        • ICEM Surfacing
        • ICEM Parallel Meshing and Repair
        • ICEM Theory
      • Importing External Geometry to ANSYS
      • ANSYS CFX Types of Meshing >
        • Mesh (Refinement/Relevance)
        • Mesh Number of Cells
        • Mesh Types
        • Mesh Sizing
      • CFX Meshing Online Material
    • ANSYS Simulation Setup >
      • ANSYS CFX Lang CEL >
        • ANSYS-CFX Time Dependent Boundary Conditions
        • Applying a time dependent Velocity Profile
        • Inserting Equation into ANSYS
      • Workbech File Structure
      • Dealing With Memory Problems >
        • Calculating Resources
        • Calculation Guide Lines
      • Applying a Source Term
      • Applying a Velocity Profile to BC
      • Varabile Dependent Boundary Condition >
        • Time dependent Boundary Condition
        • Temperature Dependent Boundary Condition
      • Applying a Riged Body
      • CFX Data Transfer
      • CFX User Functions
      • ANSYS CFX Material Addition
    • ANSYS CFX Steady/Unsteady >
      • ANSYS CFX Time Stepping
      • Time Step Planning
      • Adaptive Time Stepping
      • Length Scale
      • Time Scale
      • Number of Iterations
      • CFL Condition
      • ANSYS CFX Transient Blade Flow
    • ANSYS CFX Data Analysis >
      • ANSYS CFX Moving Mesh >
        • ANSYS Dynamic Mesh
        • ANSYS CFX GGI Interface
      • CFD-Post >
        • CFX Point Parameter
        • ANSYS Parameter Analysis
        • Fatigue Life Optimization with ANSYS nCode DesignLife
        • ANSYS-CFX Probe Tool
        • Exporting Plane Data
        • CFD-Post Parameters
        • Using FFT for Data Analysis
        • Finding Paramters of a Close Surface
        • Histograms in CFD-Post
        • Extracting Data from a Stream Line
        • Transient or Seqence in CFD-Post
        • Linear Data Analysis in CFD-Post
        • CFD-Post Point Cloud
      • ANSYS Making Movies
      • ANSYS CFD-Post Data Loading
      • ANSYS-CFX Data Importing for Analysis
      • ANSYS Loading Simulation Data
      • ANSYS CFX Analysis Tools
      • ANSYS and Excel Data Analysis
      • Using Report Viewer
    • ANSYS Simulation Validation >
      • Flow Validation Around a Cylinder
      • Grid Sensitivity Analysis >
        • ANSYS-FLUENT Time Dependent Boundary Condition
      • Validation Steps
    • ANSYS Blogs >
      • ANSYS HPC
      • ANSYS Stress Analysis >
        • Wing Stress Analysis
        • ANSYS Mechanical APDL
        • Tail Fin Stress Analysis
        • ANSYS Stress Analysis Material >
          • Assigning Boundary Conditions
        • ANSYS Friction Modelling
        • ANSYS Static Structure
        • ANSYS Rigid Dynamics
        • ANSYS Explicit Dynamics
        • ANSYS Assembly Manager >
          • ANSYS Rigid Dynamics
  • MATLAB
    • MATLAB Control Circuits
    • MATLAB GUI
    • MATLAB Fourier Transform >
      • MATLAB Fourier Transform
    • MATLAB Numerical Analysis >
      • Newton Raphson Method
      • MATLAB Derivatives
      • Coding MATLAB EQUATIONS
    • MATLAB APPLICATION >
      • MATLAB Time Dependent Beams
      • MATLAB Hydrulic Circuts Losses
      • MATLAB Sensitivity Analysis
      • MATLAB Water Resources
      • MATLAB Reciprocating Engine
      • MATLAB Ready Polygon Data
      • MATLAB Aerofoil Lift Calculation
      • MATLAB Gas Diffusion
      • MATLAB Studying Drag
      • MATLAB Fuel Droplet Studies
      • MATLAB Atmospheric
      • MATLAB Gas Turbine Code
      • MATLAB Combustion
      • MATLAB Spray Modelling
      • MATLAB Moving Sets of Data
      • MATLAB Applying Non-Slip Conditions
      • MATLAB Fuel Gas Diffusion
      • MATLAB Landing Gear
      • MATLAB Beam Analysis >
        • MATLAB Bending of Plates
      • MATLAB Wind Analysis
      • MATLAB Code for Solar Radiation
      • MATLAB SIMULATION
    • MATLAB Data Analysis >
      • Adding Descriptive Text to Images
      • MATLAB Multiplying Two Functions
      • MATLAB Image Analysis >
        • MATLAB Image Simulation
      • MATLAB Movies >
        • MATLAB Cameras
      • MATLAB Plotting Functions
      • MATLAB PDF Methods
      • MATLAB Adding Two Functions
      • MATLAB Area Segmintation
      • MATLAB Reading Data In and Out
      • MATLAB Functions Written by User
      • COUPLING MATLAB WITH SOFTWARE
    • MATLAB FlOW MODELLING >
      • MATLAB Continuity Equation
      • MATLAB Navier Stokes Equations >
        • Navier Stokes U Velocity in 2D
      • MATLAB Flow Diffusion
      • Gauss Seidel Matlab
      • MATLAB Partical Motion
      • Matlab Gauss Elimination
      • MATLAB Ideal Gas Equation
      • MATLAB Fluid Properties
      • MATLAB Gauss-Seidel Method
      • MATLAB Boundary Layer
      • MATLAB Infinitesimal strain theory
      • MATLAB Stream Functions >
        • MATLAB Studying Vorticity
        • MATLAB 2D Heat Diffusion
      • MATLAB Atmospheric Analysis
      • MATLAB Crank Nicolson
      • Building Codes >
        • MATLAB Data Generation Algorithm
        • MATLAB DNS Subsonic Code
        • MATLAB Runge Kutta
        • MATLAB DNS Sonic Code
        • MATLAB DNS Incompressible Code
      • MATLAB Flow Applications
      • MATLAB Species Concentration
      • MATLAB Wind Flow Analysis
      • MATLAB Turbulence Modelling
      • MATLAB VECTOR FIELD PLOTS >
        • Vector Fields Sites
        • MATLAB Vector Arrow Function
        • MATLAB Vector Gradient
    • MATLAB Working with Different Coordinates >
      • MATLAB Cylindrical Coordinates
      • MATLAB Spherical Coordinates
    • MATLAB Algebric Operations >
      • MATLAB Diagonal Matrix Construction
      • MATLAB Applying Shear to a Box
      • MATLAB Rotating a Set of Points
      • MATLAB Translation
      • MATLAB Scaling a Box
    • MATLAB MESH GENERATION >
      • MATLAB GEOMETRICAL MODELLING
      • MATLAB Geometric Operations
      • MATLAB Mesh Simulation
      • Delaunay Trangulation >
        • Mesh Genration Code Trials
      • MATLAB Uniform Mesh
    • MATLAB PDE Problems >
      • MATLAB Vibrations Modelling >
        • MATLAB Harmonic Motion
        • Molecular vibration
      • MATLAB Solving ODEs
    • MATLAB Reading List
  • SolidWorks
    • AutoDesk 3ds Max
    • AutoCAD
    • Aircraft Design >
      • Aircraft Design Data Base 1
      • Aircraft Structures Books
      • Aircraft Cutaway Drawings
      • Aerodynamics Book Reviews
  • Programs
    • STAR-CCM+ Tutorials
    • FORTRAN90 >
      • The Netlib
      • Salome-Platform
    • CHEMKIN
    • OpenFoam >
      • OpenFOAM Installation
      • OpenFoam Links
    • C++ >
      • C++ Compiling Your First Code
      • C++ Delaunay Triangulation

Example Working on Images jpg,bmp....etc

http://www.mathworks.com/products/matlab/demos.html?file=/products/demos/shipping/matlab/imagedemo.html#11

a = magic(4);
image(a);
map = hsv(16);
colormap(map)
colorbar
Picture

Example  Creating Tables in MATLAB

Create a that has a row with the following , called mydata.txt:

u v w p t

Then write the code

clc
clear
[names1, names2, names3, names4, names5] = textread('mydata.txt','%s %s %s %s %s',1);

Working with strings http://www.mathworks.co.uk/help/techdoc/ref/textread.html

ExampleTracying a profile from an image file

It is a usefull command to use by importing and image and selecting the cooordinates of a number of points

[x,y]=ginput(10)

More info go to :http://www.mathworks.com/help/techdoc/ref/ginput.html
Picture

Example Using The Area Command

This command can be very usefull for higligting the studied area.

clc
clear
N=12;
for i=1:N
x(i)=randn(1,1);
end
area(x)
Picture

Example Best Fit for a Set of Data to a Line

clc
clear
x1=(0:1:4);
y1=[ 1 1.8 3.3 4.5 6.3 ];
nn=size(x1);
for i=1:nn(2);
z1(i)=x1(i)*y1(i);
z2(i)=x1(i)*x1(i);
end
check1=sum(x1);
check2=sum(y1);
check3=sum(z1);
check4=sum(z2);
A(1,1:2)=[nn(2) check1 ];
A(2,1:2)=[check1 check4];
B(1,1:2)=[check2 check3]
BB=(A^-1)*B'
for i=1:nn(2);
x(i)=x1(i);
y(i) = BB(1)+BB(2)*x(i)
end
plot(y,'--')
hold on
plot(y1,'r')
title('Best Fit for a Line')
xlabel('x axis','FontSize',12)
ylabel('y axis','FontSize',12)
grid on
Picture

Example Reading an Image into Matlab

The user can change the name and extention of the studied material .

[x,map]=imread('flowers.tif');

image(x)

colormap(map)

Example Performing Cosmetics on a Generated Plot

clc
clear
M=10;
N=10;
for i=1:M;
x(i)=rand(1,1)
end
y=(1:1:N)
figure(1)
plot(y,x,'--');
title('Text on Plot Test','FontSize',15);
text(y(7),x(7),'*-Plotted Point','FontSize',10)
grid on
legend('Data');
xlabel('x axis','FontSize',10)
ylabel('y axis','Rotation',0,'FontSize',10)
Picture

Example  Specfiying Plotting Ranges

Picture
clc
clear
x = -pi:.1:pi;
y = sin(x);
p = plot(x,y)
set(gca,'XLim',[1 2]) % Change the values of the numbers in brackets which represents the data range
set(gca,'XTick',-pi:pi/2:pi)
set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})
xlabel('-\pi \leq \Theta \leq \pi')
ylabel('sin(\Theta)')
grid on
title('Plot of sin(\Theta)')
text(-pi/4,sin(-pi/4),'\leftarrow sin(-\pi\div4)', 'HorizontalAlignment','left')
set(p,'Color','red','LineWidth',2)

Example  Plotting a Simple Set of Data

clc
clear
x=[ 1 2 1 2 4 5 ]
y=[ 4 5 6 2 1 5]
plot(x,y)
title('X-Y Plot')
xlabel('x axis')
ylabel('y axis')
grid on
legend('Data')
Picture


Note 1 :Getting the wanted plot settings playing around with the aspect Ratio:

These are the required commands,for a 2D plot.

A-axis equal

B-axis equal tight

C-axis square

D-axis normal


Note 2 :Curve fitting.

Example Saving a Generated Image in png Format into a Default Folder

image = rand(400, 400, 3);
imwrite(image, 'File_name_1.png')
imwrite(image, fullfile(cd, 'File_name_1.png'))


Picture

Example Genrating an Image in jpg format onto the Default folder

image = rand(400, 400, 3);
B = double(image);
imshow(B);
imwrite(B, 'new_image.jpg', 'jpg')

Picture
A good link is one that is by Mathsworks :
http://www.mathworks.co.uk/products/matlab/examples.html?file=/products/demos/shipping/matlab/imagedemo.html#11

Example Making a Simple Movie

clc
clear
for i = 1:32
plot(peaks(i+4))
axis equal
M(i) = getframe;
end
movie(M,5,6)
Picture
Good Links
https://sites.google.com/site/amgsmatlabtutorial/home/page-2/page-3/page-4-multimedia-data
http://www.mpeg.org/MPEG/products/configuring-your-web-browser-to-play-mp3.html
http://www.mathworks.co.uk/help/matlab/ref/imwrite.html#f25-720264


Example Making a simulation using the Erase Mode

clear
clc
clf
for l=1:60;
x=-10:0.01:10;
k=-1; y=k*x.^2+3*k*x-2;
h=plot(x,y);
grid on
set(h,'EraseMode','xor')
axis([-10,10,-100,100])
while k<1
k=k+0.01;
y=k*x.^2+3*k*x-2;
set(h,'XData',x,'YData',y)
drawnow
end
end


Picture

Example Scaling a Circual in X axis Direction and Y axis Direction

clc
clear
r=2;
N=360;
theta(1)=0;
for i=1:N
theta(i+1)=theta(i)+1;
alpha(i)=(pi/180)*theta(i+1)
end
for i=1:N;
x(i)=r*cos(alpha(i));
y(i)=r*sin(alpha(i));
end
plot(x,y)
grid on
hold on
for i=1:N;
xx(i)=x(i)/1.2;
y(i)=r*sin(alpha(i));
end
plot(xx,y,'*')
hold on
for i=1:N;
xx(i)=x(i)/1.4;
y(i)=r*sin(alpha(i));
end
plot(xx,y,'*')
hold on
for i=1:N;
xx(i)=x(i)/2;
yy(i)=y(i)/3;
end
plot(xx,yy,'*')
title('Scaling Circuls')
xlabel('x')
ylabel('y')

Picture

Example Rotating a Number of Randomly Generated Points

clc
clear
%Number of points
N=5;
%coordinates of coordinate system
x(1)=0;
y(1)=0;
%Generating the random set of points
for i=2:N;
x(i)=rand(1,1);
y(i)=rand(1,1);
end
plot(x(2:N),y(2:N),'-*')
grid on
%Mirroring Angle around y axis
deg1=90; th1=(pi/180)*deg1;
%Mirroring Angle around x axis
deg2=deg1; th2=(pi/180)*deg2;
%The point rotation section
for i=2:N;
theta(i)=atan((y(i)-y(1))/(x(i)-x(1)));
r(i)=(x(i)-x(1))/cos(theta(i));
xx(i)=r(i)*cos(theta(i)+th1)+x(1);
%r(i)=(y(i)-y(1))/sin(theta(i));
yy(i)=r(i)*sin(theta(i)+th2)+y(1);
end
hold on
plot(xx(2:N),yy(2:N),'-+r')
title('Mirroring around the y or x axis of a random set of data')
xlabel('x')
ylabel('y')
%legned('orginal','mirrored')
axis equal
plot(x(1),y(1),'*r');
hold off

Picture

Data Comparison

clc
clear

M=20;
N=20;

z=3;
for i=1:M;
    for j=1:N;
        Q(i,j,z)=randn;
    end
end

z=4;
for i=1:M;
    for j=1:N;
        Q(i,j,z)=randn;
    end
end

fyi=0.7;
for i=1:M;
    for j=1:N;
        Q(i,j,5)=fyi*Q(i,j,3)+(1-fyi)*Q(i,j,4);
    end
end

beta=0.1;
fyi=beta;
for i=1:M;
    for j=1:N;
        Q(i,j,6)=fyi*Q(i,j,3)+(1-fyi)*Q(i,j,4);
    end
end

figure('Position',[10 10 1600 800])
subplot 231
contour(Q(:,:,3),19)
Xlabel('X Axis')
ylabel('Y Axis')
grid on
subplot 232
contour(Q(:,:,4),19)
Xlabel('X Axis')
ylabel('Y Axis')
grid on
subplot 233
contour(Q(:,:,5),19)
Xlabel('X Axis')
ylabel('Y Axis')
grid on
subplot 234
contour(Q(:,:,3),19)
Xlabel('X Axis')
ylabel('Y Axis')
grid on
subplot 235
contour(Q(:,:,4),19)
Xlabel('X Axis')
ylabel('Y Axis')
grid on
subplot 236
contour(Q(:,:,6),19)
Xlabel('X Axis')
ylabel('Y Axis')
grid on
Picture


Unless otherwise noted, all content on this site is @Copyright by Ahmed Al Makky 2012-2018 - http://cfd2012.com
Web Hosting by Just Host