butterfly.solution module¶
Butterfly Solution.
-
class
butterfly.solution.Solution(case, recipe, decomposeParDict=None, solution_parameter=None, remove_extra_foam_files=False)[source]¶ Bases:
objectButterfly Solution.
This class creates a solution from a recipe which is ready to run and monitor.
Parameters: - case – A butterfly case.
- recipe – A butterfly recipe.
- decomposeParDict – decomposeParDict for parallel run (default: None).
- solution_parameter – A SolutionParameter (default: None).
- remove_extra_foam_files – set to True if you want butterfly to remove all the extra files in 0 folder once you update the recipe (default: False).
-
case¶ Case.
-
controlDict¶ Get controlDict.
-
decomposeParDict¶ DecomposeParDict.
-
err_files¶ Get full path to error files.
-
info¶ Get timestep and residual values as a tuple.
-
is_running¶ Check if the solution is still running.
-
log¶ Get the log report.
-
log_files¶ Get full path to log files.
-
probes¶ Get probes if any.
-
project_dir¶ Get project directory.
-
project_name¶ Get porject name.
-
purge(remove_polyMesh_content=True, remove_snappyHexMesh_folders=True, remove_result_folders=False, remove_postProcessing_folder=False)[source]¶ Purge solution’s case folder.
-
recipe¶ Get recipe.
-
remove_extra_foam_files¶ If True, solution will remove extra files everytime recipe changes.
-
residualControl¶ Get residualControl values for this solution.
-
residual_fields¶ Get list of residuals to be watched during the run.
-
residual_file¶ Return address of the residual file.
-
residual_values¶ Get timestep and residual values as a tuple.
-
sample(name, points, field, wait=True)[source]¶ Sample the results for a certain field.
Parameters: - name – A unique name for this sample.
- points – List of points as (x, y, z).
- fields – List of fields (e.g. U, p).
- args – Command arguments.
- wait – Wait until command execution ends.
Returns: namedtuple(probes, values).
-
timestep¶ Get latest timestep for this solution.
-
class
butterfly.solution.SolutionParameter(of_filename, values, replace=False, time_range=None)[source]¶ Bases:
objectA solution parameter that can be changed during the solution.
Add solution parameter to to solution settings.
-
filename¶ OpenFOAM filename that the values are belong to (e.g. blockMeshDict, fvSchemes).
-
values¶ New values as a python dictionary.
-
replace¶ Set to True if you want the original dictionary to be replaced by new values. Default is False which means the original dictionary will be only updated by new values.
-
time_range¶ Time range that this SolutioParameter is valid as a tuple (default: (0, 1.0e+100)).
-
filename Return OpenFOAM file name.
-
classmethod
from_cpp_dictionary(of_filename, dictionary, replace=False, time_range=None, header=False)[source]¶ Create from an OpenFOAM dictionary in text format.
-
classmethod
from_dictionary_file(of_filename, filepath, replace=False, time_range=None)[source]¶ Create from an OpenFOAM dictionary file.
-
isSolutionParameter¶ Return True.
-
time_range Get time range.
-
values Return OpenFOAM file name.
-