Skip to content

Commit

Permalink
WIP: Initial commit of multiphase balance of mass
Browse files Browse the repository at this point in the history
  • Loading branch information
NateAM committed Nov 7, 2024
1 parent d116fe3 commit 0cc4f00
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/cpp/tardigrade_balance_of_mass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,47 @@ namespace tardigradeBalanceEquations{

}

template<class scalarArray_iter, class floatVectorArray_iter, class secondOrderTensorArray_iter, class scalarArray_iter_out>
void computeBalanceOfMass( const scalarArray_iter &density_begin, const scalarArray_iter &density_end,
const scalarArray_iter &density_dot_begin, const scalarArray_iter &density_dot_end,
const floatVectorArray_iter &density_gradient_begin, const floatVectorArray_iter &density_gradient_end,
const floatVectorArray_iter &velocity_begin, const floatVectorArray_iter &velocity_end,
const secondOrderTensorArray_iter &velocity_gradient_begin, const secondOrderTensorArray_iter &velocity_gradient_end,
scalarArray_iter_out &mass_change_rate_start, scalarArray_iter_out &mass_change_rate_stop ){
/*!
* Compute the balance of mass for a multi-phase continuum returning the values of the mass-change rate
*
* \f$ \frac{\partial \rho}{\partial t} + \left( \rho v_i \right)_{,i} = c \f$
*
* \param &density_begin: The starting point of the density \f$ \rho \f$
* \param &density_end: The stopping point of the density \f$ \rho \f$
* \param &density_dot_begin: The starting point of the partial time derivative of the density \f$ \frac{\partial \rho}{\partial t} \f$
* \param &density_dot_end: The stopping point of the partial time derivative of the density \f$ \frac{\partial \rho}{\partial t} \f$
* \param &density_gradient_begin: The starting point of the spatial gradient of the density \f$ \rho_{,i} \f$
* \param &density_gradient_end: The stopping point of the spatial gradient of the density \f$ \rho_{,i} \f$
* \param &velocity_begin: The starting point of the velocity \f$ v_i \f$
* \param &velocity_end: The stopping point of the velocity \f$ v_i \f$
* \param &velocity_gradient_begin: The starting point of the spatial gradient of the velocity \f$ v_{i,j} \f$
* \param &velocity_gradient_end: The stopping point of the spatial gradient of the velocity \f$ v_{i,j} \f$
* \param &mass_change_rate: The rate of change of the mass \f$ c \f$
*/

constexpr unsigned int nphases = ( const unsigned int )( density_end - density_begin );

constexpr unsigned int sotdim = dim * dim;

for ( unsigned int phase = 0; phase < nphases; phase++ ){

computeBalanceOfMass( *( density_begin + phase ), *( density_dot_begin + phase ),
density_gradient_begin + dim * phase, density_gradient_begin + dim * ( phase + 1 ),
velocity_begin + dim * phase, velocity_begin + dim * ( phase + 1 ),
velocity_gradient_begin + dim * dim * phase, velocity_gradient_begin + dim * dim * ( phase + 1 ),
mass_change_rate_start + phase );

}

}

}

}
8 changes: 8 additions & 0 deletions src/cpp/tardigrade_balance_of_mass.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ namespace tardigradeBalanceEquations{
floatVector_iter_out dCdV_begin, floatVector_iter_out dCdV_end,
secondOrderTensor_iter_out dCdGradV_begin, secondOrderTensor_iter_out dCdGradV_end );

template<class scalarArray_iter, class floatVectorArray_iter, class secondOrderTensorArray_iter, class scalarArray_iter_out>
void computeBalanceOfMass( const scalarArray_iter &density_begin, const scalarArray_iter &density_end,
const scalarArray_iter &density_dot_begin, const scalarArray_iter &density_dot_end,
const floatVectorArray_iter &density_gradient_begin, const floatVectorArray_iter &density_gradient_end,
const floatVectorArray_iter &velocity_begin, const floatVectorArray_iter &velocity_end,
const floatVectorArray_iter &velocity_gradient_begin, const floatVectorArray_iter &velocity_gradient_end,
scalarArray_iter_out &mass_change_rate_start, scalarArray_iter_out &mass_change_rate_stop );

}

}
Expand Down

0 comments on commit 0cc4f00

Please sign in to comment.