Need help on python assignment 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 clarications, or changes to being made to the assignment description. https://edstem.org/courses/5268/lessons/11409/edit/slides/82475 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: 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 Comments Comments can appear after or before a label/value(s) pair. Labels and Values A label is the text used to identify the parameter. e.g. Load weight . A value is information for that 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 specic 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: 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 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) denes zero and positive integers time values dened incrementally no duplicate time values Example le Soil data le format 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 HHCCCCCCHHHHHHHHHHHHHCCCCHHHHH HHHHHHHHHHHHHHCCCCHHHHHHHHHHHH HHCCCCCCCCCCCCCCCCCCCHHHHHHHHH HHHHHHVVHHHCCCCCCCCCCCCCCCCHHH HHHHHHHHHHHHHHHVVVHHHHHHHHVHHH HHCCCCCCCCCCCCCCCCCCCHHHHHVHHH HHHHHHHHHHHCCCCCCCCCCCCCCCCHHH HHHHHCCCCCCCHHHHHHHCCCCCCCCHHH CCCCCCCCCHHHHHCCCCHHHHHCCCCCCH HHHHHCCCCCCCHHHHHHHCCCCCCCCHHH CCCCCCCCCHHHHHCCCCHHHHHCCCCCCC HHCCCVVVCCCCCCCCCCCCCHHHHHHHHH CCCCCCCCCHHHHHCCCCHHHHHCCCCCCC BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 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 dene 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 dened must be characters dened 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, Distributed load The weight of the load implies a force. The width of the load implies a distribution of force over area, pressure. When simulating, the load will only aect the body of water which are under load Load on Column 0 has no eect in this model Load on Column 1 has eect in this model Load on Column 2 has eect in this model For simplication, you may assume that where a column is not all bedrock, the load will aect it. All columns aected 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. This aects the rate of consolidation. Custom load are user specied times and load weights to be used in the simulation. For example, the user may specify: The user may alternatively specify sparse time sequences: For the simulation, you may assume that the times not specied will use the same value as the previous time. 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. Example: 3 bodies of water. There are bedrock particles creating a barrier between the clay particles. 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 satised before proceeding. Load over soil Load geometry must be positioned entirely over soil (Load geometry cannot be overhanging the edge) Example of not permitted: Load not overhanging Load must be placed over compressible soil particles (e.g. Clay) Example of not permitted: 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 innitely There are 4 leak points in this example Void (V) particles Initial conditions can be represented as so: Initial conditions, height of middle column = 3 Initial conditions, as numeric values of water capacity: where i is innite Initial conditions, as numeric values of water volume: 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) water volume 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.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.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.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.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.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.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.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.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: Initial conditions 5 columns: height of column 1 = 4 height of column 2 = 4 height of column 3 = 4 height of column 4 = 4 Initial conditions, as numeric values of water capacity: Initial conditions, as numeric values of water volume: After 1 hour capacity (always the same) Water volume decreases by 0.1 from all particles sharing this force. 7 particles: 0.1 / 7 = 0.014 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.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.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.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 height of column 3 = 3.6 (cavity collapses) height of column 4 = 2.8 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: 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 Initial conditions, as numeric values of water capacity: Initial conditions, as numeric values of water volume: After 1 hour t=1 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.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.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: 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: Initial conditions t=0 heights: Column 1 2 3 4 5 6 7 8 9 10 11 12 13 ——————————————– 6, 6, 2, 6, 6, 2, 6, 6, 2, 6, 2, 6, 6 Hours 1-14 Load is 200 for all these hours based on the custom data t=0, L=100 t=1. heights: [6, 5.974, 1.995, 5.974, 5.974, 1.995, 5.974, 5.974, 1.995, 5.974, 1.995 , 5.974, 6] t=2. heights: [6, 5.949, 1.99, 5.949, 5.949, 1.99, 5.949, 5.949, 1.99, 5.949, 1.99, 5. 949, 6] t=3. heights: [6, 5.923, 1.985, 5.923, 5.923, 1.985, 5.923, 5.923, 1.985, 5.923, 1.985 , 5.923, 6] t=4. heights: [6, 5.897, 1.979, 5.897, 5.897, 1.979, 5.897, 5.897, 1.979, 5.897, 1.979 , 5.897, 6] t=5. heights: [6, 5.872, 1.974, 5.872, 5.872, 1.974, 5.872, 5.872, 1.974, 5.872, 1.974 , 5.872, 6] t=6. heights: [6, 5.846, 1.969, 5.846, 5.846, 1.969, 5.846, 5.846, 1.969, 5.846, 1.969 , 5.846, 6] t=7. heights: [6, 5.821, 1.964, 5.821, 5.821, 1.964, 5.821, 5.821, 1.964, 5.821, 1.964 , 5.821, 6] t=8. heights: [6, 5.795, 1.959, 5.795, 5.795, 1.959, 5.795, 5.795, 1.959, 5.795, 1.959 , 5.795, 6] t=9. heights: [6, 5.769, 1.954, 5.769, 5.769, 1.954, 5.769, 5.769, 1.954, 5.769, 1.954 , 5.769, 6] t=10. heights: [6, 5.744, 1.949, 5.744, 5.744, 1.949, 5.744, 5.744, 1.949, 5.744, 1.94 9, 5.744, 6] t=11. heights: [6, 5.718, 1.944, 5.718, 5.718, 1.944, 5.718, 5.718, 1.944, 5.718, 1.94 4, 5.718, 6] t=12. heights: [6, 5.692, 1.938, 5.692, 5.692, 1.938, 5.692, 5.692, 1.938, 5.692, 1.93 8, 5.692, 6] t=13. heights: [6, 5.667, 1.933, 5.667, 5.667, 1.933, 5.667, 5.667, 1.933, 5.667, 1.93 3, 5.667, 6] t=14. heights: [6, 5.641, 1.928, 5.641, 5.641, 1.928, 5.641, 5.641, 1.928, 5.641, 1.92 8, 5.641, 6] Hours 15-24 Load is 550 for all these hours based on custom data t=15, L=550 t=15. heights: [6, 5.615, 1.923, 5.615, 5.615, 1.923, 5.615, 5.615, 1.923, 5.615, 1.92 3, 5.615, 6] t=16. heights: [6, 5.545, 1.909, 5.545, 5.545, 1.909, 5.545, 5.545, 1.909, 5.545, 1.90 9, 5.545, 6] t=17. heights: [6, 5.474, 1.895, 5.474, 5.474, 1.895, 5.474, 5.474, 1.895, 5.474, 1.89 5, 5.474, 6] t=18. heights: [6, 5.404, 1.881, 5.404, 5.404, 1.881, 5.404, 5.404, 1.881, 5.404, 1.88 1, 5.404, 6] t=19. heights: [6, 5.333, 1.867, 5.333, 5.333, 1.867, 5.333, 5.333, 1.867, 5.333, 1.86 7, 5.333, 6] t=20. heights: [6, 5.263, 1.853, 5.263, 5.263, 1.853, 5.263, 5.263, 1.853, 5.263, 1.85 3, 5.263, 6] t=21. heights: [6, 5.192, 1.838, 5.192, 5.192, 1.838, 5.192, 5.192, 1.838, 5.192, 1.83 8, 5.192, 6] t=22. heights: [6, 5.122, 1.824, 5.122, 5.122, 1.824, 5.122, 5.122, 1.824, 5.122, 1.82 4, 5.122, 6] t=23. heights: [6, 5.051, 1.81, 5.051, 5.051, 1.81, 5.051, 5.051, 1.81, 5.051, 1.81, 5 .051, 6] t=24. heights: [6, 4.981, 1.796, 4.981, 4.981, 1.796, 4.981, 4.981, 1.796, 4.981, 1.79 6, 4.981, 6] Hours 25-37 Load is 977 for all these hours based on custom data t=25, L=977 t=25. heights: [6, 4.91, 1.782, 4.91, 4.91, 1.782, 4.91, 4.91, 1.782, 4.91, 1.782, 4.9 1, 6] t=26. heights: [6, 4.785, 1.757, 4.785, 4.785, 1.757, 4.785, 4.785, 1.757, 4.785, 1.75 7, 4.785, 6] t=27. heights: [6, 4.66, 1.732, 4.66, 4.66, 1.732, 4.66, 4.66, 1.732, 4.66, 1.732, 4.6 6, 6] t=28. heights: [6, 4.534, 1.707, 4.534, 4.534, 1.707, 4.534, 4.534, 1.707, 4.534, 1.70 7, 4.534, 6] t=29. heights: [6, 4.409, 1.682, 4.409, 4.409, 1.682, 4.409, 4.409, 1.682, 4.409, 1.68 2, 4.409, 6] t=30. heights: [6, 4.284, 1.657, 4.284, 4.284, 1.657, 4.284, 4.284, 1.657, 4.284, 1.65 7, 4.284, 6] t=31. heights: [6, 4.159, 1.632, 4.159, 4.159, 1.632, 4.159, 4.159, 1.632, 4.159, 1.63 2, 4.159, 6] t=32. heights: [6, 4.033, 1.607, 4.033, 4.033, 1.607, 4.033, 4.033, 1.607, 4.033, 1.60 7, 4.033, 6] t=33. heights: [6, 4.0, 1.6, 4.0, 4.0, 1.6, 4.0, 4.0, 1.6, 4.0, 1.6, 4.0, 6] 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. 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 bedro 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 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 onhours_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 pairsof 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 times 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, co hours_passed – representing the current time in the simulation. must be a posit output: on success, the load applied (single float) is returned (without considering th on failure, -1.0 is returned [ ] Complete the partially completed code for the simulation_start() function. Refer to the scaold code provided. 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 conguration le for simulation parameters How do I begin? It is always good to start with the simplest possible simulation to run. Small number of particles, very well dened input and outcome. Pick a simple scenario. Here is a suggested one. Create a simple conguration The conguration les: basic_params.in basic_soil.in Expectations Can you predict the expected outcome? 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 summarise_soil_data() Expected to return this list of strings 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 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 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 Total water removed: 0.7999999999999999 t=0. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]] t=1. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]] t=2. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]] t=3. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]] t=4. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]] t=5. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]] t=6. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]] t=7. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]] 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 dierent shape of soil? How about a dierent 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 conrm 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: 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 scaold le directory in Ed. Explain how each of these modules and their functions are used as part of the simulation: sim_cong.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/pep0008/ Please use comments or docstrings for sections of code to explain the sections 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 specically 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- 1999 (as amended). These penalties may be imposed in cases where any signicant 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.

Need help on python assignment

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 clarications, or changes to being made to the assignment description. https://edstem.org/courses/5268/lessons/11409/edit/slides/82475 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:

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

Comments

Comments can appear after or before a label/value(s) pair.

Labels and Values

A label is the text used to identify the parameter. e.g. Load weight . A value is information for that

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 specic 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:

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

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) denes zero and positive integers time values dened incrementally no duplicate time values

Example le

Soil data le format

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

HHCCCCCCHHHHHHHHHHHHHCCCCHHHHH

HHHHHHHHHHHHHHCCCCHHHHHHHHHHHH

HHCCCCCCCCCCCCCCCCCCCHHHHHHHHH

HHHHHHVVHHHCCCCCCCCCCCCCCCCHHH

HHHHHHHHHHHHHHHVVVHHHHHHHHVHHH

HHCCCCCCCCCCCCCCCCCCCHHHHHVHHH

HHHHHHHHHHHCCCCCCCCCCCCCCCCHHH

HHHHHCCCCCCCHHHHHHHCCCCCCCCHHH

CCCCCCCCCHHHHHCCCCHHHHHCCCCCCH

HHHHHCCCCCCCHHHHHHHCCCCCCCCHHH

CCCCCCCCCHHHHHCCCCHHHHHCCCCCCC

HHCCCVVVCCCCCCCCCCCCCHHHHHHHHH

CCCCCCCCCHHHHHCCCCHHHHHCCCCCCC

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB

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 dene 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 dened must be characters dened 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,

Distributed load

The weight of the load implies a force. The width of the load implies a distribution of force over area, pressure.

When simulating, the load will only aect the body of water which are under load

Load on Column 0 has no eect in this model Load on Column 1 has eect in this model Load on Column 2 has eect in this model

For simplication, you may assume that where a column is not all bedrock, the load will aect it.

All columns aected

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.

This aects the rate of consolidation.

Custom load are user specied times and load weights to be used in the simulation. For example, the user may specify:

The user may alternatively specify sparse time sequences:

For the simulation, you may assume that the times not specied will use the same value as the previous time.

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.

Example: 3 bodies of water. There are bedrock particles creating a barrier between the clay particles.

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 satised before proceeding.

Load over soil

Load geometry must be positioned entirely over soil (Load geometry cannot be overhanging the edge)

Example of not permitted:

Load not overhanging

Load must be placed over compressible soil particles (e.g. Clay) Example of not permitted:

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 innitely

There are 4 leak points in this example Void (V) particles Initial conditions can be represented as so:

Initial conditions, height of middle column = 3

Initial conditions, as numeric values of water capacity:

where i is innite

Initial conditions, as numeric values of water volume:

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)

water volume

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.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.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.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.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.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.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.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.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:

Initial conditions

5 columns:

height of column 1 = 4

height of column 2 = 4

height of column 3 = 4

height of column 4 = 4

Initial conditions, as numeric values of water capacity:

Initial conditions, as numeric values of water volume:

After 1 hour capacity (always the same)

Water volume decreases by 0.1 from all particles sharing this force. 7 particles: 0.1 / 7 = 0.014

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.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.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.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

height of column 3 = 3.6 (cavity collapses)

height of column 4 = 2.8

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:

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

Initial conditions, as numeric values of water capacity:

Initial conditions, as numeric values of water volume:

After 1 hour t=1

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.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.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:

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:

Initial conditions t=0 heights:

Column 1 2 3 4 5 6 7 8 9 10 11 12 13

——————————————–

6, 6, 2, 6, 6, 2, 6, 6, 2, 6, 2, 6, 6

Hours 1-14

Load is 200 for all these hours based on the custom data t=0, L=100

t=1. heights: [6, 5.974, 1.995, 5.974, 5.974, 1.995, 5.974, 5.974, 1.995, 5.974, 1.995

, 5.974, 6] t=2. heights: [6, 5.949, 1.99, 5.949, 5.949, 1.99, 5.949, 5.949, 1.99, 5.949, 1.99, 5.

949, 6]

t=3. heights: [6, 5.923, 1.985, 5.923, 5.923, 1.985, 5.923, 5.923, 1.985, 5.923, 1.985

, 5.923, 6]

t=4. heights: [6, 5.897, 1.979, 5.897, 5.897, 1.979, 5.897, 5.897, 1.979, 5.897, 1.979 , 5.897, 6]

t=5. heights: [6, 5.872, 1.974, 5.872, 5.872, 1.974, 5.872, 5.872, 1.974, 5.872, 1.974

, 5.872, 6]

t=6. heights: [6, 5.846, 1.969, 5.846, 5.846, 1.969, 5.846, 5.846, 1.969, 5.846, 1.969

, 5.846, 6]

t=7. heights: [6, 5.821, 1.964, 5.821, 5.821, 1.964, 5.821, 5.821, 1.964, 5.821, 1.964

, 5.821, 6]

t=8. heights: [6, 5.795, 1.959, 5.795, 5.795, 1.959, 5.795, 5.795, 1.959, 5.795, 1.959

, 5.795, 6]

t=9. heights: [6, 5.769, 1.954, 5.769, 5.769, 1.954, 5.769, 5.769, 1.954, 5.769, 1.954

, 5.769, 6]

t=10. heights: [6, 5.744, 1.949, 5.744, 5.744, 1.949, 5.744, 5.744, 1.949, 5.744, 1.94

9, 5.744, 6]

t=11. heights: [6, 5.718, 1.944, 5.718, 5.718, 1.944, 5.718, 5.718, 1.944, 5.718, 1.94

4, 5.718, 6]

t=12. heights: [6, 5.692, 1.938, 5.692, 5.692, 1.938, 5.692, 5.692, 1.938, 5.692, 1.93

8, 5.692, 6]

t=13. heights: [6, 5.667, 1.933, 5.667, 5.667, 1.933, 5.667, 5.667, 1.933, 5.667, 1.93

3, 5.667, 6]

t=14. heights: [6, 5.641, 1.928, 5.641, 5.641, 1.928, 5.641, 5.641, 1.928, 5.641, 1.92 8, 5.641, 6]

Hours 15-24

Load is 550 for all these hours based on custom data t=15, L=550

t=15. heights: [6, 5.615, 1.923, 5.615, 5.615, 1.923, 5.615, 5.615, 1.923, 5.615, 1.92

3, 5.615, 6]

t=16. heights: [6, 5.545, 1.909, 5.545, 5.545, 1.909, 5.545, 5.545, 1.909, 5.545, 1.90

9, 5.545, 6]

t=17. heights: [6, 5.474, 1.895, 5.474, 5.474, 1.895, 5.474, 5.474, 1.895, 5.474, 1.89

5, 5.474, 6]

t=18. heights: [6, 5.404, 1.881, 5.404, 5.404, 1.881, 5.404, 5.404, 1.881, 5.404, 1.88

1, 5.404, 6]

t=19. heights: [6, 5.333, 1.867, 5.333, 5.333, 1.867, 5.333, 5.333, 1.867, 5.333, 1.86

7, 5.333, 6]

t=20. heights: [6, 5.263, 1.853, 5.263, 5.263, 1.853, 5.263, 5.263, 1.853, 5.263, 1.85

3, 5.263, 6]

t=21. heights: [6, 5.192, 1.838, 5.192, 5.192, 1.838, 5.192, 5.192, 1.838, 5.192, 1.83

8, 5.192, 6]

t=22. heights: [6, 5.122, 1.824, 5.122, 5.122, 1.824, 5.122, 5.122, 1.824, 5.122, 1.82

4, 5.122, 6]

t=23. heights: [6, 5.051, 1.81, 5.051, 5.051, 1.81, 5.051, 5.051, 1.81, 5.051, 1.81, 5

.051, 6]

t=24. heights: [6, 4.981, 1.796, 4.981, 4.981, 1.796, 4.981, 4.981, 1.796, 4.981, 1.79 6, 4.981, 6]

Hours 25-37

Load is 977 for all these hours based on custom data t=25, L=977

t=25. heights: [6, 4.91, 1.782, 4.91, 4.91, 1.782, 4.91, 4.91, 1.782, 4.91, 1.782, 4.9

1, 6]

t=26. heights: [6, 4.785, 1.757, 4.785, 4.785, 1.757, 4.785, 4.785, 1.757, 4.785, 1.75

7, 4.785, 6]

t=27. heights: [6, 4.66, 1.732, 4.66, 4.66, 1.732, 4.66, 4.66, 1.732, 4.66, 1.732, 4.6

6, 6]

t=28. heights: [6, 4.534, 1.707, 4.534, 4.534, 1.707, 4.534, 4.534, 1.707, 4.534, 1.70

7, 4.534, 6]

t=29. heights: [6, 4.409, 1.682, 4.409, 4.409, 1.682, 4.409, 4.409, 1.682, 4.409, 1.68

2, 4.409, 6]

t=30. heights: [6, 4.284, 1.657, 4.284, 4.284, 1.657, 4.284, 4.284, 1.657, 4.284, 1.65

7, 4.284, 6]

t=31. heights: [6, 4.159, 1.632, 4.159, 4.159, 1.632, 4.159, 4.159, 1.632, 4.159, 1.63

2, 4.159, 6]

t=32. heights: [6, 4.033, 1.607, 4.033, 4.033, 1.607, 4.033, 4.033, 1.607, 4.033, 1.60

7, 4.033, 6] t=33. heights: [6, 4.0, 1.6, 4.0, 4.0, 1.6, 4.0, 4.0, 1.6, 4.0, 1.6, 4.0, 6]

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.

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 bedro

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 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 onhours_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 pairsof 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 times 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, co hours_passed – representing the current time in the simulation. must be a posit output: on success, the load applied (single float) is returned (without considering th on failure, -1.0 is returned

[ ] Complete the partially completed code for the simulation_start() function. Refer to the scaold code provided.

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 conguration le for simulation parameters

How do I begin?

It is always good to start with the simplest possible simulation to run. Small number of particles, very well dened input and outcome. Pick a simple scenario. Here is a suggested one.

Create a simple conguration

The conguration les: basic_params.in

basic_soil.in

Expectations

Can you predict the expected outcome?

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

summarise_soil_data()

Expected to return this list of strings

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

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

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

Total water removed: 0.7999999999999999

t=0. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]]

t=1. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2

.7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]]

t=2. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2

.7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]]

t=3. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2

.7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]]

t=4. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2

.7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]]

t=5. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2

.7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]]

t=6. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2

.7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]]

t=7. load: [0, 100, 100, 100, 100, 100, 100, 100, 100] heights: [[0], [2.9], [2.8], [2 .7], [2.6], [2.5], [2.4000000000000004], [2.3], [2.2]]

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 dierent shape of soil?

How about a dierent 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 conrm 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:

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 scaold le directory in Ed.

Explain how each of these modules and their functions are used as part of the simulation:

sim_cong.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/pep0008/

Please use comments or docstrings for sections of code to explain the sections 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 specically 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- 1999 (as amended). These penalties may be imposed in cases where any signicant 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.

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
Open chat
1
You can contact our live agent via WhatsApp! Via + 1 929 473-0077

Feel free to ask questions, clarifications, or discounts available when placing an order.

Order your essay today and save 20% with the discount code GURUH