Fixed BC but not finalized for simpleCubic

This commit is contained in:
L-Nafaryus 2021-03-04 15:58:08 +05:00
parent 088ff3b2ce
commit 5b14cc5b81
4 changed files with 39 additions and 16 deletions

View File

@ -10,3 +10,11 @@
## 3.03.21 ## 3.03.21
- [x] configure salome server, ports, etc. - [x] configure salome server, ports, etc.
- [ ] less processes for salome, optimization. - [ ] less processes for salome, optimization.
## 4.03.21
- [ ] 3rd direction
- [ ] createPatch(Dict)
- [ ] views (mesh, ..)
- [ ] alpha for simpleCubic [0.01 .. 0.28]
- [ ] translation vector (cyclicAMI)

View File

@ -31,6 +31,11 @@ boundaryField
{ {
type zeroGradient; type zeroGradient;
} }
symetryPlane
{
type fixedValue;
value uniform (0 0 0);
}
wall wall
{ {
type fixedValue; type fixedValue;

View File

@ -32,6 +32,10 @@ boundaryField
type fixedValue; type fixedValue;
value uniform 0; value uniform 0;
} }
symetryPlane
{
type zeroGradient;
}
wall wall
{ {
type zeroGradient; type zeroGradient;

View File

@ -7,7 +7,7 @@ import time
from datetime import timedelta from datetime import timedelta
def application(name, case, log=False, args=[], parallel=False): def application(name, case, log=False, args=[], parallel=False):
logging.info("Running '{}' for {}".format(name, case)) logging.info("Running '{}'.".format(name))
if log: if log:
logfile = open("{}/{}.log".format(case, name), "a") logfile = open("{}/{}.log".format(case, name), "a")
@ -33,10 +33,10 @@ def checkMesh(case):
application("checkMesh", case, True, ["-allGeometry", "-allTopology"]) application("checkMesh", case, True, ["-allGeometry", "-allTopology"])
def foamDictionaryGet(case, foamFile, entry): def foamDictionaryGet(case, foamFile, entry):
application("foamDictionary", case, False, [foamFile, "-entry", entry]) application("foamDictionary", case, True, [foamFile, "-entry", entry])
def foamDictionarySet(case, foamFile, entry, value): def foamDictionarySet(case, foamFile, entry, value):
application("foamDictionary", case, False, [foamFile, "-entry", entry, "-set", value]) application("foamDictionary", case, True, [foamFile, "-entry", entry, "-set", value])
def decomposePar(case): def decomposePar(case):
application("decomposePar", case, True) application("decomposePar", case, True)
@ -62,7 +62,7 @@ if __name__ == "__main__":
format="%(levelname)s: %(message)s", format="%(levelname)s: %(message)s",
handlers = [ handlers = [
logging.StreamHandler(), logging.StreamHandler(),
logging.FileHandler("{}/genmesh.log".format(build)) logging.FileHandler("{}/foam.log".format(build))
]) ])
start_time = time.monotonic() start_time = time.monotonic()
@ -81,6 +81,7 @@ if __name__ == "__main__":
"direction-{}".format(direction), "direction-{}".format(direction),
"alpha-{}".format(coefficient)) "alpha-{}".format(coefficient))
logging.info("Entry with parameters: {}, direction = {}, alpha = {}".format(structure, direction, coefficient)) logging.info("Entry with parameters: {}, direction = {}, alpha = {}".format(structure, direction, coefficient))
logging.info("Copying baseFOAM case ...") logging.info("Copying baseFOAM case ...")
@ -89,34 +90,39 @@ if __name__ == "__main__":
shutil.copytree(os.path.join(src_path, d), shutil.copytree(os.path.join(src_path, d),
os.path.join(build_path, d)) os.path.join(build_path, d))
os.chdir(build_path)
case_path = "."
logging.info("Importing mesh to foam ...") logging.info("Importing mesh to foam ...")
ideasUnvToFoam(build_path, "{}-{}-{}.unv".format(structure, direction, coefficient)) ideasUnvToFoam(case_path, "{}-{}-{}.unv".format(structure, direction, coefficient))
logging.info("Scaling mesh ...") logging.info("Scaling mesh ...")
transformPoints(build_path, "'(1e-5 1e-5 1e-5)'") transformPoints(case_path, "(1e-5 1e-5 1e-5)")
logging.info("Checking mesh ...") logging.info("Checking mesh ...")
checkMesh(build_path) checkMesh(case_path)
# TODO: change type for symetryPlane
logging.info("Changing mesh boundaries types ...") logging.info("Changing mesh boundaries types ...")
foamDictionarySet(build_path, "constant/polyMesh/boundary", "entry0.wall.type", "wall") foamDictionarySet(case_path, "constant/polyMesh/boundary", "entry0.wall.type", "wall")
foamDictionarySet(case_path, "constant/polyMesh/boundary", "entry0.symetryPlane.type", "symetryPlane")
logging.info("Decomposing case ...") logging.info("Decomposing case ...")
decomposePar(build_path) decomposePar(case_path)
logging.info("Evaluating initial approximation via potentialFoam ...") logging.info("Evaluating initial approximation via potentialFoam ...")
potentialFoam(build_path) potentialFoam(case_path)
logging.info("Preparing boundaryFields for simpleFoam ...") logging.info("Preparing boundaryFields for simpleFoam ...")
for n in range(4): for n in range(4):
foamDictionarySet(build_path, "processor{}/0/U".format(n), foamDictionarySet(case_path, "processor{}/0/U".format(n),
"boundaryField.inlet.type", "pressureInletVelocity") "boundaryField.inlet.type", "pressureInletVelocity")
foamDictionarySet(build_path, "processor{}/0/U", foamDictionarySet(case_path, "processor{}/0/U",
"boundaryField.inlet.value", "'uniform (0 0 0)'") "boundaryField.inlet.value", "uniform (0 0 0)")
logging.info("Calculating ...") logging.info("Calculating ...")
simpleFoam(build_path) simpleFoam(case_path)
os.chdir(project)
end_time = time.monotonic() end_time = time.monotonic()
logging.info("Elapsed time: {}".format(timedelta(seconds=end_time - start_time))) logging.info("Elapsed time: {}".format(timedelta(seconds=end_time - start_time)))