Assignment 5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

ID2090: Introduction to Scientific Computing Jan-May 24

Introduction to Scientific Computing


Indian Institute of Technology, Madras
Assignment 5
Maximum Marks: 100 Assigned: April 24, 2024
Deadline: May 5, 2024
General Instructions
• You are expected to use the VM for this assignment. Create a directory in your home directory called
assignment_5. Use this directory to work on the assignment.
• For each question (for question i), create a bash file called question_i.sh in the assignment_5 directory.
This bash file should contain the necessary code or commands to solve the respective question.
• We will be using an evaluation script to assess and evaluate your submission. Therefore, kindly ensure
that the naming convention (as mentioned in usage section of each question) is strictly adhered to, and
that the output which you get from running a script, matches the structure of the sample output.
• For submission, upload the MD5 checksum of the assignment_5 directory on Moodle. You can use the
following command. Make sure that you are in HOME directory for this command to work as intended.
find ./assignment_3/* -exec md5sum {} \; | cut -f 1 -d " " | md5sum
• After submitting the MD5 checksum on Moodle, do not update any file(s). Doing so will change your
checksum, and your submission will not be evaluated.
• You are free to read through various resources. However, please ensure that you cite your sources to avoid
plagiarism. Any detected instances of plagiarism will result in penalties.
• Please contact your assigned TA for any doubts or queries regarding this assignment.
• The soft deadline for this assignment is 11:59 PM on May 5, 2024. Submissions after this deadline
will face a linearly increasing penalty of 10 marks per late day.
• The hard deadline for this assignment is 11:59 PM on May 8, 2024. Submissions after this deadline
will not be evaluated.

[30 marks] 1. Transform your chances:


Context
1. The ability of Fourier Transform to approximate a signal as an infinite sum of sinusoidal waves of
integral multiples of some frequency, the ability to transform a time-series data into the frequency
domain, has a variety of applications in Solving of Dirichlet PDEs, Von Neumann Stability Analysis
of CFD schemes, Analysis of Complicated Circuits, etc.
2. Its discrete version, discrete Fourier Transform DFT, is crucial to analyzing images in terms of
noise, details, structure, filters required, etc.
Task Fourier Transform is often used to model convolution operation between two functions, where each
function is applied a Fourier Transform and multiplied, to get the Fourier Transform representation
of the convoluted function. Your task is to create a Sage / Sympy script that takes the functions to
be convolved, as arguments from a plaintext file, performs convolution using Fourier Transform, and
outputs the final convolved function.1 You may assume that the functions given in the input are defined
over x ∈ (−∞, +∞).
Usage:

1 Brownie points for those who convolved traditionally, and compare the performance between the two
approaches in the report3.

1
ID2090: Introduction to Scientific Computing Jan-May 24

./question_1.sh functions.txt

Sample Input:
$ head functions.txt
\frac{\sqrt{2} e^{- 0.5 \left(\frac{x}{2} - \frac{1}{2}\right)^{2}}}{8 \sqrt{\pi}}
\frac{\sqrt{2} e^{- 0.5 \left(\frac{x}{2} - \frac{5}{2}\right)^{2}}}{8 \sqrt{\pi}}

Sample Output:
\frac{0.0625 e^{- 0.0625 \left(x - 6\right)^{2}}}{\sqrt{\pi}}

[30 marks] 2. Poised for Poiseuille flow


Context
1. The Transport phenomenon and associated equations are derived from the continuum hypothesis,
which governs the fluid flow and its related properties.
2. They are predominantly used in mechanical, chemical, metallurgy, ocean engineering, and mathe-
matics, too, to predict fluid properties at a given time and location.
Task Given below is a typical internal fluid flow problem and given the pressure gradients, velocity
profiles are related using the below flow-governing equations as:2

∂ρ 1 ∂ (ρrvr ) ∂ (ρvz ) 1 ∂ (ρvθ )


+ + + =0 (1)
∂t r ∂r ∂z r ∂θ

∂ (ρ⃗v )
+ ∇ · (ρ⃗v⃗v ) = ρ⃗g − ∇P + µ∇2⃗v (2)
∂t
However, governing equations are often coupled and contain partial differential terms, which cannot be
solved as it is without simplifying the problem with certain logical assumptions. Some of them are as
follows:
• Incompressible flow (ρ is constant)
• Fully Developed Flow (z-velocity not dependent on z)
• θ−symmetric flow (θ components and their changes can be neglected)
• Impenetrable wall (Zero radial velocity at a radius equal to pipe radius
• Continuous and Smooth (Differentiable) flow profile.
The approach that is typically used to solve these types of coupled equations is:
• Simplify the continuity equation 1 and get a boundary condition for the pipe wall,
• Simplify z-component of the Navier-Stokes equation 2,

2 All symbols depict their usual meaning

2
ID2090: Introduction to Scientific Computing Jan-May 24

• Integrate recursively until z-velocity is obtained.


Using this knowledge of these approximations to Navier-Stokes equation 2, create a Sympy script which
• Takes as argument, a file (press.txt), whose only line is pressure profile along the z-direction, as
a string convertible to a Sympy expression
• Computes the axial velocity symbolically, step-by-step using the above approach.
• Creates a C++ file (vel.cpp) which takes in argument as the radial distance from the axis and
outputs the corresponding z-velocity to the output stream.
• Note that for this specific question, for the sake of simplicity, you can take the constants µ, R to
be unity.
Usage:
$ ./question_1.sh press.txt
$ ./vel.cpp 0.5

Sample Input:
$ head press.txt
2*z

Sample Output:3
0.375

[40 marks] 3. Reflection:


– Write a LATEX report (named <roll_number>_A5.pdf), which contains your observations and the
overall conclusion you got from performing the tasks above. Upload the same on Moodle.
– Avoid repeating the same point multiple times in the report.
– Make use of math expressions effectively, whenever possible. Mathematically explain the significance
of the assumptions stated in 2, and the corresponding equations.
– As and when possible, write your points in ordered or unordered bullet points. Images/ Screenshots
of intermediate steps are appreciated.
– Remember that the more details you project in the report, the more marks you will be reflected
with.
[20 marks] (a) Task 1
[20 marks] (b) Task 2

3 ’u’ here means ’µ’

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy