You are on page 1of 97

(including a general overview of company)

A Report on 1D and 2D heat transfer project

Aerospace Department TATA Technologies Limited, Hinjewadi


By: Vishesh Gupta 2011A4PS273P

At TATA Technologies Limited, Hinjewadi, Pune A Practice School I station of

Birla Institute of Technology and Science, Pilani, Rajasthan July, 2013


Tata Technologies Limited 1

A Report on 1D and 2D heat transfer project


(including a general overview of company)

Aerospace Department TATA Technologies Limited, Hinjewadi


By: Vishesh Gupta 2011A4PS273P

Prepared in partial fulfillment of the Practice school I Course At TATA Technologies Limited, Hinjewadi, Pune A Practice School I station of

Birla Institute of Technology and Science, Pilani, Rajasthan July, 2013

Tata Technologies Limited

Acknowledgement
I am grateful to Tata Technologies Limited for giving me this opportunity to gain experience at the organization and for giving me invaluable guidance right at the start. I would also like to thank Mr Sumeet Dhar (Project Manager), Mrs Prachi Dhadheech (HR) for their valuable support throughout our tenure. I would like to make a special mention of Vinay Shekhar (employee at the aerospace department) for providing me deep insight at crucial junctures of my project and small helps in debugging the code. I would also like to extend my gratitude towards Mr Manoj (aerospace project manager) for giving me the freedom to work through my project and patiently listening to my queries and explanations also giving worthy advice. I would further like to express my gratitude towards Dr Biswadip Shome for giving me worthy suggestions and sufficient time to extend my project to 2D analysis in the short time I worked under him. I would finally like to thank Dr Ranjit Patil( PS Instructor from BITS Pilani) for being a constant source of motivation for me throughout my internship at Tata Technologies.

Tata Technologies Limited

Birla Institute of Technology and Science Pilani (Rajasthan) Practice School Division Station: Tata Technologies Ltd. Centre: Hinjewadi, Pune Duration: 53 Days Date of Start: 22/05/2013 Date of Submission: 07/07/2013 Title of Project: Simulation tool for a floor fire test and the behavior of the material in the test by modeling of a transient heat transfer process through a series of slabs. Name of Student I.D.No. Vishesh Gupta 2011A4PS273P Discipline B.E. Mechanical

Name and designation of experts: Dr Biswadip Shome (Head Aerospace Design & Validation) Manoj Radle (Project Manager) Name of PS Faculty: Dr. Ranjit Patil Key words: heat transfer, finite difference analysis Project Areas: transient heat transfer, partial differential equations, fully implicit FDM
Tata Technologies Limited

Abstract
This project report has been primarily divided into four chapters. Chapter 1 deals with company information. Chapters 2, 3 and 4 give detailed analysis of my project related work. Chapter 1 aims at giving a general overview of the company, mainly information pertaining to what was observed during the orientation sessions. Chapter 2 deals with 1 dimensional heat transfer solved by the analytical method using techniques like transformation of nonhomogenous boundary conditions to homogenous boundary conditions by superposition principle, separation of variables and Greens function. Chapter 3 concerns with the numerical approach adopted to solving the 1D heat transfer problem. The fully implicit finite difference scheme has been utilized here which is unconditionally stable and convergent. The matrix formed has been solved both directly using in-built MATLAB methods as well as Gauss-Seidel iterative procedures. Finally, Chapter 4 showcases the 2D heat transfer problem solved by a numerical approach which uses a slight variant of the fully implicit finite difference scheme called the alternating direction implicit method (ADI).

Signature (Student) Date:


Tata Technologies Limited

Signature (Project Guide) Date:

Signature (PS Faculty) Date:

Table of Contents
S No. Topic Page No.

CHAPTER I Introduction Orientation Related Information ERM Software Partners CHAPTER II 1D Analytical approach Improvements & Conclusion CHAPTER III 1D Numerical Approach Improvements & Conclusion CHAPTER IV 2D Numerical Approach Improvements and Conclusion Appendix A Appendix B Appendix C References

5 11 20 24

34 46

47 58

59 70 71 77 87 92

5 6 7 8

Tata Technologies Limited

List Of Illustrations
Figures Fig. 1.1 Fig. 1.2 Fig. 1.3 Fig. 1.4 Fig. 1.5 Fig. 1.6 Fig. 1.7 Fig. 1.8 Fig. 1.9 Fig. 2.1 Fig. 2.2 Fig. 2.3 Fig. 3.1 Fig. 4.1 Tata overview Presence of Tata Technologies over the globe Product Cycle at Tata Technologies Historical Performance Global initiatives to sustain and grow employee engagement Risk Management Process Some clients of Tata Technologies Aerospace Design Procedure Airplane structure components Time-Temperature Curve Values of source temperature and time Transient heat transfer through a series of blocks 1 dimensional heat transfer through a series of blocks 2 dimensional heat transfer through a series of blocks

Tata Technologies Limited

Graphs Graph 2.1 Graph 2.2 Graph 2.3 Graph 3.1 Graph 3.2 Graph 3.3 Variation of source and interface 1 temperature with time Variation of source and interface 2 temperature with time Variation of source and all interface temperature with time Variation of source and interface temperature with time by direct solving of matrix Variation of source and interface temperature with time (Gauss-Seidel iteration) Variation of source and interface temperature with time (both direct by direct matrix and Gauss-Seidel iteration) Convergence of temperature at particular time by Gauss-Seidel iterations Variation of node 1 temperatures of all interfaces with time Variation of temperature of all nodes at top surface with time Temperature of all nodes at 30 min at top surface

Graph 3.4

Graph 4.1 Graph 4.2 Graph 4.3

Tata Technologies Limited

CHAPTER I
Introduction
The origins of Tata Technologies lie with disparate organizations started in India, Europe and the USA over 20 years ago. Gradually the European and North American companies came together until in 1989 a single entity emerged INCAT. Following growth and acquisition, that company firmly established itself in North America, Europe and Japan. And in 2004, INCAT was launched on the London Stock Exchange. Tata Technologies started in Singapore in 1994 as a provider of specialized IT enabled consulting, services and products to leading manufacturers. Establishing itself in the USA, UK and India, the companys first major outsourcing contract was with Tata Motors. Then, in 2005, Tata Technologies acquired INCAT. Today, the enlarged company serves the major automotive and aerospace OEMs and their suppliers. Tata Technologies is active in North America, Europe, the Middle East and the Asia-Pacific region, and currently services all of the top ten aerospace original equipment manufacturers (OEMs) and all of the top ten automotive OEMs.

Tata Technologies Limited

The Tata group


Tata Technologies is part of the Tata group, one of Indias oldest, largest and most respected businesses. Founded by Jamsetji Tata in 1868, the group pioneered industries of national importance to India: steel, power, hospitality and airlines. With revenues over US $100 billion, the group today has 3.2 million shareholders, more than 100 operating companies in six continents and employs more than 450,000 people. It focuses on steel production, power generation, commercial and passenger vehicles, chemicals, hotels, textiles, consumer goods, consultancy, information technology and telecommunications. Earning the trust and respect of millions of stakeholders around the world, the group and its enterprises have adhered to a rigorous set of business ethics and a strong commitment to corporate social responsibility for over 140 years.

Fig. 1.1: Tata overview

Tata Technologies Limited

10

Fig. 1.2: Presence of Tata Technologies over the globe


Tata Technologies Limited

11

Fig. 1.3: Product Cycle at Tata Technologies (1st half)

Tata Technologies Limited

12

Fig. 1.3: Product Cycle at Tata Technologies (2nd half)

Tata Technologies Limited

13

Fig. 1.4: Historical Performance

Tata Technologies Limited

14

Orientation Related Information


Tata Technologies enables manufacturing companies to design and build better products through engineering services and the application of information technology to product development and manufacturing enterprise processes. With over 6,000 engineers, representing 17 nationalities, Tata Technologies covers every aspect of the value chain from conceptualization, manufacturing and aftermarket/MRO support. The three major industry verticals that it serves include aerospace, automotive and machinery manufacturing. Tata Technologies supports clients through comprehensive engineering services and IT processes and tools to manage product development and the complete manufacturing ecosystem. It serves clients in 25 countries, with a delivery model specifically designed for engineering and IT engagements that offers a unique blend of deep, local expertise integrated with our nine global delivery centers based in Detroit (USA), Coventry (UK), Pune and Bangalore (India), Brasov, Craiova & Iasi (Romania), Stuttgart (Germany), and Bangkok (Thailand).

Tata Technologies Limited

15

VPD Vehicle Programs & Development (VPD) The VPD provides complete outsourced program management, concept development, detail design, validation and manufacturing planning services. Projects of this scale and complexity are achieved through a combination of automotive experts in the US and Europe, coupled with Indias most experienced automotive engineers. Programs include electric vehicles, or EV variants that help achieve sustainability targets, while providing mobility at an affordable price point. The eMO-C electric delivery vehicle concept, designed by Tata Technologies, follows the eMO showcased at the 2012 International Auto Show in Detroit, was a first for any Indiabased engineering services firm. E&D Outsourced Engineering & Design The services of this group include concept development, VA/VE, CAE, detailed engineering, embedded software development, product verification, and manufacturing process design, tool design and validation, applied to major product subsystems and components. Offerings include the provision of providing services from offshore engineering centers in India, Romania and Thailand. PLM Product Lifecycle Management Solutions The PLM optimizes product development processes, implementing collaborative PLM tools, a major contributor to ER&D investment efficiency, especially for global engineering teams with extensive supply chains. Tata Technologies is the worlds largest independent reseller of PLM technology. It and
Tata Technologies Limited 16

its customers are among the worlds top users of PLM technology. The companys engineers use these products to efficiently deliver services to our clients worldwide. It packages the insights and best practices we have developed through our engineering heritage into service offering templates to improve the efficiency of engineering teams at Tata Technologies and its clients. ESG Enterprise Solutions Group The ESG provides consulting and IT solutions that help manufacturing customers in optimizing critical enterprise processes through the application and data analytics of Enterprise Resource Planning, (ERP), Manufacturing Execution Systems, (MES), and Customer Relationship Management, (CRM), including the use of social media and improving manufacturing planning and performance. It also has extensive experience in rapidly integrating the processes, systems and data of companies acquired by manufacturers.

Tata Technologies Limited

17

Overview and Outlook


1. Manufacturing The sectors that it serves aerospace, automotive and machinery manufacturing, have emerged from the global recession and engineering R&D (ER&D) spends have grown consistently. Demand is being driven by an increasingly competitive market and changing demographics in the west, where availability of a skilled engineering workforce is on the decline in many countries, adds NASSCOM. Tata Technologies helps its partners in the manufacturing industry tackle challenges relating to the shortage of engineering resources and skills. It partners with the worlds top automotive OEMs and tier one auto suppliers, top aerospace companies and leading machinery manufacturing OEMs to supply high-end capability and variable capacity. It can scale up rapidly, flexing resources and specific skills to meet the project demands of our clients, helping them move from fixed to variable costs, yet retaining access to top talent, who understand their products and processes. 2. Aerospace Global air travel is poised to grow significantly over the next few years and expand the addressable market for airlines and their partners. While innovation in business and operating models evolve at a rapid pace, product innovation needs to gather exponential momentum for airlines to win the battle against high operating costs. The aerospace sector is projected to be worth over $4 trillion by 2030 according to Airbus and
Tata Technologies Limited

18

Boeing with 86,000 new aircraft expected to be delivered over the next 20 years. The backlog of orders for large commercial fixed-wing aircraft stands at 8,000 and is growing, driven mainly by the introduction of new aircraft such as Airbus A320neo and A350, and Boeings 737 MAX and 787. The depressed market for business jets is starting to recover and new product development is on the rise with expectations that the market will grow five percent annually over the next few years. Even the global commercial helicopter market is recovering sooner than expected. Booz & Co identifies four major challenges confronting the civilian aerospace sector: increasing production rates; unsustainable development cost and value distribution; growing demand for more efficient aircraft; and digitization of the industry. The spurt in production of aircraft has led to a slip-up in the supply chain, as not all suppliers are geared to meet the increased demand. The existing tooling, infrastructure and capabilities will be pushed to the limit across the upstream supply chain because of increased outsourcing and the complexity of sub-systems and assemblies.

Tata Technologies Limited

19

3. Automotive Rarely has an industry confronted the magnitude of multidimensional change that the automotive industry faces today. Meanwhile, 2012 sales in Europe reached the lowest level in 17 years, due to a weak economy and low consumer confidence. In the United States, strong pent-up demand and a falling unemployment rate helped auto sales reach a five-year high in 2012. The regional shift in vehicle sales opportunities translates into a need to develop products that resonate with new groups of consumers. The automotive industry is being shaped by a number of forces, according to KPMG's 2013 Global Automotive Executive Survey. Among them are environmental pressures leading to more efficient engines. Electric mobility To capitalize on these industry trends, Tata Technologies formed a Vehicle Programs Development group in2011. The group has demonstrated its capabilities to develop a complete vehicle. In 2012, Tata Technologies' eMO (electric mobility) vehicle study was introduced to the industry at the North American International Auto Show in Detroit. The worlds first complete vehicle study developed by an India-based engineering services company, the eMO showcases innovation in automotive packaging and design, manufacturing processes, as well as electric vehicle engineering benchmarks, and was developed to go to market at the disruptive price point of $20,000.

Tata Technologies Limited

20

In 2013, the group introduced the eMO-C, a commercial vehicle variant, profiled in another part of this report, and opened an all-new 10,000-square foot North American Engineering and Innovation Center in Troy, Michigan, USA. The facility opened in March with 60 engineering professionals, with the number expected to exceed 100 by the end of the year.

4. Machinery Manufacturing There are five major trends that are evident in the global industrial machinery segment: agile product development; cost fitness/fine-tuning the cost structure to fund growth; leveraging IT/digitization; developing the BRIC markets and other emerging regions; and impacting technological trends connectivity, monitoring and emissions reduction. For many industrial companies, developing the BRIC markets and other emerging regions represent the best opportunities for growth. With the machinery manufacturing sector witnessing steady growth worldwide, Tata Technologies is well positioned to support various OEMs and tier 1 suppliers. Its service offerings cover product design, mechanical, electrical and embedded electronics and manufacturing engineering. The aim is to be a full service provider to the machinery

Tata Technologies Limited

21

manufacturing industry by leveraging our skills and knowledge in engineering, Product Lifecycle Management (PLM) and enterprise IT solutions. Its machinery manufacturing domain comprises experts with extensive knowledge in systems engineering, mechanical engineering, product design, electrical, electronics and embedded design and development. Its innovative and frugal engineering approach helps organizations create products, at a faster pace with a lower cost, delivering more value to end customers. Human Capital The Company continues to pursue its strategy of growing returns on human capital. It strives to consistently sustain a high performance culture to bring out the best in people in a signature working experience. This supports its customers with highly proactive and motivated teams to ensure delivery on promises of best of breed solutions cost effectively. Customer delight leads to Shareholder value. Talent Acquisition A focused branding of the Company both with Campuses and the industry job market lies at the foundation of our strategy for talent acquisition. The focus on acquiring skills, specific to customer needs takes root with specialized courses designed by us and offered to select institutions. The company addresses the job market with several propositions for quick engagement of exceptional talent. Its PFLE branding (Passionate Fun Loving Engineer), a proactive team of recruiters supported by imaginative IT enabled processes, ensures the highest
Tata Technologies Limited

22

productivity on talent acquisition. Costs of recruitment benchmark well with industry. Recruitment lead times are continuously on the decline.

Fig. 1.5: Global initiatives to sustain and grow employee engagement

Tata Technologies Limited

23

ERM
Definition ERM is a process, effected by an entity's Board of Directors, management and other personnel, applied in strategy setting and across the enterprise, designed to identify potential events that may affect the entity, and manage risks to be within its risk appetite, to provide reasonable assurance regarding the achievement of entity objectives. The Company has established a formal Enterprise Risk Management (ERM). The Company has adopted the recommendations on the Enterprise Risk Management framework provided by the Committee of Sponsoring Organizations of the Treadway Commission (COSO). As a services focused Company, it is necessary for the Company to manage risk at the individual transaction level and to consider aggregate risk at the customer, industry and geographic, where appropriate. ERM Organization and Process The Executive Management Team of the Company is responsible for implementing the Risk Management Framework under the direction of the Audit Committee of the Company, and the Audit Committee provides periodical updates to the Board of Directors of the Company. The Board monitors the overall performance of the Risk Management function.

Tata Technologies Limited

24

Risk Management Activities A disciplined approach to risk is important in an organization such as ours in order to ensure that we are executing according to our strategic objectives and this process is designed to identify potential events that, if they occur, will affect our Company. The management has identified the following top 10 risks, classified into external risk factors and internal risk factors, to help achieve business objectives in a robust manner.

Fig. 1.6: Risk Management Process

Tata Technologies Limited

25

Global delivery Tata Technologies has fine-tuned its ability to gather its global resources in combinations that reap the utmost benefit for its clients. It can combine its scalable resources both human and physical with the proven technology and our accumulated lengthy experience to address any client requirement. And it can do it while providing the underlying assurance that all its efforts are underpinned by a robust reputation for thorough organization and first-class engineering. At each client engagement, it balances its resources for maximum benefit. With access to several thousand engineering and technology specialists, it can also provide the right level of qualifications, experience and skills to meet your exact requirements. In addition, its global services delivery team is led by individuals with a robust background in engineering. It offers real-world education for: 1) Dassault Systmes 2) Siemens PLM 3) Autodesk (mechanical design applications) 4) MSC Software Product-development IT IT is the lifeblood of your business. And aligning your enterprise systems, PLM, enterprise resource planning (ERP), customer relationship management (CRM), information lifecycle management (ILM), application lifecycle management (ALM) and production systems to your business strategies is
Tata Technologies Limited 26

key to creating successful products, satisfied customers and enhanced profits. Tata Technologies is unique in that it look at this area holistically, allying your business strategies to the most appropriate software and systems. The company has been engaged in SAP implementation services for product-centric organizations in a wide variety of industries around the world. Its SAP service offerings span all phases of the lifecycle of your enterprise from planning to implementation, customization, development, testing and postmanufacturing support. And thats how it keeps the lifeblood of your company flowing. Better CRM initiatives are not limited to software installation, they involve considering the context, support and understanding of professionals so that they can learn and take full advantage of your information systems.

Tata Technologies Limited

27

Software partners
Dassault Systmes Tata Technologies is recognized as a Premier Partner with Dassault Systmes, a global software alliance for the CAD/CAM/CAE/PLM market. 1) CATIA products are based on the open and scalable Dassault Systmes V5 and V6 architecture. CATIA is the leading product development solution for all manufacturing companies, from big OEMs to small producers. 2) SMARTEAM brings affordable product data management capabilities to small-to-medium companies. 3) ENOVIA is a leading enterprise solution for robust, collaborative product data management. 4) DELMIAs digital manufacturing solutions enable the continuous creation and validation of manufacturing processes throughout the product lifecycle.

MSC Software MSC Software is the leading global provider of integrated enterprise simulation solutions. 1) SimOffice easy-to-use simulation enables engineers to verify design in the Microsoft Windows desktop environment.

Tata Technologies Limited

28

2) Nastran is the powerful all-purpose finite element analysis solution used by the worlds most admired manufacturers. 3) Adams, the market-leading motion-simulation software, simulates system level and loads. 4) Patran, with its universal graphics user interface enables finite element modeling, analysis and data integration, analysis simulation and visualization capabilities. 5) Marc is ideal for the simulation of non-linear physical behavior of material conditions under extreme stress. Siemens PLM Siemens PLM provides leading software solutions that help manufacturers turn more ideas into successful products. 1) Teamcenter powers innovation and improves productivity by connecting your team with the product and process knowledge you need to make good decisions throughout the product lifecycle. Teamcenters open PLM foundation powers end-to-end lifecycle process excellence. 2) NX Synchronous technology from Siemens PLM Software can make your design process up to 100 times faster. With this breakthrough, you no longer have to choose between constraint-driven or history-free modeling, and you can use data from multiple CAD systems. 3) Solid Edge with synchronous technology is a complete feature-based 2D/3D CAD system that combines the speed and flexibility of direct modelling with precise control of dimension-driven design.
Tata Technologies Limited 29

Autodesk Autodesk is a world-recognized leader in design, visualization and documentation software products. Tata Technologies is an Autodesk Premier Solutions Provider with the added distinctions of being a Manufacturing Specialist and an Authorized Training Center. Tata Technologies provides clients with AutoCAD, AutoCAD Electrical, AutoCAD Mechanical and Autodesk Inventor software and servicebased solutions.

Tata Technologies Limited

30

Fig. 1.7: Some clients of Tata Technologies

Tata Technologies Limited

31

Project in the Aerospace Department Todays intelligent aerospace businesses understand that the key to successful engineering and PLM collaboration is finding the right strategic partner a partner with credible experience in the aerospace domain, integrated global design delivery centers, innovative business processes, proven resource scalability, and one who understands your unique business requirements. For over two decades Tata Technologies has been providing the worlds foremost aerospace organizations with complete design-to-build solutions and customized answers to the most complex PLM challenges. Seeing the problems better and delivering better solutions is what we do well no matter what the challenge. As global delivery and outsourcing become key strategies for the aerospace industry, its approach helps companies to achieve cost savings, time to market, and gain competitive advantage. Tata Technologies brings blended onshore and offshore delivery resources combined with state-of-the-art design center facilities and the largest concentration of PLM aerospace technology expertise in the world. Its engineering pedigree is its foundation which is better in every way

Tata Technologies Limited

32

for aircraft design. Andbetter for the customers at 35,000 feet.

Fig. 1.8: Aerospace Design Procedure


Tata Technologies Limited

33

Fig. 1.9: Airplane structure components

Tata Technologies Limited

34

Project on 1 dimensional heat transfer Project Statement Create a simulation tool/calculation tool that will allow us to simulate a floor fire test and the behavior of the material in the test. See sketch below for test setup. - The tool shall be able to calculate the temperature at the top of the flooring material inside the vehicle floor - The tool shall have the ability to simulate the temperature rise at the top of the flooring material when the under said floor is subjected to a temperature curve per ASTM E-119. The tool has to be able to calculate the "top of floor" temperature at least every minute for at least 30 minutes.

Tata Technologies Limited

35

Fig. 2.1: Time-Temperature Curve

Tata Technologies Limited

36

Fig. 2.2: Values of source temperature and time

Tata Technologies Limited

37

CHAPTER II

1D analytical approach
In Simple Words

Fig. 2.3: Transient heat transfer through a series of blocks

The given problem is to be sampled for the base of an aero plane which is linked to the engine and has a high heat exposure. Since, exact experimental tests are not very feasible for this problem, a theoretical study and a simulation model is necessary for this very purpose. This model is then to be simulated in reality and passed through required tests for the aircraft to be considered risk-free for manufacturing purpose.
Tata Technologies Limited 38

If the heat at the top of the surface is found to exceed danger limits, then the experimental simulation will not pass the given test. In any case, a theoretical model for this 1 dimensional heat transfer is highly essential.

Explanation
In the given model, an unknown number of blocks (to be decided by the user) are placed on top of one another (all of different materials and properties). The sides of the blocks are insulated so that heat transfer takes place only from bottom to base in 1 direction. The bottom of the 1st block is heated on an imaginary oven which has varying temperature according to the plot shown in figure 2.1 (and also the values printed in figure 2.2). The ambient temperature is 293 K. Assumptions Heat flow is considered to be transient in nature The interfaces of the blocks are assumed to be in perfect thermal contact so that temperature at the interface is equal for both the blocks and thus no convection takes place at the interface Rate of heat conduction at the interfaces is assumed to be the same for both the blocks Radiation and convection effects within the blocks are neglected (convection on the top surface is however considered)

Tata Technologies Limited

39

The properties of the blocks like thermal conductivity, density etc. are assumed to be constant with temperature. The heat transfer coefficient at the convection surface is also assumed to be constant. The temperature at the bottom surface is approximated to be a sixth order polynomial (varying with time). The values of beta in the solution are taken only up to 10 values as the effect of the latter values on the solution is assumed to be negligible. No heat generation in any of the blocks

Formulation of the differential equations

Boundary Conditions ( )

Tata Technologies Limited

40

Initial Conditions

Solution Background: non homogeneity in equations knowledge of Greens function transformation of non-homogenous boundary conditions to homogenous boundary conditions by superposition principle separation of variables for solving partial differential equations In the given problem, we have a non - homogeneity at the last boundary condition which we attempt to remove. We do this by transforming the non homogenous boundary conditions to homogenous boundary conditions although it

Tata Technologies Limited

41

will leave us with a non-homogenous set of differential equations which can be solved through the greens function. ( ) ( ) ( ) ( )( )

The function ( ) will be obtained through the polyfit() function of MATLAB as a sixth order polynomial. The functions (x) and (x) are described below. ( ) Boundary Conditions ( ) ( ) ( )

( ) ( )

and

Tata Technologies Limited

42

( ) Boundary Conditions ( ) ( ) ( )

( ) ( )

Solution of these set of ordinary differential equations is pretty simple and can be easily obtained through matrix manipulations in MATLAB. For (x,t), the following equations hold:

) ( )

Tata Technologies Limited

43

Boundary Conditions

Initial Conditions ( ) ( ( ) ( )) ( )

We first solve the homogenous system assuming gi(x,t)=0 . From the method of sepration of variables, ( ) ( )

Tata Technologies Limited

44

For a 2 block system ( ) ( ) )

( )

The eigen value problem for 2 slabs then yields

| |

|=0 |

where a=a1, b=a2

These equations are for a 2 block system and can be extended to multi block by extending the determinant. After finding the values of for each iteration, values of will be known. Thus, [ ][ ]=[ and ] .

will give the values of The solution for


( [ ) ( | ( | )] ) ( ) ( )

) for a 2 block system would then be


[ ( | )] ( | ( ) ) ( )

Tata Technologies Limited

45

where ( | )
( )

( ) ( )

( )

and

( )

The final solution is ( ) ( ) ( ) ( )( )

for any of the two blocks.

The code for the above solution has however been developed for any number of slabs in MATLAB. The code developed is printed in Appendix A.

Tata Technologies Limited

46

Input Data
Enter Enter Enter Enter Enter Enter Enter Enter the number of slabs: 3 material of plate 1: aluminium thickness of plate 1: 0.005 material of plate 2: brass thickness of plate 2: 0.005 material of plate 3: stainless steel thickness of plate 3: 0.005 value of coefficient h for given problem: 10

1200

1000

800 Temperature(K)

600

Source temperature Interface 1

400

200

0 0 5 10 15 20 25 30 35 Time(minutes)

Graph 2.1: Variation of source and interface 1 temperature with time

Tata Technologies Limited

47

1200

1000

800

Temperature(K)

600

Source temperature Interface 2

400

200

0 0 5 10 15 20 25 30 35 Time(minutes)

Graph 2.2: Variation of source and interface 2 temperature with time

Tata Technologies Limited

48

1200

1000

800

Temperature(K)

600

Source temperature
Interface 1

Interface 2
Interface 3 400

200

0 0 5 10 15 20 25 30 35 Time(minutes)

Graph 2.3: Variation of source and all interface temperatures with time

The graphs obtained from the program have been plotted into EXCEL and shown above. The graphs show the variation of temperature versus time at the different interfaces. As we can see, the trend followed is similar to the source curve but the graphs are not easily distinguishable. The code takes about a minute to show up the solution.
Tata Technologies Limited

49

Improvements converting the program into GUI The temperatures obtained are not fully correct as they exceed the source temperature at some locations The time taken to solve this problem can certainly be reduced increasing options for user to input values like surrounding temperature etc. creating separate functions for some part of the code for better reusability validating the answer obtained through experimental techniques making the problem more and more generalized by reducing number of assumptions Conclusion Although this model gives a fair idea of the trend followed by the interface temperatures, it is not a very accurate or fast model, and thus I have shifted to solving this problem by the finite difference scheme covered in Chapter 3 which is really fast as well as accurate.

Tata Technologies Limited

50

CHAPTER III

1D numerical approach
In Simple Words

Fig. 3.1: 1 dimensional heat transfer through a series of blocks

Explanation
In the given model, an unknown number of blocks (to be decided by the user) are placed on top of one another (all of different materials and properties). The sides of the blocks are insulated so that heat transfer takes place only from bottom to base in 1 direction. The bottom of the 1st block is heated on an

Tata Technologies Limited

51

imaginary oven which has varying temperature according to the plot shown in the figure 2.1 (and also the values printed in figure 2.2).The ambient temperature is 293 K. Assumptions Heat flow is considered to be transient in nature The interfaces of the blocks are assumed to be in perfect thermal contact so that temperature at the interface is equal for both the blocks and thus no convection takes place at the interface Rate of heat conduction at the interfaces is assumed to be the same for both the blocks Radiation and convection effects within the blocks are neglected (convection on the top surface is however considered) The properties of the blocks like thermal conductivity, density etc. are assumed to be constant with temperature. The heat transfer coefficient at the convection surface is also assumed to be constant. No heat generation in any of the blocks The block is given 5 partitions and the time step is taken to be 0.1 minute although these values can be changed any time before the program run.

Tata Technologies Limited

52

Formulation of the differential equations

Boundary Conditions ( )

Initial Conditions

Tata Technologies Limited

53

Solution Background Fully implicit finite difference scheme of solving partial differential equations Solving a matrix using Gauss-Seidel iterative methods The given set of equations is solved using the fully implicit finite difference. The fully implicit scheme is chosen due to its ease of implementation and because it is unconditionally convergent and stable, thereby warranting any time step and number of divisions to be chosen. In figure 3.1, each of the blocks is partitioned into a given number of segments. The finite difference equations would be applied at each of the segments. For the position derivative, the central difference approximation is used and for time derivative, the backward difference approximation. The following substitutions were made:

Tata Technologies Limited

54

If the number of slabs is taken to be 3 and the number of nodes per slab to be 5 as shown in figure 3.1, then the following system of equations will hold starting from n=0: ( ( ( ( ) ) ) )

An imaginary node is taken here to satisfy the conditions. Similarly, other such nodes will be taken when required to form the given matrix although the values obtained for these variables will hold no meaning. Continuing with the system of equations: ( ( ( ( ( ( ( ( ( ( ) ) ) ) ) ) ) ) ) )

Tata Technologies Limited

55

The given system of equations has 17 variables and 17 equations to be solved which is then encoded into a matrix and solved by MATLAB using the command A\b. But in very high dimensional codes, the non-iterative codes used by MATLAB may not succeed and thus an iterative technique (the Gauss-Seidel method) has been worked out which gives just the same solutions but takes a lot more time inside the for loops. In the Gauss-Seidel procedure, the above system of equations would be written in the following manner: ( ( ( ( ) ) ) )

Tata Technologies Limited

56

( ( )
( )

and so on till each node is explicitly written in terms of other nodes. A set of values for all 17 nodes is then assumed and the 1st node is then calculated from the above equation. The modified 1st node and the remaining nodes are then put into the 2nd node equation. The procedure keeps repeating till the consecutive values of the same node converge. For the GaussSeidel method, this convergence mostly happens if the given matrix is tri-diagonal or diagonally dominant. In this case, even though the formed matrix is neither, it is very close to being a tri-diagonal matrix and thus the solution does converge. After the 17 values for n=0 are obtained either by direct matrix solutions or iterative procedures, the matrix is solved again for n=1 and so on till all required values for all times are obtained. The code for the above solution has however been developed for any number of slabs and partitions in MATLAB. The code developed is printed in Appendix B.

Tata Technologies Limited

57

Input Data
Enter Enter Enter Enter Enter Enter Enter Enter the number of slabs: 3 material of plate 1: aluminium thickness of plate 1: 0.005 material of plate 2: brass thickness of plate 2: 0.005 material of plate 3: stainless steel thickness of plate 3: 0.005 value of coefficent h for given problem: 10

Without Gauss-Seidel iteration


1200

1000

800 Temperature(K)

600

Source temperature Interface 1 Interface 2

400

Interface 3

200

0 0 5 10 15 20 25 30 35 Time(minutes)

Graph 3.1: Variation of source and interface temperature with time by direct solving of matrix

Tata Technologies Limited

58

With Gauss-Seidel iteration


1200

1000

800

Temperature(K)

600

Source temperature

Interface 1 gs
Interface 2 gs Interface 3 gs

400

200

0 0 5 10 15 20 25 30 35 Time(minutes)

Graph 3.2: Variation of source and interface temperature with time (Gauss-Seidel iteration)

Tata Technologies Limited

59

Comparison (with and without Gauss-Seidel)


1200

1000

800 Temperature(K) Source temperature Interface 1 gs 600 Interface 2 gs Interface 3 gs Interface 1 400 Interface 2 Interface 3 200

0 0 5 10 15 20 25 30 35 Time(minutes)

Graph 3.3: Variation of source and interface temperature with time (both direct by direct matrix and Gauss-Seidel iteration)

As we can see, both the non-iterative and the iterative programs yield exactly the same results with the respective graphs in both the methods overlapping. The iterative procedure however takes up slightly more time and memory space although it guarantees solution for very large matrices too.

Tata Technologies Limited

60

Convergence of Gauss-Seidel procedure

1200

1000

800 Temperature(Kelvin) 5min 600 10min 15min 20min

400

25min

200

0 0 10 20 30 40 50 60 70 80 90 Iterations

Graph 3.4: Convergence of temperature at particular time by GaussSeidel iterations

The above graph is shown for the convergence of temperatures of the top-most surface of all the slabs at different time intervals for the Gauss-Seidel method. This confirms that even though the formed matrix in this case does not rigorously satisfy convergence criteria, but the implemented code does happen to converge.

Tata Technologies Limited

61

Improvements
converting the program into GUI increasing options for user to input values like surrounding temperature etc. creating separate functions for some part of the code for better reusability and optimizing code to work faster validating the answer obtained through experimental techniques making the problem more and more generalized by reducing number of assumptions

Conclusion
The fully implicit finite difference method, both by with and without Gauss-Seidel iteration, gives a seemingly good and accurate solution which can now be verified by experimental techniques. Now that a seemingly right methodology has been accomplished, the scope of expanding the project to higher dimensions (2D has been included next) or including radiation conditions always remains.

Tata Technologies Limited

62

CHAPTER IV 2D numerical approach


In Simple Words

Fig. 4.1: 2 dimensional heat transfer through a series of blocks

Explanation
In the given model, an unknown number of blocks (to be decided by the user) are placed on top of one another (all of different materials and properties). The sides of the blocks are now open to atmosphere so that heat transfer takes place in 2 directions, from bottom to top and through the sides. The bottom of the 1st block is heated on an imaginary oven which
Tata Technologies Limited 63

has varying temperature according to the plot shown in figure 2.1 (and also the values printed in figure 2.2). The ambient temperature is 293 K. Assumptions Heat flow is considered to be transient in nature The interfaces of the blocks are assumed to be in perfect thermal contact so that temperature at the interface is equal for both the blocks and thus no convection takes place at the interface. Rate of heat conduction at the interfaces is assumed to be the same for both the blocks Radiation and convection effects within the blocks are neglected (convection on the top surface and the sides is however considered) The properties of the blocks like thermal conductivity, density etc. are assumed to be constant with temperature. The heat transfer coefficient at the convection surface is also assumed to be constant. No heat generation in any of the blocks There are two values of interface temperatures found at each time step which differ by a slight proportion. Thus, the first has been taken as the valid temperature in such a scenario.

Tata Technologies Limited

64

Formulation of the differential equations ( ( ) )

Boundary Conditions ( )

( ( )

Tata Technologies Limited

65

Initial Conditions

Solution Background The alternating direction implicit (ADI) finite difference scheme of solving partial differential equations which is well suited for a 2D heat transfer problem The above set of equations is solved using a slight variant of the fully implicit FDM scheme called the alternating direction implicit method. A usual implementation of a fully implicit FDM in this case would result in a near penta-diagonal matrix which would have to be coded all over again. Instead, the ADI scheme breaks a time step into two halves. In the first half, the x-derivative is written as an implicit central-difference approximation and the y-derivative as an explicit central-difference approximation. The reverse holds true for the second half of the time step. Each of these halves result in matrices

Tata Technologies Limited

66

very similar to tri-diagonal matrix, the results of which are then combined to obtain the final solution. Since the resulting matrices are close to tri-diagonal, the code from Chapter III could be re-used and modified to give the solution. This scheme also has the advantage of being unconditionally stable just as the fully implicit methods. The Gauss-Seidel iterative procedure for the solving of the matrices has not been implemented here as it has already been taken up in the previous chapter and the implementation would exactly be the same. This time the blocks were divided into segments in both x and y directions such that it resulted in creation of point nodes. At each of these nodes, the equations and boundary conditions stated above are valid. The following substitutions were made: For (n+ )th time step

( (

) )

Tata Technologies Limited

67

For (n+1)th time step

( (

) )

If the number of slabs is taken to be 3 and the number of segments per slab to be 5 in both x and y direction as shown in figure 4.1, then the following system of equations will hold starting from n=0:

( ( ( (

) ) ) )

) ( ( ( ) ) )

And so on for the remaining slabs.


Tata Technologies Limited

68

From the equations obtained a 1717 matrix is formed and solved for corresponding temperatures. Once the temperatures for j=1 have been obtained, we move on to j=2. ( ( ( ( ) ) ) ) ( ) ( ( ( ) ) )

And so on for the remaining slabs. Thus, we solve the matrix for 1 j 5, and finally, we would have solved the complete node system at n= . After having all the values, we move to the next half of the solution method for finding values at n=1. The following equations hold: ( ( ( ( ( ) ) ) ) ) ( ) ( ( ( ( ) ) ) )

Tata Technologies Limited

69

and so on. Similarly, here we form the matrix at the ith value and keep solving for each i until we have the temperatures for each node in the mesh at n=1. We then move on to solving for n=2 by the same procedure described above. The difference from the previous chapters is that the temperatures at each node here can be different even varying along the y direction although only slightly. The code for the above solution has been developed for any number of slabs and partitions in MATLAB. The code developed is printed in Appendix C.

Tata Technologies Limited

70

Input Data
Enter Enter Enter Enter Enter Enter Enter Enter Enter the number of slabs: 3 material of plate 1: aluminium thickness of plate 1: 0.005 material of plate 2: brass thickness of plate 2: 0.005 material of plate 3: stainless steel thickness of plate 3: 0.005 equal width of all plates: 0.01 value of coefficent h for given problem: 10

1200

1000

800 Temperature(K)

600

Source temperature Interface 1 node 1 Interface 2 node 1

400

Interface 3 node 1

200

0 0 5 10 15 node 20 25 30 35

Graph 4.1: Variation of node 1 temperatures of all interfaces with time

Tata Technologies Limited

71

The graph above has been shown for the corner nodes of all the interfaces and follows similar trends as discussed in the previous chapters.

Top Surface
1200

1000

800 Temperature(K) Source temperature 600 node 1 node 2 node 3 node 4 400 node 5

200

0 0 5 10 15 20 25 30 35 Time(minutes)

Graph 4.2: Variation of temperature of all nodes at top surface with time

The graph above shows temperature curves for all nodes of the top surface. As we see, the temperature variation along the y

Tata Technologies Limited

72

direction is not much and the temperature curves for all these nodes overlap.

Top Surface
1093.8 1093.6

1093.4
1093.2 1093 30 min 1092.8 1092.6 1092.4 1092.2 0 1 2 3 node 4 5 6

Graph 4.3: Temperature of all nodes at 30 min at top surface

This graph shows the temperature variation along the top surface at time t=30 min. As expected, the temperature is symmetric with respect to the middle node with heat flowing from both sides of the middle node to the surroundings at ambient temperature.

Tata Technologies Limited

Temperature(K)

73

Improvements
converting the program into GUI increasing options for user to input values like surrounding temperature etc. creating separate functions for some part of the code for better reusability and optimizing code to work faster validating the answer obtained through experimental techniques making the problem more and more generalized by reducing number of assumptions can be extended to the 3 dimensional case

Conclusion
The ADI finite difference technique works for the 2 dimensional case and gives good results which can now be validated using experimental techniques.

Tata Technologies Limited

74

Appendix A
% This program executes the given project statement using methods mentioned in Chapter II. It gives the output as the graphs of all interfaces and source temperature varying with time % The symbolic toolbox is must for the running of this program % Please refer to the theory mentioned for smooth understanding of this program % The following user inputs are required: % 1) material of slabs (only following materials are allowed: % (i)brass (ii)alunminium (iii) stainless steel (iv) wood % 2) thickness of slabs (the user is requested to keep thickness small < 0.02 meters) % 3)heat transfer convection coefficient % "All values must be entered in SI Units" clc clear A={'*' 'k' 'rho' 'c' ; 'water' 0.617 996 4178 ; 'brass' 110 8530 380 ; 'stainless steel' 14.9 7900 477 ; 'soil' 0.4 3333.3 800 ; 'wood' 1.26 700 1700 ; 'aluminium' 237 2700 897}; %declares matrix of available materials with physical properties A{1,5}='alpha'; for i=2:7 A {i,5}=A{i,2}/(A{i,3}*A{i,4}); % calculates value of alpha for all materials end n=input('Enter the number of slabs: '); mat=cell(1,30); L=zeros(1,30); k=zeros(1,30); rho=zeros(1,30); c=zeros(1,30); alpha=zeros(1,30); for i=1:n fprintf('Enter material of plate %d',i); mat{i}=input(': ','s'); if(i==1) fprintf('Enter thickness of plate %d',i); L(i)=input(': '); else fprintf('Enter thickness of plate %d',i); L(i)=L(i-1)+input(': '); end end h=input('Enter value of coefficent h for given problem: '); for j=1:n confirm=0; for i=2:size(A,1) %disp('1'); if (strcmp(A{i,1},mat{j})==1) %loop compares values entered with values stored in matrix and assigns properties accordingly %disp('1'); confirm=1; k(j)=A{i,2}; rho(j)=A{i,3};

Tata Technologies Limited

75

c(j)=A{i,4}; alpha(j)=A{i,5}; end if(confirm==1) break; end end end phi=zeros(2*n-1,2*n-1); phi(1,1)=L(1); phi(1,2)=L(1)*-1; phi(1,3)=-1; for i=2:n-1 phi(i,2*i-2)=L(i); phi(i,2*i-1)=1; phi(i,2*i)=-1*L(i); phi(i,2*i+1)=-1;

% creates left hand matrix for solution of phi(x)

end phi(n,1)=k(1); phi(n,2)=k(2)*-1; for i=n+1:2*n-2 phi(i,2*i-2*n)=k(i-n+1); phi(i,2*i-2*n+2)=-1*k(i-n+2); end phi(2*n-1,2*n-2)=k(n)+h*L(n); phi(2*n-1,2*n-1)=h; ans1=zeros(2*n-1,1); % creates right hand matrix for solution of phi(x) ans1(1,1)=-1; coeffphi=phi\ans1; %coeffiecients obtained syms x; fphi=zeros(n,1); fphi=sym(fphi); fphi(1,1)=coeffphi(1,1).*x+1; for i=2:n fphi(i,1)=coeffphi(2*i-2,1)*x+coeffphi(2*i-1,1); %creates function(x) using coefficients end zi=phi; ans2=zeros(2*n-1,1); ans2(2*n-1,1)=h; coeffzi=zi\ans2; % coefficients for zhi(x) obtained fzi=zeros(n,1); fzi=sym(fzi); fzi(1,1)=coeffzi(1,1).*x; for i=2:n fzi(i,1)=coeffzi(2*i-2,1)*x+coeffzi(2*i-1,1); %creates function(x) using coefficients end F=zeros(n,1); F=sym(F); for i=1:n F(i,1)=293*(1-fphi(i,1)-fzi(i,1)); %inital condition for transformed solution end

Tata Technologies Limited

76

syms x1; betamat=zeros(2*n-1,2*n-1); betamat=sym(betamat); betamat(1,1)=-1*sin((x1*L(1))/sqrt(alpha(1))); betamat(1,2)=sin((x1*L(1))/sqrt(alpha(2))); betamat(1,3)=cos((x1*L(1))/sqrt(alpha(2))); betamat(n,1)=((k(1)/k(2))*sqrt(alpha(2)/alpha(1))*cos((x1*L(1))/sqrt(alpha(1)))); betamat(n,2)=cos((x1*L(1))/sqrt(alpha(2))); betamat(n,3)=-(sin((x1*L(1))/sqrt(alpha(2)))); for i=2:n-1 betamat(i,2*i-2)=sin((x1*L(i))/sqrt(alpha(i))); betamat(i,2*i-1)=cos((x1*L(i))/sqrt(alpha(i))); betamat(i,2*i)=-(sin((x1*L(i))/sqrt(alpha(i+1)))); betamat(i,2*i+1)=-(cos((x1*L(i))/sqrt(alpha(i+1)))); end for i=n+1:2*n-2 betamat(i,2*i-2*n)=(k(i-n+1)/k(i-n+2))*sqrt(alpha(i-n+2)/alpha(in+1))*cos((x1*L(i-n+1))/sqrt(alpha(i-n+1))); betamat(i,2*i-2*n+1)=-((k(i-n+1)/k(i-n+2))*sqrt(alpha(i-n+2)/alpha(in+1))*sin((x1*L(i-n+1))/sqrt(alpha(i-n+1)))); betamat(i,2*i-2*n+2)=-(cos((x1*L(i-n+1))/sqrt(alpha(i-n+2)))); betamat(i,2*i-2*n+3)=sin((x1*L(i-n+1))/sqrt(alpha(i-n+2))); end betamat(2*n-1,2*n2)=(((h*sqrt(alpha(n)))/(x1*k(n)))*sin((x1*L(n))/sqrt(alpha(n))))+cos((x1*L(n ))/sqrt(alpha(n))); betamat(2*n-1,2*n1)=(((h*sqrt(alpha(n)))/(x1*k(n)))*cos((x1*L(n))/sqrt(alpha(n))))sin((x1*L(n))/sqrt(alpha(n))); y=det(betamat); %calculates determinant of matrix formed for getting values of beta y=simplify(y); y=matlabFunction(y); syms t; %a=[0 5 10 15 20 25 30]; %a=[0 5 10 15 20 25 30 35 40 45 50 55 60 ]; a=[0 300 600 900 1200 1500 1800 2100 2400 2700 3000 3300 3600 ]; %b=[293 811 977 1033 1068 1094 1116]; b=[293 811 977 1033 1068 1094 1116 1135 1151 1165 1178 1189 1200 ]; f1temp=polyfit(a,b,6); %f1temp=polyfit(a,b,15); f1=f1temp(1).*(t).^6+f1temp(2).*(t).^5+f1temp(3).*(t).^4+f1temp(4).*(t).^3+f1 temp(5).*(t).^2+f1temp(6).*(t)+f1temp(7); %sixth-order polynomial approximation, any of the other functions commented can also be used f1(t)=f1; %f1=f1temp(1).*t.^6+f1temp(2).*t.^5+f1temp(3).*t.^4+f1temp(4).*t.^3+f1temp(5) .*t.^2+f1temp(6).*t+f1temp(7);%put simulating time after iteration %f1=(1.7267*t)+293;%t/60 is 1.7267 %f1=990.1098*exp((0.0027948556*t)/60) - 728.6*exp((-0.23*t)/60); %f1=990.10977*exp(0.0040060346*(t/60)) - 697.22292*exp(-0.25160733*(t/60)); %f1=713.09*cos(0.16482*(t/60)) 34.844*cos(0.2747*(t/60)) 13.599*sin(0.2747*(t/60)) 268.81*sin(0.16482*(t/60)) 1128.9*cos(0.05494*(t/60)) + 1100.0*cos(0.10988*(t/60)) + 2.1099*cos(0.21976*(t/60)) + 2311.0*sin(0.05494*(t/60)) + 1211.9*sin(0.10988*(t/60)) - 235.36*sin(0.21976*(t/60)) - 358.39;

Tata Technologies Limited

77

%f1=(0.0001513*t^5 - 0.02684*t^4 + 1.787*t^3 - 53.74*t^2 + 1965*t + 2613) /(t + 8.92); %f1=2163*sin(0.06295*(t/60)-0.6615) + 1875*sin(0.1206*(t/60)+0.5249) + 1207*sin(0.1647*(t/60)+2.177) + 361.1*sin(0.1984*(t/60)+4.188); %f1= 2.501*10^-5*(t/60)^5 0.004423*(t/60)^4 + 0.2938*(t/60)^3 9.088*(t/60)^2 + 134*(t/60) + 304; f1der=diff(f1); g=zeros(n,1); g=sym(g); for i=1:n g(i,1)=(fphi(i,1)*f1der); %function g(x,t) is calculated for all slabs end syms xd tou; g=subs(g,x,xd); g=subs(g,t,tou); %Theta(x,t)=sym('Theta(x,t)'); Theta=0; green(x,xd,t,tou)=sym('green(x,xd,t,tou)'); %integral1(x,t,tou)=sym('integral1(x,t,tou)'); %integralgen1(x,t,tou)=sym('integralgen1(x,t,tou)'); for z=1:n green=0*x; p=1; i=1; beta2=0; while(p~=11) beta=fzero(y,0.1*i); %value of beta around 0.1*i is obtained by solving y=0 if(beta<0.0001) i=i+1; continue; end if(beta-beta2<0.0001) i=i+1; continue; end beta2=beta; coeffmat=zeros(2*n-2,2*n-2); coeffmat(1,1)=sin((beta*L(1))/sqrt(alpha(2))); coeffmat(1,2)=cos((beta*L(1))/sqrt(alpha(2))); coeffmat(n,1)=cos((beta*L(1))/sqrt(alpha(2))); coeffmat(n,2)=-(sin((beta*L(1))/sqrt(alpha(2)))); for j=2:n-1 coeffmat(j,2*j-3)=sin((beta*L(j))/sqrt(alpha(j))); coeffmat(j,2*j-2)=cos((beta*L(j))/sqrt(alpha(j))); coeffmat(j,2*j-1)=-(sin((beta*L(j))/sqrt(alpha(j+1))));%keep this coeffmat seperately so that evaluation doesn't take place again & again coeffmat(j,2*j)=-(cos((beta*L(j))/sqrt(alpha(j+1)))); end for j=n+1:2*n-2 coeffmat(j,2*j-2*n-1)=(k(j-n+1)/k(j-n+2))*sqrt(alpha(jn+2)/alpha(j-n+1))*cos((beta*L(j-n+1))/sqrt(alpha(j-n+1))); coeffmat(j,2*j-2*n)=-((k(j-n+1)/k(j-n+2))*sqrt(alpha(jn+2)/alpha(j-n+1))*sin((beta*L(j-n+1))/sqrt(alpha(j-n+1)))); coeffmat(j,2*j-2*n+1)=-(cos((beta*L(j-n+1))/sqrt(alpha(j-n+2)))); coeffmat(j,2*j-2*n+2)=(sin((beta*L(j-n+1))/sqrt(alpha(j-n+2)))); end

Tata Technologies Limited

78

rhsmat=zeros(2*n-2,1); rhsmat(1,1)=sin((beta*L(1))/sqrt(alpha(1))); rhsmat(n,1)=(k(1)/k(2))*sqrt(alpha(2)/alpha(1))*cos((beta*L(1))/sqrt(alpha(1) )); solmat=coeffmat\rhsmat; %coefficients A and B for different zhi are obtained zhimat=zeros(n,1); zhimat=sym(zhimat); zhimat(1,1)=sin((x*beta)/sqrt(alpha(1))); for j=2:n zhimat(j,1)=solmat(2*j-3,1)*sin((x*beta)/sqrt(alpha(j)))+solmat(2*j2,1)*cos((x*beta)/sqrt(alpha(j))); %zhi(x) is formed, not to be confused with previous zhi(x) , this is part of theta(x) solution end Nn=(k(1)/alpha(1))*int(zhimat(1,1).^2,0,L(1)); %Nn evaluated for j=2:n Nn=Nn+(k(j)/alpha(j))*int(zhimat(j,1).^2,L(j-1),L(j)); end green=green+((1/Nn)*(k(z)/alpha(z))*zhimat(n,1)*exp(-(beta.^2*(ttou)))*subs(zhimat(z,1),x,xd)); %green's function evaluated green=vpa(green,6); i=i+1; p=p+1; end %green=simplify(green); if(z==1) integral1(x,t,tou)=int((green*subs(F(1,1),x,xd)),xd,0,L(1)); integral1=integral1(x,t,0); integral1=vpa(integral1,6); integral2=int(int(green*g(1,1),xd,0,L(1)),tou,0,t); integral2=vpa(integral2,6); Theta=Theta+integral1+integral2; Theta=vpa(Theta,6); Theta=simplify(Theta); Theta=vpa(Theta,6); else integralgen1(x,t,tou)=int((green*subs(F(z,1),x,xd)),xd,L(z-1),L(z)); integralgen1=integralgen1(x,t,0); integralgen1=vpa(integralgen1,6); integralgen2=int(int(green*g(z,1),xd,L(z-1),L(z)),tou,0,t); integralgen2=vpa(integralgen2,6); Theta=Theta+integralgen1+integralgen2; %final calculation of Theta(x,t) Theta=vpa(Theta,6); Theta=simplify(Theta); Theta=vpa(Theta,6); % Theta=simplify(Theta);%input for calcualting temp. bet. a and b end end Tfinal(x,t)=Theta+fphi(n,1)*f1+fzi(n,1)*293; %The actual temperature varying with time is finally obtained Tfinal=vpa(Tfinal,6); %Tfinal=simplify(Tfinal); disp('Equation of temperature on surface is '); %pretty(Tfinal(L(n),t));%why is it giving 2 answers but it is 1*1 matrix ezplot(f1(t*60),[0,30]); hold all;

Tata Technologies Limited

79

Tfinalatsurf=zeros(n,1); Tfinalatsurf=sym(Tfinalatsurf); for i=1:n Tfinalatsurf(i)=Tfinal(L(i),t); %recording temperature at interfaces end Tfinalatsurf=vpa(Tfinalatsurf,6); Tfinalatsurf(t)=Tfinalatsurf; Tfinalatsurf=Tfinalatsurf(t*60); Tfinalatsurf=simplify(Tfinalatsurf); Tfinalatsurf=vpa(Tfinalatsurf,6); %Tfinalatsurf(t)=Tfinalatsurf; %disp(Tfinalatsurf); for i=1:n ezplot(Tfinalatsurf(i),[0,30]); end % This program has certain pitfalls as it does not give exact variation of temperature of interfaces with time but merely a correct trend. % Some other improvements include: % 1) optimization of code for faster running % 2) Ambient temperature can be input by user % 3) User can be asked if he/she wants the trend of temperature with time for a line within the block instead of interface in which case only values varying between the given lengths will be accepted

Tata Technologies Limited

80

Appendix B
Matrix solved directly
% This program executes the given project statement using methods mentioned in Chapter III. It gives the output as the graphs of all interfaces and source temperature varying with time % Please refer to the theory mentioned for smooth understanding of this program % The following user inputs are required: % 1) material of slabs (only following materials are allowed: % (i)brass (ii)alunminium (iii) stainless steel (iv) wood % 2) thickness of slabs (the user is requested to keep thickness small < 0.02 metres) % 3) heat transfer convection coefficient % "All values must be entered in SI Units" clc clear A={'*' 'k' 'rho' 'c' ; 'water' 0.617 996 4178 ; 'brass' 110 8530 380 ; 'stainless steel' 14.9 7900 477 ; 'soil' 0.4 3333.3 800 ; 'wood' 1.26 700 1700 ; 'aluminium' 237 2700 897}; A{1,5}='alpha'; for i=2:7 A {i,5}=A{i,2}/(A{i,3}*A{i,4}); % calculates value of alpha for all materials end n=input('Enter the number of slabs: '); mat=cell(1,n); L=zeros(1,n); k=zeros(1,n); rho=zeros(1,n); c=zeros(1,n); alpha=zeros(1,n); for i=1:n fprintf('Enter material of plate %d',i); mat{i}=input(': ','s'); %if(i==1) fprintf('Enter thickness of plate %d',i); L(i)=input(': '); % else % fprintf('Enter thickness of plate %d',i); % L(i)=input(': '); % end end h=input('Enter value of coefficent h for given problem: '); for j=1:n for i=2:size(A,1) %disp('1'); if (strcmp(A{i,1},mat{j})==1) %loop compares values entered with values stored in matrix and assigns properties accordingly %disp('1'); k(j)=A{i,2}; rho(j)=A{i,3}; c(j)=A{i,4};

Tata Technologies Limited

81

alpha(j)=A{i,5}; end end end deltax=zeros(1,n); deltat=0.1; r=zeros(1,n); N=5; a=[0 5 10 15 20 25 30]; b=[293 811 977 1033 1068 1094 1116]; for i=1:n deltax(i)=L(i)/(N-1); r(i)=(alpha(i)*deltat)/(deltax(i)^2); end fdmmat=zeros(n*N+n-1,n*N+n-1); fdmmat(1,1)=1+2*r(1); fdmmat(1,2)=-r(1); for i=2:(N-1) fdmmat(i,(i-1))=-r(1); fdmmat(i,i)=1+2*r(1); fdmmat(i,i+1)=-r(1); end %fdmmat(N,N-1)=1+2*r(2); %fdmmat(N,N+1)=-r(2); %fdmmat(N,N+2)=-r(2); j=1; %for i=N+1:2*N-1 % fdmmat(i,i-2)=-r(2); % fdmmat(i,i+1)=1+2*r(2); % fdmmat(i,i+2)=-r(2); %end for i=N:n*N-1 if(mod(i,N)==0) j=j+1; fdmmat(i,i+j-3)=1+2*r(j); fdmmat(i,i+j-1)=-r(j); fdmmat( i,i+j)=-r(j); else if(mod(i,N)==1) fdmmat(i,i+j-4)=-r(j); %creating left hand side matrix fdmmat(i,i+j-1)=1+2*r(j); fdmmat(i,i+j)=-r(j); else fdmmat(i,i+j-2)=-r(j); fdmmat(i,i+j-1)=1+2*r(j); fdmmat(i,i+j)=-r(j); end end end j=N-4; p=1; for i=n*N:n*N+n-2 fdmmat(i,j+2)=-k(p)/deltax(p); fdmmat(i,j+4)=k(p)/deltax(p); fdmmat(i,j+5)=k(p+1)/deltax(p+1); fdmmat(i,j+6)=-k(p+1)/deltax(p+1); j=j+N+1; p=p+1;

Tata Technologies Limited

82

end fdmmat(n*N+n-1,n*N+n-3)=-k(n)/(2*deltax(n)*h); fdmmat(n*N+n-1,n*N+n-2)=1; fdmmat(n*N+n-1,n*N+n-1)=k(n)/(2*deltax(n)*h); rhsmat=zeros(n*N+n-1,1); rhsmat(1,1)=293+r(1)*((deltat/5)*(b(2)-b(1))+b(1)); for i=2:n*N-1 rhsmat(i,1)=293; %creating right hand side matrix end rhsmat(n*N+n-1,1)=293; solmat=fdmmat\rhsmat; %first solution matrix surfrec=zeros(301,n); for i=1:n surfrec(1,i)=293; end %surfrec(2,2)=solmat(4.1); i=N-1; j=1; while(i<n*N+n-1) surfrec(2,j)=solmat(i,1); j=j+1; i=i+N+1; end for q=2:300 j=2; if q*deltat>=0 && q*deltat<5 Tatiter=((q*deltat)/5)*(b(2)-b(1))+b(1); %calculate temperature at base at given time end if q*deltat>=5 && q*deltat<10 Tatiter=((q*deltat-5)/5)*(b(3)-b(2))+b(2); end if q*deltat>=10 && q*deltat<15 Tatiter=((q*deltat-10)/5)*(b(4)-b(3))+b(3); end if q*deltat>=15 && q*deltat<20 Tatiter=((q*deltat-15)/5)*(b(5)-b(4))+b(4); end if q*deltat>=20 && q*deltat<25 Tatiter=((q*deltat-20)/5)*(b(6)-b(5))+b(5); end if q*deltat>=25 && q*deltat<30 Tatiter=((q*deltat-25)/5)*(b(7)-b(6))+b(6); end rhsmat(1,1)=solmat(1,1)+r(1)*Tatiter; for i=2:n*N-1 if(mod(i,N)~=0) rhsmat(i,1)=solmat(j,1); %right hand side matrix for given iteration end if(mod(i,N)==0) rhsmat(i,1)=rhsmat(i-1,1); j=j+1; end j=j+1; end rhsmat(n*N+n-1,1)=solmat(n*N+n-1,1);

Tata Technologies Limited

83

solmat=fdmmat\rhsmat; %these are the temperatures obtained at given iteration(time) %surfrec(q+1)=solmat(n*N+n-2,1); %surfrec(q+1,1)=solmat(1,1); c=N-1; d=1; while(c<n*N+n-1) surfrec(q+1,d)=solmat(c,1); d=d+1; c=c+N+1; end end temp=0:0.1:30; plot(temp,surfrec(:,1)); hold on plot(temp,surfrec(:,2)); plot(temp,surfrec(:,3)); % Some improvements include: % 1) optimiztion of code for faster running % 2) Ambient temperature can be input by user % 3) Trend of a line within the slab can be shown when asked by the user

Matrix solved by iterative procedures


% This program executes the given project statement using methods mentioned in Chapter III. It gives the output as the graphs of all interfaces and source temperature varying with time % Please refer to the theory mentioned for smooth understanding of this program % The following user inputs are required: % 1) material of slabs (only following materials are allowed: % (i)brass (ii)alunminium (iii) stainless steel (iv) wood % 2) thickness of slabs (the user is requested to keep thickness small < 0.02 metres) % 3) heat transfer convection coefficient % "All values must be entered in SI Units" clc clear A={'*' 'k' 'rho' 'c' ; 'water' 0.617 996 4178 ; 'brass' 110 8530 380 ; 'stainless steel' 14.9 7900 477 ; 'soil' 0.4 3333.3 800 ; 'wood' 1.26 700 1700 ; 'aluminium' 237 2700 897}; A{1,5}='alpha'; for i=2:7 A {i,5}=A{i,2}/(A{i,3}*A{i,4}); % calculates value of alpha for all material end n=input('Enter the number of slabs: ');%can ask user for outside temperature %n=3; mat=cell(1,n); L=zeros(1,n); k=zeros(1,n); rho=zeros(1,n); c=zeros(1,n);

Tata Technologies Limited

84

alpha=zeros(1,n); for i=1:n fprintf('Enter material of plate %d',i); mat{i}=input(': ','s'); %if(i==1) fprintf('Enter thickness of plate %d',i); L(i)=input(': '); % else % fprintf('Enter thickness of plate %d',i); % L(i)=input(': '); % end end h=input('Enter value of coefficent h for given problem: '); % mat{1,1}='aluminium'; % mat{1,2}='aluminium'; % mat{1,3}='aluminium'; % L(1)=0.005;L(2)=0.005;L(3)=0.005; % h=10; for j=1:n for i=2:size(A,1) %disp('1'); if (strcmp(A{i,1},mat{j})==1) %loop compares values entered with values stored in matrix and assigns properties accordingly %disp('1'); k(j)=A{i,2}; rho(j)=A{i,3}; c(j)=A{i,4}; alpha(j)=A{i,5}; end end end deltax=zeros(1,n); deltat=0.1; r=zeros(1,n); N=5; a=[0 5 10 15 20 25 30]; b=[293 811 977 1033 1068 1094 1116]; for i=1:n deltax(i)=L(i)/(N-1); r(i)=(alpha(i)*deltat)/(deltax(i)^2); end fdmmat=zeros(n*N+n-1,n*N+n-1); fdmmat(1,1)=1+2*r(1); fdmmat(1,2)=-r(1); for i=2:(N-1) fdmmat(i,(i-1))=-r(1); fdmmat(i,i)=1+2*r(1); fdmmat(i,i+1)=-r(1); end %fdmmat(N,N-1)=1+2*r(2); %fdmmat(N,N+1)=-r(2); %fdmmat(N,N+2)=-r(2); j=1; %for i=N+1:2*N-1 % fdmmat(i,i-2)=-r(2); % fdmmat(i,i+1)=1+2*r(2); % fdmmat(i,i+2)=-r(2);

Tata Technologies Limited

85

%end for i=N:n*N-1 if(mod(i,N)==0) j=j+1; fdmmat(i,i+j-3)=1+2*r(j); fdmmat(i,i+j-1)=-r(j); %creating left hand side matrix fdmmat( i,i+j)=-r(j); else if(mod(i,N)==1) fdmmat(i,i+j-4)=-r(j); fdmmat(i,i+j-1)=1+2*r(j); fdmmat(i,i+j)=-r(j); else fdmmat(i,i+j-2)=-r(j); fdmmat(i,i+j-1)=1+2*r(j); fdmmat(i,i+j)=-r(j); end end end j=N-4; p=1; for i=n*N:n*N+n-2 fdmmat(i,j+2)=-k(p)/deltax(p); fdmmat(i,j+4)=k(p)/deltax(p); fdmmat(i,j+5)=k(p+1)/deltax(p+1); fdmmat(i,j+6)=-k(p+1)/deltax(p+1); j=j+N+1; p=p+1; end fdmmat(n*N+n-1,n*N+n-3)=-k(n)/(2*deltax(n)*h); fdmmat(n*N+n-1,n*N+n-2)=1; fdmmat(n*N+n-1,n*N+n-1)=k(n)/(2*deltax(n)*h); rhsmat=zeros(n*N+n-1,1); rhsmat(1,1)=293+r(1)*((deltat/5)*(b(2)-b(1))+b(1)); for i=2:n*N-1 rhsmat(i,1)=293; %creating right hand side matrix end rhsmat(n*N+n-1,1)=293; solmat=zeros(n*N+n-1,1); for i=1:n*N+n-1 solmat(i,1)=293; end large=1; while(large>=0.0001) temp=solmat; k=1; for i=1:n*N-1 sum=rhsmat(i,1); change=1; for j=1:n*N+n-1 if mod(i,N)~=0 if fdmmat(i,j)~=1+2*r(k) sum=sum-fdmmat(i,j)*solmat(j,1); end else if mod(i,N)==0

%getting first solution

Tata Technologies Limited

86

if j==1 k=k+1; end if fdmmat(i,j)==-r(k) if change==1 change=0; else if change==0 sum=sum-fdmmat(i,j)*solmat(j,1); end end else if fdmmat(i,j)~=-r(k) sum=sum-fdmmat(i,j)*solmat(j,1); end end end end end for j=1:n*N+n-1 if mod(i,N)~=0 if fdmmat(i,j)==1+2*r(k) sum=sum/fdmmat(i,j); end else if fdmmat(i,j)==-r(k) sum=sum/fdmmat(i,j); break; end end end solmat(i+k-1,1)=sum; end sum=0; j=N-4; for i=n*N:n*N+n-2 sum=(fdmmat(i,j+2)*solmat(j+2,1)+fdmmat(i,j+5)*solmat(j+5,1)+fdmmat(i,j+6)*solmat (j+6,1)); solmat((i-n*N)*(N+1)+N)=sum/fdmmat(i,j+4); j=j+N+1; end solmat(n*N+n-1,1)=(rhsmat(n*N+n-1,1)-fdmmat(n*N+n-1,n*N+n-2)*solmat(n*N+n-2)fdmmat(n*N+n-1,n*N+n-3)*solmat(n*N+n-3,1))/fdmmat(n*N+n-1,n*N+n-1); temp=solmat-temp; large=max(temp); end surfrec=zeros(301,n); for i=1:n surfrec(1,i)=293; end %surfrec(2,2)=solmat(4.1); i=N-1; j=1; while(i<n*N+n-1) surfrec(2,j)=solmat(i,1); j=j+1; i=i+N+1;

Tata Technologies Limited

87

end for q=2:300 iter=0; j=2; if q*deltat>=0 && q*deltat<5 Tatiter=((q*deltat)/5)*(b(2)-b(1))+b(1); end if q*deltat>=5 && q*deltat<10 Tatiter=((q*deltat-5)/5)*(b(3)-b(2))+b(2); end if q*deltat>=10 && q*deltat<15 Tatiter=((q*deltat-10)/5)*(b(4)-b(3))+b(3); end if q*deltat>=15 && q*deltat<20 Tatiter=((q*deltat-15)/5)*(b(5)-b(4))+b(4); end if q*deltat>=20 && q*deltat<25 Tatiter=((q*deltat-20)/5)*(b(6)-b(5))+b(5); end if q*deltat>=25 && q*deltat<30 Tatiter=((q*deltat-25)/5)*(b(7)-b(6))+b(6); end rhsmat(1,1)=solmat(1,1)+r(1)*Tatiter; for i=2:n*N-1 if(mod(i,N)~=0) rhsmat(i,1)=solmat(j,1); end if(mod(i,N)==0) rhsmat(i,1)=rhsmat(i-1,1); j=j+1; end j=j+1; end rhsmat(n*N+n-1,1)=solmat(n*N+n-1,1); solmat=zeros(n*N+n-1,1); for i=1:n*N+n-1 solmat(i,1)=293; end large=1; while(large>=0.0001) iter=iter+1; temp=solmat; k=1; for i=1:n*N-1 sum=rhsmat(i,1); change=1; for j=1:n*N+n-1 if mod(i,N)~=0 if fdmmat(i,j)~=1+2*r(k) sum=sum-fdmmat(i,j)*solmat(j,1); end else if mod(i,N)==0 if j==1 k=k+1;

Tata Technologies Limited

88

end if fdmmat(i,j)==-r(k) if change==1 change=0; else if change==0 sum=sum-fdmmat(i,j)*solmat(j,1); end end else if fdmmat(i,j)~=-r(k) sum=sum-fdmmat(i,j)*solmat(j,1); end end end end end for j=1:n*N+n-1 if mod(i,N)~=0 if fdmmat(i,j)==1+2*r(k) sum=sum/fdmmat(i,j); end else if fdmmat(i,j)==-r(k) sum=sum/fdmmat(i,j); break; end end end solmat(i+k-1,1)=sum; end sum=0; j=N-4; for i=n*N:n*N+n-2 sum=(fdmmat(i,j+2)*solmat(j+2,1)+fdmmat(i,j+5)*solmat(j+5,1)+fdmmat(i,j+6)*solmat (j+6,1)); solmat((i-n*N)*(N+1)+N)=sum/fdmmat(i,j+4); j=j+N+1; end solmat(n*N+n-1,1)=(rhsmat(n*N+n-1,1)-fdmmat(n*N+n-1,n*N+n-2)*solmat(n*N+n-2)fdmmat(n*N+n-1,n*N+n-3)*solmat(n*N+n-3,1))/fdmmat(n*N+n-1,n*N+n-1); if q==50 iter2=1; result(iter,iter2)=solmat(n*N+n-2,1); elseif q==100 iter2=2; result(iter,iter2)=solmat(n*N+n-2,1); elseif q==150 iter2=3; result(iter,iter2)=solmat(n*N+n-2,1); elseif q==200 iter2=4; result(iter,iter2)=solmat(n*N+n-2,1); elseif q==250 iter2=5; result(iter,iter2)=solmat(n*N+n-2,1); elseif q==250 iter2=6;

Tata Technologies Limited

89

result(iter,iter2)=solmat(n*N+n-2,1); end temp=solmat-temp; large=max(temp); end %surfrec(q+1)=solmat(n*N+n-2,1); %surfrec(q+1,1)=solmat(1,1); c=N-1; d=1; while(c<n*N+n-1) surfrec(q+1,d)=solmat(c,1); d=d+1; c=c+N+1; end end temp=0:0.1:30; plot(a,b); hold on for i=1:n plot(temp,surfrec(:,i)); end % Some improvements include: % 1) optimiztion of code for faster running % 2) Ambient temperature can be input by user % 3) Trend of a line within the slab can be shown when asked by the user

Tata Technologies Limited

90

Appendix C
% This program executes the given project statement using methods mentioned in Chapter IV. It gives the output as the graphs of node 1 of all interfaces and source temperature varying with time % Please refer to the theory mentioned for smooth understanding of this program % The following user inputs are required: % 1) material of slabs (only following materials are allowed: % (i)brass (ii)alunminium (iii) stainless steel (iv)wood) % 2) thickness of slabs (the user is requested to keep thickness small < 0.02 metres) % 3) width of slabs (all slabs must be equal width) % 3) heat transfer convection coefficient % "All values must be entered in SI Units" %"Do not take very large number of partitions clc clear A={'*' 'k' 'rho' 'c' ; 'water' 0.617 996 4178 ; 'brass' 110 8530 380 ; 'stainless steel' 14.9 7900 477 ; 'soil' 0.4 3333.3 800 ; 'wood' 1.26 700 1700 ; 'aluminium' 237 2700 897}; A{1,5}='alpha'; for i=2:7 A {i,5}=A{i,2}/(A{i,3}*A{i,4}); end n=input('Enter the number of slabs: ');%can ask user for outside temperature %n=3; mat=cell(1,n); L=zeros(1,n); k=zeros(1,n); rho=zeros(1,n); c=zeros(1,n); alpha=zeros(1,n); for i=1:n fprintf('Enter material of plate %d',i); mat{i}=input(': ','s'); %if(i==1) fprintf('Enter thickness of plate %d',i);%you have to introduce vpa at many places. Check to see results for 3 or more slab right or not then use vpa % L(i)=input(': '); % else % fprintf('Enter thickness of plate %d',i); L(i)=input(': '); % end end width=input('Enter equal width of all plates: '); h=input('Enter value of coefficent h for given problem: '); % mat{1,1}='aluminium'; % mat{1,2}='brass'; % mat{1,3}='stainless steel'; % L(1)=0.005;L(2)=0.006;L(3)=0.007;L(4)=0.008; % h=10; % width=0.01;

Tata Technologies Limited

91

for j=1:n for i=2:size(A,1) %disp('1'); if (strcmp(A{i,1},mat{j})==1) %disp('1'); k(j)=A{i,2}; rho(j)=A{i,3}; c(j)=A{i,4}; alpha(j)=A{i,5}; end end end N=5; deltax=zeros(1,n); deltay=width/(N-1); deltat=0.1; rx=zeros(1,n); ry=zeros(1,n); a=[0 5 10 15 20 25 30]; b=[293 811 977 1033 1068 1094 1116]; for i=1:n deltax(i)=L(i)/(N-1); rx(i)=(alpha(i)*deltat)/(2*deltax(i)^2); ry(i)=(alpha(i)*deltat)/(2*deltay^2); end solmat=zeros(n*N+n-1,N); fdmmat=zeros(n*N+n-1,n*N+n-1); rhsmat=zeros(n*N+n-1,1); for w=1:N fdmmat(1,1)=1+2*rx(1); fdmmat(1,2)=-rx(1); for i=2:(N-1) fdmmat(i,(i-1))=-rx(1); fdmmat(i,i)=1+2*rx(1); fdmmat(i,i+1)=-rx(1); end j=1; for i=N:n*N-1 if(mod(i,N)==0) j=j+1; fdmmat(i,i+j-3)=1+2*rx(j); fdmmat(i,i+j-1)=-rx(j); fdmmat( i,i+j)=-rx(j); else if(mod(i,N)==1) fdmmat(i,i+j-4)=-rx(j); fdmmat(i,i+j-1)=1+2*rx(j); fdmmat(i,i+j)=-rx(j); else fdmmat(i,i+j-2)=-rx(j); fdmmat(i,i+j-1)=1+2*rx(j); fdmmat(i,i+j)=-rx(j); end end end j=N-4; p=1; for i=n*N:n*N+n-2

Tata Technologies Limited

92

fdmmat(i,j+2)=-k(p)/deltax(p); fdmmat(i,j+4)=k(p)/deltax(p); fdmmat(i,j+5)=k(p+1)/deltax(p+1); fdmmat(i,j+6)=-k(p+1)/deltax(p+1); j=j+N+1; p=p+1; end fdmmat(n*N+n-1,n*N+n-3)=-k(n)/(2*deltax(n)*h); fdmmat(n*N+n-1,n*N+n-2)=1; fdmmat(n*N+n-1,n*N+n-1)=k(n)/(2*deltax(n)*h); rhsmat(1,1)=293+rx(1)*((deltat/10)*(b(2)-b(1))+b(1)); for i=2:n*N-1 rhsmat(i,1)=293; end rhsmat(n*N+n-1,1)=293; solmat(:,w)=fdmmat\rhsmat; end fdmmat2=zeros(N+2,N+2); rhsmat2=zeros(N+2,1); solmat2=zeros(n*N-1,N+2); p=1; u=0; for w=1:n*N-1 if mod(w,N)==0 p=p+1; end for i=1:N fdmmat2(i,i)=-ry(p); fdmmat2(i,i+1)=1+2*ry(p); fdmmat2(i,i+2)=-ry(p); end fdmmat2(N+1,1)=k(p)/(2*deltay*h); fdmmat2(N+1,2)=1; fdmmat2(N+1,3)=-k(p)/(2*deltay*h); fdmmat2(N+2,N)=-k(p)/(2*deltay*h); fdmmat2(N+2,N+1)=1; fdmmat2(N+2,N+2)=k(p)/(2*deltay*h); if w==1 for i=1:N rhsmat2(i,1)=(12*rx(p))*solmat(w,i)+rx(p)*solmat(w+1,i)+rx(p)*((deltat/10)*(b(2)b(1))+b(1)); end else if mod(w,N)==0 rhsmat(i,1)=rhsmat(i-1,1); u=u+1; else for i=1:N rhsmat2(i,1)=(12*rx(p))*solmat(w+u,i)+rx(p)*solmat(w+u+1,i)+rx(p)*solmat(w+u-1,i); end end end rhsmat2(N+1,1)=293;

Tata Technologies Limited

93

rhsmat2(N+2,1)=293; solmat2(w,:)=fdmmat2\rhsmat2; end surfrec=zeros(301,n); surfrec2=zeros(301,N); surfrec(1,:)=293; surfrec2(1,:)=293; i=N-1; j=1; while(i<=n*N-1) surfrec(2,j)=solmat2(i,1); j=j+1; i=i+N; end for i=2:N+1 surfrec2(2,i-1)=solmat2(n*N-1,i); end for q=2:300 if q*deltat>=0 && q*deltat<5 Tatiter=(((q-0.5)*deltat)/5)*(b(2)-b(1))+b(1); end if q*deltat>=5 && q*deltat<10 Tatiter=(((q-0.5)*(deltat)-5)/5)*(b(3)-b(2))+b(2); end if q*deltat>=10 && q*deltat<15 Tatiter=(((q-0.5)*(deltat)-10)/5)*(b(4)-b(3))+b(3); end if q*deltat>=15 && q*deltat<20 Tatiter=(((q-0.5)*(deltat)-15)/5)*(b(5)-b(4))+b(4); end if q*deltat>=20 && q*deltat<25 Tatiter=(((q-0.5)*(deltat)-20)/5)*(b(6)-b(5))+b(5); end if q*deltat>=25 && q*deltat<30 Tatiter=(((q-0.5)*(deltat)-25)/5)*(b(7)-b(6))+b(6); end for w=1:N p=1; rhsmat(1,1)=(12*ry(p))*solmat2(1,w+1)+ry(p)*solmat2(1,w+2)+ry(p)*solmat2(1,w)+rx(p)*Tatiter ; for i=2:n*N-1 if mod(i,N+1)==0 p=p+1; end rhsmat(i,1)=(12*ry(p))*solmat2(i,w+1)+ry(p)*solmat2(i,w+2)+ry(p)*solmat2(i,w); end rhsmat(n*N+n-1,1)=293; solmat(:,w)=fdmmat\rhsmat; end p=1; u=0; for w=1:n*N-1

Tata Technologies Limited

94

if mod(w,N)==0 p=p+1; end for i=1:N fdmmat2(i,i)=-ry(p); fdmmat2(i,i+1)=1+2*ry(p); fdmmat2(i,i+2)=-ry(p); end fdmmat2(N+1,1)=k(p)/(2*deltay*h); fdmmat2(N+1,2)=1; fdmmat2(N+1,3)=-k(p)/(2*deltay*h); fdmmat2(N+2,N)=-k(p)/(2*deltay*h); fdmmat2(N+2,N+1)=1; fdmmat2(N+2,N+2)=k(p)/(2*deltay*h); if w==1 for i=1:N rhsmat2(i,1)=(12*rx(p))*solmat(w,i)+rx(p)*solmat(w+1,i)+rx(p)*Tatiter; end else if mod(w,N)==0 rhsmat(i,1)=rhsmat(i-1,1); u=u+1; else for i=1:N rhsmat2(i,1)=(12*rx(p))*solmat(w+u,i)+rx(p)*solmat(w+u+1,i)+rx(p)*solmat(w+u-1,i); end end end rhsmat2(N+1,1)=293; rhsmat2(N+2,1)=293; solmat2(w,:)=fdmmat2\rhsmat2; end c=N-1; d=1; while(c<=n*N-1) surfrec(q+1,d)=solmat2(c,1); d=d+1; c=c+N; end for i=2:N+1 surfrec2(q+1,i-1)=solmat2(n*N-1,i); end end temp=0:0.1:30; plot(a,b); hold on for i=1:n plot(temp,surfrec(:,i)); end % Some improvements include: % 1) optimiztion of code for faster running % 2) Ambient temperature can be input by user % 3) Trend of a line within the slab can be shown when asked by the user

Tata Technologies Limited

95

References
Heat conduction by M Necati Ozisik
http://highered.mcgraw-hill.com/sites/dl/free/0073129305/314124/cen29305_ch04.pdf

en.wikepedia.org www.mathworks.in www.wolframalpha.org Computational Fluid Dynamics by John D. Anderson

Tata Technologies Limited

96

Thank You!!!

Tata Technologies Limited

97

You might also like