首页 新闻 聚焦 科技 财经 创业 综合 图片 视频

IT界

旗下栏目: 行业 生态 IT界 创新

Simulate Soil Consolidatio编程代写

来源:未知 发布时间:2021-06-01
Simulate Soil Consolidatio编程代写
Simulate Soil Consolidation
Simulate Soil Consolidation
Due date 11:59PM Friday 28 May April 2021 (local
Sydney time)
You are tasked to write the parts needed for the simulation of soil consolidation.
Changes to description
This document is being updated:
Students should refer to the Ed website for any clari�cations, or changes to being made to the
assignment description.
A brief list of changes is Documented here.
9 May 2021
CLAY_COMPRESSIBILITY_RATE is 0.001. It is a constant dening water units moved per 1kN per
hour (no longer 100kN)
A message to all students about Academic Integrity
This is an assignment and sta are not permitted to give specic guidance on your code, or how to
solve the specic problem. That is the purpose of the assessment that you are required to perform to
achieve the grade.
You may ask clarication questions about the assignment description. This is often necessary to
implement functionality that is otherwise ambiguous.
The assignment description is not intended to be complete and you can conrm your assumptions in
a form of a question. In asking the question you should be quoting the description you are asking
about.
If you have a question to Ask on Ed please search before asking. However, remember that you
should not be posting any assignment code publicly, as this would constitute academic
dishonesty.
Also, do not wait too long before starting. This assignment needs time and sustained eort.
Background
Consolidation is the gradual changes in volume of a partly or fully saturated soil when subject to a
sustained load. The changes are mainly due to the removal of gases, uids and organic matter from
the soil. We simplify our model to consider this matter as water.
A sample of soil shows the particles arranged with voids between them.
Soil can be composed of many minerals, primary silica, but clay, sand, shale, rock. Some of these
have more water content than others. Water is present within soil and we can assume water is an
incompressible uid, where any pressure applied will cause the water to move to a lower pressure.
The water is eectively squeezed out of the soil very slowly.
Soil consolidation has a huge impact on the planning and construction of buildings throughout
history. The leaning tower of Pisa is a great example to showcase the importance of soil consolidation
[https://www.geoengineer.org/education/web-class-projects/ce-179-geosystems-engineeringdesign/assignments/the-tilt-of-the-tower-of-pisa-why-and-how
].
https://www.youtube.com/watch?v=nK4oDD-4CeE
The purpose of the simulation is to determine:
how long consolidation will take for a given load and placement over a soil conguration
how much water is displaced during consolidation
what are the changes in Height of the soil after consolidation
Simulation Input and Output
functionality for le input/output provided for you
The simulation will require information about the nature of the soil, the load, and the parameters
used to simulate. These are read from a le using the three command line arguments.
$ simulate.py <simulation parameters file path> <soil data file path> <output file pat
h>
Your program will read in a le for the simulation parameters from argument 1
Your program will read in a le for the soil geometry and composition from argument 2
Your program will write to a �le for the results of the simulation from argument 3
For example:
$ simulate.py tests/params_example1.in tests/soil_example1.in sim_results_p1_s1.txt
Modelling of the problem
The modelling of soil consolidation in this assignment makes the following assumptions:
soil particles have no air
soil particles initially have a capacity to hold water and is considered full
for example, if clay can hold 40% water, then at the beginning of the simulation, the clay
particle holds 40% water.
water is an incompressible uid
water moving out of a particle will cause the particle to compress
any amount of water removed from a particle cannot be reintroduced
soil particle categorisation is limited to Clay and Shale and only relevant to the initial conditions
bedrock is an incompressible Particle and will always provide an equal and opposite reactive
force
The void particle is a simple characterisation of representing a lower pressure area and it is
assume to have no volume or capacity. A sand column could be represented as a lower
pressure region, but as a void it has no capacity.
We model a particle of soil.
soil consists of a mixture of solid matter (aggregate) and water.
soil particle has a capacity to hold water. This is dictated by the soil type and the water capacity
value [0,1]
soil particle has pressure acting on it.
Initially the soil particle is at a rest state, in equilibrium with its neighbours.
adding force to the soil will cause change in pressure and result in a movement of water
assume a particle is 1 unit wide and 1 unit deep (square)
We model the movement of water.
water is an incompressible uid.
the entire soil mass is considered as a body of uid where the pressure is even throughout.
water reaching a void in the soil Will cause it to leak out (sink). Void are explicitly dened in 
every simulation.
pressure acting on the soil will cause the equivalent water mass to leave the exit points of the
soil.
There should always be a leak point, place for water to be displaced.
If soil has no leak points, the pressure will continue to rise and no water movement is
possible until there is a break in those soil barriers such as bedrock. This building of
pressure and breaking is not considered in the model or the simulation.
water can move up into a void, against gravity. This is to reduce complexity of the assignment.
We model the rate at which water moves out of soil:
it is constant (for simplicity)
Water volume moved per 1kN per hour
 CLAY_COMPRESSIBILITY_RATE = 0.001
 SHALE_COMPRESSIBILITY_RATE = 0.0005
More water cannot be removed from a particle:
if there is 0.04 water in a particle of clay, and 100kN is applied over one hour.
Water moved is 100,000 x 0.001 = 0.1 . 0.1 > 0.04 , and we expect the particle
of clay will have 0.00 units of water.
File formats
Applicable to parse_sim_parameters and parse_soil_data
The le format contains pairs of Labels and Values , as well as Comments .
# comments
label1
value(s) for label1
label2
value(s) for label2
label3
value(s) for label3
# comments
...
Comments
A comment is identied when the # symbol rst appears in the line after any whitespace.
# a valid comment
 # also a valid comment
### valid comment
-- # INVALID comment
NOT # a # comment
Comments can appear after or before a label/value(s) pair.
# comment1
# more of comment1
label1
value(s) for label1
# comment2
# comment2
label2
value(s) for label2
# comment3
label3
value(s) for label3
# comment4
# more comments...
Labels and Values
A label is the text used to identify the parameter. e.g. Load weight . A value is information for that
label. e.g. 1000
Load weight
1000
Once a label has been identied, the value(s) are always in next lines that follow. A blank line is used
to separate denitions of labels and their values.
Labels can appear at any point within the le. There is no speci�c ordering.
Label matching and identication
Each le format has a well dene set of labels.
All label matching is case insensitive.
Duplicate labels
Labels appearing more than once are permitted, however, only the last value is used.
For example:
Load weight
1000
Load weight
800
During the reading of the le, the program should print a message to the console stderr Warning
label Load weight defined twice. Using last value of 800
Simulation Parameters le format
Applicable to parse_sim_parameters
Load location, width
<value1>, <value2>
Load weight
<value>
Load type
<value>
Load timing
<value>
Load custom data
<time1, load1>, <time2, load2>, <time3, load3>, ...
Format details
Load location, width
2 integers, representing columns starting and how many columns wide
comma separated
must each be positive integers from 0 to 100
Load weight
1 integer representing kilonewtons of weight
must be a positive integer between 0 and 1,000,000
Load type
1 string - Constant or Linear or Custom
Optional, default is Constant .
Load timing
1 integer representing the number of hours the load will apply for Linear
not used for Constant or Custom Load types
must be a positive integer between 0 and 1,000,000
Load custom data
pairs of integer values representing the weight of the load at the given time
Comma separated in the order <hour>, <load weight>
Used when Custom Load type is dened. Otherwise ignored.
Must have an even number of values (a whole number of pairs)
de�nes zero and positive integers
time values dened incrementally
no duplicate time values
Example le
Load location, width
0, 1
Load weight
100
Load type
Linear
Load timing
100
Load location, width
1, 3
Load weight
3860
Load type
Linear
Load timing
56
Load custom data
1,10, 25,50, 75,55, 4,100, 5,150
Soil data le format
Soil width, depth
<value1>, <value2>
Soil keys
<key1>, <description1>, <key2>, <description2>, ...
Soil data
<key>...<key>
<key>...<key>
... ...
... <key> ...
... ...
<key>...<key>
<key>...<key>
The keys describe a symbol to use for a particular soil category. The width of the symbol is 1
character.
The key description is a string of any size
Example
Soil width, depth
30, 20
Soil keys
C,Clay, H,Shale, B,Bedrock, V,Void
Soil data
A special particle is the void. Void is represented by a V . It represents a space which will allows water
to move to (lower pressure).
Format details
Applicable to parse_soil_data
Soil width, depth
2 integers representing the number of columns and the number of layers (rows) of soil data to
follow
comma separated
must each be positive integers from 0 to 10,000
Soil keys
pairs of character,string for representing a soil particle type by a single character
comma separated
must have an even number of values
must de�ne single character followed by a string
no duplicate values (key or description)
Soil data
string(s)
must have the appropriate number of columns and rows previously de�ned
must be characters de�ned in the Soil keys
all rows are equal length
all columns are equal length
Simulation parameters
Applicable to check_simulation_data, calculate_applicable_load, calculate_current_load,
simulation_start
Load location, width
Where and how wide the load is placed.
The location is the column integer, where 0 is the left most column.
The width is the side of the load
For example:
Load location = 1 Load width = 1
In this document, we will represent load with L to illustrate the load location and width. However,
the symbol L will not be present in the �le formats, or simulation.
 L
BCCV
BCCB
BCCB
BBBB
Load location = 2 Load width = 1
 L
BCCV
BCCB
BCCB
BBBB
Most of the problems will focus on a single load point, where Load width =1
Distributed load
The weight of the load implies a force. The width of the load implies a distribution of force over area,
pressure.
For example: Load location = 1 Load width = 3
 LLL
BCCCV
BCCCB
BCCCB
BBBBB
When simulating, the load will only a�ect the body of water which are under load
For example: Load location = 0 Load width = 3
LLL
BCCCV
BCCCB
BCCCB
BBBBB
Load on Column 0 has no e�ect in this model Load on Column 1 has e�ect in this model Load on
Column 2 has e�ect in this model
For simpli�cation, you may assume that where a column is not all bedrock, the load will a�ect it.
For example: Load location = 1 Load width = 3
 LLL
BCCCV
BBCBB
BCCCB
BBBBB
All columns a�ected
Hint: You should focus on load width of 1 to simulate �rst before moving to distributed loads
Load type and timing
Constant load is �xed. Every hour will impose a force of Load weight at the load point(s).
Linear. At time zero, there is zero load. At time Load timing , there will be 100% of the Load weight
at the load point(s). For example, if Load weight=100 and Load timing = 10 . It would take 10
hours for the load to reach 100kN.
t=0, load=0
t=1, load=10
t=2, load=20
t=3, load=30
t=4, load=40
t=5, load=50
t=6, load=60
t=7, load=70
t=8, load=80
t=9, load=90
t=10, load=100
This a�ects the rate of consolidation.
Custom load are user speci�ed times and load weights to be used in the simulation. For example, the
user may specify:
t=0, load=100
t=1, load=120
t=2, load=180
t=3, load=200
t=4, load=150
t=5, load=110
The user may alternatively specify sparse time sequences:
t=0, load=0
t=1, load=500
t=6, load=1300
t=14, load=2000
t=15, load=1500
t=23, load=400
For the simulation, you may assume that the times not speci�ed will use the same value as the
previous time.
t=0, load=0
t=1, load=500
t=2-5, load=500 # this is implicit
t=6, load=1300
t=7-13, load=1300 # this is implicit
t=14, load=2000
t=15, load=1500
t=16-22, load=1300 # this is implicit
t=23, load=400
t=24-end of simulation, 400 # this is implicit
The only error checking you need for custom data is where there are missing pairs of time/load
values. Otherwise, you may assume that the custom data is correct.
A group of connected soil particles as a body of water
Particles of clay that are adjacent will share the same pressure and push of water throughout.
Therefore, the simulation requires knowing which particles constitute a group, or a body of water.
Example: 1 body of water. All clay particles C are adjacent to all other clay C particles. A pressure 
acting on any clay particle will be transmissible throughout the body of water.
BCCCCCCCCCV
BCCCBCCBCBB
BCCCBCCBCBB
BBBBBBBBBBB
Example: 3 bodies of water. There are bedrock particles creating a barrier between the clay particles.
BCCCBCCCCCB
BCCCBCCBBBB
BCCCBCCBCBB
BBBBBBBBBBB
Important:
You do not have to calculate a body of water
You do not have to consider the case where a load is applied to 2 or more bodies of water.
This is calculated for you using the function
 leak_points, fluid_body_particles = find_leak_points(start_particle)
Every hour of the simulation the body of water will lose an amount of water related to the load
applied.
The formula for calculating the water moved in 1 hour relates to how much load is applied at the
time, how much is applicable to the soil (exclude bedrock), and the rate of water movement out of
soil particles (constant).
water_moved = CLAY_COMPRESSIBILITY_RATE x load_applicable
Consistency checking between parameters and soil
Having both parameters and soil data, we can test whether these conditions are satis�ed before
proceeding.
Load over soil
Load geometry must be positioned entirely over soil (Load geometry cannot be overhanging the
edge)
Example of not permitted:
 L
VCC
BCC
BCC
Load not overhanging
Load must be placed over compressible soil particles (e.g. Clay)
Example of not permitted:
 LLL
VCC
BCC
BCC
Simulation examples
Example 1
Consider a column of clay soil with a force applied vertically.
Let the load L be 100kN
The water volume and capacity for clay is 0.4 in this example.
The rate of water movement from clay is 0.001 per hour for every 1kN of force.
The sides of the column are empty, meaning water can leak there in�nitely
There are 4 leak points in this example Void (V) particles
Initial conditions can be represented as so:
 L
 VCV
 VCV
 BBB
Initial conditions, height of middle column = 3
0 1 0
0 1 0
1 1 1
Initial conditions, as numeric values of water capacity:
i 0.4 i
i 0.4 i
0 0 0
where i is in�nite
Initial conditions, as numeric values of water volume:
0 0.4 0
0 0.4 0
0 0 0
After 1 hour
There is 0.1 of water removed per hour on the entire soil mass. The soil pressure is even throughout,
and 0.1 water move to the 4 leak points.
Water leaked = 0.1 / 4 = 0.025
capacity (always the same)
i 0.4 i
i 0.4 i
0 0 0
water volume
0.025 0.35 0.025
0.025 0.35 0.025
0 0 0
0.1 water units removed from the soil in this hour 0.1 total water units removed since t=0
After 2 hours
water volume
0.050 0.3 0.050
0.050 0.3 0.050
0 0 0
0.1 water units removed from the soil in this hour 0.2 total water units removed since t=0
After 3 hours
water volume
0.075 0.25 0.075
0.075 0.25 0.075
0 0 0
0.1 water units removed from the soil in this hour 0.3 total water units removed since t=0
After 4 hours
water volume
0.100 0.20 0.100
0.100 0.20 0.100
0 0 0
0.1 water units removed from the soil in this hour 0.4 total water units removed since t=0
After 5 hours
water volume
0.125 0.15 0.125
0.125 0.15 0.125
0 0 0
0.1 water units removed from the soil in this hour 0.5 total water units removed since t=0
After 6 hours
water volume
0.150 0.10 0.150
0.150 0.10 0.150
0 0 0
0.1 water units removed from the soil in this hour 0.6 total water units removed since t=0
After 7 hours
water volume
0.175 0.05 0.175
0.175 0.05 0.175
0 0 0
0.1 water units removed from the soil in this hour 0.7 total water units removed since t=0
After 8 hours
water volume
0.200 0.00 0.200
0.200 0.00 0.200
0 0 0
0.1 water units removed from the soil in this hour 0.8 total water units removed since t=0
Final result
height of middle column = 2.2
0 0.6 0
0 0.6 0
1 1 1
0.8 units of water has been removed from the soil.
Example 2
So long as there is a lower force area, water can be pushed out.
Consider two columns of clay soil surrounded by bedrock with a vertical force applied on the left
column only.
Let the load L be 100kN
The water volume and capacity for clay is 0.4 in this example.
The rate of water movement from clay is 0.001 per hour for every 1kN of force.
There is one leak point in this example Void (V) particle. water �ows toward this point.
Initial conditions can be represented as so:
 L
BCBCV
BCBCB
BCCCB
BBBBB
Initial conditions
5 columns:
height of column 1 = 4
height of column 2 = 4
height of column 3 = 4
height of column 4 = 4
height of column 5 = 3
Heights:
4 4 4 4 3
1 1 1 1 0
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
Initial conditions, as numeric values of water capacity:
 
0 0.4 0 0.4 i
0 0.4 0 0.4 0
0 0.4 0.4 0.4 0
0 0 0 0 0
Initial conditions, as numeric values of water volume:
 
0 0.4 0 0.4 0
0 0.4 0 0.4 0
0 0.4 0.4 0.4 0
0 0 0 0 0
After 1 hour
capacity (always the same)
 i
0 0.4 0 0.4 0
0 0.4 0 0.4 0
0 0.4 0.4 0.4 0
0 0 0 0 0
Water volume decreases by 0.1 from all particles sharing this force. 7 particles: 0.1 / 7 = 0.014
 
0 0.386 0 0.386 0.1
0 0.386 0 0.386 0
0 0.386 0.386 0.386 0
0 0 0 0 0
0.1 water units removed from the soil in this hour 0.1 total water units removed since t=0
After 2 hours
water volume
 
0 0.371 0 0.371 0.2
0 0.371 0 0.371 0
0 0.371 0.371 0.371 0
0 0 0 0 0
0.1 water units removed from the soil in this hour 0.2 total water units removed since t=0
After 3 hours
water volume
 
0 0.357 0 0.357 0.3
0 0.357 0 0.357 0
0 0.357 0.357 0.357 0
0 0 0 0 0
0.1 water units removed from the soil in this hour 0.3 total water units removed since t=0
...
After 28 hours
water volume
 
0 0 0 0 2.8
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0.1 water units removed from the soil in this hour 2.8 total water units removed since t=0
Final result
height of column 2 = 2.8
0.6
0.6
0.6
1
height of column 3 = 3.6 (cavity collapses)
1
1
0.6
1
height of column 4 = 2.8
0.6
0.6
0.6
1
2.8 units of water has been removed from the soil.
Example 3
This example will demonstrate the load linearly increasing to the maximum weight.
Consider a column of clay soil with a force applied vertically.
Let the load L be 2450kN
Let the load timing be 10 hours
The water volume and capacity for clay is 0.4 in this example.
The rate of water movement from clay is 0.001 per hour for every 1kN of force.
There are 3 leak points in this example Void (V) particles
Initial conditions can be represented as so:
 L
 BCCCCV
 BCCCCV
 BCCCCV
 BBBBBB
Initial conditions t=0
5 columns:
height of column 1 = 4
height of column 2 = 4
height of column 3 = 4
height of column 4 = 4
height of column 5 = 4
height of column 6 = 1
Heights:
4 4 4 4 4 1
1 1 1 1 1 0
1 1 1 1 1 0
1 1 1 1 1 0
1 1 1 1 1 1
Initial conditions, as numeric values of water capacity:
0 0.4 0.4 0.4 0.4 i
0 0.4 0.4 0.4 0.4 i
0 0.4 0.4 0.4 0.4 i
0 0 0 0 0 0
Initial conditions, as numeric values of water volume:
0 0.4 0.4 0.4 0.4 0
0 0.4 0.4 0.4 0.4 0
0 0.4 0.4 0.4 0.4 0
0 0 0 0 0 0
After 1 hour t=1
capacity (always the same)
0 0.4 0.4 0.4 0.4 i
0 0.4 0.4 0.4 0.4 i
0 0.4 0.4 0.4 0.4 i
0 0 0 0 0 0
Force applied at this time is: (1/10) * 2450 = 245
Based on the formula: water_moved = CLAY_COMPRESSIBILITY_RATE x load_applicable
water_moved = ( 0.001 * 245 ) = 0.245
Water volume decreases by 0.245 from all particles sharing this force.
12 particles: 0.245 / 12 = 0.020416667 loss each
0 0.380 0.380 0.380 0.380 0.0817
0 0.380 0.380 0.380 0.380 0.0817
0 0.380 0.380 0.380 0.380 0.0817
0 0 0 0 0 0
0.245 water units removed from the soil in this hour 0.245 total water units removed since t=0
After 2 hours
Force applied at this time is: (2/10) * 2450 = 490
water_moved = ( 0.1 * 490 ) / 100 = 0.49
Water volume decreases by 0.490 from all particles sharing this force.
12 particles: 0.490 / 12 = 0.040833333 loss each
0 0.339 0.339 0.339 0.339 0.245
0 0.339 0.339 0.339 0.339 0.245
0 0.339 0.339 0.339 0.339 0.245
0 0 0 0 0 0
0.490 water units removed from the soil in this hour 0.735 total water units removed since t=0
After 3 hours
Force applied at this time is: (3/10) * 2450 = 735
water_moved = ( 0.001 * 735 ) = 0.735
Water volume decreases by 0.735 from all particles sharing this force.
12 particles: 0.735 / 12 = 0.06125 loss each
0 0.278 0.278 0.278 0.278 0.49
0 0.278 0.278 0.278 0.278 0.49
0 0.278 0.278 0.278 0.278 0.49
0 0 0 0 0 0
0.735 water units removed from the soil in this hour 1.47 total water units removed since t=0
After 4 hours
Force applied at this time is: (4/10) * 2450 = 980
water_moved = ( 0.001 * 980 ) = 0.98
Water volume decreases by 0.98 from all particles sharing this force.
12 particles: 0.98 / 12 = 0.081666667 loss each
0 0.196 0.196 0.196 0.196 0.816
0 0.196 0.196 0.196 0.196 0.816
0 0.196 0.196 0.196 0.196 0.816
0 0 0 0 0 0
0.98 water units removed from the soil in this hour 2.45 total water units removed since t=0
After 5 hours
Force applied at this time is: (5/10) * 2450 = 1225
water_moved = ( 0.001 * 1225 ) = 1.225
Water volume decreases by 1.225 from all particles sharing this force.
12 particles: 1.225 / 12 = 0.102083333 loss each
0 0.094 0.094 0.094 0.094 0.816
0 0.094 0.094 0.094 0.094 0.816
0 0.094 0.094 0.094 0.094 0.816
0 0 0 0 0 0
1.225 water units removed from the soil in this hour 3.675 total water units removed since t=0
After 6 hours
Force applied at this time is: (6/10) * 2450 = 1470
water_moved = ( 0.001 * 1470 ) = 1.47
Water volume decreases by 1.47 from all particles sharing this force.
12 particles: 1.47 / 12 = 0.1225 loss each
0 0.000 0.000 0.000 0.000 0.816
0 0.000 0.000 0.000 0.000 0.816
0 0.000 0.00 0.000 0.000 0.816
0 0 0 0 0 0
1.125 water units removed from the soil in this hour (remainder) 4.8 total water units removed since
t=0
Final result
heights:
Column 1 2 3 4 5 6
--------------------------------
 4, 2.8, 2.8, 2.8, 2.8, 1
4.8 units of water has been removed from the soil in 6 hours.
Example 4
This example will demonstrate the custom load.
Consider the scenario where sand columns are used to consolidate faster:
Load custom data is: 0,200, 15,550, 25,977, 99,1489
The water volume and capacity for clay is 0.4 in this example.
The rate of water movement from clay is 0.001 per hour for every 1kN of force.
There are 16 leak points in this example Void (V) particles
There are 39 soil particles in this example Clay (C)
There is only one body of water
Sand columns are emulated as void and are positioned between clay columns.
Initial conditions can be represented as so:
Final result
15.6 units of water has been removed from the soil in 33 hours.
Your tasks
Please see the following functions for you to complete. They describe the necessary input and output.
[ ] Complete the code necessary to load and parse the simulation parameters �le.
def parse_sim_parameters(file_obj, config):
 ''' input: open file object
 output:
 set the config variables load_location, load_width, load_weight, load_type, load_timing, load
 close the file_obj
 return True on success, otherwise False
 '''
[ ] Complete the code necessary to load and parse the soil data �le
def parse_soil_data(file_obj, config):
 ''' input: open file object
 output: 
 set the config variables soil_width, soil_depth, soil_key_desc, soil_data
 close the file_obj
 return True on success, otherwise False
 '''
[ ] Complete the code for the summarise_sim_data() and summarise_soil_data() functions
def summarise_sim_data(config):
 ''' print the summary of the simulation parameter data
 input: config variables load_location, load_width, load_weight, load_type, load_timing, load_cus
 output: list of strings
 '''
def summarise_soil_data(config):
 ''' print the summary of the soil data
 input: config variables soil_width, soil_depth, soil_key_desc, soil_data
 output: list of strings
 '''
See basic simulation scenario for the output string formats.
[ ] Complete the code for the functions of class sim_results
[ ] Complete the code for the calculate_heights() function
def calculate_heights(particles2d):
 ''' calculate the height of each column
 input: 2D grid of particles (list of lists)
 output: a list of heights for each column
 '''
[ ] Complete the code for the get_bedrock_columns function
def get_bedrock_columns(particles2d):
 ''' returns a list of boolean values to represent whether the column is entirely bedrock
 input: 2D grid of particles (list of lists)
 output: a list of bool, where the list length is the number of columns
 example:
 BCCS
 BCCS 
 BCCS
 BBBB
 [ True, False, False, False ]
 '''
[ ] Complete the code for the check_simulation_data function
def check_simulation_data(config):
 '''
 check the simulation parameters and soil data are compatible
 - load location must be within the columns of soil defined
 - load width cannot overhang last soil column
 input: config variables for simulation parameters and soil
 output: on success, return True, otherwise return False
 '''
[ ] Complete the code for the calculate_applicable_load function
def calculate_applicable_load(config, particles2d, current_load):
 '''
 Calculate how much of the load will be applied based on whether there are bedrock columns. When t
 Formula for your idea:
 load = load * ( #non-bedrock-cols / width + #bedrock-cols / width )
 input:
 current_load, the number of kN for the given time instance (externally calculated based o
 config data with Load location and dimensions.
 particle2d - 2D grid of particles at present
 output: the kN (single float) applied to the body of water
 '''
[ ] Complete the code for the calculate_current_load function
def calculate_current_load(config, hours_passed):
 '''
 caclulate the amount of weight to be applied at hours_passed time.
 - Where the load type is constant. config.load_weight is returned.
 - Where the load type is linear, a calculation is needed based on
hours_passed and load_timing. If the hours_passed exceeds load_timing,
then the full load_weight is used
 
 - Where the load type is custom, the calculation follows the pairs
of time,load values in config.load_custom_data. config.load_custom_data
is assumed to be in time sorted order with no duplicates. The
intermediate values of custom data use the last known time's load value.
If the hours_passed is before all time/load pairs, then the load is zero.
 input:
 config information config.load_weight, config.load_type, config.load_timing, config.load_custom_d
 hours_passed - representing the current time in the simulation. must be a positive integer
 output:
 on success, the load applied (single float) is returned (without considering the soil information
 on failure, -1.0 is returned
 '''
[ ] Complete the partially completed code for the simulation_start() function. Refer to the
sca�old code provided.
Testing
Sta� will run tests on your code. The functions will be called to evalute the output to your functions.
You are to ensure the correct data is returned or set in memory as described by the function.
Test loading the con�guration �le for simulation parameters
Test loading the con�guration �le for soil data
Test for checking the simulation data is consistent
Test for summarising the simulation con�guration
Test for calculating the load for a given time
Test for calculating the load applicable
Some testing �les and output date are provided for you. Please refer to the tests directory in the
workspace on Ed.
How do I begin?
It is always good to start with the simplest possible simulation to run. Small number of particles, very 
well de�ned input and outcome. Pick a simple scenario. Here is a suggested one.
Create a simple con�guration
The con�guration �les:
basic_params.in
Load location, width
0, 1
Load weight
100
Load type
Constant
basic_soil.in
Soil width, depth
1, 4
Soil keys
C,Clay, B,Bedrock, V,Void
C
C
V
B
Expectations
Can you predict the expected outcome?
C becomes
C ---> C
V ---> C
B ---> B
Height should be 0.6 + 0.6 + 0 + 1 = 2.2
Time taken?
1 clay has 0.4 water
total water for 2 clay is thus 0.8 water
CLAY_COMPRESSIBILITY_RATE = 0.001 hence it would take 8 hours
Code for the basic simulation scenario
No need to write code for:
simulate.py
summarise_sim_data()
Expected to return this list of strings
[ 'Load location, width: 0, 1',
 'Load weight: 100',
 'Load type: constant',
 'Load timing: -1',
 'Load custom data: [0, 0]' ]
summarise_soil_data()
Expected to return this list of strings
[ "Soil width, depth: 1, 4",
 "Soil keys and description:",
 " C - Clay",
 "Soil data:",
 "['C']",
 "['C']",
 "['V']",
 "['B']" ]
Easy implementation for the basic simulation scenario
check_simulation_data() - always returns True
calculate_applicable_load() - always returns current_load
calculate_current_load() - always returns config.load_weight
sim_loader.py
parse_sim_parameters()
 config.load_location = 0
 config.load_width = 1
 config.load_weight = 100
 config.load_type = "Constant"
 return True
parse_soil_data()
 config.soil_width = 1
 config.soil_depth = 4
 config.soil_keys = [ 'C','Clay', 'B','Bedrock', , 'V','Void']
 config.soil_data = [ ['C'], ['C'], ['V'], ['B'] ]
 return True
sim_particles2d.py
get_bedrock_columns() - always returns [ False ]
calculate_heights()
 height = 0
 height += (1 - particles2d[0][0].capacity) + particles2d[0][0].water
 height += (1 - particles2d[1][0].capacity) + particles2d[1][0].water
 # for particles2d[2][0], skip adding height of void particle
 # for particles2d[3][0], always add height 1 for bedrock particle
 height += 1
 return [height]
sim_results.py init() - use suggested variables get_consolidation_time() - returns
self.consolidation_time get_total_water_removed() - returns self.total_water_removed
get_height_data() - returns self.heights_data get_load_data() - returns self.load_data
Hardest part
simulate.py
simulation_start()
Run the code:
python3 simulate.py tests/basic_params.in tests/basic_soil.in results.txt
Check your results
The results �le should look like this:
sim_param: basic_params.in
soil_data: basic_soil.in
Consolidation time: 8
What next?
Now you can pick which part to increase in complexity.
How about checking the �le format values for this basic simulation scenario are correct or
rejected? (test your code!)
How about changing the number of clay particles from 2 --> 3 ? but ideally how can you
change it from 2 --> N particles!
How about a di�erent shape of soil?
How about a di�erent load location?
How about changing from Constant to Linear Load Type?
etc.
Take small steps. Test as you go using the previous as well as new scenarios. Use scenarios where
you already know or can con�rm the outcome!
Code Submission
Your code submission must be made via Ed in this lesson.
To make a submission, you will need to press the "Mark" button.
You may submit as many times as you wish without penalty.
You are able to view previous submissions from the code submission section.
Every submission you make includes the README.md and the python .py �les
The following rules apply to your code submission:
Only the �le simulate.py will be started by the automarker
Only the last submission will be graded. 
Only the �nal README.md �le of the last submission will be graded by your tutor
Submission after the due date will incur a late penalty as described in the unit of study outline.
Your submission must be able to compile and run within the Ed environment provided.
After each submission, the marking system will automatically check your code against the public test
cases.
The Python version is that which is presently being used on Ed system:
$ python3 --version
Python 3.9.2
Please ensure you carefully follow the assignment description. Your program output must exactly
match the output shown in the examples.
Late is late!
The computer does not discriminate about what is late. There are two �les for submission
all python �les .py
README.md
They are both in your Ed workspace. Make sure these are the ones for your submission.
Changes to these �les after the deadline will incur a penalty for both (not individually).
Marking criteria
This assignment is 20% of your �nal course grade.
The grade you will receive is based on the number of test cases passed as well as manual grading by
your tutor.
We have provided you with some sample test cases but these do not test all the functionality
described in the assignment. It is important that you thoroughly test your own code.
Automatic tests 15 / 20
These are marked by a computer.
There are public test cases
There are hidden test cases
There are private test cases
Manual grading 5 / 20
The manual grading from your tutor will consider the style, layout and comments you provide in
your code. Your tutor will not be debugging or running your code against any test cases.
edit the README.md �le to describe the parts you have completed and the general structure of
your code. Maximum 1000 words. See sca�old �le directory in Ed.
Explain how each of these modules and their functions are used as part of the simulation:
sim_con�g.py
sim_loader.py
sim_particle.py
sim_particles2d.py
sim_results.py
simulate.py
Justify the choice of testing tool and type of tests that you have conducted to verify your
work. Additional Python �les and logs that were created to run these tests must be
included in your submission.
in your python code �les .py:
Please ensure your code is comprehensible for the purposes of marking. We recommend
that your code adheres to the PEP 8 style guide https://www.python.org/dev/peps/pep-
0008/
Please use comments or docstrings for sections of code to explain the section's purpose.
e.g. the following block of code will "search for", "calculate", "get input for options" etc.
Academic declaration
By submitting this assignment you declare the following:
I declare that I have read and understood the University of Sydney Academic Dishonesty and
Plagiarism in Coursework Policy, and except where speci�cally acknowledged, the work contained in
this assignment or project is my own work, and has not been copied from other sources or been
previously submitted for award or assessment.
I understand that failure to comply with the the Academic Dishonesty and Plagiarism in Coursework
Policy, can lead to severe penalties as outlined under Chapter 8 of the University of Sydney By-Law
1999 (as amended). These penalties may be imposed in cases where any signi�cant portion of my
submitted work has been copied without proper acknowledgement from other sources, including
published works, the internet, existing programs, the work of other students, or work previously
submitted for other awards or assessments.
I realise that I may be asked to identify those portions of the work contributed by me and required to
demonstrate my knowledge of the relevant material by answering oral questions or by undertaking
supplementary work, either written or in the laboratory, in order to arrive at the �nal assessment
mark.
I acknowledge that the School of Computer Science, in assessing this assignment, may reproduce it
entirely, may provide a copy to another member of faculty, and or communicate a copy of this
assignment to a plagiarism checking service or in house computer program, and that a copy of the
assignment may be maintained by the service or the School of Computer Science for the purpose of
future plagiarism checking.
Warning: Any attempts to deceive or disrupt the marking system will result in an immediate zero for
the entire assignment. Negative marks can be assigned if you do not properly follow the assignment
description, or your code is unnecessarily or deliberately obfuscated.
 
请加QQ:99515681 或邮箱:99515681@qq.com   WX:codehelpSimulate Soil Consolidatio编程代写
Simulate Soil Consolidation
Simulate Soil Consolidation
Due date 11:59PM Friday 28 May April 2021 (local
Sydney time)
You are tasked to write the parts needed for the simulation of soil consolidation.
Changes to description
This document is being updated:
Students should refer to the Ed website for any clari�cations, or changes to being made to the
assignment description.
A brief list of changes is documented here.
9 May 2021
CLAY_COMPRESSIBILITY_RATE is 0.001. It is a constant dening water units moved per 1kN per
hour (no longer 100kN)
A message to all students about Academic Integrity
This is an assignment and sta are not permitted to give specic guidance on your code, or how to
solve the specic problem. That is the purpose of the assessment that you are required to perform to
achieve the grade.
You may ask clarication questions about the assignment description. This is often necessary to
implement functionality that is otherwise ambiguous.
The assignment description is not intended to be complete and you can conrm your assumptions in
a form of a question. In asking the question you should be quoting the description you are asking
about.
If you have a question to ask on Ed please search before asking. However, remember that you
should not be posting any assignment code publicly, as this would constitute academic
dishonesty.
Also, do not wait too long before starting. This assignment needs time and sustained eort.
Background
Consolidation is the gradual changes in volume of a partly or fully saturated soil when subject to a
sustained load. The changes are mainly due to the removal of gases, uids and organic matter from
the soil. We simplify our model to consider this matter as water.
A sample of soil shows the particles arranged with voids between them.
Soil can be composed of many minerals, primary silica, but clay, sand, shale, rock. Some of these
have more water content than others. Water is present within soil and we can assume water is an
incompressible uid, where any pressure applied will cause the water to move to a lower pressure.
The water is eectively squeezed out of the soil very slowly.
Soil consolidation has a huge impact on the planning and construction of buildings throughout
history. The leaning tower of Pisa is a great example to showcase the importance of soil consolidation
[https://www.geoengineer.org/education/web-class-projects/ce-179-geosystems-engineeringdesign/assignments/the-tilt-of-the-tower-of-pisa-why-and-how
].
https://www.youtube.com/watch?v=nK4oDD-4CeE
The purpose of the simulation is to determine:
how long consolidation will take for a given load and placement over a soil conguration
how much water is displaced during consolidation
what are the changes in height of the soil after consolidation
Simulation Input and Output
functionality for le input/output provided for you
The simulation will require information about the nature of the soil, the load, and the parameters
used to simulate. These are read from a le using the three command line arguments.
$ simulate.py <simulation parameters file path> <soil data file path> <output file pat
h>
Your program will read in a le for the simulation parameters from argument 1
Your program will read in a le for the soil geometry and composition from argument 2
Your program will write to a �le for the results of the simulation from argument 3
For example:
$ simulate.py tests/params_example1.in tests/soil_example1.in sim_results_p1_s1.txt
Modelling of the problem
The modelling of soil consolidation in this assignment makes the following assumptions:
soil particles have no air
soil particles initially have a capacity to hold water and is considered full
for example, if clay can hold 40% water, then at the beginning of the simulation, the clay
particle holds 40% water.
water is an incompressible uid
water moving out of a particle will cause the particle to compress
any amount of water removed from a particle cannot be reintroduced
soil particle categorisation is limited to Clay and Shale and only relevant to the initial conditions
bedrock is an incompressible particle and will always provide an equal and opposite reactive
force
The void particle is a simple characterisation of representing a lower pressure area and it is
assume to have no volume or capacity. A sand column could be represented as a lower
pressure region, but as a void it has no capacity.
We model a particle of soil.
soil consists of a mixture of solid matter (aggregate) and water.
soil particle has a capacity to hold water. This is dictated by the soil type and the water capacity
value [0,1]
soil particle has pressure acting on it.
Initially the soil particle is at a rest state, in equilibrium with its neighbours.
adding force to the soil will cause change in pressure and result in a movement of water
assume a particle is 1 unit wide and 1 unit deep (square)
We model the movement of water.
water is an incompressible uid.
the entire soil mass is considered as a body of uid where the pressure is even throughout.
water reaching a void in the soil will cause it to leak out (sink). Void are explicitly dened in 
every simulation.
pressure acting on the soil will cause the equivalent water mass to leave the exit points of the
soil.
There should always be a leak point, place for water to be displaced.
If soil has no leak points, the pressure will continue to rise and no water movement is
possible until there is a break in those soil barriers such as bedrock. This building of
pressure and breaking is not considered in the model or the simulation.
water can move up into a void, against gravity. This is to reduce complexity of the assignment.
We model the rate at which water moves out of soil:
it is constant (for simplicity)
Water volume moved per 1kN per hour
 CLAY_COMPRESSIBILITY_RATE = 0.001
 SHALE_COMPRESSIBILITY_RATE = 0.0005
More water cannot be removed from a particle:
if there is 0.04 water in a particle of clay, and 100kN is applied over one hour.
Water moved is 100,000 x 0.001 = 0.1 . 0.1 > 0.04 , and we expect the particle
of clay will have 0.00 units of water.
File formats
Applicable to parse_sim_parameters and parse_soil_data
The le format contains pairs of Labels and Values , as well as Comments .
# comments
label1
value(s) for label1
label2
value(s) for label2
label3
value(s) for label3
# comments
...
Comments
A comment is identied when the # symbol rst appears in the line after any whitespace.
# a valid comment
 # also a valid comment
### valid comment
-- # INVALID comment
NOT # a # comment
Comments can appear after or before a label/value(s) pair.
# comment1
# more of comment1
label1
value(s) for label1
# comment2
# comment2
label2
value(s) for label2
# comment3
label3
value(s) for label3
# comment4
# more comments...
Labels and Values
A label is the text used to identify the parameter. e.g. Load weight . A value is information for that
label. e.g. 1000
Load weight
1000
Once a label has been identied, the value(s) are always in next lines that follow. A blank line is used
to separate denitions of labels and their values.
Labels can appear at any point within the le. There is no speci�c ordering.
Label matching and identication
Each le format has a well dene set of labels.
All label matching is case insensitive.
Duplicate labels
Labels appearing more than once are permitted, however, only the last value is used.
For example:
Load weight
1000
Load weight
800
During the reading of the le, the program should print a message to the console stderr Warning
label Load weight defined twice. Using last value of 800
Simulation Parameters le format
Applicable to parse_sim_parameters
Load location, width
<value1>, <value2>
Load weight
<value>
Load type
<value>
Load timing
<value>
Load custom data
<time1, load1>, <time2, load2>, <time3, load3>, ...
Format details
Load location, width
2 integers, representing columns starting and how many columns wide
comma separated
must each be positive integers from 0 to 100
Load weight
1 integer representing kilonewtons of weight
must be a positive integer between 0 and 1,000,000
Load type
1 string - Constant or Linear or Custom
Optional, default is Constant .
Load timing
1 integer representing the number of hours the load will apply for Linear
not used for Constant or Custom Load types
must be a positive integer between 0 and 1,000,000
Load custom data
pairs of integer values representing the weight of the load at the given time
Comma separated in the order <hour>, <load weight>
Used when Custom Load type is dened. Otherwise ignored.
Must have an even number of values (a whole number of pairs)
de�nes zero and positive integers
time values dened incrementally
no duplicate time values
Example le
Load location, width
0, 1
Load weight
100
Load type
Linear
Load timing
100
Load location, width
1, 3
Load weight
3860
Load type
Linear
Load timing
56
Load custom data
1,10, 25,50, 75,55, 4,100, 5,150
Soil data le format
Soil width, depth
<value1>, <value2>
Soil keys
<key1>, <description1>, <key2>, <description2>, ...
Soil data
<key>...<key>
<key>...<key>
... ...
... <key> ...
... ...
<key>...<key>
<key>...<key>
The keys describe a symbol to use for a particular soil category. The width of the symbol is 1
character.
The key description is a string of any size
Example
Soil width, depth
30, 20
Soil keys
C,Clay, H,Shale, B,Bedrock, V,Void
Soil data
A special particle is the void. Void is represented by a V . It represents a space which will allows water
to move to (lower pressure).
Format details
Applicable to parse_soil_data
Soil width, depth
2 integers representing the number of columns and the number of layers (rows) of soil data to
follow
comma separated
must each be positive integers from 0 to 10,000
Soil keys
pairs of character,string for representing a soil particle type by a single character
comma separated
must have an even number of values
must de�ne single character followed by a string
no duplicate values (key or description)
Soil data
string(s)
must have the appropriate number of columns and rows previously de�ned
must be characters de�ned in the Soil keys
all rows are equal length
all columns are equal length
Simulation parameters
Applicable to check_simulation_data, calculate_applicable_load, calculate_current_load,
simulation_start
Load location, width
Where and how wide the load is placed.
The location is the column integer, where 0 is the left most column.
The width is the side of the load
For example:
Load location = 1 Load width = 1
In this document, we will represent load with L to illustrate the load location and width. However,
the symbol L will not be present in the �le formats, or simulation.
 L
BCCV
BCCB
BCCB
BBBB
Load location = 2 Load width = 1
 L
BCCV
BCCB
BCCB
BBBB
Most of the problems will focus on a single load point, where Load width =1
Distributed load
The weight of the load implies a force. The width of the load implies a distribution of force over area,
pressure.
For example: Load location = 1 Load width = 3
 LLL
BCCCV
BCCCB
BCCCB
BBBBB
When simulating, the load will only a�ect the body of water which are under load
For example: Load location = 0 Load width = 3
LLL
BCCCV
BCCCB
BCCCB
BBBBB
Load on Column 0 has no e�ect in this model Load on Column 1 has e�ect in this model Load on
Column 2 has e�ect in this model
For simpli�cation, you may assume that where a column is not all bedrock, the load will a�ect it.
For example: Load location = 1 Load width = 3
 LLL
BCCCV
BBCBB
BCCCB
BBBBB
All columns a�ected
Hint: You should focus on load width of 1 to simulate �rst before moving to distributed loads
Load type and timing
Constant load is �xed. Every hour will impose a force of Load weight at the load point(s).
Linear. At time zero, there is zero load. At time Load timing , there will be 100% of the Load weight
at the load point(s). For example, if Load weight=100 and Load timing = 10 . It would take 10
hours for the load to reach 100kN.
t=0, load=0
t=1, load=10
t=2, load=20
t=3, load=30
t=4, load=40
t=5, load=50
t=6, load=60
t=7, load=70
t=8, load=80
t=9, load=90
t=10, load=100
This a�ects the rate of consolidation.
Custom load are user speci�ed times and load weights to be used in the simulation. For example, the
user may specify:
t=0, load=100
t=1, load=120
t=2, load=180
t=3, load=200
t=4, load=150
t=5, load=110
The user may alternatively specify sparse time sequences:
t=0, load=0
t=1, load=500
t=6, load=1300
t=14, load=2000
t=15, load=1500
t=23, load=400
For the simulation, you may assume that the times not speci�ed will use the same value as the
previous time.
t=0, load=0
t=1, load=500
t=2-5, load=500 # this is implicit
t=6, load=1300
t=7-13, load=1300 # this is implicit
t=14, load=2000
t=15, load=1500
t=16-22, load=1300 # this is implicit
t=23, load=400
t=24-end of simulation, 400 # this is implicit
The only error checking you need for custom data is where there are missing pairs of time/load
values. Otherwise, you may assume that the custom data is correct.
A group of connected soil particles as a body of water
Particles of clay that are adjacent will share the same pressure and push of water throughout.
Therefore, the simulation requires knowing which particles constitute a group, or a body of water.
Example: 1 body of water. All clay particles C are adjacent to all other clay C particles. A pressure 
acting on any clay particle will be transmissible throughout the body of water.
BCCCCCCCCCV
BCCCBCCBCBB
BCCCBCCBCBB
BBBBBBBBBBB
Example: 3 bodies of water. There are bedrock particles creating a barrier between the clay particles.
BCCCBCCCCCB
BCCCBCCBBBB
BCCCBCCBCBB
BBBBBBBBBBB
Important:
You do not have to calculate a body of water
You do not have to consider the case where a load is applied to 2 or more bodies of water.
This is calculated for you using the function
 leak_points, fluid_body_particles = find_leak_points(start_particle)
Every hour of the simulation the body of water will lose an amount of water related to the load
applied.
The formula for calculating the water moved in 1 hour relates to how much load is applied at the
time, how much is applicable to the soil (exclude bedrock), and the rate of water movement out of
soil particles (constant).
water_moved = CLAY_COMPRESSIBILITY_RATE x load_applicable
Consistency checking between parameters and soil
Having both parameters and soil data, we can test whether these conditions are satis�ed before
proceeding.
Load over soil
Load geometry must be positioned entirely over soil (Load geometry cannot be overhanging the
edge)
Example of not permitted:
 L
VCC
BCC
BCC
Load not overhanging
Load must be placed over compressible soil particles (e.g. Clay)
Example of not permitted:
 LLL
VCC
BCC
BCC
Simulation examples
Example 1
Consider a column of clay soil with a force applied vertically.
Let the load L be 100kN
The water volume and capacity for clay is 0.4 in this example.
The rate of water movement from clay is 0.001 per hour for every 1kN of force.
The sides of the column are empty, meaning water can leak there in�nitely
There are 4 leak points in this example Void (V) particles
Initial conditions can be represented as so:
 L
 VCV
 VCV
 BBB
Initial conditions, height of middle column = 3
0 1 0
0 1 0
1 1 1
Initial conditions, as numeric values of water capacity:
i 0.4 i
i 0.4 i
0 0 0
where i is in�nite
Initial conditions, as numeric values of water volume:
0 0.4 0
0 0.4 0
0 0 0
After 1 hour
There is 0.1 of water removed per hour on the entire soil mass. The soil pressure is even throughout,
and 0.1 water move to the 4 leak points.
Water leaked = 0.1 / 4 = 0.025
capacity (always the same)
i 0.4 i
i 0.4 i
0 0 0
water volume
0.025 0.35 0.025
0.025 0.35 0.025
0 0 0
0.1 water units removed from the soil in this hour 0.1 total water units removed since t=0
After 2 hours
water volume
0.050 0.3 0.050
0.050 0.3 0.050
0 0 0
0.1 water units removed from the soil in this hour 0.2 total water units removed since t=0
After 3 hours
water volume
0.075 0.25 0.075
0.075 0.25 0.075
0 0 0
0.1 water units removed from the soil in this hour 0.3 total water units removed since t=0
After 4 hours
water volume
0.100 0.20 0.100
0.100 0.20 0.100
0 0 0
0.1 water units removed from the soil in this hour 0.4 total water units removed since t=0
After 5 hours
water volume
0.125 0.15 0.125
0.125 0.15 0.125
0 0 0
0.1 water units removed from the soil in this hour 0.5 total water units removed since t=0
After 6 hours
water volume
0.150 0.10 0.150
0.150 0.10 0.150
0 0 0
0.1 water units removed from the soil in this hour 0.6 total water units removed since t=0
After 7 hours
water volume
0.175 0.05 0.175
0.175 0.05 0.175
0 0 0
0.1 water units removed from the soil in this hour 0.7 total water units removed since t=0
After 8 hours
water volume
0.200 0.00 0.200
0.200 0.00 0.200
0 0 0
0.1 water units removed from the soil in this hour 0.8 total water units removed since t=0
Final result
height of middle column = 2.2
0 0.6 0
0 0.6 0
1 1 1
0.8 units of water has been removed from the soil.
Example 2
So long as there is a lower force area, water can be pushed out.
Consider two columns of clay soil surrounded by bedrock with a vertical force applied on the left
column only.
Let the load L be 100kN
The water volume and capacity for clay is 0.4 in this example.
The rate of water movement from clay is 0.001 per hour for every 1kN of force.
There is one leak point in this example Void (V) particle. water �ows toward this point.
Initial conditions can be represented as so:
 L
BCBCV
BCBCB
BCCCB
BBBBB
Initial conditions
5 columns:
height of column 1 = 4
height of column 2 = 4
height of column 3 = 4
height of column 4 = 4
height of column 5 = 3
Heights:
4 4 4 4 3
1 1 1 1 0
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
Initial conditions, as numeric values of water capacity:
 
0 0.4 0 0.4 i
0 0.4 0 0.4 0
0 0.4 0.4 0.4 0
0 0 0 0 0
Initial conditions, as numeric values of water volume:
 
0 0.4 0 0.4 0
0 0.4 0 0.4 0
0 0.4 0.4 0.4 0
0 0 0 0 0
After 1 hour
capacity (always the same)
 i
0 0.4 0 0.4 0
0 0.4 0 0.4 0
0 0.4 0.4 0.4 0
0 0 0 0 0
Water volume decreases by 0.1 from all particles sharing this force. 7 particles: 0.1 / 7 = 0.014
 
0 0.386 0 0.386 0.1
0 0.386 0 0.386 0
0 0.386 0.386 0.386 0
0 0 0 0 0
0.1 water units removed from the soil in this hour 0.1 total water units removed since t=0
After 2 hours
water volume
 
0 0.371 0 0.371 0.2
0 0.371 0 0.371 0
0 0.371 0.371 0.371 0
0 0 0 0 0
0.1 water units removed from the soil in this hour 0.2 total water units removed since t=0
After 3 hours
water volume
 
0 0.357 0 0.357 0.3
0 0.357 0 0.357 0
0 0.357 0.357 0.357 0
0 0 0 0 0
0.1 water units removed from the soil in this hour 0.3 total water units removed since t=0
...
After 28 hours
water volume
 
0 0 0 0 2.8
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0.1 water units removed from the soil in this hour 2.8 total water units removed since t=0
Final result
height of column 2 = 2.8
0.6
0.6
0.6
1
height of column 3 = 3.6 (cavity collapses)
1
1
0.6
1
height of column 4 = 2.8
0.6
0.6
0.6
1
2.8 units of water has been removed from the soil.
Example 3
This example will demonstrate the load linearly increasing to the maximum weight.
Consider a column of clay soil with a force applied vertically.
Let the load L be 2450kN
Let the load timing be 10 hours
The water volume and capacity for clay is 0.4 in this example.
The rate of water movement from clay is 0.001 per hour for every 1kN of force.
There are 3 leak points in this example Void (V) particles
Initial conditions can be represented as so:
 L
 BCCCCV
 BCCCCV
 BCCCCV
 BBBBBB
Initial conditions t=0
5 columns:
height of column 1 = 4
height of column 2 = 4
height of column 3 = 4
height of column 4 = 4
height of column 5 = 4
height of column 6 = 1
Heights:
4 4 4 4 4 1
1 1 1 1 1 0
1 1 1 1 1 0
1 1 1 1 1 0
1 1 1 1 1 1
Initial conditions, as numeric values of water capacity:
0 0.4 0.4 0.4 0.4 i
0 0.4 0.4 0.4 0.4 i
0 0.4 0.4 0.4 0.4 i
0 0 0 0 0 0
Initial conditions, as numeric values of water volume:
0 0.4 0.4 0.4 0.4 0
0 0.4 0.4 0.4 0.4 0
0 0.4 0.4 0.4 0.4 0
0 0 0 0 0 0
After 1 hour t=1
capacity (always the same)
0 0.4 0.4 0.4 0.4 i
0 0.4 0.4 0.4 0.4 i
0 0.4 0.4 0.4 0.4 i
0 0 0 0 0 0
Force applied at this time is: (1/10) * 2450 = 245
Based on the formula: water_moved = CLAY_COMPRESSIBILITY_RATE x load_applicable
water_moved = ( 0.001 * 245 ) = 0.245
Water volume decreases by 0.245 from all particles sharing this force.
12 particles: 0.245 / 12 = 0.020416667 loss each
0 0.380 0.380 0.380 0.380 0.0817
0 0.380 0.380 0.380 0.380 0.0817
0 0.380 0.380 0.380 0.380 0.0817
0 0 0 0 0 0
0.245 water units removed from the soil in this hour 0.245 total water units removed since t=0
After 2 hours
Force applied at this time is: (2/10) * 2450 = 490
water_moved = ( 0.1 * 490 ) / 100 = 0.49
Water volume decreases by 0.490 from all particles sharing this force.
12 particles: 0.490 / 12 = 0.040833333 loss each
0 0.339 0.339 0.339 0.339 0.245
0 0.339 0.339 0.339 0.339 0.245
0 0.339 0.339 0.339 0.339 0.245
0 0 0 0 0 0
0.490 water units removed from the soil in this hour 0.735 total water units removed since t=0
After 3 hours
Force applied at this time is: (3/10) * 2450 = 735
water_moved = ( 0.001 * 735 ) = 0.735
Water volume decreases by 0.735 from all particles sharing this force.
12 particles: 0.735 / 12 = 0.06125 loss each
0 0.278 0.278 0.278 0.278 0.49
0 0.278 0.278 0.278 0.278 0.49
0 0.278 0.278 0.278 0.278 0.49
0 0 0 0 0 0
0.735 water units removed from the soil in this hour 1.47 total water units removed since t=0
After 4 hours
Force applied at this time is: (4/10) * 2450 = 980
water_moved = ( 0.001 * 980 ) = 0.98
Water volume decreases by 0.98 from all particles sharing this force.
12 particles: 0.98 / 12 = 0.081666667 loss each
0 0.196 0.196 0.196 0.196 0.816
0 0.196 0.196 0.196 0.196 0.816
0 0.196 0.196 0.196 0.196 0.816
0 0 0 0 0 0
0.98 water units removed from the soil in this hour 2.45 total water units removed since t=0
After 5 hours
Force applied at this time is: (5/10) * 2450 = 1225
water_moved = ( 0.001 * 1225 ) = 1.225
Water volume decreases by 1.225 from all particles sharing this force.
12 particles: 1.225 / 12 = 0.102083333 loss each
0 0.094 0.094 0.094 0.094 0.816
0 0.094 0.094 0.094 0.094 0.816
0 0.094 0.094 0.094 0.094 0.816
0 0 0 0 0 0
1.225 water units removed from the soil in this hour 3.675 total water units removed since t=0
After 6 hours
Force applied at this time is: (6/10) * 2450 = 1470
water_moved = ( 0.001 * 1470 ) = 1.47
Water volume decreases by 1.47 from all particles sharing this force.
12 particles: 1.47 / 12 = 0.1225 loss each
0 0.000 0.000 0.000 0.000 0.816
0 0.000 0.000 0.000 0.000 0.816
0 0.000 0.00 0.000 0.000 0.816
0 0 0 0 0 0
1.125 water units removed from the soil in this hour (remainder) 4.8 total water units removed since
t=0
Final result
heights:
Column 1 2 3 4 5 6
--------------------------------
 4, 2.8, 2.8, 2.8, 2.8, 1
4.8 units of water has been removed from the soil in 6 hours.
Example 4
This example will demonstrate the custom load.
Consider the scenario where sand columns are used to consolidate faster:
Load custom data is: 0,200, 15,550, 25,977, 99,1489
The water volume and capacity for clay is 0.4 in this example.
The rate of water movement from clay is 0.001 per hour for every 1kN of force.
There are 16 leak points in this example Void (V) particles
There are 39 soil particles in this example Clay (C)
There is only one body of water
Sand columns are emulated as void and are positioned between clay columns.
Initial conditions can be represented as so:
Final result
15.6 units of water has been removed from the soil in 33 hours.
Your tasks
Please see the following functions for you to complete. They describe the necessary input and output.
[ ] Complete the code necessary to load and parse the simulation parameters �le.
def parse_sim_parameters(file_obj, config):
 ''' input: open file object
 output:
 set the config variables load_location, load_width, load_weight, load_type, load_timing, load
 close the file_obj
 return True on success, otherwise False
 '''
[ ] Complete the code necessary to load and parse the soil data �le
def parse_soil_data(file_obj, config):
 ''' input: open file object
 output: 
 set the config variables soil_width, soil_depth, soil_key_desc, soil_data
 close the file_obj
 return True on success, otherwise False
 '''
[ ] Complete the code for the summarise_sim_data() and summarise_soil_data() functions
def summarise_sim_data(config):
 ''' print the summary of the simulation parameter data
 input: config variables load_location, load_width, load_weight, load_type, load_timing, load_cus
 output: list of strings
 '''
def summarise_soil_data(config):
 ''' print the summary of the soil data
 input: config variables soil_width, soil_depth, soil_key_desc, soil_data
 output: list of strings
 '''
See basic simulation scenario for the output string formats.
[ ] Complete the code for the functions of class sim_results
[ ] Complete the code for the calculate_heights() function
def calculate_heights(particles2d):
 ''' calculate the height of each column
 input: 2D grid of particles (list of lists)
 output: a list of heights for each column
 '''
[ ] Complete the code for the get_bedrock_columns function
def get_bedrock_columns(particles2d):
 ''' returns a list of boolean values to represent whether the column is entirely bedrock
 input: 2D grid of particles (list of lists)
 output: a list of bool, where the list length is the number of columns
 example:
 BCCS
 BCCS 
 BCCS
 BBBB
 [ True, False, False, False ]
 '''
[ ] Complete the code for the check_simulation_data function
def check_simulation_data(config):
 '''
 check the simulation parameters and soil data are compatible
 - load location must be within the columns of soil defined
 - load width cannot overhang last soil column
 input: config variables for simulation parameters and soil
 output: on success, return True, otherwise return False
 '''
[ ] Complete the code for the calculate_applicable_load function
def calculate_applicable_load(config, particles2d, current_load):
 '''
 Calculate how much of the load will be applied based on whether there are bedrock columns. When t
 Formula for your idea:
 load = load * ( #non-bedrock-cols / width + #bedrock-cols / width )
 input:
 current_load, the number of kN for the given time instance (externally calculated based o
 config data with Load location and dimensions.
 particle2d - 2D grid of particles at present
 output: the kN (single float) applied to the body of water
 '''
[ ] Complete the code for the calculate_current_load function
def calculate_current_load(config, hours_passed):
 '''
 caclulate the amount of weight to be applied at hours_passed time.
 - Where the load type is constant. config.load_weight is returned.
 - Where the load type is linear, a calculation is needed based on
hours_passed and load_timing. If the hours_passed exceeds load_timing,
then the full load_weight is used
 
 - Where the load type is custom, the calculation follows the pairs
of time,load values in config.load_custom_data. config.load_custom_data
is assumed to be in time sorted order with no duplicates. The
intermediate values of custom data use the last known time's load value.
If the hours_passed is before all time/load pairs, then the load is zero.
 input:
 config information config.load_weight, config.load_type, config.load_timing, config.load_custom_d
 hours_passed - representing the current time in the simulation. must be a positive integer
 output:
 on success, the load applied (single float) is returned (without considering the soil information
 on failure, -1.0 is returned
 '''
[ ] Complete the partially completed code for the simulation_start() function. Refer to the
sca�old code provided.
Testing
Sta� will run tests on your code. The functions will be called to evalute the output to your functions.
You are to ensure the correct data is returned or set in memory as described by the function.
Test loading the con�guration �le for simulation parameters
Test loading the con�guration �le for soil data
Test for checking the simulation data is consistent
Test for summarising the simulation con�guration
Test for calculating the load for a given time
Test for calculating the load applicable
Some testing �les and output date are provided for you. Please refer to the tests directory in the
workspace on Ed.
How do I begin?
It is always good to start with the simplest possible simulation to run. Small number of particles, very 
well de�ned input and outcome. Pick a simple scenario. Here is a suggested one.
Create a simple con�guration
The con�guration �les:
basic_params.in
Load location, width
0, 1
Load weight
100
Load type
Constant
basic_soil.in
Soil width, depth
1, 4
Soil keys
C,Clay, B,Bedrock, V,Void
C
C
V
B
Expectations
Can you predict the expected outcome?
C becomes
C ---> C
V ---> C
B ---> B
Height should be 0.6 + 0.6 + 0 + 1 = 2.2
Time taken?
1 clay has 0.4 water
total water for 2 clay is thus 0.8 water
CLAY_COMPRESSIBILITY_RATE = 0.001 hence it would take 8 hours
Code for the basic simulation scenario
No need to write code for:
simulate.py
summarise_sim_data()
Expected to return this list of strings
[ 'Load location, width: 0, 1',
 'Load weight: 100',
 'Load type: constant',
 'Load timing: -1',
 'Load custom data: [0, 0]' ]
summarise_soil_data()
Expected to return this list of strings
[ "Soil width, depth: 1, 4",
 "Soil keys and description:",
 " C - Clay",
 "Soil data:",
 "['C']",
 "['C']",
 "['V']",
 "['B']" ]
Easy implementation for the basic simulation scenario
check_simulation_data() - always returns True
calculate_applicable_load() - always returns current_load
calculate_current_load() - always returns config.load_weight
sim_loader.py
parse_sim_parameters()
 config.load_location = 0
 config.load_width = 1
 config.load_weight = 100
 config.load_type = "Constant"
 return True
parse_soil_data()
 config.soil_width = 1
 config.soil_depth = 4
 config.soil_keys = [ 'C','Clay', 'B','Bedrock', , 'V','Void']
 config.soil_data = [ ['C'], ['C'], ['V'], ['B'] ]
 return True
sim_particles2d.py
get_bedrock_columns() - always returns [ False ]
calculate_heights()
 height = 0
 height += (1 - particles2d[0][0].capacity) + particles2d[0][0].water
 height += (1 - particles2d[1][0].capacity) + particles2d[1][0].water
 # for particles2d[2][0], skip adding height of void particle
 # for particles2d[3][0], always add height 1 for bedrock particle
 height += 1
 return [height]
sim_results.py init() - use suggested variables get_consolidation_time() - returns
self.consolidation_time get_total_water_removed() - returns self.total_water_removed
get_height_data() - returns self.heights_data get_load_data() - returns self.load_data
Hardest part
simulate.py
simulation_start()
Run the code:
python3 simulate.py tests/basic_params.in tests/basic_soil.in results.txt
Check your results
The results �le should look like this:
sim_param: basic_params.in
soil_data: basic_soil.in
Consolidation time: 8
What next?
Now you can pick which part to increase in complexity.
How about checking the �le format values for this basic simulation scenario are correct or
rejected? (test your code!)
How about changing the number of clay particles from 2 --> 3 ? but ideally how can you
change it from 2 --> N particles!
How about a di�erent shape of soil?
How about a di�erent load location?
How about changing from Constant to Linear Load Type?
etc.
Take small steps. Test as you go using the previous as well as new scenarios. Use scenarios where
you already know or can con�rm the outcome!
Code Submission
Your code submission must be made via Ed in this lesson.
To make a submission, you will need to press the "Mark" button.
You may submit as many times as you wish without penalty.
You are able to view previous submissions from the code submission section.
Every submission you make includes the README.md and the python .py �les
The following rules apply to your code submission:
Only the �le simulate.py will be started by the automarker
Only the last submission will be graded. 
Only the �nal README.md �le of the last submission will be graded by your tutor
Submission after the due date will incur a late penalty as described in the unit of study outline.
Your submission must be able to compile and run within the Ed environment provided.
After each submission, the marking system will automatically check your code against the public test
cases.
The Python version is that which is presently being used on Ed system:
$ python3 --version
Python 3.9.2
Please ensure you carefully follow the assignment description. Your program output must exactly
match the output shown in the examples.
Late is late!
The computer does not discriminate about what is late. There are two �les for submission
all python �les .py
README.md
They are both in your Ed workspace. Make sure these are the ones for your submission.
Changes to these �les after the deadline will incur a penalty for both (not individually).
Marking criteria
This assignment is 20% of your �nal course grade.
The grade you will receive is based on the number of test cases passed as well as manual grading by
your tutor.
We have provided you with some sample test cases but these do not test all the functionality
described in the assignment. It is important that you thoroughly test your own code.
Automatic tests 15 / 20
These are marked by a computer.
There are public test cases
There are hidden test cases
There are private test cases
Manual grading 5 / 20
The manual grading from your tutor will consider the style, layout and comments you provide in
your code. Your tutor will not be debugging or running your code against any test cases.
edit the README.md �le to describe the parts you have completed and the general structure of
your code. Maximum 1000 words. See sca�old �le directory in Ed.
Explain how each of these modules and their functions are used as part of the simulation:
sim_con�g.py
sim_loader.py
sim_particle.py
sim_particles2d.py
sim_results.py
simulate.py
Justify the choice of testing tool and type of tests that you have conducted to verify your
work. Additional Python �les and logs that were created to run these tests must be
included in your submission.
in your python code �les .py:
Please ensure your code is comprehensible for the purposes of marking. We recommend
that your code adheres to the PEP 8 style guide https://www.python.org/dev/peps/pep-
0008/
Please use comments or docstrings for sections of code to explain the section's purpose.
e.g. the following block of code will "search for", "calculate", "get input for options" etc.
Academic declaration
By submitting this assignment you declare the following:
I declare that I have read and understood the University of Sydney Academic Dishonesty and
Plagiarism in Coursework Policy, and except where speci�cally acknowledged, the work contained in
this assignment or project is my own work, and has not been copied from other sources or been
previously submitted for award or assessment.
I understand that failure to comply with the the Academic Dishonesty and Plagiarism in Coursework
Policy, can lead to severe penalties as outlined under Chapter 8 of the University of Sydney By-Law
1999 (as amended). These penalties may be imposed in cases where any signi�cant portion of my
submitted work has been copied without proper acknowledgement from other sources, including
published works, the internet, existing programs, the work of other students, or work previously
submitted for other awards or assessments.
I realise that I may be asked to identify those portions of the work contributed by me and required to
demonstrate my knowledge of the relevant material by answering oral questions or by undertaking
supplementary work, either written or in the laboratory, in order to arrive at the �nal assessment
mark.
I acknowledge that the School of Computer Science, in assessing this assignment, may reproduce it
entirely, may provide a copy to another member of faculty, and or communicate a copy of this
assignment to a plagiarism checking service or in house computer program, and that a copy of the
assignment may be maintained by the service or the School of Computer Science for the purpose of
future plagiarism checking.
Warning: Any attempts to deceive or disrupt the marking system will result in an immediate zero for
the entire assignment. Negative marks can be assigned if you do not properly follow the assignment
description, or your code is unnecessarily or deliberately obfuscated.
 
请加QQ:99515681 或邮箱:99515681@qq.com   WX:codehelp
  免责声明:珠穆朗玛网对于有关本网站的任何内容、信息或广告,不声明或保证其正确性或可靠性,用户自行承担使用网站信息发布内容的真假风险。
责任编辑:珠穆朗玛网