New: db models
Mod: replace default mesh parameters
This commit is contained in:
parent
7f75e9c790
commit
5a490a98d2
19
anisotropy/db.py
Normal file
19
anisotropy/db.py
Normal 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")
|
||||||
|
|
@ -11,8 +11,8 @@ name = "anisotropy"
|
|||||||
format = "%(levelname)s: %(message)s"
|
format = "%(levelname)s: %(message)s"
|
||||||
|
|
||||||
[base]
|
[base]
|
||||||
simple = true
|
simple = false
|
||||||
bodyCentered = true
|
bodyCentered = false
|
||||||
faceCentered = true
|
faceCentered = true
|
||||||
|
|
||||||
###
|
###
|
||||||
@ -50,7 +50,7 @@ directions = [
|
|||||||
fillet = true
|
fillet = true
|
||||||
|
|
||||||
[bodyCentered.mesh]
|
[bodyCentered.mesh]
|
||||||
viscousLayers = false
|
viscousLayers = true
|
||||||
thickness = [0.005, 0.0005]
|
thickness = [0.005, 0.0005]
|
||||||
|
|
||||||
[bodyCentered.mesh.submesh.strips]
|
[bodyCentered.mesh.submesh.strips]
|
||||||
@ -71,7 +71,7 @@ directions = [
|
|||||||
fillet = true
|
fillet = true
|
||||||
|
|
||||||
[faceCentered.mesh]
|
[faceCentered.mesh]
|
||||||
viscousLayers = false
|
viscousLayers = true
|
||||||
thickness = [0.001, 0.0005]
|
thickness = [0.001, 0.0005]
|
||||||
|
|
||||||
[faceCentered.mesh.submesh.strips]
|
[faceCentered.mesh.submesh.strips]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
numpy
|
numpy
|
||||||
pyquaternion
|
pyquaternion
|
||||||
toml
|
toml
|
||||||
|
peewee
|
||||||
|
pandas
|
||||||
|
@ -27,52 +27,7 @@ from salomepl.faceCentered import faceCentered
|
|||||||
from salomepl.bodyCentered import bodyCentered
|
from salomepl.bodyCentered import bodyCentered
|
||||||
|
|
||||||
from salomepl.geometry import getGeom
|
from salomepl.geometry import getGeom
|
||||||
from salomepl.mesh import Mesh, Fineness, ExtrusionMethod
|
from salomepl.mesh import Mesh, Fineness, ExtrusionMethod, defaultParameters
|
||||||
|
|
||||||
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 genmesh(config):
|
def genmesh(config):
|
||||||
|
@ -20,6 +20,51 @@ class ExtrusionMethod(object):
|
|||||||
def getSmesh():
|
def getSmesh():
|
||||||
return smesh
|
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):
|
def updateParams(old, new: dict):
|
||||||
old.SetMaxSize(new.get("maxSize") if new.get("maxSize") else old.GetMaxSize())
|
old.SetMaxSize(new.get("maxSize") if new.get("maxSize") else old.GetMaxSize())
|
||||||
old.SetMinSize(new.get("minSize") if new.get("minSize") else old.GetMinSize())
|
old.SetMinSize(new.get("minSize") if new.get("minSize") else old.GetMinSize())
|
||||||
|
Loading…
Reference in New Issue
Block a user