obr.OpenFOAM.case#

Module Contents#

Classes#

File

Abstraction of OpenFOAMs config files which contain key value pairs or key block pairs

OpenFOAMCase

A class for simple access to typical OpenFOAM files

Attributes#

obr.OpenFOAM.case.logger#
obr.OpenFOAM.case.OF_HEADER_REGEX = Multiline-String#
Show Value
"""(/\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\
(\||)\s*=========                 \|(\s*\||)
(\||)\s*\\\\      /  F ield         \| (OpenFOAM:|foam-extend:)\s*[\d\w\W]*\s*(\||)
(\||)\s*\\\\    /   O peration     \| (Version:|Website:)\s*[\d\w\W]*\s*(\||)
(\||)\s*\\\\  /    A nd           \| (Web:|Version:|Website)\s*[\d\w\W]*\s*(\||)
(\||)\s*\\\\/     M anipulation  \|(\s*\||)
\\\*---------------------------------------------------------------------------\*/)"""
class obr.OpenFOAM.case.File(**kwargs)#

Bases: Owls.parser.FoamDict.FileParser

Abstraction of OpenFOAMs config files which contain key value pairs or key block pairs

get(name: str)#

Get a value from an OpenFOAM dictionary file

md5sum(refresh=False) str#

Compute a files md5sum

is_modified() bool#
set(args: dict)#

modifies the current controlDict by the given dictionary

if the key exists in the controlDict the values are replaced non-existent keys are added

class obr.OpenFOAM.case.OpenFOAMCase(path, job)#

Bases: obr.OpenFOAM.BlockMesh.BlockMesh

A class for simple access to typical OpenFOAM files

property path: pathlib.Path#
property system_folder: pathlib.Path#
property constant_folder: pathlib.Path#
property const_polyMesh_folder: pathlib.Path#
property system_include_folder: pathlib.Path#
property zero_folder: pathlib.Path#

TODO check for 0.orig folder

property init_p: pathlib.Path#
property init_U: pathlib.Path#
property is_decomposed: bool#
property time_folder: list[pathlib.Path]#

Returns all timestep folder

property processor_folder: list[pathlib.Path]#
property current_time: float#

Returns the current timestep of the simulation

property progress: float#

Returns the progress of the simulation in percent

property latest_solver_log_path: pathlib.Path#

Returns the absolute path to the latest log

property latest_log: Owls.parser.LogFile.LogFile#

Returns handle to the latest log

property finished: bool#

check if the latest simulation run has finished gracefully

property solver#
property config_file_tree: list[str]#

Iterates through case file tree and returns a list of paths to non-symlinked files.

property esi_version: bool#

Check if esi version of OpenFOAM is sourced

latest_log_path_: pathlib.Path#
config_files_in_folder(folder: pathlib.Path) Generator[Tuple[File, str], Any, None]#

Yields all OF config files in given folder

fetch_logs() list[pathlib.Path]#
fetch_latest_log() None#
get(key: str) File | None#
has_openfoam_header(path: pathlib.Path) bool#
_exec_operation(operation) pathlib.Path#
reset_case()#

Removes all artifacts after case generation

decomposePar(args={})#

Sets decomposeParDict and calls decomposePar. If no decomposeParDict exists a new one gets created

setKeyValuePair(args: dict)#
run(args: dict)#
is_file_modified(file: str) bool#

Checks if a file has been modified by comparing the current md5sum with the previously saved one inside self.job.dict.

is_tree_modified() list[str]#

Iterates all files inside the case tree and returns a list of files that were modified, based on their md5sum.

process_latest_time_stats() bool#

This function parses the latest time step log and stores the results in the job document.

Return: A boolean indication whether processing was successful

detailed_update()#

Perform a detailed update on the job doc state

remove_solver_logs()#

Search for solver logs and deletes them

perform_post_md5sum_calculations()#

calculates md5sums for all case files. Primarily called from dispatch_post_hooks

was_successful() bool#

Returns True, if both its label and the last OBR operation returned successful, False otherwise.