欧美在线专区-欧美在线伊人-欧美在线一区二区三区欧美-欧美在线一区二区三区-pornodoxxx中国妞-pornodoldoo欧美另类

position>home>Spotlights

PX390編程代做、C/C++程序語言代寫

編程
PX390 2023-24, Assignment 3
1 Intro
The purpose of this exercise is to further expand your knowledge of C and your
ability to understand and test numerical code. You are given a code which
should solve two coupled partial differential equations. The code is, however,
broken and needs to be fixed. Your task is to read the specification, understand
the program, and ‘debug’ it. At the end of this task the program should do
what these specifications say it is meant to do. Some of these problems with
the code are basic C programming errors, other are more subtle mismatches
between the required and actual code behaviour.
You should submit a single C source file with a list of corrected bugs, at the
top of the C source file (in comments), where I have added a placeholder (this
description will not be marked but helps both of us keep track of what you have
changed). You may submit your code via the link in the assignment section of
the moodle page.
The code must compile and generate no warnings when compiled with
gcc -Wall -Werror -std=c99 -o assign3 assign3.c -lm
There are a finite number of bugs, but we will not tell you how many: make
sure that your code actually works by testing it rather than just looking for
obvious errors. Some errors may be repeated in multiple statements, or may
effect multiple lines of code.
1.1 How is it marked
Marks are given for the absence of each bug (in an otherwise correctly working
code) and for the code compiling correctly. You may lose marks in more than one
category for sufficiently severe problems. A correctly working code will contain
a stable and consistent finite difference method for solving the equations below.
1.2 Tips
1. The compiler is your friend. Start with the first warning/error messages
and work through them until there are none left.
2. Some bugs are hard to catch just by inspecting the code. Adding printf
statements is usually the easiest way to check that the code is doing what
you think it is: check the maths at the first timestep, for example.
3. You can often catch bugs in numerical code by looking at the output
graphically: does it do something strange at the boundaries? A variety of
tools (Matlab/matplotlib/Origin) exist which can take numerical output
and plot it for you. This is one of the things you should learn while doing
this assignment as it will be essential later on.
1
4. Learn how to use debuggers (gdb). Memory checking tools like valgrind
can help catch issues to do with reading/writing into an incorrect memory
location.
5. It is expected that you will allocate arrays on the heap and that the
allocated memory is released (freed) after use.
2 Specification
The code must use a simple, convergent, finite difference scheme to solve the
coupled differential equation for real-valued functions u and v with
∂u
∂t − K

2u
∂x2
− v(u + 1) = 0 (1)
∂v
∂t − K

2v
∂x2
+ u(v + 1) = 0 (2)
The equation is to be solved on a 1D x domain with x ∈ [0, length], as an
initial value problem. The domain length, number of grid points, length of time
over which to solve and the coefficients are defined at the start of the main.
The initial condition is u(x, 0) = 1.0 + sin(2πx/[length]), v(x, 0) = 0.0. The
first grid point is at x = 0, and the final point at x =[length]= (nx−1)×δx. The
function and its derivatives are periodic, so periodic boundary conditions should
be enforced, that is, u(x = 0) = u(x =[length]) and v(x = 0) = v(x =[length]).
The provided code may take a slightly different approach to periodic boundaries
than your used to so examine closely. Please note that at no point should the
values of u or v blow up to infinity.
2.1 Output
The code outputs simulation data at a fixed interval in time equal to the chosen
time step dt: it should output the initial values (at t=0), and at dt, 2dt, 3dt . . .
(but not necessarily the final value).
The time t, x coordinate, and u and v are written in that order in a single
output line for each gridpoint. Do not add extra comments/blank lines to
the output, which should contain only numbers! Remember that I will need
to read the numbers, so if it is output in an unreadable format then you’ll lose
marks.
請加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

Popular articles

主站蜘蛛池模板: 波多野结衣痴女系列88| 美女毛片在线看| 男人肌肌桶女肌肌网站| 再深点灬舒服灬太大了np视频| 樱花草在线社区www| 中文字幕免费在线观看动作大片| 日本漫画之无翼彩漫大全| 最近免费最新高清中文字幕韩国 | 四虎在线免费播放| 超污视频在线观看| 最近中文字幕国语免费完整| 四虎影院永久在线| 国产女人18毛片水真多18精品| 天堂影院www陈冠希张柏芝| 日韩精品一区二区三区在线观看l| 国产福利精品一区二区| 欧美四虎| 久久天天躁夜夜躁狠狠躁2020| 交换韩国电影| 中国一级片在线观看| 女人张开腿给人桶免费视频| 波多野结衣在线一区二区| 正在播放暮町ゆう子在线观看| 成a人片亚洲日本久久| 日韩毛片| 久草免费资源站| 啊灬啊灬啊灬快灬深用力| loveme枫と铃樱花动漫| 岛国片在线播放| 旧里番6080在线观看| 又大又爽又湿又紧a视频| 国产高清免费在线观看| www.五月天婷婷| 美国式的禁忌19| 亚洲日韩欧洲无码av夜夜摸| 亚洲午夜久久久久久尤物| 欧美色欧美亚洲另类二区| 再深点灬舒服灬快h视频| 亚洲欧美四级在线播放| 伊人久久大香线蕉综合电影网| 国产亚洲人成网站在线观看|