Access to problem quantities (like thermal conductivity) model dependent
I observed that it is problem-/model-dependent how to obtain the thermal conductivity. This make it hard to reuse some of my functions with different problems/models.
- Would it be possible to unify the interface?
- Is there a (smart) way to generalize functions that should work for different problems/models?
The interface to obtain model properties is not unique. Obtaining the thermal conductivity
lambda looks different for different types of problems used.
lambda = ThermalConductivityModel::effectiveThermalConductivity(volVars,problem.spatialParams(),element,fvGeometry,scv)
lambda = volVars.effectiveThermalConductivity()
In my case, this makes is hard to reuse an already implemented function. Moreover, it does not feel intuitive that the interface to obtain the conductivity differs (that much) between two physical models.
Kilian and me have been recently worked on a routine that constructs the temperature on a boundary. It basically gets a heat flux
Q on the face of an element and the temperature
T_cc at the cell center. Together with the thermal conductivity
lambda and the distance from the cell center to the face
distance obtain the temperature on the face
T_face from the following formula:
Q = - lambda ( T_face - T_center ) / distance => T_face = - Q * distance / lambda + T_center
It has been implement once for a heat equation problem that inherits from
SolidEnergy. In this case heat conductivity is obtained via
ThermalConductivityModel::effectiveThermalConductivity. In my particular case it looks like that:
const Scalar lambda = ThermalConductivityModel::effectiveThermalConductivity(volVars, problem.spatialParams(), element, fvGeometry, scv);
Now, I wanted to reuse the function for a Navier-Stokes based problem that inherits
NavierStokesNI. I tried reuse the function we had already written, but this fails since the heat conductivity has to be obtained via the
effectiveThermalConductivity member function of an object of type
ElementVolumeVariables. In my case it looks like:
const Scalar insideLambda = volVars.effectiveThermalConductivity();
Due to that I had to implement the same function twice which I would like to avoid