@@ -1986,10 +1986,10 @@ add_fault!(Phase, Temp, Grid;
1986
1986
```
1987
1987
"""
1988
1988
function add_fault! (
1989
- Phase,
1990
- Temp,
1989
+ Phase,
1990
+ Temp,
1991
1991
Grid:: AbstractGeneralGrid ;
1992
- Start= (20 ,100 ),
1992
+ Start= (20 ,100 ),
1993
1993
End= (10 ,80 ),
1994
1994
Fault_thickness= 10.0 ,
1995
1995
Depth_extent= nothing ,
@@ -2014,18 +2014,16 @@ function add_fault!(
2014
2014
fault_mask = falses (size (X))
2015
2015
2016
2016
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
2029
2027
end
2030
2028
end
2031
2029
end
0 commit comments