@@ -231,7 +231,8 @@ def from_map2loop_directory(
231231 the created geological model and a dictionary of the map2loop data
232232 """
233233 from LoopStructural .modelling .input .map2loop_processor import Map2LoopProcessor
234-
234+ log_to_file (f"{ m2l_directory } /loopstructural_log.txt" )
235+ logger .info ('Creating model from m2l directory' )
235236 processor = Map2LoopProcessor (m2l_directory , use_thickness )
236237 processor ._gradient = gradient
237238 processor .vector_scale = vector_scale
@@ -263,9 +264,11 @@ def from_map2loop_directory(
263264
264265 @classmethod
265266 def from_processor (cls , processor ):
267+ logger .info ('Creating model from processor' )
266268 model = GeologicalModel (processor .origin , processor .maximum )
267269 model .data = processor .data
268270 for i in processor .fault_network .faults :
271+ logger .info (f"Adding fault { i } " )
269272 model .create_and_add_fault (
270273 i ,
271274 ** processor .fault_properties .to_dict ("index" )[i ],
@@ -311,6 +314,7 @@ def from_processor(cls, processor):
311314 faults = None
312315 if processor .fault_stratigraphy is not None :
313316 faults = processor .fault_stratigraphy [s ]
317+ logger .info (f'Adding foliation { s } ' )
314318 f = model .create_and_add_foliation (
315319 s , ** processor .foliation_properties [s ], faults = faults
316320 )
@@ -1073,6 +1077,11 @@ def create_and_add_intrusion(
10731077 ** kwargs ,
10741078 ):
10751079 """
1080+ An intrusion in built in two main steps:
1081+ (1) Intrusion network and intrusion frame: the algorithm first identify the intrusion network, which is a set of points
1082+ representing the roof or floor contact of the intrusion. Then this set of points is used to contraint the main structural
1083+ direction of the structural frame.
1084+ (2) Intrusion body: simulation of lateral and vertical extent of intrusion, using parameterization provided by the structural frame
10761085
10771086 Parameters
10781087 ----------
@@ -1130,28 +1139,50 @@ def create_and_add_intrusion(
11301139 INet .build (** kwargs )
11311140
11321141 # Create intrusion frame, using intrusion network points, propagation and inflation direction
1142+ if "gxxgz" in kwargs : # weight for orthogonality constraint between coord 0 and coord 2
1143+ gxxgz = kwargs ["gxxgz" ]
1144+ else :
1145+ gxxgz = 0
11331146
1134- gxxgz = 0 # weight for orthogonality constraint between coord 0 and coord 2
1135- gxxgy = 0 # weight for orthogonality constraint between coord 0 and coord 1
1136- gyxgz = 0 # weight for orthogonality constraint between coord 1 and coord 2
1147+ if "gxxgy" in kwargs : # weight for orthogonality constraint between coord 0 and coord 1
1148+ gxxgy = kwargs ["gxxgy" ]
1149+ else :
1150+ gxxgy = 0
1151+
1152+ if "gyxgz" in kwargs : # weight for orthogonality constraint between coord 1 and coord 2
1153+ gyxgz = kwargs ["gyxgz" ]
1154+ else :
1155+ gyxgz = 0
1156+
1157+ if "interpolatortype" in kwargs : # number of elements for interpolation
1158+ interpolatortype = kwargs ["interpolatortype" ]
1159+ else :
1160+ interpolatortype = 'FDI'
1161+
1162+ if "nelements" in kwargs : # number of elements for interpolation
1163+ nelements = kwargs ["nelements" ]
1164+ else :
1165+ nelements = 1e2
11371166
11381167 weights = [gxxgz , gxxgy , gyxgz ]
1139- # reg=np.array([1,0.5,1])
11401168 logger .info ("building intrusion frame" )
1141- interpolator = self .get_interpolator (interpolatortype = "FDI" )
1169+ interpolator = self .get_interpolator (interpolatortype = interpolatortype )
11421170 frame_data = self .data [self .data ["feature_name" ] == intrusion_frame_name ].copy ()
11431171 IFrame_builder = IntrusionBuilder (
1144- interpolator , model = self , feature_name = intrusion_frame_name
1172+ interpolator ,
1173+ model = self ,
1174+ name = intrusion_frame_name
11451175 )
11461176 IFrame_builder .set_data (frame_data , INet .intrusion_network_outcome )
1147- IFrame = IFrame_builder .setup (
1148- nelements = 1e2 ,
1149- solver = "lu" ,
1150- gxxgz = weights [0 ],
1151- gxxgy = weights [1 ],
1177+ IFrame_builder .setup (
1178+ nelements = nelements ,
1179+ # solver = solver ,
1180+ w2 = weights [0 ],
1181+ w1 = weights [1 ],
11521182 gxygz = weights [2 ],
11531183 )
11541184
1185+ IFrame = IFrame_builder .frame
11551186 # Create intrusion feature
11561187 intrusion_feature = IntrusionFeature (
11571188 intrusion_name , structural_frame = IFrame , model = self
@@ -1171,14 +1202,17 @@ def create_and_add_intrusion(
11711202 intrusion_feature .set_intrusion_frame (IFrame )
11721203 intrusion_feature .set_intrusion_body (IBody )
11731204
1205+ #set data for simulations
1206+ logger .info ("setting data for lateral thresholds simulation" )
1207+ IBody .set_data_for_s_simulation ()
1208+ logger .info ("setting data for vertical thresholds simulation" )
1209+ IBody .set_data_for_g_simulation ()
1210+
11741211 if intrusion_lateral_extent_model == None :
11751212 logger .error (
11761213 "Specify conceptual model function for intrusion lateral extent"
11771214 )
1178-
1179- else :
1180- logger .info ("setting data for lateral thresholds simulation" )
1181- IBody .set_data_for_s_simulation ()
1215+ else :
11821216 IBody .set_lateral_extent_conceptual_model (intrusion_lateral_extent_model )
11831217 IBody .set_s_simulation_GSLIBparameters (lateral_extent_sgs_parameters )
11841218 IBody .make_s_simulation_variogram (lateral_extent_sgs_parameters )
@@ -1192,10 +1226,7 @@ def create_and_add_intrusion(
11921226 logger .error (
11931227 "Specify conceptual model function for intrusion vertical extent"
11941228 )
1195-
1196- else :
1197- logger .info ("setting data for vertical thresholds simulation" )
1198- IBody .set_data_for_g_simulation ()
1229+ else :
11991230 IBody .set_vertical_extent_conceptual_model (intrusion_vertical_extent_model )
12001231 IBody .set_g_simulation_GSLIBparameters (vertical_extent_sgs_parameters )
12011232 IBody .make_g_simulation_variogram (vertical_extent_sgs_parameters )
@@ -1493,6 +1524,18 @@ def create_and_add_fault(
14931524 fault : FaultSegment
14941525 created fault
14951526 """
1527+ logger .info (f'Creating fault "{ fault_surface_data } "' )
1528+ logger .info (f'Displacement: { displacement } ' )
1529+ logger .info (f'Tolerance: { tol } ' )
1530+ logger .info (f'Fault function: { faultfunction } ' )
1531+ logger .info (f'Fault slip vector: { fault_slip_vector } ' )
1532+ logger .info (f'Fault center: { fault_center } ' )
1533+ logger .info (f'Major axis: { major_axis } ' )
1534+ logger .info (f'Minor axis: { minor_axis } ' )
1535+ logger .info (f'Intermediate axis: { intermediate_axis } ' )
1536+ for k , v in kwargs .items ():
1537+ logger .info (f'{ k } : { v } ' )
1538+
14961539 if tol is None :
14971540 tol = self .tol
14981541 self .parameters ["features" ].append (
@@ -1523,6 +1566,12 @@ def create_and_add_fault(
15231566 fault_frame_data = self .data [
15241567 self .data ["feature_name" ] == fault_surface_data
15251568 ].copy ()
1569+ trace_mask = np .logical_and (fault_frame_data ['coord' ] == 0 ,fault_frame_data ['val' ] == 0 )
1570+ logger .info (f'There are { np .sum (trace_mask )} points on the fault trace' )
1571+ if np .sum (trace_mask ) == 0 :
1572+ logger .error ('You cannot model a fault without defining the location of the fault' )
1573+ raise ValueError (f'There are no points on the fault trace' )
1574+
15261575 mask = np .logical_and (
15271576 fault_frame_data ["coord" ] == 0 , ~ np .isnan (fault_frame_data ["gz" ])
15281577 )
@@ -1562,9 +1611,7 @@ def create_and_add_fault(
15621611 # if we haven't defined a fault centre take the center of mass for lines assocaited with
15631612 # the fault trace
15641613 if (
1565- "centreEasting" in kwargs
1566- and "centreNorthing" in kwargs
1567- and "centreAltitude" in kwargs
1614+ ~ np .isnan (kwargs .get ("centreEasting" ,np .nan )) and ~ np .isnan (kwargs .get ('centreNorthing' ,np .nan )) and ~ np .isnan (kwargs .get ('centreAltitude' ,np .nan ))
15681615 ):
15691616 fault_center = self .scale (
15701617 np .array (
@@ -1598,7 +1645,7 @@ def create_and_add_fault(
15981645 minor_axis = minor_axis ,
15991646 major_axis = major_axis ,
16001647 intermediate_axis = intermediate_axis ,
1601- points = kwargs .get ("points" , None ),
1648+ points = kwargs .get ("points" , True ),
16021649 )
16031650
16041651 # if minor_axis == None or major_axis == None or intermediate_axis == None:
0 commit comments