Write a function to solve the two-dimensional in Matlab, unsteady heat conduction equation with no internal heat generation on a square domain. The length of each side of the square is 1 m. The function will have the following 4 inputs:
npts number of grid points in each coordinate direction
nt number of time steps to take
dt size of time step (s)
alpha thermal diffusivity (m2/s)
Use the following initial and boundary conditions:
Initialize the body to T = 0 oC. At time t = 0, boundary conditions are imposed such that the temperatures on the sides of the square vary linearly. Here are the corner temperatures:
bottom left corner: T = 50 oC
bottom right corner: T = 500 oC
top right corner: T = 350 oC
top left corner: T = 150 oC
Write the function definition statement. If you type doc function at the MATLAB command prompt it will give you details on the proper syntax. The syntax is general, showing how to use both inputs and outputs. We will have no outputs, only the four inputs noted above.
Make the name of your function the same as the name of your file. For example, if you call your function heat, then your filename should be heat.m.
Create a variable name for each of the four corner boundary conditions and the initial condition, and set their values.
Noting that the temperature on each edge varies linearly, calculate the temperature at every grid point on the outer boundaries. You’ll need the corner temperatures to do this calculation.
Create an array to contain the “old” temperature field at time level p, and call it told. A convenient way to do this is to use the ones function (look at doc ones), which creates an array of all ones of specified dimensions. An easy way to set the field to the initial condition is to multiply this array by the initial temperature.
If there are any calculated variables that you will use multiple times, calculate them. For example, it’s handy to have a variable npm = npts – 1, where npts is the input number of points in each direction.
Create an array to contain the “current” solution at time level p+1, and call it tnew. An easy way to do initialize it in MATLAB is to simply use
tnew = told;
Create a time loop going from 1 to nt, where nt is the input number of time steps.
Inside the time loop, create two other nested loops, one for the “m” indices (x direction) and one for the “n” indices (y direction). Since we don’t have to re-calculate any values on boundaries, the loops will go from 2 to npm.
For each pair of indices within the loops, calculate the solution at time level p+1 (tnew) as a function of temperatures at time level p (told) using the finite-difference form of the 2-D heat equation.
We are going to do a simple animation of the unsteady results as they evolve. Use the contourf function to create the evolving contour plot. (doc contourf) One of the arguments is the number of contours, and 20 seems to work well for this problem. We want to re-draw the contour plot once per time step, so contourf should be called after the end of the nested spatial loops, but before the end of the time loop. It’s not necessary to use a plot handle as we did in the example in class. Simply call contour each time through the loop.
MATLAB tries to be efficient, so when it sees the contourf function, it will buffer the results rather than plotting them right away. We don’t want it to buffer since we want to create a real-time animation. To prevent buffering, include a drawnow statement on a separate line immediately after the call to contourf. (This is similar to the example we did in class.)
Now that the current time step is complete, we have to copy the new solution to the old one so we can go on to the next iteration, told = tnew. Make this the last line before the end of the time loop.
Add the following to the end of the time loop. The first line adds a “colorbar,” which is a scale showing the correspondence between temperatures and colors. The second line adds a label to the colorbar. Finally, the third line gets rid of the plot axes, since we don’t need them here.
hc = colorbar;
hc.Label.String = ‘Temperature, deg. C’;
axis off
When you’re got your program ready to run, use the following input values:
npts = 40
nt = 1000
dt = 0.1
alpha = 0.001
To run the program, simply type
heat(40, 1000, 0.1, 0.001)
In: Mechanical Engineering
i) Discuss the national plans and policies of ASEAN member states relevant to the growth of Renewable Energy towards regional sustainable development. How would Malaysia play a role in achieving this? You are allowed to include case studies as proof of existing schemes.
ii) Identify the economic enablers to propel Renewable Energy growth at each ASEAN member states.
In: Mechanical Engineering
What historical "first" in spaceflight shocked the world on October 4, 1957, triggering the beginning of the space age and motivating the formation of NASA the following year?
In: Mechanical Engineering
A centrifugal pump is driven at 1300 rpm by a 10 hp motor and delivers 250 GPM at 85 Fahrenheit water against 75 ft water head, assuming that the initial pump efficiency is 65 % doesn’t vary appreciably the maximum flow the pump can deliver is most nearly
In: Mechanical Engineering
4. When does a surface have its total hemispherical emissivity equal to its total hemispherical absorptivity for radiation coming from a blackbody?
A. When the surface temperature is equal to the temperature of the source of radiation
B. When the surface temperature is greater than the temperature of the source of radiation
C. When the surface temperature is less than the temperature of the source of radiation
D. When the surface temperature and the temperature of the source of radiation are equal to absolute zero
In: Mechanical Engineering
2. The emissive power varies with wavelength, the total spectral blackbody power does not. A. True B. False
In: Mechanical Engineering
A wind turbine with cut-in velocity of 8m/s and
cut-out velocity of 30 m/s is installed at a
site with Weibull shape factor 2.4 and scale factor of 9.8 m/s. for
how many hours in a day,
will the turbine generate power, estimate the probability of wind
velocity to exceed 30 m/s.
In: Mechanical Engineering
What composition of lead-tin solder is the best choice for joining electronic components?
Why is this composition chosen?
explain
In: Mechanical Engineering
what are the obstacles that might inhibit the collection and evaluation of Agile process metrics and production analysis matrices?
In: Mechanical Engineering
The creep rate of a viscoelastic material is measured under a load P at 25 °C and 100 °C, respectively. What material property causes the strain rate measured at 100 °C to be greater than that measured at 25 °C? According to what relationship does this material property change with temperature?
In: Mechanical Engineering
hydrofracking involves impregnating the shale with water (which contains some additives) at high pressure which opens cracks in the shale. explain why, to a natural gas company, hydrofracking might seem more feasible than drilling into the shale?
In: Mechanical Engineering
snowboards are typically made out of a thermosetting polymer (i.e. a three dimensionally connected glassy polymer). what type of mechanical behavior would you expect from that type of polymer and why do you suppose reinforcing the polymer with fiber would alleviate problems that might occur due to the mechanical behavior of the polymer?
In: Mechanical Engineering
how can I mount a 3" wheel on a motor with a 52mm dc motor
In: Mechanical Engineering
True False Question
1 Pneumatic energy is the power created by the release of water from a pond.
2 AD- Anaerobic Digester is the conversion of biodegradable waste matter into
compost in the absence of water.
3 Ocean Renewable Energy only includes Wave energy, current energy and
tidal energy.
4 Matching Renewable energy to aquaculture requires using rated kW and loads.
5 A Fish farm is sustainable when the aquaculture energy from the fish-fish
products is less than the energy used to power the farm.
6 For Desalination systems the main energy requirement is electricity.
7 For aquaculture farms, the two main energy areas are heating and electricity.
8 Offshore wind harvesting can be improved by using large floating wind turbines.
In: Mechanical Engineering
The acceleration of a rocket traveling upward is given by a = (8 + 0.02s) m/s2, where s is in meters.(Figure 1). Initially, v = 0 and s = 0 when t = 0.
Determine the time needed for the rocket to reach an altitude of s = 100 m .
In: Mechanical Engineering