T Mechanical Engineering
MATLAB as a General Simulation Tool in the
Mechanical Engineering Education at Chalmers
Mikael Enelund,
Head of Mechanical Engineering program, Chalmers
Mechanical Engineering
CO DEVELOPPERS
Stig Larsson, Professor in Applied Mathematics.
Examiner Mathematical Analysis in Several variables
stig@[Link]
Anders Logg, Professor in Computational Mathematics.
Examiner Introductory Mathematics
[Link]@[Link]
Anders Johansson, Associate Professor in Applied
Mechanics. Examiner Programming in MATLAB
[Link]@[Link]
Mikaael Enelund, Professor in Structural Dynamics.
Head of ME program
[Link]@[Link]
Mechanical Engineering
CHALMERS’ ME PROGRAM - BASIS
• 5-yrs two cycle program (combined 3-yrs BSc + 2-yrs MSc)
• 500 students on BSc-level + 550 on MSc level incl 200 international
students
• Long history of curriculum, pedagogic and learning environment innovations
• Initiator (together with MIT, KTH and LiTH) to the CDIO-initiative
• Integrating general engineering skills and education for sustainable
development
• Integrating simulation based math education and computer-based
simulations (programming and CAE-tools)
• Early engineering experiences and Multiple design-build-test projects
• Supportive environment with project workspaces, course lab, prototyping
workshop and driving simulator
• Globalization
Mechanical Engineering
EVOLUTION OF ENGINEERING EDUCATION
Innovation,
Implementation, Pre-1950s:
Collaboration Practice
skills
Practice
1960s: 2000:
Science & CDIO
practice
1980s: Analytical skills,
Science Disciplinary
knowledge,
Theory
Today's and tomorrow's engineers need "both-and"
... Full-detail, synthesis - analysis, disciplinary-interdisciplinary, theory-practice,
...
Mechanical Engineering
THE CDIO VISION
An education that stresses the fundamentals, set in the context of
Conceiving – Designing – Implementing – Operating systems and
products
• A curriculum organised around mutually Bring forward the role of
supporting courses. Rich with student design and implementation
design-build projects in the education - from
paper or computer designs
• Integrated approach to learning general to physical or virtual
engineering skills incl programming prototypes
• Featuring active and experiential learning
Bridge theory and practice -
• Set in both the classroom and a modern
more authentic, realistic
learning laboratory/workspace/virtual
• Continuously improved through a robust Improve learning of non-
assessment/evaluation process technical skills
Mechanical Engineering
CDIO ENVIRONMENTS
Mechanical Engineering
CDIO ENVIRONMENTS
Also need for
• Virtual lab for testing and evaluation
• ICT and programming skills
• Reformed math education
Mechanical Engineering
ME ENGINEERS USE A LOT OF ADVANCED MATH
• Simulation driven design
• CAE
• Optimization
• Control
• Industry 4.0
• Internet of things
• Computerization and
digitalization
• …..
Mechanical Engineering
What do mechanical engineers three years after
graduation??
Main Duties
Alumni questionnaire 2015,
MSc in MecEng, graduated 2012
Mechanical Engineering
What do mechanical engineers three years after
graduation??
SHARE WORKING MAINLY WITH
COMPUTATIONS AND SIMULATIONS
YEAR (Year of Graduation)
Mechanical Engineering
CALCULUS: A complete course, BETA Mathematics
Adams handbook
That kind of mathematics is historically not taught …
Focus on the GO ON, solve (using tricks and hints) specific
problems with known analytical solutions, often without any
connection to applications…..
Mechanical Engineering
Instead, write a computer program that
solves all problems (integrals)
3.141592653589793
Mechanical Engineering
Mathematics + programming = true
• A computer program solves the "general" problem
• Reduce repetitive exercising to practice more on understanding,
problem definition and computations
• Opportunities to practice math and problem solving at a higher level
• Logical and algorithmic thinking, creativity and problem solving
• Requires knowledge of mathematics and programming
• Programming creates an understanding of the digital world and
opportunities to solve new problems, create new systems,
processes and products
Mechanical Engineering
REFORMED SIMULATION BASED
MATHEMATICAL EDUCATION
• Launched 2006/2007 and continuously improved,
• New math courses including a basic course in MATLAB
programming,
• Integration of mathematics in other fundamental engineering
courses, e.g., Mechanics and Automatic Control (‘just in time’)
• Computer-oriented exercises, assignments and team projects
that are used simultaneously in the mathematics courses and in
courses of mechanics and solid mechanics,
• Interactive/virtual learning learning environments in math and
statistics courses
• Teaching and learning in computer lab. Scheduled classed
Mechanical Engineering
CORNERSTONES
• To highlight and clarify modeling, computations, analyses and
simulations,
• Full integration of computational aspects (including programming)
and symbolic aspects of mathematics,
• Construction of algorithms and writing own programs
(programming skills and understanding of mathematics and
algorithm construction)
• General equations instead of the simplified special equations
whose solutions can be written in elementary functions
• Handle real problems (toolbox)
• Visualization
Chalmers University of Technology
ME PROGRAMME – INTERGRATED CURRICULUM
YEAR 1
Quarter 1 Quarter 2 Quarter 3 Quarter 4
Programming in Computer aided Linear algebra Mathematical
MATLAB engineering analysis in several
Mathematical variables
Introductory
mathematics analysis in a single Statics & Solid Solid mechanics
variable mechanics
Introduction to Mechanical engineering
MATLAB programming, numerical solutions and simulations
Simulation using CAE software (CATIA, ANSYS, ADAMS, FLUENT…)
Chalmers University of Technology
YEAR 2
Quarter 1 Quarter 2 Quarter 3 Quarter 4
Mechanics - Machine element Thermodynamics Industrial
Dynamics and energy production and
technology organisation
Material Material and Integrated design and manufacturing
technology manufacturing
technology Sustainable Engineering
product economics
development
MATLAB programming, numerical solutions and simulations
Simulation using CAE software (CATIA, ANSYS, ADAMS, FLUENT…)
Chalmers University of Technology
YEAR 3
Quarter 1 Quarter 2 Quarter 3 Quarter 4
Mechatronics Automatic Bachelor diploma project
control
Fluid mechanics Elective 1 Elective 1 Mathematical
statistics
Elective 1 Elective 2
•Energy conversion •Logistics
•Finite element method •Sound and vibration
•Machine design •Object oriented programming
•Simulation of production •Transforms and differential equations
•Heat transfer
MATLAB/Simulink programming
Simulation using CAE software (CATIA, ANSYS, ADAMS, FLUENT…)
Mechanical Engineering
YEARS 4 and 5
Second cycle, 2 years international master programme. 8
master programmes belong to Mechanical Engineering
• MSc PROGRAM IN APPLIED MECHANICS
• MSc PROGRAM IN AUTOMOTIVE ENGINEERING
• MSc PROGRAM IN MATERIALS ENGINEERING
• MSc PROGRAM IN NAVAL ARCHITECTUREAND
OCEANS ENGINEERING
• MSc PROGRAM IN PRODUCT DEVELOPMENT
• MSc PROGRAM IN PRODUCTION ENGINEERING
• MSc PROGRAM IN SUSTAINABLE ENERGY SYSTEMS
• MSc PROGRAM IN TECHNOLOGY, SOCIETY AND THE
ENVIRONMENT
Chalmers University of Technology
PROGRAMMING IN MATLAB
• Experience shows the need for a separate programming course
• General methodology requires programming
• Why MATLAB?
• Easy to use and suitable as a first programming
environment (cf. edit-compile-execute-debug programming)
• Easy to visualize
• Used in all applied courses and in applied research
• Toolboxes, built-in function and user-submitted libraries
• Aim: Develop own programs from problem description to
working code (“real programming”)
• 4 programming assignments and final exam in computer lab
Chalmers University of Technology
Example: Assignment “Least cost path
using Dijkstra's algorithm”
Let the node at which we are starting be called the initial node. Let the distance of node Y be the
distance from the initial node to Y. Dijkstra's algorithm will assign some initial distance values and will
try to improve them step by step.
1. Assign to every node a tentative distance value: set it to zero for our initial node and to infinity for
all other nodes.
2. Set the initial node as current. Mark all other nodes unvisited. Create a set of all the unvisited
nodes called the unvisited set.
3. For the current node, consider all of its unvisited neighbors and calculate their tentative
distances. Compare the newly calculated tentative distance to the current assigned value and
assign the smaller one. For example, if the current node A is marked with a distance of 6, and
the edge connecting it with a neighbor B has length 2, then the distance to B (through A) will be 6
+ 2 = 8. If B was previously marked with a distance greater than 8 then change it to 8. Otherwise,
keep the current value.
4. When we are done considering all of the neighbors of the current node, mark the current node as
visited and remove it from the unvisited set. A visited node will never be checked again.
5. If the destination node has been marked visited (when planning a route between two specific
nodes) or if the smallest tentative distance among the nodes in the unvisited set is infinity (when
planning a complete traversal; occurs when there is no connection between the initial node and
remaining unvisited nodes), then stop. The algorithm has finished.
6. Otherwise, select the unvisited node that is marked with the smallest tentative distance, set it as
the new "current node", and go back to step 3.
Chalmers University of Technology
JOINT COMPUTER ASSIGNMENTS, 2 EXAMPLES
Courses Statics and strength of materials/Linear algebra:
Analysis of elastic truss frame
• Programming: from problem definition to code
• Manage large systems of equations,
• Visualize the stress distribution and
deformations and optimization (redesign)
• Introduction to FEM and Structural Mechanics
Chalmers University of Technology
Courses: Mathematical Analysis in Several Variables and
Solid Mechanics
Stress analysis of plane elastic plate with 3 holes
• Develop knowledge about stress distribution and how the stress is
increased due to abrupt changes in geometry
• Skills to use the finite element method and introduction to error
estimation and adaptive mesh refinement
Chalmers University of Technology
Chalmers ME driving simulator CASTER
• Used to test and evaluate in-house developed vehicle models,
• Train vehicle dynamics and programming
• Work with the complete design cycle
• Links virtual and physical realities
• Full Vehicle Models in Simulink run natively with Simulator
• Give input and collect output by Matlab scripts
• Used in courses and projects from 1st to 4th year
Chalmers University of Technology
Chalmers ME driving simulator – Examples
Programming in MATLAB (1st year)
Assignment: Code an automatic transmission in Matlab for a
drag racing car based on a given torque curve. Implement and
evaluate the transmission in the simulator
Vehicle dynamics (4th year)
Assignment: Evaluate how weight and brake distribution
affect the handling of a primitive vehicle model and
compare that to a more complex simulink model
Hybrid vehicles and control (4th year)
Assignment: Optimize a hybrid powertrain control strategy
for fuel consumption in Simulink and then evaluate
whether this is good from a drivability standpoint
Chalmers University of Technology
EVALUATION AND RESULTS
• Main goal that each student should gain knowledge, skills and ability to
effectively use computational modelling and simulations in applications has
been reached to a large extent
• Programming skills have increased significantly
• Decision making is brought forward in the sense that students consider real
systems and structures and solve real problem (reasoning and decision
making at a higher level),
• Active learning is emphasized in simulations, open-ended problems and in
the virtual/interactive learning environments that are used,
• The Employers claim that the mechanical engineering students have
became significantly better prepared for the managing and solving of open-
ended problem, carrying out numerical simulations, programming and using
modern industrial software.
• Reviewers “Especially encouraged to see CAD and MATLAB integrated as
educational tools and the interest to embrace computational mathematics
into mechanical engineering courses”
Chalmers University of Technology
References
• Match course descriptions (learning outcomes, computer assignments,
old exams etc)
[Link]
chalmers/arkitekt-och-civilingenjor/maskinteknik/Sidor/[Link]
• Integration of Computational Mathematics Education in the Mechanical
Engineering Curriculum, Proceedings of 7th International CDIO
Conference, Copenhagen, Denmark, 2011
• A computational mathematics education for students of mechanical
engineering, World Transactions on Engineering and Technology
Education, vol 5, 2006.
Chalmers University of Technology
Questions?