Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

EX1010 Mathematics I: Computing Coursework 2022-23

Introduction

This is an individual coursework that is to be submitted in Moodle by 23:59 18th April, 2023. You are required to submit MATLAB scripts (M-files) that respond to the brief below. The scripts shall be ready to be run in MATLAB and contain sufficient comments explaining different parts, the use of built-in and user-defined functions, and the numerical schemes used to complete the tasks.  Good examples of comments can be found in the code repository in Moodle.   You shall not submit any additional documents, reports or plots.   The numerical results and plots shall be displayed after running the submitted scripts.

This work shall be entirely your own. You are encouraged to review the MATLAB codes in the repository when writing your own scripts. However, you shall not directly use those codes for  this  coursework.  Any potential  case  of plagiarism will be  investigated based  on  the comments that you need to include in the M-files to describe them using your own words, the coding structures and declarations of variables.  If plagiarism is found it will be considered as serious academic misconduct and you will be invited to defend the originality of your work in a formal interview.

Water surface

Mean water surface

 

 

Mean water depth 4m

seabed

Figure 1: Wave impact on a seawall

Problem 1

Seawalls  are  classic  coastal protection  infrastructure.  The  most  critical parameters  to be considered in the seawall design are the maximum wave loading and water surface on the seawall. Figure 1 shows a sketch of a wave interacting with a vertical seawall. In this case, the mean water depth (the water depth when the water is still) is 4 m. Various pressure sensors are installed on the seawall surface to measure the pressure distribution.

At one specific time, the water surface on the seawall is found to be 0.4 m above the mean water surface. The dynamic pressure recorded by different pressure sensors is stored in the array dataset whose first and second columns are the location (vertical coordinate z) and the dynamic pressure p, respectively.  For convenience, the vertical axis (z-axis) origins is set at the mean water surface.  This means that the seabed is at z = - 4 while z = 0.4 is the coordinate of the instantaneous location of the water surface.  To secure satisfactory accuracy additional measurements have also been carried out. Some results are included in the array newdata, which has the same data structure as the array dataset. For clarity, the data in the array dataset is referred to as the low-resolution data, and the combined data in both dataset and newdata is referred  to  as  the high-resolution  data.    These  data  are  archived  in  the  data  file  named ‘courseworkdata.mat’ .

1)   Processing the low-resolution data and high-resolution data. You need to delete the repeated data points from both sets and sort the data in ascending order of z(10 marks)

2)   Using the low-resolution data, estimate the pressure gradient (i.e. dp/dz ) at different locations using appropriate finite difference schemes with a consistent order of O(h2), where h is the spacing.  Due to the fact that the theoretical or the measured pressure gradient is not available, direct evaluation of the error is not possible. Instead, the error can be estimated by comparing the present estimation with the corresponding results with higher-order accuracy. To do so, you need to estimate dp/dz using the high- resolution data, which can be considered as the reference value for the error estimation. Using the L2-norm, estimate the error on the pressure gradient ranging from – 4 to 0.4 with a spatial resolution of 0.2. (20 marks)

3)   Calculate  the  pressure  force  per  unit  spanwise  length  acting  on  the  seawall  by integrating the pressure, 4(.)4 p(z)dz, using repeated Simpson’s rule. Similar to 2), you

need to use both low-resolution and high-resolution data to order to evaluate the error. (20 marks)

The pressure variations at different times were also recorded by the pressure sensors. The data file pressureSignal.mat’ contains the pressure time history recorded by one pressure sensor with a sampling frequency of 100 Hz.

4)   Using   the   Fourier   Transform,   one   can   reconstruct   the   signal   by   p(t) = 0 aisin(fit + gi) in which the coefficients ai , fi  and gi  can be obtained using the attached user-defined function FourierTransform(t, p(t)).  Plot the coefficients ai  and gi  vs fi .    Reconstruct the signal by filtering any components with a frequency higher than 15 rad/s.  Plot the filtered signal and the original signal at different time. (20 marks)

 

Figure 2: Temperature distribution along a heated rod

Problem 2

The temperature distribution along a heated rod is governed by the second order, constant coefficients ordinary differential equation:

 + ℎ(Ta  − T) = 0,                                                                                  (1)

where T is the temperature at any location along the rod, Ta  is the ambient temperature and h’ is the heat conduction coefficient. The physical situation is sketched in the left panel of Figure 2, in which L is the length of the rod, with the horizontal coordinate origins set at the left end of the rod. Providing the temperature at two ends of the rod (i.e. the boundary values), e.g. T = Tb at x = 0 (left end) and T = Tc  at x = L (right end), a particular solution of the differential equation (1) can be found analytically as seen in your Math lectures.. Alternatively, the problem can be solved using the computing technique you have learned, i.e. the finite difference method. Along the rod, we can distribute n equally spaced points. As an example, the right panel of Figure 2 illustrates the distribution of 6 points along the rod. These points are called nodes. The

d2T

dx2                        approximated using the finite difference scheme, e.g. the central finite difference scheme,

 and Ti−1  are the temperature at nodes

i+1, i and i- 1, respectively.  Consequently, for all nodes except the ones at the ends of the rod, equation (1) can be approximately by

 + ℎ(Ta  Ti) = 0

At node i=2,3. . n − 1 . This equation can be rearranged as

Ti+1  − (2 + ∆x2 )Ti  + Ti−1  = −∆x2 Ta

Applying Eq. (2b) to the examples shown in Figure 2 with 6 nodes,  we obtain

Node 2: T3  − (2 + ∆x2 ℎ′ )T2  + T1  = −∆x2 Ta

Node 3: T4  − (2 + ∆x2 ℎ′)T3  + T2  = −∆x2 Ta

Node 4: T5  − (2 + ∆x2 ℎ′ )T4  + T3  = −∆x2 Ta

Node 5: T6  − (2 + ∆x2 ℎ′ )T5  + T4  = −∆x2 Ta

Considering the known conditions at two ends, i.e.,

(2a)

(2b)

Node 1: T1  = Tb

Node 6: T6  = Tc

These 6 equations can be rewritten to a matrix form,

1                0

1    −(2 + ∆x2 )

0                1

0                0

0                0

0

1

−(2 + ∆x2 )

1

0

0


0

0

1

−(2 + ∆x2 )

1

0


0

0

0

1

−(2 + ∆x2 )

0

0    T1                         Tb

0    T2              −∆x2 ℎ Ta

0    T3              −∆x2 ℎ Ta

0    T4     =   −∆x2 ℎ Ta

1    T5             −∆x2 Ta

(3)

where  Tb  = 40o , Tc  = 100o , L = 10 m , ∆x = L/5 = 2 m, h’ = 0.01 m- 1 and Ta  = 20o .  In the attached MATLAB script temperatureDistribution.m, the corresponding matrices have been defined.  Your tasks are:

(1) Finish the script by insert commands to solve the linear system of equations using Gauss-Seidel Iteration solver.

(2) Rewrite the script to a function fddTempRod with input of Ta , Tb , Tc , L, h’ and n (number of nodes) and return arrays of T and x, which gives the coordinate values of each node.

(3) Using the function, obtain the solutions for the two cases with n =  11 and n=101, keeping all other parameters the same.  Compare the results in the cases with different n (i.e. 6, 11 and 101) in a figure. (30 marks)

Marking and formative feedback

Problem  1: you need to submit main m-script to finish 4 tasks with a list of user-defined functions, together with the data files.

Problem 2: you need to submit main m-script, the user-defined function fddTempRod and the function for Gauss-Seidel solver.

For all tasks, the weighting is 75% for getting correct solutions and 25% for providing sufficient comments.

Formative feedback can be given through in-person or online meeting  1 week before the submission deadline.