国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

MATH4063代做、代寫C++編程設(shè)計(jì)

時(shí)間:2023-11-17  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



1 MATH**3
The University of Nottingham
SCHOOL OF MATHEMATICAL SCIENCES
AUTUMN SEMESTER 2022-2023
MATH**3 - SCIENTIFIC COMPUTING AND C++
Coursework 1 - Released 30th October 2023, 4pm
Your work should be submitted electronically via the MATH**3 Moodle page by 12noon on Monday 20th
November (unless you have arranged an extension). Since this work is assessed, your submission must be
entirely your own work (see the University’s policy on Academic Misconduct). Submissions up to five working
days late will be marked, but subject to a penalty of 5% of the maximum mark per working day.
The marks for each question are given by means of a figure enclosed by square brackets, eg [20]. There are
a total of 100 marks available for the coursework and it contributes 45% to the module. The marking rubric
available on Moodle will be applied to each full question to further break down this mark.
You are free to name the functions you write as you wish, but bear in mind these names should be meaningful.
Functions should be grouped together in .cpp files and accessed in other files using correspondingly named
.hpp files.
All calculations should be done in double precision.
A single zip file containing your full solution should be submitted on Moodle. This zip file should contain three
folders called main, source and include, with the following files in them:
main:
• q1d.cpp
• q2c.cpp
• q3c.cpp
• q4b.cpp
source:
• vector.cpp
• dense_matrix.cpp
• csr_matrix.cpp
• linear_algebra.cpp
• finite_volume.cpp
include:
• vector.hpp
• dense_matrix.hpp
• csr_matrix.hpp
• linear_algebra.hpp
• finite_volume.hpp
Prior to starting the coursework, please download the CW1_code.zip from Moodle and extract the files. More
information about the contents of the files included in this zip file is given in the questions below.
Hint: When using a C++ struct with header files, the whole struct needs to be defined fully in the header file,
and the header file included in the corresponding .cpp file. Include guards should also be used.
MATH**3 Turn Over
2 MATH**3
In this coursework you will build a 2D finite volume solver for the following PDE boundary value problem
−𝛥w**6; + ∇ ⋅ (bw**6;) = 𝑓 (w**9;, 𝑦) ∈ 𝛺, (1)
w**6; = 𝑔, (w**9;, 𝑦) ∈ 𝜕𝛺, (2)
where 𝑓 ∶ 𝛺 → **7;, 𝑔 ∶ 𝜕𝛺 → **7; and b ∶ 𝛺 → **7;2
.
In order to solve this problem, you will first define a sparse matrix structure, then write functions to apply
the GMRES linear algebra solver and finally build and solve the linear system arising from the finite volume
approximation of (1)-(2).
1. Matrices arising from the discretisation of partial differential equations using, for example, finite volume
methods, are generally sparse in the sense that they have many more zero entries than nonzero ones.
We would like to avoid storing the zero entries and only store the nonzero ones.
A commonly employed sparse matrix storage format is the Compressed Sparse Row (CSR) format. Here,
the nonzero entries of an 𝑛 × 𝑛 matrix are stored in a vector matrix_entries, the vector column_no gives
the column position of the corresponding entries in matrix_entries, while the vector row_start of length
𝑛+1 is the list of indices which indicates where each row starts in matrix_entries. For example, consider
the following:
𝐴 =




8 0 0 2
0 3 1 0
0 0 4 0
6 0 0 7





matrix_entries = (8 2 3 1 4 6 7)
column_no = (0 3 1 2 2 0 3)
row_start = (0 2 4 5 7)
Note, in the above, C++ indexing has been assumed, i.e, indices begin at 0.
(a) In csr_matrix.hpp, define a C++ struct called csr_matrix to store a matrix in CSR format. In
addition to matrix_entries, column_no and row_start, you should store the number of rows of the
matrix explicitly.
(b) In csr_matrix.cpp, write a C++ function that will set up the matrix 𝐴 from above in CSR format.
Remember, if you are using dynamically allocated memory, then you should also have corresponding
functions that will deallocate the memory you have set up.
(c) In csr_matrix.cpp, write a C++ function that takes as input a matrix 𝐴 stored in CSR format and a
vector x and computes the product 𝐴x. The prototype for your function should be:
void MultiplyMatrixVector ( csr_matrix & matrix ,double* vector ,
double* productVector )
Hence, the input vector and the output productVector should be pointers to dynamically allocated
arrays. In particular, it should be assumed that productVector has been preallocated to the correct
size already.
(d) By setting a vector x = (4, −1, 3, 6)⊤, write a test program in q1d.cpp to compute and print to the
screen the product 𝐴x, where 𝐴 is the matrix given above.
[20 marks]
MATH**3
3 MATH**3
2. Suppose we wish to find x ∈ **7;𝑛
such that
𝐴x = b, (3)
where 𝐴 is an 𝑛 × 𝑛 matrix and b ∈ **7;𝑛
.
One algorithm for solving this problem is the (restarted) Generalised Minimal RESidual (GMRES) algorithm.
The method is too complicated to explain here, but works to quickly find approximations x𝑘 = x0 + y𝑘
where y𝑘 ∈ 𝒦𝑘 ∶= Span{𝐴q0
, 𝐴2q0 … 𝐴𝑘q0
} for 𝑘 = 1, 2, …. y𝑘 is chosen to minimise the residual
‖b − 𝐴x𝑘‖2
.
Here x0
is some initial guess vector and q0
is the normed initial residual
q0 =
b − 𝐴x0
‖b − 𝐴x0‖2
.
𝒦𝑘 is called a Krylov subspace of 𝐴.
The algorithm stops when ‖b − 𝐴x𝑘‖2 < tol for some termination tolerance tol. As the method becomes
very memory inefficient when 𝑘 is large, the method is restarted every so often and x𝑘 reset to be x0
.
An incomplete GMRES algorithm function PerformGMRESRestarted() has been written in
linear_algebra.cpp.
A key component of the GMRES algorithm is the Arnoldi iteration that seeks to find an orthonormal basis
of 𝒦𝑘. At the 𝑘th step of the iteration, the Arnoldi method constructs the following matrix decomposition
of 𝐴:
𝐴𝑄𝑘 = 𝑄𝑘+1𝐻̃
𝑘,
where the columns of 𝑄𝑘 (𝑄𝑘+1) contain the orthonormal basis of 𝒦𝑘 (𝒦𝑘+1, resp.) and 𝐻̃
𝑘 is a (𝑘+1)× 𝑘
upper Hessenberg matrix. That is, a matrix that is nearly upper triangular but has non-zero components
on the first subdiagonal.
The 𝑘th step of the Arnoldi algorithm is:
Algorithm 1 One step of the Arnoldi Iteration.
Require: 𝑘 > 0, 𝐴, 𝑄𝑘:
1: Let q𝑖 be the 𝑖th column of 𝑄𝑘.
2: Let h = {ℎ𝑖
}
𝑘+1
𝑖=1 be a vector of length 𝑘 + 1.
3: Compute q𝑘+1 = 𝐴q𝑘
4: for 𝑖 = 1, … , 𝑘 do
5: ℎ𝑖 = q𝑘+1 ⋅ q𝑖
.
6: q𝑘+1 = q𝑘+1 − ℎ𝑖q𝑖
.
7: end for
8: ℎ𝑘+1 = ‖q𝑘+1‖2
.
9: q𝑘+1 = q𝑘+1/ℎ𝑘.
10: 𝑄𝑘+1 = [𝑄𝑘, q𝑘+1].
11: return 𝑄𝑘+1 and h.
(a) In linear_algebra.cpp, write a C++ function which implements one step of the Arnoldi iteration
method defined above.
The function should have the following prototype
void PerformArnoldiIteration ( csr_matrix & matrix ,
dense_matrix & krylov_matrix , int k, double* hessenberg )
MATH**3 Turn Over
4 MATH**3
Here, matrix is 𝐴, k is the step of the iteration to perform, krylov_matrix is the matrix containing
the orthonormal basis, where each row is a basis vector. Upon entry, krylov_matrix should have 𝑘
rows and upon exit it should contain 𝑘 + 1 rows, with the new basis vector in the last row.
Finally, upon exit, hessenberg should contain h, which is the final column of 𝐻̃
𝑘. You may assume that
hessenberg has been preallocated to be of length 𝑘+1 before the call to PerformArnoldiIteration.
Your function should make use, where possible, of prewritten functions defined in dense_matrix.cpp
and vector.cpp. Your code should also make use of the matrix multiplication function from Q1.
Once you have written PerformArnoldiIteration() the GMRES function should function as intended.
Note: Storage of the basis functions in the rows of krylov_matrix, rather than in the columns,
improves efficiency of the code.
(b) In csr_matrix.cpp, write a C++ function that will read from a file a matrix already stored in CSR
format and a vector. You may assume the file structures are as in matrix1.dat and vector1.dat on
Moodle and you may use these data files to test your function.
(c) Write a test program in file q2c.cpp that will read in the matrix 𝐴 from matrix2.dat and the vector
x from vector2.dat, compute b = 𝐴x, then use PerformGMRESRestarted() with the default input
arguments to find an approximation x̂to x. At the end of the calculation, print to the screen the error
‖x − ̂ x‖2
.
[30 marks]
3. The file mesh.hpp contains a struct that defines a mesh data structure mesh for a general mesh comprising
axis-aligned rectangular cells. In particular, each cell in the mesh has an additional struct called
cell_information that contains, among other things, information about the cell neighbours. Familiarise
yourself with these data structures by looking in mesh.hpp.
mesh.cpp contains two functions that will generate meshes, they are:
• ConstructRectangularMesh() - this constructs a mesh on the rectangular domain 𝛺𝑅 = [𝑎, 𝑏] ×
[𝑐, 𝑑].
• ConstructLShapedMesh() - this constructs a mesh on the L-shaped domain 𝛺𝐿 = 𝛺𝑅\𝛺𝐶, where
𝛺𝐶 = [(𝑎 + 𝑏)/2, 𝑏] × [(𝑐 + 𝑑)/2, 𝑑].
(a) In finite_volume.cpp, write a C++ function that will create the storage for a matrix 𝐴 in CSR format
and a RHS vector F required for a cell-centred finite volume method for solving (1)-(2). You should
follow the procedure outlined in the Unit 6 lecture notes. As one of the inputs, your function should
take in a variable of type mesh.
(b) In csr_matrix.cpp, write a C++ function that will output to the screen a matrix stored in CSR format
in the same style as in matrix1.dat.
(c) In Q3c.cpp, write a program that will ask the user to supply the number of cells in each coordinate
direction of a rectangular mesh, sets up the mesh using ConstructRectangularMesh() then calls the
function from part (a) to set up the corresponding matrix and finally prints it to the screen using the
function from part (b).
[30 marks]
MATH**3
5 MATH**3
4. (a) In finite_volume.cpp, write a function that takes in a mesh, uses the function from Q3(a) to construct
𝐴 and F, then populates it with the correct entries to solve problem (1)-(2) using the cell-centred finite
volume method, as outlined in the Unit 6 notes. The function should also take as input the functions
𝑓(w**9;, 𝑦), b(w**9;, 𝑦) and the Dirichlet boundary function 𝑔(w**9;, 𝑦).
(b) In Q4b.cpp, write a main program to ask the user to select from the following problems and supply
the number of cells in each coordinate direction.
1. • Rectangular Mesh - 𝑎 = 0, 𝑏 = 1, 𝑐 = 0 and 𝑑 = 1;
• 𝑓(w**9;, 𝑦) = 1;
• 𝑔(w**9;, 𝑦) = 0;
• b = 0.
2. • L-shaped Mesh - 𝑎 = 0, 𝑏 = 1, 𝑐 = 0 and 𝑑 = 1;
• 𝑓(w**9;, 𝑦) = 8𝜋2
cos(2𝜋w**9;) cos(2𝜋𝑦);
• 𝑔(w**9;, 𝑦) = cos(2𝜋w**9;) cos(2𝜋𝑦);
• b = 0.
3. • Rectangular Mesh - 𝑎 = −1, 𝑏 = 1, 𝑐 = −1 and 𝑑 = 1;
• 𝑓(w**9;, 𝑦) = 1;
• 𝑔(w**9;, 𝑦) = 0;
• b = (10, 10)⊤.
4. • L-Shaped Mesh - 𝑎 = 0, 𝑏 = 1, 𝑐 = 0 and 𝑑 = 1;
• 𝑓(w**9;, 𝑦) = 0;

𝑔(w**9;, 𝑦) = {
1, w**9; = 0, 0.25 < 𝑦 < 0.75,
0, otherwise;
• b = (
50𝑦
√w**9;2+𝑦2
,
−50w**9;
√w**9;2+𝑦2
)

.
The code should then set up the linear system arising from the finite volume discretisation and solve
the system
𝐴uℎ = F
using PerformGMRESRestarted().
Finally, print to the screen the maximum value of uℎ.
Hint: Once you have computed uℎ you can output it to together with the mesh to a file using
OutputSolution() in mesh.cpp. plot_solution.py can then be used to plot the solution in Python.
Note, if you are unable to get the iterative solver from Q2 working, then you may create the finite volume
matrix 𝐴 as if it were a dense matrix (i.e store all the zero entries) and use the function
PerformGaussianElimination() from dense_matrix.cpp to solve the system of equations. This will incur
a small penalty. Note, an illustration of the use of PerformGaussianElimination() can be found in the
main program inside gaussian_elimination_test.cpp.
[20 marks]
MATH**3 End

請(qǐng)加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:COMP9021代做、代寫Python程序語言
  • 下一篇:代寫CSE 30程序、代做c/c++編程設(shè)計(jì)
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場(chǎng)仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動(dòng)
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個(gè)行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手,多多出評(píng)軟件徽y1698861
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服務(wù)平臺(tái)
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 豆包網(wǎng)頁版入口 破天一劍 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號(hào)-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    久久久久久尹人网香蕉| 91精品国产高清自在线| 五月婷婷一区| 欧美资源一区| 分分操这里只有精品| 久久精品日产第一区二区三区精品版 | 日韩在线国产| 欧美日本亚洲| 成人国内精品久久久久一区| 日韩在线观看免费高清| 尤物国产精品| 激情视频综合网| 国产富婆一区二区三区| 精品国产乱码久久久久久郑州公司 | 久久婷婷国产麻豆91天堂| 国产精品国模大尺度私拍| 无码人妻h动漫| 成人精品在线视频| 国产精品久久九九| 大地资源第二页在线观看高清版| 国产一区二区片| 精品国偷自产在线视频| 日日摸日日碰夜夜爽av| 97久久国产亚洲精品超碰热| 国产精品久久77777| 欧美在线亚洲在线| 91九色偷拍| 国产精品免费在线播放| 日韩毛片在线免费看| 久久久午夜视频| 亚洲专区中文字幕| 国产精品在线看| 国产精品久久久久9999小说| 欧美影院在线播放| 日韩一区二区欧美| 欧美在线影院在线视频| 日韩在线免费av| 日韩精品久久一区| 国产高清精品一区二区三区| 亚洲国产欧美不卡在线观看| 福利在线一区二区| 国产精品久久久久7777| 日本午夜精品一区二区| 久久久久高清| 欧美一级片久久久久久久| 久久久精品有限公司| 亚洲精品免费网站| 91精品久久久久久久久中文字幕 | 国产欧美日韩小视频| 久热精品在线视频| 精品视频免费观看| 精品久久久久久无码中文野结衣| 精品视频一区二区三区四区| 国产精品久久久久免费a∨大胸 | 国产精品一区二区久久精品| 欧美日韩成人在线观看| 国语精品免费视频| 国产精品久久久精品| 国产偷久久久精品专区| 久久久久国产视频| www日韩av| 亚洲一区二区久久久久久久| 91麻豆国产语对白在线观看| 亚洲a∨日韩av高清在线观看| 91精品久久久久久久久久久久久 | 日韩av电影免费播放| 国产成人在线亚洲欧美| 欧美影院久久久| 国产精品青草久久久久福利99| 国内成人精品一区| 欧美精品久久久久a| aaa级精品久久久国产片| 亚洲欧洲精品一区二区 | 99国产高清| 午夜免费福利小电影| 国产成人精品免费久久久久| 精品嫩模一区二区三区| 欧美精品一区二区三区国产精品 | 美日韩免费视频| 制服诱惑一区| 久久久精品动漫| 欧美久久在线| 最新欧美日韩亚洲| 久久久伊人欧美| 欧美日韩国产综合在线| 一区二区三区视频| 国产成人短视频| 国产在线观看一区二区三区| 亚洲精品高清视频| 久久久久久精| 欧美亚洲色图视频| 久久国产精品久久久久| 久久久久一区二区| 91精品中文在线| 国产日产久久高清欧美一区| 欧美日韩精品综合| 日本一区二区三区在线播放| 中日韩在线视频| 国产精品国产三级欧美二区| 久久久久久成人精品| 久久手机免费视频| 国产成人一区二区三区免费看| 国产有码在线一区二区视频| 亚洲a∨日韩av高清在线观看| 色视频www在线播放国产成人| 国产在线播放91| 国产精品初高中精品久久| 粉嫩精品一区二区三区在线观看| 综合一区中文字幕| 日韩精品一区中文字幕| 日韩视频中文字幕| 日本不卡在线观看视频| 色噜噜狠狠狠综合曰曰曰88av| 国产主播喷水一区二区| 青青在线免费视频| 日本wwww视频| 久久国产色av| 国产精品久久二区| 国产精品久久波多野结衣| 亚洲中文字幕无码专区| 久久99精品国产99久久6尤物| 欧美亚洲日本黄色| 奇米一区二区三区四区久久| 手机在线观看国产精品| 午夜精品视频在线观看一区二区| 中文字幕中文字幕在线中心一区 | 国产精品视频免费在线| 日韩一区二区在线视频| 久久最新免费视频| 久久久综合香蕉尹人综合网| 国产成a人亚洲精v品在线观看| 国产成人亚洲精品| 国产www免费| 久99久在线| 精品国产一区二区三区在线观看| 深夜成人在线观看| 久久久久久久爱| 啊v视频在线一区二区三区| 久久久精品日本| 国产精品极品美女粉嫩高清在线| 久久不射电影网| 亚洲中文字幕无码av永久| 亚洲国产精品久久久久久女王| 亚洲人一区二区| 欧美一级片中文字幕| 欧美在线观看视频| 国产一区二区色| 国产男人精品视频| 国产乱淫av片杨贵妃| 99电影在线观看| 久久精品美女| 国产精品视频一区国模私拍| 国产精品高清网站| 亚洲欧洲精品在线观看| 日韩在线视频在线| 日韩免费高清在线观看| 黄色大片中文字幕| 成人精品在线视频| 国产黄视频在线| 国产精品久久一| 亚洲一区精品电影| 日韩欧美一区三区| 国产一区一区三区| 97精品视频在线观看| www.欧美精品一二三区| 欧美乱人伦中文字幕在线| 亚洲欧美日韩另类精品一区二区三区 | 免费拍拍拍网站| 欧美中在线观看| 国产欧美日韩专区发布| 99国产在线观看| 日韩中文字幕在线| 欧美日本在线视频中文字字幕| 少妇高潮流白浆| 国产在线观看一区二区三区| 国产精品99久久免费黑人人妻| 精品国产一区二区三区久久久狼| 一区二区三区四区在线视频| 日韩欧美第二区在线观看| 国产偷久久久精品专区| 久久99精品久久久久久三级| 九九久久精品一区| 奇米成人av国产一区二区三区| 国产伦精品一区二区三区照片91| 久久精品中文字幕一区二区三区| 国产精品无av码在线观看| 中文字幕在线乱| 黄色www网站| 国产av熟女一区二区三区| 精品国产免费一区二区三区| 日韩五码在线观看| av在线不卡观看| 国产精品传媒毛片三区| 日av中文字幕| 91免费看片在线| 久久国产精品偷| 黄色a级在线观看| 久久久久久久久久久人体| 亚洲欧洲一区二区在线观看| 国产一区 在线播放|