Skip to content
Snippets Groups Projects
Commit 05d0ca08 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[2p2c] Adapt to new interface of intialPhasePresence[2p2c]

parent 95340a01
No related branches found
No related tags found
4 merge requests!600[WIP][components][plotproperties] Add a source file to plot properties of some components,!501Freeflow/turbulenceproperties,!492Resolve "Inconsistent `index()` method of the different `SubControlVolume` classes",!400Feature/improve initial phasepresence
...@@ -147,46 +147,29 @@ public: ...@@ -147,46 +147,29 @@ public:
{ {
ParentType::init(problem); ParentType::init(problem);
unsigned numDofs = this->numDofs(); staticDat_.resize(this->numDofs());
staticDat_.resize(numDofs);
setSwitched_(false); setSwitched_(false);
// check, if velocity output can be used (works only for cubes so far) FVElementGeometry fvGeometry;
for (const auto& element : elements(this->gridView_())) for (const auto& element : elements(this->gridView_()))
{ {
if (!isBox) // i.e. cell-centered discretization // deal with the current element
{ fvGeometry.update(this->gridView_(), element);
int eIdxGlobal = this->dofMapper().index(element);
const GlobalPosition &globalPos = element.geometry().center();
// initialize phase presence
staticDat_[eIdxGlobal].phasePresence
= this->problem_().initialPhasePresence(*(this->gridView_().template begin<dim>()),
eIdxGlobal, globalPos);
staticDat_[eIdxGlobal].wasSwitched = false;
staticDat_[eIdxGlobal].oldPhasePresence
= staticDat_[eIdxGlobal].phasePresence;
}
}
if (isBox) // i.e. vertex-centered discretization // loop over all element vertices, i.e. sub control volumes
{ for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++)
for (const auto& vertex : vertices(this->gridView_()))
{ {
int vIdxGlobal = this->dofMapper().index(vertex); // get the global index of the degree of freedom
const GlobalPosition &globalPos = vertex.geometry().corner(0); int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim);
// initialize phase presence // initialize phase presence
staticDat_[vIdxGlobal].phasePresence staticDat_[dofIdxGlobal].phasePresence = this->problem_().initialPhasePresence(element, fvGeometry, scvIdx);
= this->problem_().initialPhasePresence(vertex, vIdxGlobal,
globalPos); staticDat_[dofIdxGlobal].wasSwitched = false;
staticDat_[vIdxGlobal].wasSwitched = false;
staticDat_[vIdxGlobal].oldPhasePresence staticDat_[dofIdxGlobal].oldPhasePresence = staticDat_[dofIdxGlobal].phasePresence;
= staticDat_[vIdxGlobal].phasePresence;
} }
} }
} }
......
...@@ -329,15 +329,11 @@ public: ...@@ -329,15 +329,11 @@ public:
} }
/*! /*!
* \brief Returns the initial phase state for a control volume. * \brief Return the initial phase state inside a control volume.
* *
* \param vertex The vertex
* \param vIdxGlobal The global index of the vertex
* \param globalPos The global position * \param globalPos The global position
*/ */
int initialPhasePresence(const Vertex &vertex, int initialPhasePresenceAtPos(const GlobalPosition &globalPos) const
int &vIdxGlobal,
const GlobalPosition &globalPos) const
{ return Indices::wPhaseOnly; } { return Indices::wPhaseOnly; }
// \} // \}
......
...@@ -326,13 +326,9 @@ public: ...@@ -326,13 +326,9 @@ public:
/*! /*!
* \brief Return the initial phase state inside a control volume. * \brief Return the initial phase state inside a control volume.
* *
* \param vertex The vertex
* \param vIdxGlobal The global index of the vertex
* \param globalPos The global position * \param globalPos The global position
*/ */
int initialPhasePresence(const Vertex &vertex, int initialPhasePresenceAtPos(const GlobalPosition &globalPos) const
int &vIdxGlobal,
const GlobalPosition &globalPos) const
{ {
return wPhaseOnly; return wPhaseOnly;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment