Optimal Simulation of Sandcastle Life in Dynamic Environment Based on Stability Principle

This paper mainly studies to explore a three-dimensional geometric model including three modules of a sandcastle foundation with optimal stability. Firstly, based on the knowledge of streamline structure, structural mechanics, and ﬂuid mechanics, the most stable sand pile foundation model under the action of tidal current and wave is established. Secondly, by limiting the degree of allowable aggregation, the discrete global optimization algorithm based on the continuous descent method is adopted to ﬁnd out the optimal water-sand ratio. Finally, we apply the above results to verify the reliability of the optimal model by comprehensively considering the inﬂuence of rainfall factors on sandcastles.


Introduction
Playing is the nature of humans, but it is not easy to come to a kind of inspiration while playing.
ere are castles of various shapes on the beach; how to make our castles more durable is a question that most people are curious about.
ere are numerous factors which influence the firmness of sandcastles [1], such as sand-to-water mixture proportion, the type of sand, weather, etc. In this paper, we attempt to explore a three-dimensional geometric model of a sandcastle foundation having the best stability.
Our model is formulated on a certain theoretical basis. After consulting a lot of literature, we carefully selected the parameters of the model. In this way, we can make our model as close to reality as possible [2]. Based on the streamlined structure and the knowledge of structural mechanics and fluid mechanics, the most stable sand pile foundation model under the action of tides and waves is established. e water-sand ratio is limited to a reasonable range by limiting the degree of allowable polymerization. e discrete global optimization algorithm based on successive descent method was used to efficiently find the optimal water-sand mix ratio [3]. Meanwhile, we divide the impact of rain on sandcastles into two parts: scour and infiltration.
rough the calculation and analysis of the model, it is found that the sandcastle with streamlined structure is still the most durable, which proves the reliability of the model.

Basic Assumptions
In order to solve the problem, we make assumptions as follows: (i) it is assumed that, in the process of natural erosion, one should ignore the situation of huge waves and winds sweeping the sandcastle far from the original location. (ii) It is assumed that there is no significant difference in the sand quality of our sandcastle foundation. (iii) It is assumed that there is negligible chemical erosion of sandcastle foundations. (iv) ere are no unexpected factors affecting our assessment during the study period.

Construction of the Best Sandcastle Shape
Model Based on Dynamics Under certain conditions such as sandcastle base volume and distance from the sea, the ratio of the horizontal impact force to the volume of sandcastle can be as small as feasible, which can reduce the loss of sand grains and ensure its stability [4].

Model Preparation.
e damage of waves and tides on the foundation of sandcastle is mainly manifested as the tangential impact force parallel to the beach and the impact force close to the horizontal direction. e smaller the projected area of wave front influence is, the smaller the impact force of the entire foundation will be. e water flowed along the side of the sandcastle foundation. e smaller the angle between the water flow and the contact surface, the smaller the local impact force. e sand base is subject to the impact force of the water flow [5]. For example, when the tangential force of the sand element is greater than the adhesion force between the sand grains, the sand grains will go with the water flow and the sandcastle will be destroyed. In order to guarantee the stability of the foundation, we change the shape of the foundation to reduce the resultant force of water flow in the tangential direction.

Model Establishing and Solving.
Sand under certain water flow under the force is divided into two kinds: the friction force and pressure difference; the friction is caused by fluid viscosity, close to flow around objects surface boundary layer, within the scope of the boundary layer thickness; flow around fluid velocity increased dramatically by objects close to the wall of a stationary speed where V 0 is outflow velocity; thus, the object surface has larger friction shear stress.
On the other hand, when there is a relative motion and fluid flow field around the quantities that causes disturbance, surface pressure distribution of symmetry is broken, the unbalanced pressure leads to flow around objects flow period, and period of pressure difference exists in the object moving direction; through the above analysis, the friction force and differential pressure can be expressed as follows. As shown in Figure 1, ds is an area of an object's surface, T is friction shear stress, and P is the compressive stress.
Friction and differential pressure force, respectively, are as follows: (1) From formula (1), we get the total force: It is assumed that the water flowing towards each part of the sand base at high tide is the same in nature, and the smaller the ratio between the resistance of the part in contact with the sea water and the base volume is, the smaller the amount of sand taken away by the sea water after the impact can be regarded as the smallest damage caused by the sea water impact on the sand base and the most stable in nature [6]. Since the streamlined structure is subject to less resistance in the water, the streamlined structure of sand infrastructure can mitigate the impact of waves and tides on the sandcastle. From the kinetic energy loss of water flow in the process of high tide to low tide, we preliminarily designed the structure of sandcastle as a semi-elliptic and parabolic streamlined semi-rotating body. e top view is shown in Figure 2.
e streamline inlet section of the sand pile foundation close to the sea water is a semi-ellipse, which can be expressed as follows: In formula (3), the variable K 0 represents the maximum cross section diameter of the rotary body, and the variable L z represents the length of incoming flow segment; the units are mm. e seawater first passes through the incoming flow section and then through the outgoing flow section. e outgoing flow section is a parabola, which can be expressed as follows: In formula (4), L Y represents the length of the outlet section; the units are mm. Since only the influence of the basic shape on its stability is considered, we assume that the water flow is laminar for the convenience of calculation. For a semi-rotary body, it is necessary to integrate the march surface in the direction of its length when calculating its frictional resistance; since the cross section of a rotary body is a semicircle, it is only necessary to integrate the function of the length in the y direction [7][8][9]: For incoming flow segments, e friction shear force of the laminar flow on the plate is expressed as follows: In the formula, the variable V 0 represents the coming flow speed, the units are m/s, and Re represents Reynolds number; it is a dimensionless quantity; then, the laminar frictional resistance in the incoming flow section is 2 Discrete Dynamics in Nature and Society In the formula, the Gauss three-point interpolation formula with fifth-degree algebraic precision was used for an approximate calculation, and the laminar frictional resistance in the incoming flow segment was obtained as follows: erefore, the frictional resistance in the reaching flow section is Finally, from formula (5) to formula (10), the total frictional resistance of semi-elliptic and parabolic streamlined rotating bodies under laminar flow is obtained as follows: As the flow velocity, Reynolds number, and other parameters are all certain, and only the influence of the foundation shape on stability is considered, ρ, μ, V 0 values are set to 1, and the total frictional resistance of the rotary body is as follows: From formula (11) to formula (12), the optimal solution is obtained by calculation: X � 0.63, Y � 0.22. erefore, the function expression of the basic model is as follows:

Result
Analysis. e effect of waves and tides on the stability of a sandcastle foundation is converted into a functional relationship between the impact force and volume ratio of sandcastle foundation and the threedimensional shape parameters of sandcastle foundation, and the minimum ratio of impact force and volume is obtained [10]. ree-dimensional shape parameters of sand fort foundation: in order to mitigate the effects of water flow on the sand, as best as possible to reduce the loss of sand, on the basis of sandcastle simple structural mechanics and fluid mechanics analysis, the optimal model determines the best 3D sand foundation model.

Optimal Water-to-Sand Mixture Proportion.
e ratio of water to sand will directly affect the antierosion ability of sandcastle foundation. By introducing the relation equation between water-sand polymerization degree and water-sand ratio, we limited the allowable range of polymerization degree to obtain a reasonable range of water-sand ratio and then solved the optimal water-sand ratio through models [11,12].

Model Preparation.
We considered the aggregation of water and sand, leading to the concept of the degree of aggregation of water and sand [13]. We defined the degree of water and sand polymerization according to the volume change of water and sand specific gravity before and after polymerization: where M 1 and M 2 represent the volume of sand and water before mixing and C 1 and C 2 represent water absorption coefficient and water solubility coefficient, respectively. Let us use these two coefficients to express the polymerization capacity of water and sand.

Model Establishing and Solving.
Let us use water-sand ratio NR to simplify this equation: From formula (13) to formula (15), MATLAB was used to solve the equation, and the relation curve between water-  Discrete Dynamics in Nature and Society 3 sand polymerization degree and water-sand ratio was obtained, as shown in Figure 3.
With the increase of water-sand ratio, the polymerization degree of water-sand increases. In order to ensure the longest erosion resistance time of sandcastles, not only the relatively larger adhesion but also the optimization of erosion resistance performance should be considered. In combination with the actual situation, the two-point interval with a wide viscosity range as shown in the figure was selected as the optimization parameter [14,15].
Based on the optimal proportion of the best shape selected above and the initial value of water-sand ratio N R as a variable, the target T was discretized in the same way. According to the variation of foundation ΔS and Δh, the relationship between the damage index and time, the constraint is added: 0.7 < N R < 0.85. Obtain the continuous schedule record of N R equidistant points, as shown in Table 1.
Using the above model, we can get that when the watersand ratio is N R � 0.74, under the condition of good shape adhesion, the maximum service life of sandcastle foundation can be achieved.

Sandcastle-Rain-Erosion Model.
When considering rainfall, a sandcastle-rain-erosion model is established, and the influence of rainfall is directly superimposed with that of seawater; that is, the rainfall directly affects the sandcastles eroded by seawater. Suppose the raindrops were particles of mass, hitting the sandcastle vertically, with the same force as the waves [16][17][18].

Model Preparation.
To study the effect of rain on sandcastles, we first need to understand some of the motion characteristics of rain. Let us say the rain falls straight down. Raindrops have a lot of kinetic energy [19]. When they hit a sandcastle, they destroy the structure of the sandcastle and change the water content of the sandcastle. erefore, we divide the impact of rain on sandcastles into two parts: scour and infiltration [20,21].
Formula for calculating the final velocity of raindrop is as follows.
If d ≤ 3 mm, we have If 3 mm < d ≤ 6 mm, we have . (17) In the formula, v is the viscosity coefficient of air motion. When T � 293 K, v � 1.810741555 × 10 −5 Pa·S.
ink of raindrops as spheres. According to the momentum formula q � mV max and energy formula E � (mV 2 max )/2, the momentum and energy contained in each raindrop can be obtained, and then the relationship between raindrop diameter and momentum and energy can be obtained [22][23][24].

Model Establishing and Solving.
However, in the actual calculation of rainfall characteristics such as rainfall kinetic energy, only the data of rainfall or rainfall intensity are usually available, and the observed data of raindrop diameter are not available. In order to facilitate production and application, the final raindrop velocity can be expressed as a function of rain intensity [25]. According to the analysis of the measured data, there is a power function relationship between the median raindrop diameter and rainfall intensity: In the formula, d m represents median diameter of raindrops; the units are mm. i represents rain intensity; the units are mm/min. e final velocity of raindrop is determined by rainfall intensity through substitution and calculation. If From formula (16) to formula (20), the relationship between precipitation and raindrop velocity, energy, and momentum is calculated, as shown in Figures 4-6.
After understanding the motion parameters of raindrops, we also need to analyze the influence of raindrops on sandcastles [26].
e Sartor-Boyd scour model is mainly  applicable to the rainfall process with initial scour effect, as shown in the following equation: In formula (21), K e represents the erosion coefficient, the units are mm −1 ; V p represents the volume of sandcastle at the beginning, the units are m 3 ; R p represents rainwater runoff per unit time per unit area, the units are mm/min; t represents time, the unit is min. In our model, take K e as 0.2 to get the change of sand grain quantity washed away by precipitation, as shown in Figure 7.

Result Analysis.
When the sandcastle is affected by rainfall, MATLAB is used to fit the relationship between the internal friction angle and water content of the sandcastle, as shown in Figure 8.    In the precipitation model, we get the formula for calculating the final velocity of raindrop. en, the water content of sandcastle and the angle of internal friction during rainfall are calculated. Finally, compare the relationship between the two and draw a conclusion. e results show that the rain has a certain effect on the structural stability of the sandcastle. rough the establishment and solution of the above model, we find that streamline is still the optimal geometric shape, which verifies the reliability of the model.

Conclusions
On the basis of the simulation results, the destructive power of seawater, rainy days, and other environments is summarized, which is an important threat to the sandcastle foundation [27][28][29][30][31]. Several models established in the detailed mathematical analysis provided answers to the required questions, including a view of the exterior of the sandcastle with the longest period of stability in the natural state.
In general, a sandcastle foundation with a gentle slope is good at resisting seawater erosion, while a foundation with a large top is good at resisting rain. After many iterations, all initial sandcastle foundation transfers have similar structures. As mentioned earlier, the optimal sand-water mixture ratio is about 0.74. Due to the trade-off between friction and fluidity, three measures can be taken to strengthen the sandcastle foundation, such as adjusting construction time, adding support structure, and improving the building. ose are all practical measures one can take in order to obtain a better sandcastle foundation.
Data Availability e data in this paper come from Question B of the 2020 American College Students Mathematical Modeling Competition.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.