@@ -79,7 +79,7 @@ def GetDefaultParameters(cls):
7979 "dynamic_tau" : 1.0,
8080 "tau_nodal":true
8181 }
82- },
82+ },
8383 "distance_reinitialization_type" :"variational",
8484 "distance_reinitialization_settings":{
8585 },
@@ -105,7 +105,7 @@ def __init__(self, model, custom_settings):
105105 self .condition_name = "TwoFluidNavierStokesWallCondition"
106106 self .element_integrates_in_time = True
107107 self .element_has_nodal_properties = True
108-
108+
109109 # Set the levelset characteristic variables and add them to the convection settings
110110 # These are required to be set as some of the auxiliary processes admit user-defined variables
111111 self ._levelset_variable = KratosMultiphysics .DISTANCE
@@ -115,10 +115,10 @@ def __init__(self, model, custom_settings):
115115 self .settings ["levelset_convection_settings" ].AddEmptyValue ("levelset_gradient_variable_name" ).SetString ("DISTANCE_GRADIENT" )
116116 self .settings ["levelset_convection_settings" ].AddEmptyValue ("levelset_convection_variable_name" ).SetString ("VELOCITY" )
117117 self .settings ["levelset_convection_settings" ].AddEmptyValue ("convection_model_part_name" ).SetString ("LevelSetConvectionModelPart" )
118-
118+
119119 self .settings ["fractional_splitting_settings" ].AddEmptyValue ("model_part_name" ).SetString (self .main_model_part .Name )
120-
121-
120+
121+
122122 dynamic_tau = self .settings ["formulation" ]["dynamic_tau" ].GetDouble ()
123123 self .main_model_part .ProcessInfo .SetValue (KratosMultiphysics .DYNAMIC_TAU , dynamic_tau )
124124
@@ -220,25 +220,25 @@ def InitializeSolutionStep(self):
220220 # Inlet and outlet water discharge is calculated for current time step, first discharge and the considering the time step inlet and outlet volume is calculated
221221 if self .mass_source :
222222 self ._ComputeStepInitialWaterVolume ()
223-
223+
224224 # Recompute the BDF2 coefficients
225225 (self .time_discretization ).ComputeAndSaveBDFCoefficients (self .GetComputingModelPart ().ProcessInfo )
226226
227227 # STEP I: NS Fractional part 1
228- # Perform the pure convection of the fractional velocity which corresponds to the first part of the NS fractional splitting.
228+ # Perform the pure convection of the fractional velocity which corresponds to the first part of the NS fractional splitting.
229229 self .__PerformNSFractionalSplitting ()
230230 KratosMultiphysics .Logger .PrintInfo (self .__class__ .__name__ , "Navier Stokes fractional convection part is performed." )
231-
232- # STEP II: Convect the free surface according to the fractional velocity
233- # Before doing this second step, the fractional velocity data is copied to the velocity data since the level set convection process takes velocity variable as convection variable.
231+
232+ # STEP II: Convect the free surface according to the fractional velocity
233+ # Before doing this second step, the fractional velocity data is copied to the velocity data since the level set convection process takes velocity variable as convection variable.
234234 # And the previous previous velocity is copied in an auxiliar variable
235235 KratosMultiphysics .VariableUtils ().CopyModelPartNodalVar (KratosCFD .FRACTIONAL_VELOCITY ,KratosMultiphysics .VELOCITY , self .main_model_part , self .main_model_part , 0 , 0 )
236236 KratosMultiphysics .VariableUtils ().CopyModelPartNodalVar (KratosMultiphysics .VELOCITY ,KratosCFD .AUXILIAR_VECTOR_VELOCITY , self .main_model_part , self .main_model_part , 0 , 0 )
237237
238238 self .__PerformLevelSetConvection ()
239239 KratosMultiphysics .Logger .PrintInfo (self .__class__ .__name__ , "Level-set convection is performed." )
240240
241- # After the convection process, the velocity is copied back to the original state.
241+ # After the convection process, the velocity is copied back to the original state.
242242 KratosMultiphysics .VariableUtils ().CopyModelPartNodalVar (KratosCFD .AUXILIAR_VECTOR_VELOCITY ,KratosMultiphysics .VELOCITY , self .main_model_part , self .main_model_part , 0 , 0 )
243243
244244 # Perform distance correction to prevent ill-conditioned cuts
@@ -272,14 +272,14 @@ def FinalizeSolutionStep(self):
272272
273273 # Prepare distance correction for next step
274274 self ._GetDistanceModificationProcess ().ExecuteFinalizeSolutionStep ()
275-
276- # FinalizeSolutionStep of Navier-Stokes strategy
275+
276+ # FinalizeSolutionStep of Navier-Stokes strategy
277277 self ._GetSolutionStrategy ().FinalizeSolutionStep ()
278278
279279 def _ComputeStepInitialWaterVolume (self ):
280-
281- # This function calculates the theoretical water volume at each time step.
282- # Reminder: Despite adding the source term to both air and water, the absolute volume error
280+
281+ # This function calculates the theoretical water volume at each time step.
282+ # Reminder: Despite adding the source term to both air and water, the absolute volume error
283283 # is referenced to the water volume, since what is lost from water is gained by air and vice versa.
284284
285285 # Here the initial water volume of the system is calculated without considering inlet and outlet flow rate
@@ -299,8 +299,8 @@ def _ComputeStepInitialWaterVolume(self):
299299 self .__initial_water_system_volume = system_water_volume
300300
301301 def _ComputeVolumeError (self ):
302- # In this function, the volume of the cut elements is calculated,
303- # corresponding to the portions of water and air volumes, as this is the domain where the source term will be added.
302+ # In this function, the volume of the cut elements is calculated,
303+ # corresponding to the portions of water and air volumes, as this is the domain where the source term will be added.
304304 # Meanwhile, the absolute error is calculated within the water domain
305305
306306 if self .mass_source :
@@ -336,7 +336,7 @@ def __PerformNSFractionalSplitting(self):
336336 self ._GetNSFractionalSplittingProcess ().Execute ()
337337 # Trasfer velocity slip condition to fractional velocity
338338 self .__SlipConditonFractionalFixity ()
339- # TODO: Remove those methods as soon as a new hydraulic slip process is done.
339+ # TODO: Remove those methods as soon as a new hydraulic slip process is done.
340340 def __SlipConditonFractionalFixity (self ):
341341 for node in self .GetComputingModelPart ().Nodes :
342342 if node .Is (KratosMultiphysics .SLIP ):
@@ -345,7 +345,7 @@ def __SlipConditonFractionalFixity(self):
345345 v = node .GetSolutionStepValue (KratosCFD .FRACTIONAL_VELOCITY )
346346 v_prooj = self .DotProduct (v ,n )
347347 v -= v_prooj * n
348- node .SetSolutionStepValue (KratosCFD .FRACTIONAL_VELOCITY ,v )
348+ node .SetSolutionStepValue (KratosCFD .FRACTIONAL_VELOCITY ,v )
349349 def VelocityBoundaryConditionFractional (self , fractional_velocity_componentes , velocity_components ):
350350 for node in self .GetComputingModelPart ().Nodes :
351351 if node .IsFixed (velocity_components ):
@@ -381,7 +381,7 @@ def GetAuxMaterialsFileName(mat_file_name, prop_id):
381381
382382 if data_comm .Rank () == 0 :
383383 # Create and read an auxiliary materials file for each one of the fields (only on one rank)
384- for i_material in materials ["properties" ]:
384+ for i_material in materials ["properties" ]. values () :
385385 aux_materials = KratosMultiphysics .Parameters ()
386386 aux_materials .AddEmptyArray ("properties" )
387387 aux_materials ["properties" ].Append (i_material )
@@ -393,7 +393,7 @@ def GetAuxMaterialsFileName(mat_file_name, prop_id):
393393 data_comm .Barrier ()
394394
395395 # read the files on all ranks
396- for i_material in materials ["properties" ]:
396+ for i_material in materials ["properties" ]. values () :
397397 aux_materials_filename = GetAuxMaterialsFileName (materials_filename , i_material ["properties_id" ].GetInt ())
398398 aux_material_settings = KratosMultiphysics .Parameters ("""{"Parameters": {"materials_filename": ""}} """ )
399399 aux_material_settings ["Parameters" ]["materials_filename" ].SetString (aux_materials_filename )
@@ -403,7 +403,7 @@ def GetAuxMaterialsFileName(mat_file_name, prop_id):
403403
404404 if data_comm .Rank () == 0 :
405405 # remove aux files after every rank read them
406- for i_material in materials ["properties" ]:
406+ for i_material in materials ["properties" ]. values () :
407407 aux_materials_filename = GetAuxMaterialsFileName (materials_filename , i_material ["properties_id" ].GetInt ())
408408 KratosUtilities .DeleteFileIfExisting (aux_materials_filename )
409409
0 commit comments