Empowering Mechanical Engineering Students: Your Premier Source for Expert Assignment Assistance

MechanicalEngineerin37 18 views 17 slides Jul 05, 2024
Slide 1
Slide 1 of 17
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17

About This Presentation

MechanicalEngineeringAssignmentHelp.com is a premier online platform dedicated to providing high-quality mechanical engineering assignment assistance to students worldwide. Our mission is to support engineering students in achieving academic excellence by offering expert guidance and custom solution...


Slide Content

Visit: www.mechanicalengineeringassignmenthelp.com Email: [email protected] Phone: +1 (315) 557-6473 Topic- Achieving Precision: Solutions for Numerical Fluid Mechanics

Welcome to MechanicalEngineeringAssignmentHelp.com , your go-to resource for solving complex mechanical engineering assignments. Our expert team is dedicated to providing students with detailed, step-by-step solutions to challenging problems, ensuring a thorough understanding of key concepts. In this example, we delve into the intricacies of numerical fluid mechanics and population growth models, showcasing our approach to tackling real-world engineering problems with precision and clarity. Whether you're grappling with finite differences, root finding, or time integration, our comprehensive solutions are designed to help you succeed in your academic endeavors.

Exercise 1 Truncation Error, Round-off Error, Order of Accuracy and Noisy Data . This problem studies the errors occurring during the evaluation of the first derivative f’(x) of a given function f (x) using the forward and central difference schemes (of course, in real fluid problems, f would be unknown). For the example here, f (x) = sin(x). First, we evaluate the effect of the discretization step size h on the estimate of f’(x) . Set h =10i , with i = [-20: 0.5: 0] and x = π – 0.1. Write a short program that evaluates the total errors of both the forward and central difference estimates of f x '( ) , for each of these values of h. Plot the results, i.e. plot two total error curves as a function of h in a single figure panel. For each case, plot also the leading term of the truncation ( discretization ) error. Question

b) Briefly discuss and explain the results, in terms of h. c) Briefly explain the behavior of the total error at the largest values of h? (Hint: which of the forward or central difference is most accurate at these values of h?).

Solution To solve this Numerical Fluid Mechanics assignment problem regarding truncation error, round-off error, order of accuracy, and noisy data, here's how you can approach it: Problem Breakdown: Function and Methods: Function: f(x)=sin⁡(x)f(x) = \sin(x)f(x)=sin(x) Objective: Evaluate f′(x)f'(x)f′(x) using forward and central difference schemes. Steps to Solve: Write a Program:

b) Plot Results: Plot two curves (one for forward difference and one for central difference) showing total error vs. hhh . Include the leading term of truncation error O(h) for each scheme. Discussion: Effect of h: Discuss how the total error changes with h. Typically, as h increases, truncation error decreases (since O(h) but round-off error may dominate. Behavior at Large h: Identify which scheme (forward or central difference) performs better at large h. Implementation Steps:

import numpy as np import matplotlib.pyplot as plt   # Function definition def f(x): return np.sin(x)   # True derivative of f(x) def f_prime (x): return np.cos(x)   # Forward difference scheme def forward_difference (f, x, h): return (f(x + h) - f(x)) / h # Central difference scheme def central_difference (f, x, h): return (f(x + h/2) - f(x - h/2)) / h  

# Parameters x = np.pi - 0.1 i_values = np.arange (-20, 0.5, 0.5) h_values = 10** i_values   # Arrays to store errors errors_forward = [] errors_central = [] truncation_error_term = []   # Compute errors for each h for h in h_values : # Compute derivatives f_prime_exact = f_prime (x) f_prime_forward = forward_difference (f, x, h) f_prime_central = central_difference (f, x, h)

# Compute total errors error_forward = np.abs( f_prime_forward - f_prime_exact ) error_central = np.abs( f_prime_central - f_prime_exact ) # Store errors errors_forward.append ( error_forward ) errors_central.append ( error_central ) # Leading term of truncation error (O(h)) truncation_error_term.append (h)   # Plotting results plt.figure ( figsize =(10, 6)) plt.loglog ( h_values , errors_forward , label='Forward Difference Error', marker='o')

plt.loglog ( h_values , errors_central , label='Central Difference Error', marker='o') plt.loglog ( h_values , truncation_error_term , '--', label='Truncation Error (O(h))') plt.xlabel ('h') plt.ylabel ('Error') plt.title ('Errors in Numerical Derivative Approximation') plt.legend () plt.grid (True) plt.show () Discussion (Part b and c): b) Results Discussion: As h decreases, both forward and central difference errors decrease initially due to reduced truncation errors.

Central difference typically outperforms forward difference at larger h due to its higher order accuracy (reduced O(h^2) truncation error compared to O(h) for forward difference). c) Behavior at Large h: At very large h, the total error for both schemes increases due to increased round-off errors, but central difference remains more accurate initially due to its better handling of higher-order terms. This approach provides a structured way to solve and analyze the errors in numerical differentiation using forward and central difference schemes. Adjust the plotting and analysis as needed based on specific instructions or additional criteria provided in your assignment.

Exercise 2 Root finding, Finite Difference, and Time integration. A significant model of population growth was derived in 1838 by Belgian Pierre-Francois Verhulst . His model eliminated the unrealistic effects of unlimited exponential growth. He suggested that when a population increases, there is a tendency for individuals to compete with each other and so reduce growth. His model has come to be known as the logistic growth equation. Consider a turtle’s population modeled by such a logistic growth equation:

Using Taylor series, apply the forward, backward, and central differences to the first order (time) derivative in the above equation and derive the corresponding discrete timeintegration schemes. Re-arrange the terms such that the unknown values (at future time steps) are on the left-hand side and known values are on the right-hand side. Solution- To apply Taylor series and derive discrete time-integration schemes for the logistic growth equation given:

Let's derive the discrete time-integration schemes using forward, backward, and central differences. Derivation of Discrete Time-Integration Schemes Forward Difference Scheme:

b,c . The moving averages and exponentially weighted moving averages are listed below. The MAPE is 0.2655% and 0.5679% for MA and EWMA respectively.

Conclusion The derived discrete time-integration schemes are: These schemes provide numerical approximations for x( t+Δt ) based on the logistic growth equation, facilitating time integration in numerical simulations of turtle population dynamics.