Skip to content
Snippets Groups Projects
Commit 7d27fa82 authored by Philip Mueller's avatar Philip Mueller
Browse files

This commit updates the material model to also support the outer cylinder.

It introduces the necessary changes.
However it also setts the default value if they are not found to 40, which is the same as in the case of the setup object.
parent 9c540058
No related branches found
No related tags found
No related merge requests found
......@@ -58,8 +58,8 @@ using ::std::sqrt;
{
return;
};
pgl_assert(isValidFloat(this->m_angVel));
pgl_assert(isValidFloat(this->m_angVel),
isValidFloat(this->m_angVelOut));
//Now get the marker properties
MarkerProperty_t& VELX = mColl.getMarkerProperty(PropIdx::VelX() );
......@@ -72,46 +72,74 @@ using ::std::sqrt;
/*
* Setting the velocity of the disc
*/
for(const Index_t m : mColl.getIndexes(TY_DISC))
for(const Index_t TY : {TY_DISC, TY_WALL})
{
pgl_assert(0 <= m, m < TYPE.size() ,
TY_DISC == Index_t(TYPE[m]) );
Numeric_t angVelTmp = NAN;
// Select the velocity
switch(TY)
{
case TY_DISC:
angVelTmp = this->m_angVel;
break;
case TY_WALL:
angVelTmp = this->m_angVelOut;
break;
//Load the actuall position
const Numeric_t x = X[m];
const Numeric_t y = Y[m];
default:
pgl_assert(false && "Reached unreachable code.");
}; //End switch(TY)
//compute the distance from the rigin, the assumed point of rotation
const Numeric_t d2 = pow(x, 2) + pow(y, 2);
const Numeric_t d = sqrt(d2);
//this is the velocity we expect
const Numeric_t velMagnitude = d * (this->m_angVel);
//Test if a velocity was found
if(isValidFloat(angVelTmp) == false)
{
throw PGL_EXCEPT_RUNTIME("Did not found a velocity for material " + std::to_string(TY));
};
//This is the angular velocity that is currently in use
const Numeric_t thisAngVel = angVelTmp;
//Setting all velocities
for(const Index_t m : mColl.getIndexes(TY))
{
pgl_assert(0 <= m, m < TYPE.size(),
TY == Index_t(TYPE[m]) );
const Numeric_t phi = std::atan2(y, x); //can also handle both zero
const Numeric_t sinPhi = std::sin(phi);
const Numeric_t cosPhi = std::cos(phi);
pgl_assert(pgl::isValidFloat(velMagnitude), velMagnitude >= 0.0);
//Load the actuall position
const Numeric_t x = X[m];
const Numeric_t y = Y[m];
VELX[m] = - velMagnitude * sinPhi; //Minus is important and swapped cos sin
VELY[m] = velMagnitude * cosPhi;
}; //End for(m):
//compute the distance from the rigin, the assumed point of rotation
const Numeric_t d2 = pow(x, 2) + pow(y, 2);
const Numeric_t d = sqrt(d2);
//this is the velocity we expect
const Numeric_t velMagnitude = d * thisAngVel;
const Numeric_t phi = std::atan2(y, x); //can also handle both zero
const Numeric_t sinPhi = std::sin(phi);
const Numeric_t cosPhi = std::cos(phi);
pgl_assert(pgl::isValidFloat(velMagnitude));
VELX[m] = - velMagnitude * sinPhi; //Minus is important and swapped cos sin
VELY[m] = velMagnitude * cosPhi;
}; //End for(m):
}; //End for(TY): itertaing through the domains
/*
* Now handle teh velocity of the outer fluid and the wall
* Setting the fluid to disc
*/
for(const Index_t TY : {TY_WALL, TY_OUT_FLUID} )
for(const Index_t m : mColl.cgetIndexes(TY_OUT_FLUID))
{
for(const Index_t m : mColl.cgetIndexes(TY))
{
pgl_assert(0 <= m, m < TYPE.size() ,
TY == Index_t(TYPE[m]) );
pgl_assert(0 <= m, m < TYPE.size(),
TY_OUT_FLUID == Index_t(TYPE[m]));
VELX[m] = 0.0;
VELY[m] = 0.0;
}; //ENd for(m):
}; //End for(TY):
VELX[m] = 0.0;
VELY[m] = 0.0;
}; //ENd for(m):
return;
(void)grid;
......@@ -127,7 +155,8 @@ egd_MarkerRehologyRotDiscTC_t::print()
const
{
return (std::string("TC RotDisc Rehology")
+ " angVel = " + std::to_string(this->m_angVel) + ";"
+ " angVel = " + std::to_string(this->m_angVel ) + ";"
+ " angVelOut = " + std::to_string(this->m_angVelOut) + ";"
+ " imposeVel = " + (this->m_imposeVel ? std::string("Yes") : std::string("No"))
);
}; //End: print function
......@@ -182,21 +211,27 @@ egd_MarkerRehologyRotDiscTC_t::inspectDumper(
egd_MarkerRehologyRotDiscTC_t::egd_MarkerRehologyRotDiscTC_t(
const Numeric_t angVel,
const Numeric_t angVelOut,
const bool imposeVel,
const egd_confObj_t* const confObj)
:
Base_t()
{
using ::pgl::isValidFloat;
if((isValidFloat(angVel) == false) ||
(angVel <= 0.0 ) )
if(isValidFloat(angVel) == false)
{
throw PGL_EXCEPT_InvArg("The passed angVel value of " + std::to_string(angVel) + " is invalid.");
};
if(isValidFloat(angVelOut) == false)
{
throw PGL_EXCEPT_InvArg("The passed angVelOut value of " + std::to_string(angVelOut) + " is invalid.");
};
/* setting the value */
this->m_imposeVel = imposeVel;
this->m_angVel = angVel;
this->m_angVel = angVel;
this->m_angVelOut = angVelOut;
PGL_UNUSED(confObj);
}; //End building constructor
......@@ -205,7 +240,10 @@ using ::pgl::isValidFloat;
egd_MarkerRehologyRotDiscTC_t::egd_MarkerRehologyRotDiscTC_t()
:
egd_MarkerRehologyRotDiscTC_t(20.0, true, nullptr)
egd_MarkerRehologyRotDiscTC_t(40.0, //inner disc
0.0, //outer cylinder
true, //impose vel
nullptr) //conf object
{};
......@@ -213,7 +251,8 @@ egd_MarkerRehologyRotDiscTC_t::egd_MarkerRehologyRotDiscTC_t(
const egd_confObj_t& confObj)
:
egd_MarkerRehologyRotDiscTC_t(
confObj.setUpPar("angularvel", 20.0),
confObj.setUpPar("angularvel", 40.0),
confObj.setUpPar("angularvelout", 0.0),
confObj.rheologyImposeVel(),
&confObj)
{};
......
......@@ -48,7 +48,7 @@ PGL_NS_START(egd)
* a constant rotating speed with angular vel x.
* It is assumed that the disc is rotating around the origin.
*
* Velocities of the outer cylinder and fluid are set to zero.
* Velocity of the outer fluid is set to zero.
*/
class egd_MarkerRehologyRotDiscTC_t final : public egd_MarkerRehology_i
{
......@@ -106,10 +106,12 @@ public:
* omega.
*
* \param rotVel The supposed rotational velocity of the disc.
* \param outVelOut Rotation speed of the outer cylinder.
* \param imposeVel Should velocity be imposed.
*/
egd_MarkerRehologyRotDiscTC_t(
const Numeric_t rotVel,
const Numeric_t rotVelOut,
const bool imposeVel,
const egd_confObj_t* const confObj = nullptr);
......@@ -270,6 +272,7 @@ public:
*/
private:
Numeric_t m_angVel = NAN; //!< Supposed angular velocity of the inner disc.
Numeric_t m_angVelOut = NAN; //!< SUpposed angular velocity of the outer disc.
bool m_imposeVel = true; //!< Should we impose the velocity.
}; //End class(egd_MarkerRehologyRotDiscTC_t)
......
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