diff --git a/anisotropy/db.py b/anisotropy/db.py new file mode 100644 index 0000000..5879393 --- /dev/null +++ b/anisotropy/db.py @@ -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") + diff --git a/conf/config.toml b/conf/config.toml index e8db286..5b98663 100644 --- a/conf/config.toml +++ b/conf/config.toml @@ -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] diff --git a/requirements.txt b/requirements.txt index 19031ae..c3b62b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ numpy pyquaternion toml +peewee +pandas diff --git a/salomepl/genmesh.py b/salomepl/genmesh.py index 1c11cb4..98b2a6a 100644 --- a/salomepl/genmesh.py +++ b/salomepl/genmesh.py @@ -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): diff --git a/salomepl/mesh.py b/salomepl/mesh.py index 3519738..db48f44 100644 --- a/salomepl/mesh.py +++ b/salomepl/mesh.py @@ -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())