New: db models

Mod: replace default mesh parameters
This commit is contained in:
L-Nafaryus 2021-07-12 18:01:15 +05:00
parent 7f75e9c790
commit 5a490a98d2
5 changed files with 71 additions and 50 deletions

19
anisotropy/db.py Normal file
View File

@ -0,0 +1,19 @@
from peewee import *
class BaseModel(Model):
class Meta:
database = db
class Structure(BaseModel):
name = TextField()
direction = TextField()
theta = FloatField()
class Mesh(BaseModel):
maxSize = FloatField()
minSize = FloatField()
chordalErrorEnabled = BooleanField()
chordalError = FloatField()
calculationTime = TimeField()
structure = ForeignKeyField(Structure, backref = "mesh")

View File

@ -11,8 +11,8 @@ name = "anisotropy"
format = "%(levelname)s: %(message)s"
[base]
simple = true
bodyCentered = true
simple = false
bodyCentered = false
faceCentered = true
###
@ -50,7 +50,7 @@ directions = [
fillet = true
[bodyCentered.mesh]
viscousLayers = false
viscousLayers = true
thickness = [0.005, 0.0005]
[bodyCentered.mesh.submesh.strips]
@ -71,7 +71,7 @@ directions = [
fillet = true
[faceCentered.mesh]
viscousLayers = false
viscousLayers = true
thickness = [0.001, 0.0005]
[faceCentered.mesh.submesh.strips]

View File

@ -1,3 +1,5 @@
numpy
pyquaternion
toml
peewee
pandas

View File

@ -27,52 +27,7 @@ from salomepl.faceCentered import faceCentered
from salomepl.bodyCentered import bodyCentered
from salomepl.geometry import getGeom
from salomepl.mesh import Mesh, Fineness, ExtrusionMethod
def defaultParameters(**configParameters):
maxSize = 0.5
minSize = 0.05
fineness = Fineness.Custom.value
growthRate = 0.7
nbSegPerEdge = 0.3
nbSegPerRadius = 1
chordalErrorEnabled = True
chordalError = 0.25
secondOrder = False
optimize = True
quadAllowed = False
useSurfaceCurvature = True
fuseEdges = True
checkChartBoundary = False
viscousLayers = False
thickness = 0.005
numberOfLayers = 1
stretchFactor = 1
isFacesToIgnore = True
facesToIgnore = ["inlet", "outlet"]
faces = []
extrusionMethod = ExtrusionMethod.SURF_OFFSET_SMOOTH
p = locals()
del p["configParameters"]
if configParameters:
for k, v in p.items():
if configParameters.get(k) is not None:
p[k] = configParameters[k]
# Overwrite special values
if k == "fineness":
p["fineness"] = Fineness.__dict__[p["fineness"]].value
if k == "extrusionMethod":
p["extrusionMethod"] = ExtrusionMethod.__dict__[p["extrusionMethod"]]
return p
from salomepl.mesh import Mesh, Fineness, ExtrusionMethod, defaultParameters
def genmesh(config):

View File

@ -20,6 +20,51 @@ class ExtrusionMethod(object):
def getSmesh():
return smesh
def defaultParameters(**configParameters):
maxSize = 0.5
minSize = 0.05
fineness = Fineness.Custom.value
growthRate = 0.7
nbSegPerEdge = 0.3
nbSegPerRadius = 1
chordalErrorEnabled = True
chordalError = 0.25
secondOrder = False
optimize = True
quadAllowed = False
useSurfaceCurvature = True
fuseEdges = True
checkChartBoundary = False
viscousLayers = False
thickness = 0.005
numberOfLayers = 1
stretchFactor = 1
isFacesToIgnore = True
facesToIgnore = ["inlet", "outlet"]
faces = []
extrusionMethod = ExtrusionMethod.SURF_OFFSET_SMOOTH
p = locals()
del p["configParameters"]
if configParameters:
for k, v in p.items():
if configParameters.get(k) is not None:
p[k] = configParameters[k]
# Overwrite special values
if k == "fineness":
p["fineness"] = Fineness.__dict__[p["fineness"]].value
if k == "extrusionMethod":
p["extrusionMethod"] = ExtrusionMethod.__dict__[p["extrusionMethod"]]
return p
def updateParams(old, new: dict):
old.SetMaxSize(new.get("maxSize") if new.get("maxSize") else old.GetMaxSize())
old.SetMinSize(new.get("minSize") if new.get("minSize") else old.GetMinSize())