@@ -1986,10 +1986,10 @@ add_fault!(Phase, Temp, Grid;
19861986```
19871987"""
19881988function add_fault! (
1989- Phase,
1990- Temp,
1989+ Phase,
1990+ Temp,
19911991 Grid:: AbstractGeneralGrid ;
1992- Start= (20 ,100 ),
1992+ Start= (20 ,100 ),
19931993 End= (10 ,80 ),
19941994 Fault_thickness= 10.0 ,
19951995 Depth_extent= nothing ,
@@ -2014,18 +2014,16 @@ function add_fault!(
20142014 fault_mask = falses (size (X))
20152015
20162016 for k in 1 : size (Z, 3 ), j in 1 : size (Y, 2 ), i in 1 : size (X, 1 )
2017- # Rotate the point using the dip angle
2018- x_rot, y_rot, z_rot = Rot3D (X[i, j, k], Y[i, j, k], Z[i, j, k], 1.0 , 0.0 , cosd (DipAngle), sind (DipAngle))
2019-
2020- # Calculate the projection of the rotated point onto the fault line
2021- projection_length = (x_rot - Start[1 ]) * unit_direction[1 ] + (y_rot - Start[2 ]) * unit_direction[2 ]
2022- if 0 ≤ projection_length ≤ length
2023- # Calculate the perpendicular distance to the fault line
2024- perpendicular_distance = abs ((x_rot - Start[1 ]) * unit_direction[2 ] - (y_rot - Start[2 ]) * unit_direction[1 ])
2025- if perpendicular_distance ≤ fault_half_thickness
2026- fault_mask[i, j, k] = true
2027- end
2028- end
2017+ # Rotate the point using the dip angle
2018+ x_rot, y_rot, z_rot = Rot3D (X[i, j, k], Y[i, j, k], Z[i, j, k], 1.0 , 0.0 , cosd (DipAngle), sind (DipAngle))
2019+
2020+ # Calculate the projection of the rotated point onto the fault line
2021+ projection_length = (x_rot - Start[1 ]) * unit_direction[1 ] + (y_rot - Start[2 ]) * unit_direction[2 ]
2022+ if 0 ≤ projection_length ≤ length
2023+ # Calculate the perpendicular distance to the fault line
2024+ perpendicular_distance = abs ((x_rot - Start[1 ]) * unit_direction[2 ] - (y_rot - Start[2 ]) * unit_direction[1 ])
2025+ if perpendicular_distance ≤ fault_half_thickness
2026+ fault_mask[i, j, k] = true
20292027 end
20302028 end
20312029 end
0 commit comments