Mod: computation parameters

Mod: move salome context to cli
This commit is contained in:
L-Nafaryus 2021-08-27 16:46:09 +05:00
parent 9feb150a1c
commit 750bf30e11
4 changed files with 19 additions and 18 deletions

View File

@ -35,8 +35,8 @@ faceCentered = true
minSize = 0.05
fineness = 5
growthRate = 0.7
nbSegPerEdge = 0.3
growthRate = 0.5
nbSegPerEdge = 2
nbSegPerRadius = 1
chordalErrorEnabled = true
@ -123,8 +123,8 @@ faceCentered = true
minSize = 0.05
fineness = 5
growthRate = 0.7
nbSegPerEdge = 0.3
growthRate = 0.5
nbSegPerEdge = 2
nbSegPerRadius = 1
chordalErrorEnabled = true
@ -191,7 +191,7 @@ faceCentered = true
[structures.structure]
type = "faceCentered"
# auto # from theta: list # theta: float
theta = [0.01, 0.18, 0.01] # [min, max, step]
theta = [0.01, 0.12, 0.01] # [min, max, step]
# auto # from directions:list # direction: list
directions = [
[1, 0, 0],
@ -211,8 +211,8 @@ faceCentered = true
minSize = 0.05
fineness = 5
growthRate = 0.7
nbSegPerEdge = 0.3
growthRate = 0.5
nbSegPerEdge = 2
nbSegPerRadius = 1
chordalErrorEnabled = true

View File

@ -91,6 +91,12 @@ def anisotropy():
default = False,
help = "Overwrite existing entries"
)
@click.option(
"-u", "--update", "update",
type = click.BOOL,
default = False,
help = "Update db parameters from config"
)
@click.option(
"-p", "--param", "params",
metavar = "key=value",
@ -98,7 +104,7 @@ def anisotropy():
cls = KeyValueOption,
help = "Overwrite existing parameter (except control variables)"
)
def compute(stage, nprocs, database, force, params):
def compute(stage, nprocs, database, force, update, params):
from anisotropy.core.main import Anisotropy, Database, logger
from anisotropy.core.utils import timer, parallel
@ -125,7 +131,7 @@ def compute(stage, nprocs, database, force, params):
model.db.setup()
def fill_db():
if model.db.isempty():
if model.db.isempty() or update:
paramsAll = model.loadFromScratch()
for entry in paramsAll:
@ -234,12 +240,15 @@ def computemesh(root, type, direction, theta):
])
from anisotropy.core.main import Anisotropy
import salome
###
model = Anisotropy()
model.load(type, direction, theta)
salome.salome_init()
model.genmesh()
salome.salome_close()
###
# CLI entry

View File

@ -254,15 +254,9 @@ class Anisotropy(object):
Warning: Working only inside Salome Environment
"""
# ISSUE: double logger output
import salome
p = self.params
salome.salome_init()
###
# Shape
##
@ -357,8 +351,6 @@ class Anisotropy(object):
)
self.update()
salome.salome_close()
def computeFlow(self):
"""Computes a flow on mesh via OpenFOAM

View File

@ -179,7 +179,7 @@ class BodyCentered(object):
# Groups
##
shape = geompy.MakeCutList(poreCell, [grains])
shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "bodyCenteredCubic")
shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "bodyCentered")
sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"])
geompy.UnionIDs(sall,