代写Diffusion Simulation 编程
Background
Assignment: Temperature Diffusion Simulation Background Information:
This assignment explores temperature diffusion, a fundamental concept in thermodynamics where heat moves from higher to lower temperature regions. The simulation models how heat diffuses over time across a medium, either in one dimension (1D) or two dimensions (2D), using a nearest-neighbor averaging algorithm. Understanding this can help in environmental studies, materials science, and climatology.
A nearest-neighbor (NN) averaging algorithm takes the mean of a data point and its immediate neighbours (i.e. cells sharing a side with it, so not including diagonal neighbours). At the boundaries of a 2D table, or 1D vector, there are fewer values that are averaged due to missing neighbours. For example in the table
1.0 2.0 3.0
4.0 5.0 6.0
7.0 8.0 9.0
a NN average of the middle value 5.0 would be (5.0+2.0+6.0+8.0+4.0)/5 = 5.0, and the NN average of the top left corner 1.0 would be (1.0+2.0+4.0)/3=2.333.
Objective:
Develop Python programs that simulate and visualise temperature diffusion. You start with simple 1D diffusion and progress to more complex 2D and graph scenarios. You will need to handle boundary conditions properly to ensure the simulation does not attempt to access out-of-range data.
Questions for analysis (code)
A template file for the assignment code is provided here:In this file, there are several functions that you must implement. These functions only have a pass statement that you should replace with your own implementation. The provided functions exercise_1D_diffusion, exercise_2D_diffusion, exercise_2D_diffusion_numpy, and exercise_graph_diffusion can be used to call the associated implementation for testing and debugging purposes. You do not have to solve all the tasks, but you can only gain marks for the ones that you have attempted (see Marking criteria below for details on how we will mark your submission). Note that only task 6 should use numpy. Other tasks should use base python.
Note that the figures shown here are examples only to demonstrate the type of plot required. They should not be assumed to be correct solutions of questions in this assignment (and indeed may have been created with different parameters from the questions in this assignment).
Task 1: 1D temperature initial state
Implement create_array() function to create a 1D array of 10 elements with initial temperatures at 0°C in the interior and 1.0°C at boundary cells.
Task 2: 1D NN averaging algorithm
Implement simulate_1d_diffusion() function to apply a nearest-neighbor averaging algorithm to simulate temperature diffusion across the 1D array. Remember to handle edge cases correctly.
Task 3: 1D diffusion visualisation
Implement plot_temperatures() function to visualize and compare the temperature changes across the original and two iterations of NN averaging, using line plots (e.g. Figure 1).
Task 4: 2D temperature initial state
Implement create_grid() function to generate a 2D grid of 5x5 elements with initial temperatures at 0°C in the interior and 1.0°C at boundary cells.
Task 5: 2D temperature diffusion
Implement simulate_2d_diffusion() function to simulate one iteration of temperature diffusion in the 2D grid using nearest-neighbor averaging. Ensure correct handling of boundaries.
Task 6: vectorised 2D diffusion.
Implement simulate_large_scale() function, using NumPy, to optimize the diffusion simulation for a larger grid (i.e. 10x10). This function should compute the simulation for multiple iterations and visualise each step using a heatmap from matplotlib e.g. see Figure 2. You should show 5 heatmaps, including the initial state and 4 further iterations of the simulation. For COMP1730, any working solution is acceptable. For COMP6730, for full marks the solution needs to involve a vectorised expression with no nested loops (hint: look at the numpy pad function.)
Task 7: 2D diffusion on arbitrary graph.
Temperature diffusion in structured grids as seen in the previous questions is a standard model in environmental science, physics, and engineering. However, many real-world systems are better represented as arbitrary networks or graphs where nodes represent locations (like cities or habitats) and edges represent connections (like roads, rivers, or migration paths). This question explores temperature diffusion across such arbitrary graphs, simulating how heat (or other information) might spread in a network.
Graph Representation: The graph is represented using an adjacency list (edges), where each index corresponds to a node and its list contains connected nodes. Temperatures are stored in a separate list (temperatures), indexed correspondingly. You are provided with function that create_graph() that will create such a graph, where nodes represent different regions, each with an initial random temperature, and edges between nodes indicate that temperature can diffuse between these nodes. Study this function to understand how the two list store the graph and how the graph is created.
You are also provided with function visualize_graph that will display such a graph. An example plot is shown in Figure 3. You do not need to understand the implementation of this function.
You should implement the function simulate_diffusion() which has as parameters the two lists defining the graph and should simulate one iteration of temperature diffusion, calculated by NN average, on the graph. It returns the updated node temperatures.
Questions for the individual report
The template is a plain text file; write your answers where indicated in this file. Do not convert it to doc, docx, pdf or any other format.
The questions for you to answer in the report are:
Report question 1: Write your name and ANU ID.
Report question 2: Select a piece of code in your assignment solution that you have written, and explain:
(a) What does this piece of code do?
(b) How does it work?
(c) What other possible ways did you consider to implement this functionality, and why did you choose the one you did?
For this question, you should choose a piece of code of reasonable size and complexity. If your code has an appropriate level of functional decomposition, then a single function is likely to be a suitable choice, but it can also be a part of a function. It should not be something trivial (like a single line, or a simple loop).
For all parts of this question, it is important that your answers are at an appropriate level of detail. For part (a), describe the purpose of the code, including assumptions and restrictions. For parts (b) and (c), provide a high-level description of the algorithmic idea (and alternative ideas), not a line-by-line description of each statement.
There is no hard limit on how short or how long your answer can be, but an answer that is short and clear is always better than one that is long and confusing, if both of them convey the same essential information. As a rough guideline, an appropriate answer may be about 100 - 300 words for each of parts (a) - (c).
Restrictions on code
There are certain restrictions on your code:
You should NOT use any global variables or code outside of functions.
You can import modules that you find useful
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- Instagram营销软件,ins群发工具,ig批量私信神器,ins群发引流工具
- 便捷Line代群发,助您迅速提升用户互动!
- 代做 Rule Minimizer、代写 SQL 语言程序
- 新赛道,新机会——世界智能电动车先进技术展8月27-29日将在深圳召开
- CEG5304代做、代写Java/c++编程语言
- 数字风暴 博主授业 WhatsApp拉群营销工具是我国际业务的风起云涌
- Instagram群发私信推广软件,ins自动发帖工具,ig群发黑科技
- 外贸探险家:WhatsApp拉群工具,我这个小白的外贸探险之旅
- 不再孤单奋斗 这款WhatsApp拉群工具是我事业上的亲密战友
- Ins批量筛选群发营销采集神器,Instagram营销工具,助你实现营销梦想!
- Ins群发消息工具,Instagram模拟器群发软件,助你实现营销梦想!
- Instagram营销软件 - ins接粉软件/ig打粉软件/ins私信软件
- Telegram/TG群发加速引流器,电报/TG营销自动群发软件,TG/纸飞机营销加速器
- CS 161代做、Java/Python程序代写
- WhatsApp全球拉群,ws协议号自动注册工具/ws群发/ws养号
- 孟加拉#Telegram协议号-telegram劫持号-稳定耐用欢迎各大实力中介
- 高效互动,客户粘性 UP!商家选择 telegram 群发协议,品牌与用户深度互动无阻!
- Telegram代群发新利器,提高用户互动黏性
- Telegram加群炒群营销软件,TG自动群组活跃软件,电报脚本炒群工具
- Instagram精准私信群发营销神器,Ins引流推广最新软件购买!
- 道通智能新品行业应用无人机Autel Alpha发布,旗舰性能全面升级
- 国产PET/CT,凭什么?
- 皓丽M3系列为何能够成为会议平板领域的经典之作?
- Instagram营销软件 - ins采集软件/ig采集助手/ins群发助手/颠覆传统
- Instagram群发神器,ins自动采集工具,ig批量私信软件
- 比特币ETF“吸金”41亿美元
- Telegram/TG精准营销平台,电报/TG全自动群发系统,TG/纸飞机拉群引流器
- 吉因加获评广东省肿瘤精准防治工程技术研究中心资格认定
- WhatsApp群发软件一键覆盖,多语言推送!WhatsApp群发云控打破语言壁垒,全球推广无阻碍
- 新华三助力中国邮政私有云平台建设
推荐
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技