[FEM] Elmer: fix flux equation
- the Flux solver must be executed before Heat and Electrostatic - the analysis can have multiple Flux equations -> write a unique solver name to case.sif - the Flux equation can currently only take 2 possible values. Therefore provide them as enum
This commit is contained in:
@@ -58,6 +58,9 @@ class Proxy(linear.Proxy, equationbase.ElectricforceProxy):
|
||||
|
||||
obj.ExecSolver = SOLVER_EXEC_METHODS
|
||||
obj.ExecSolver = "After Timestep"
|
||||
# Electrostatic has priority 10 and Electricforce needs
|
||||
# the potential field calculated by Electrostatic
|
||||
# therefore set priority to 5
|
||||
obj.Priority = 5
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ from femtools import femutils
|
||||
from ... import equationbase
|
||||
from . import linear
|
||||
|
||||
COEFFICIENTS = ["Heat Conductivity", "None"]
|
||||
VARIABLES = ["Potential", "Temperature"]
|
||||
|
||||
def create(doc, name="Flux"):
|
||||
return femutils.createObject(
|
||||
@@ -111,23 +113,28 @@ class Proxy(linear.Proxy, equationbase.FluxProxy):
|
||||
)
|
||||
)
|
||||
obj.addProperty(
|
||||
"App::PropertyString",
|
||||
"App::PropertyEnumeration",
|
||||
"FluxCoefficient",
|
||||
"Flux",
|
||||
"Name of proportionality coefficient\nto compute the flux"
|
||||
"Proportionality coefficient\nto compute the flux"
|
||||
)
|
||||
obj.addProperty(
|
||||
"App::PropertyString",
|
||||
"App::PropertyEnumeration",
|
||||
"FluxVariable",
|
||||
"Flux",
|
||||
"Variable name for flux calculation"
|
||||
)
|
||||
|
||||
obj.Priority = 5
|
||||
obj.CalculateFlux = True
|
||||
# set defaults according to the Elmer manual
|
||||
obj.FluxCoefficient = "Temperature"
|
||||
obj.FluxVariable = "Heat Conductivity"
|
||||
obj.FluxCoefficient = COEFFICIENTS
|
||||
obj.FluxCoefficient = "Heat Conductivity"
|
||||
obj.FluxVariable = VARIABLES
|
||||
obj.FluxVariable = "Temperature"
|
||||
# Electrostatic has priority 10, Heat has 20 and Flux needs
|
||||
# to be solved before these equations
|
||||
# therefore set priority to 25
|
||||
obj.Priority = 25
|
||||
|
||||
|
||||
class ViewProxy(linear.ViewProxy, equationbase.FluxViewProxy):
|
||||
|
||||
@@ -52,6 +52,7 @@ from femtools import membertools
|
||||
from .equations import elasticity
|
||||
from .equations import electricforce
|
||||
from .equations import flow
|
||||
from .equations import flux
|
||||
from .equations import heat
|
||||
|
||||
|
||||
@@ -713,7 +714,7 @@ class Writer(object):
|
||||
# check if we need to update the equation
|
||||
self._updateFluxSolver(equation)
|
||||
# output the equation parameters
|
||||
s["Equation"] = "Flux Solver" # equation.Name
|
||||
s["Equation"] = equation.Name
|
||||
s["Procedure"] = sifio.FileAttr("FluxSolver/FluxSolver")
|
||||
if equation.AverageWithinMaterials is True:
|
||||
s["Average Within Materials"] = equation.AverageWithinMaterials
|
||||
@@ -799,13 +800,41 @@ class Writer(object):
|
||||
"are a posteriori set to zero."
|
||||
)
|
||||
)
|
||||
tempFluxCoefficient = ""
|
||||
if hasattr(equation, "FluxCoefficient"):
|
||||
if equation.FluxCoefficient not in flux.COEFFICIENTS:
|
||||
# was an App::PropertyString and changed to
|
||||
# App::PropertyEnumeration
|
||||
tempFluxCoefficient = equation.FluxCoefficient
|
||||
equation.removeProperty("FluxCoefficient")
|
||||
if not hasattr(equation, "FluxCoefficient"):
|
||||
equation.addProperty(
|
||||
"App::PropertyString",
|
||||
"App::PropertyEnumeration",
|
||||
"FluxCoefficient",
|
||||
"Flux",
|
||||
"Name of proportionality coefficient\nto compute the flux"
|
||||
)
|
||||
equation.FluxCoefficient = flux.COEFFICIENTS
|
||||
if tempFluxCoefficient:
|
||||
equation.FluxCoefficient = tempFluxCoefficient
|
||||
else:
|
||||
equation.FluxCoefficient = "None"
|
||||
tempFluxVariable = ""
|
||||
if hasattr(equation, "FluxVariable"):
|
||||
if equation.FluxVariable not in flux.VARIABLES:
|
||||
# was an App::PropertyString and changed to
|
||||
# App::PropertyEnumeration
|
||||
tempFluxVariable = equation.FluxVariable
|
||||
equation.removeProperty("FluxVariable")
|
||||
equation.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"FluxVariable",
|
||||
"Flux",
|
||||
"Variable name for flux calculation"
|
||||
)
|
||||
equation.FluxVariable = flux.VARIABLES
|
||||
equation.FluxVariable = tempFluxVariable
|
||||
|
||||
|
||||
def _handleElectricforce(self):
|
||||
activeIn = []
|
||||
|
||||
Reference in New Issue
Block a user