anisotropy/anisotropy/core/postProcess.py
L-Nafaryus 49368cc681
Mod: improved openfoam interface
Mod: improved runners exception handlers
Delete: some useless trash
New: post process pipeline block
2021-12-21 20:36:01 +05:00

26 lines
732 B
Python

# -*- coding: utf-8 -*-
# This file is part of anisotropy.
# License: GNU GPL version 3, see the file "LICENSE" for details.
from os import path
import logging
logger = logging.getLogger(__name__)
from anisotropy.openfoam.runnerPresets import postProcess
from anisotropy.openfoam import datReader
class PostProcess(object):
def __init__(self, dirpath):
self.path = path.abspath(dirpath)
def flowRate(self, patch: str):
func = "patchFlowRate(patch={})".format(patch)
filepath = path.join(self.path, "postProcessing", func, "0", "surfaceFieldValue.dat")
postProcess(func, cwd = self.path)
surfaceFieldValue = datReader(filepath)
return surfaceFieldValue["sum(phi)"][-1]