首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
Python编程辅导、讲解Python程序、辅导data编程 讲解Python程序|调试Matlab程序
项目预算:
开发周期:
发布时间:
要求地区:
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
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
,
Load weight
Load type
Load timing
Load custom data
,
,
, ...
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
,
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
,
Soil keys
,
,
,
, ...
Soil data
...
...
... ...
...
...
... ...
...
...
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_particle
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!