Mod: real volume
This commit is contained in:
parent
fea53d0db7
commit
c5d2bf1783
@ -136,7 +136,8 @@ def default_config() -> Config:
|
||||
"velocityOutlet": None,
|
||||
"velocityInternal": [0., 0., 0.],
|
||||
"density": 1000,
|
||||
"viscosity": 1e-3
|
||||
"viscosity": 1e-3,
|
||||
"scale": [1e-5, 1e-5, 1e-5]
|
||||
})
|
||||
|
||||
return config
|
||||
|
@ -6,6 +6,7 @@ from os import environ
|
||||
from datetime import datetime
|
||||
import pathlib
|
||||
import logging
|
||||
import numpy as np
|
||||
|
||||
from anisotropy.database import Database, tables
|
||||
from anisotropy import shaping
|
||||
@ -34,15 +35,15 @@ class UltimateRunner(object):
|
||||
self.exec_id = None
|
||||
|
||||
if exec_id is not None:
|
||||
if self.database.getExecution(exec_id):
|
||||
self.exec_id = exec_id
|
||||
if self.database.getExecution(int(exec_id)):
|
||||
self.exec_id = int(exec_id)
|
||||
|
||||
else:
|
||||
logger.warning(f"Execution id '{ exec_id }' not found. Creating new.")
|
||||
|
||||
if self.exec_id is None:
|
||||
with self.database:
|
||||
self.exec_id = tables.Execution.create(date = datetime.now())
|
||||
self.exec_id = tables.Execution.create(date = datetime.now()).exec_id
|
||||
|
||||
if self.type == "master":
|
||||
logger.info(f"Current execution id: { self.exec_id }")
|
||||
@ -176,8 +177,8 @@ class UltimateRunner(object):
|
||||
|
||||
else:
|
||||
shapeParams.shapeStatus = "done"
|
||||
shapeParams.volume = shape.shape.volume
|
||||
shapeParams.volumeCell = shape.cell.volume
|
||||
shapeParams.volume = shape.shape.volume * np.prod(params["scale"])
|
||||
shapeParams.volumeCell = shape.cell.volume * np.prod(params["scale"])
|
||||
shapeParams.porosity = shapeParams.volume / shapeParams.volumeCell
|
||||
|
||||
# commit parameters
|
||||
@ -287,6 +288,7 @@ class UltimateRunner(object):
|
||||
path = self.casepath,
|
||||
direction = params["direction"],
|
||||
patches = shape.patches(group = True, shiftIndex = True, prefix = "patch"),
|
||||
scale = params["scale"],
|
||||
**flowParamsDict
|
||||
)
|
||||
|
||||
|
@ -21,6 +21,7 @@ class FlowOnePhase:
|
||||
velocityInternal: float = None,
|
||||
density: float = None,
|
||||
viscosityKinematic: float = None,
|
||||
scale: list[float] = None,
|
||||
**kwargs
|
||||
):
|
||||
|
||||
@ -38,6 +39,7 @@ class FlowOnePhase:
|
||||
self.velocityInternal = velocityInternal
|
||||
self.density = density
|
||||
self.viscosityKinematic = viscosityKinematic
|
||||
self.scale = scale
|
||||
|
||||
def controlDict(self) -> of.FoamFile:
|
||||
ff = presets.controlDict()
|
||||
@ -246,9 +248,12 @@ class FlowOnePhase:
|
||||
commands.createPatch()
|
||||
|
||||
commands.checkMesh()
|
||||
commands.transformPoints({
|
||||
"scale": [1e-5, 1e-5, 1e-5]
|
||||
})
|
||||
|
||||
if self.scale is not None:
|
||||
commands.transformPoints({
|
||||
"scale": self.scale
|
||||
})
|
||||
|
||||
commands.renumberMesh()
|
||||
|
||||
if approximation:
|
||||
|
Loading…
Reference in New Issue
Block a user