0% found this document useful (0 votes)
136 views11 pages

Assignment 1 - Solutions

The document provides the solutions to three questions regarding computational and engineering analysis assignments. For question 1, the solution involves using the Euler method to solve a differential equation numerically over a domain by discretizing it into steps of 0.1. The solution lists the y-values calculated at each step. For question 2, the solution applies the finite difference method to solve another differential equation over a domain that satisfies given boundary conditions. The solution lists the y-values calculated at nodes within the domain. For question 3, the solution sets up using the finite difference method to solve a partial differential equation over a 2D domain that satisfies given boundary and symmetry conditions.

Uploaded by

陳文謠
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views11 pages

Assignment 1 - Solutions

The document provides the solutions to three questions regarding computational and engineering analysis assignments. For question 1, the solution involves using the Euler method to solve a differential equation numerically over a domain by discretizing it into steps of 0.1. The solution lists the y-values calculated at each step. For question 2, the solution applies the finite difference method to solve another differential equation over a domain that satisfies given boundary conditions. The solution lists the y-values calculated at nodes within the domain. For question 3, the solution sets up using the finite difference method to solve a partial differential equation over a 2D domain that satisfies given boundary and symmetry conditions.

Uploaded by

陳文謠
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Technological and Higher Education Institute of Hong Kong

Faculty of Science and Technology


Civil Engineering

SCE5401 Computational and Engineering Analysis

Assignment 1 - Solutions

Question 1

Solve the following differential equation by finite difference method within a domain of 𝑥 ∈ 1, 1.4 .
𝑑𝑦
2 4𝑦 4𝑥 10
𝑑𝑥
where y(1) = 0.5. Consider a step size of h = 0.1.

Solution

This is an initial value problem that can be solved using Euler method.
Using Euler method, the y value at Step i+1 can be found by the following equation
𝑦 𝑦 ℎ𝑦 ′ (Eq. 1-1)
For this problem,
2𝑦 4𝑦 4𝑥 10
𝑦 2𝑥 5 2𝑦
Therefore, Eq. 1-1 becomes
𝑦 𝑦 0.1 2𝑥 5 2𝑦
𝑦 0.8𝑦 0.2𝑥 0.5 (Eq. 1-2)
We will now apply Eq. 1-2 step-by-step to solve for the unknown values within the
domain as follows. We need to solve up to x = 1.8 in this case.

Step 0 (i = 0)
The x and y values at this step i = 0 are
𝑥 1
𝑦 0.5
Therefore,
𝑦 0.8𝑦 0.2𝑥 0.5
𝑦 0.8 0.5 0.2 1 0.5
𝑦 1.1

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 1 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

Step 1 (i = 1)
The x and y values at this step i = 1 are
  𝑥 1.1
𝑦 1.1
Therefore,
  𝑦 0.8𝑦 0.2𝑥 0.5
𝑦 0.8 1.1 0.2 1.1 0.5
𝑦 1.6
Step 2 (i = 2)
The x and y values at this step i = 2 are
  𝑥 1.2
𝑦 1.6
Therefore,
  𝑦 0.8𝑦 0.2𝑥 0.5
𝑦 0.8 1.6 0.2 1.2 0.5
𝑦 2.02
Step 3 (i = 3)
The x and y values at this step i = 3 are
    𝑥 1.3
𝑦 2.02
Therefore,
    𝑦 0.8𝑦 0.2𝑥 0.5
𝑦 0.8 2.02 0.2 1.3 0.5
𝑦 2.376
Therefore, the values within the domain are
x y
1 0.5
1.1 1.1 (ANS.)
1.2 1.6
1.3 2.02
1.4 2.376

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 2 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

Question 2

A problem is governed by the following differential equation


𝑑 𝑦
3𝑦 3𝑥 1 0
𝑑𝑥
where 𝑥 ∈ 0, 3 . The boundary conditions are 𝑦′ 0 1 and 𝑦 3 3.

Solution
The domain for this problem is as follows. We need to solve for unknown values for Node 1 to 3.
𝑦
Node 3
Node 2 Node 4
𝒚𝟒 𝟑
Node 1
𝑥
0 1 2 3
𝑖 1 𝑖 2 𝑖 3 𝑖 4

Step 1 – Convert differential equation to difference equation


𝑦 2𝑦 𝑦
3𝑦 3𝑥 1 0

𝑦 𝑦 𝑦 3𝑥 1 0 (Eq. 2-1)

Step 2 – Setup difference equation at each node within boundary


Setup Eq. 2-1 at each node within the boundary as follows.
At Node 2 (i = 2),
𝑦 𝑦 𝑦 3 1 1 0
  𝑦 𝑦 𝑦 4 (Eq. 2-2)
At Node 3 (i = 3),
𝑦 𝑦 𝑦 3 2 1 0
𝑦 𝑦 𝑦 7 (Eq. 2-3)

Step 3 – Apply boundary conditions


(i) Apply y(3) = 3
Substitute y(3) = y4 = 3 to Eq. 2-3, we have
3 𝑦 𝑦 7
𝑦 𝑦 4 (Eq. 2-3a)
(ii) Apply 𝑦′ 0 1
Use forward difference to approximate 𝑦 ,
𝑦 0 𝑦 ′

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 3 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

𝑦 𝑦
𝑦 1

𝑦 𝑦 1
Substitute 𝑦 𝑦 1 to Eq. 2-2, we have
𝑦 𝑦 𝑦 1 4
𝑦 2𝑦 5 (Eq. 2-2a)

Step 4 – Solve the system of equations


After applying the boundary conditions, we have the following equations
𝑦 2𝑦 5 (Eq. 2-2a)
𝑦 𝑦 4 (Eq. 2-3a)
Solving, we have
𝒚𝟑 𝟑
𝒚𝟐 𝟏
Also,
𝑦 𝑦 1
𝑦 1 1
𝒚𝟏 𝟎
Therefore, the numerical solution by FDM is
x y
1 0
2 1 (ANS.)
3 3
4 3

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 4 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

Question 3

Consider the following differential equation


𝜕 𝑢 𝜕 𝑢
3𝑥 5
𝜕𝑥 𝜕𝑦
where
𝑥 ∈ 0, 6 ; 𝑦 ∈ 0, 6
and the boundary conditions are
𝜕𝑢
0.8 and 𝑢 0, 𝑦 𝑢 𝑥, 0 𝑢 𝑥, 6 25
𝜕𝑥
Solve numerically using finite difference method with mesh size of 2 in both x and y directions.

Solution

The domain and boundary conditions are

j=3 6 u = 25 u = 25 u = 25 u = 25

j=2 4 u = 25 u’ = 0.8

j=1 2 u = 25 u’ = 0.8

j=0 0 u = 25 u = 25 u = 25 u = 25 x
0 2 4 6
i=0 i=1 i=2 i=3

We can make use of solution symmetry to reduce the number of unknowns to solve for. Based on
symmetry, we know that
u1,1 = u1,2
u2,1 = u2,2
u3,1 = u3,2

Step 1 – Convert differential equation to difference equation


The difference equation for this Poisson equation is
𝑢 , 𝑢 , 𝑢, 𝑢, 4𝑢 , 2 3𝑥 , 5
𝑢 , 𝑢 , 𝑢, 𝑢, 4𝑢 , 12𝑥 , 20 (Eq. 3-1)

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 5 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

Step 2 – Setup difference equation at each node with unknown value. Apply boundary conditions that
provide known boundary values also.
Apply Eq. 3-1 to each node with unknown value as follows. We will substitute known boundary
values to the equation also. Because of symmetry, we will only need to consider the nodes along
either j = 1 or j = 2. Let’s consider nodes along j = 1.
At i = 1, j = 1 𝑢 , 𝑢 , 𝑢 , 𝑢 , 4𝑢 , 12𝑥 , 20
25 𝑢 , 25 𝑢 , 4𝑢 , 12 2 20
𝑢 , 3𝑢 , 6 (Eq. 3-2)
At i = 2, j = 1 𝑢 , 𝑢 , 𝑢 , 𝑢 , 4𝑢 , 12𝑥 , 20
𝑢 , 𝑢 , 25 𝑢 , 4𝑢 , 12 4 20
𝑢 , 𝑢 , 3𝑢 , 43 (Eq. 3-3)
At i = 3, j = 1 𝑢 , 𝑢 , 𝑢 , 𝑢 , 4𝑢 , 12𝑥 , 20
𝑢 , 𝑢 , 25 𝑢 , 4𝑢 , 12 6 20
𝑢 , 𝑢 , 3𝑢 , 67 (Eq. 3-4)

Step 3 – Apply derivative boundary conditions


(i) Apply 𝑢′ , 0.8
By central difference,
𝑢 , 𝑢 ,
𝑢′ , 0.8
2ℎ
𝑢 , 𝑢 , 3.2
𝑢 , 3.2 𝑢 ,

Substitute to Eq. 3-4, which becomes


𝑢 , 3.2 𝑢 , 3𝑢 , 67
2𝑢 , 3𝑢 , 63.8 (Eq. 3-4a)

Step 4 – Solve the system of equations


After applying the boundary conditions, we have the following equations
𝑢 , 3𝑢 , 6 (Eq. 3-2)
𝑢 , 𝑢 , 3𝑢 , 43 (Eq. 3-3)
2𝑢 , 3𝑢 , 63.8 (Eq. 3-4a)
Solving we have,
𝒖𝟏,𝟏 𝟖. 𝟑𝟖
𝒖𝟐,𝟏 𝟑𝟏. 𝟏𝟑 (ANS.)
𝒖𝟑,𝟏 𝟒𝟐. 𝟎𝟐

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 6 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

and by symmetry,
𝒖𝟏,𝟐 𝒖𝟏,𝟏 𝟖. 𝟑𝟖
𝒖𝟐,𝟐 𝒖𝟐,𝟏 𝟑𝟏. 𝟏𝟑 (ANS.)
𝒖𝟑,𝟐 𝒖𝟑,𝟏 𝟒𝟐. 𝟎𝟐

The calculated values are shown in the mesh below...

j=3 6 u = 25 u = 25 u = 25 u = 25

j=2 4 u = 25 u = -8.38 u = -31.13 u = -42.02

j=1 2 u = 25 u = -8.38 u = -31.13 u = -42.02

j=0 0 u = 25 u = 25 u = 25 u = 25 x
0 2 4 6
i=0 i=1 i=2 i=3

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 7 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

Question 4

Consider a simply supported beam that is subjected to two point loads as shown below. Determine the
deflection at the nodes along the beam using finite difference method with a mesh size of 1 m. Take EI
as 1×105 kNm2.
120 kN 40 kN

A B

1m 2m 1m
4m

Solution
The mesh and boundary conditions are as follows

1 2 3 4 5 Nodes are 1 m
apart

The boundary conditions are


y(0) = y1 = 0
y(4) = y5 = 0

Step 1 – Determine the bending moment function along the beam


The reaction at Support A and Support B are determined based on static equilibrium and they are
RA = 100 kN
RB = 60 kN
By inspection, there are three moment functions along the entire beam’s length. Let’s call the
functions Ma, Mb and Mc where
Ma is from x = 0 to 1 m
Mb is from x = 1 to 3 m
Mc is from x = 3 to 4 m
Let’s determine Ma, Mb, and Mc by considering the cuts as shown below.

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 8 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

Cut A Cut B Cut C

120 kN 40 kN

A B

1m 2m 1m
3m

Consider Cut A to determine Ma

Cut A

+ ΣMcut = 0 𝑀 100𝑥 0
Ma
𝑀 100𝑥
x
100

Consider Cut B to determine Mb

120 kN Cut B

+ ΣMcut = 0 𝑀 120 𝑥 1 100𝑥 0


Mb
𝑀 20𝑥 120
1 x-1
100 x

Consider Cut C to determine Mc

120 kN 40 kN Cut C

+ ΣMcut = 0 𝑀 40 𝑥 3 120 𝑥 1 100𝑥 0


Mc

1 2 x-3 𝑀 60𝑥 240


x
100

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 9 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

Step 2 - Convert governing differential equation to difference equation


The governing differential equation is
𝑑 𝑦 𝑀
𝑑𝑥 𝐸𝐼
and the difference equation for this equation is
𝑦 2𝑦 𝑦 𝑀
ℎ 𝐸𝐼
𝑦 2𝑦 𝑦 𝑀
1 1 10
𝑦 2𝑦 𝑦 𝑀 10

Step 3 – Setup difference equation at each node with unknown deflection value. Apply boundary
conditions also.
At Node 2 (i = 2),
    𝑀 𝑀 1 100 1 100 kNm
𝑦 2𝑦 𝑦 𝑀 10
𝑦 2𝑦 0 100 10
𝑦 2𝑦 100 10 (Eq. 4-1)

At Node 3 (i = 3),
    𝑀 𝑀 2 20 2 120 80 kNm 
𝑦 2𝑦 𝑦 𝑀 10
𝑦 2𝑦 𝑦 80 10 (Eq. 4-2)

At Node 4 (i = 4),
    𝑀 𝑀 3 20 3 120 60 kNm
𝑦 2𝑦 𝑦 𝑀 10
0 2𝑦 𝑦 60 10 (Eq. 4-3)

Step 4 – Solve the system of equations


After applying the boundary conditions, we have the following equations
𝑦 2𝑦 100 10 (Eq. 4-1)
𝑦 2𝑦 𝑦 80 10 (Eq. 4-2)
2𝑦 𝑦 60 10 (Eq. 4-3)

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 10 of 11
SCE5401 Computational and Engineering Analysis
Assignment 1 – Solutions
 

Solving we have,
𝑦 0.0013 m
𝑦 0.0016 m
𝑦 0.0011 m

Therefore, the deflection at each node along the beam are


Node y
0 0
1 -0.0013 m
2 -0.0016 m (ANS.)
3 -0.0011 m
4 0

Prepared by: Dr. Cliff Leung


Revision: Rev. 00 Page 11 of 11

You might also like