Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added linear enthalpy gradient initial condition and a (1-porosity) p… #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions srcSubcycle/AMRLevelMushyLayer.H
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ public:
/// Initial data for a pure fluid with top and bottom cold boundaries
void initialDataLens();

/// Initial data for a linear enthalpy gradient
void initialDataLinearGradient();

/// Initial data for a test case with regions of zero porosity
void initialDataZeroPorosityTest();

Expand Down
63 changes: 32 additions & 31 deletions srcSubcycle/AMRLevelMushyLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,46 +786,47 @@ Real AMRLevelMushyLayer::advance()
return -1;
}

void AMRLevelMushyLayer::addHeatSource(LevelData<FArrayBox> &src)
void AMRLevelMushyLayer::addHeatSource(LevelData<FArrayBox>& src)
{
// This is where we add in a heat source, if required
Real gaussian_heat_source_size = 0.0;
Real gaussian_heat_source_width = 0.0;
Real gaussian_heat_source_depth = 0.0;
Real gaussian_heat_source_xpos = m_domainWidth / 2;

ParmParse ppHeatSource("heatSource");
ppHeatSource.query("size", gaussian_heat_source_size);
ppHeatSource.query("width", gaussian_heat_source_width);
ppHeatSource.query("depth", gaussian_heat_source_depth);
Real gaussian_heat_source_size = 0.0;
Real gaussian_heat_source_width = 0.0;
Real gaussian_heat_source_depth = 0.0;
Real gaussian_heat_source_xpos = m_domainWidth/2;

ParmParse ppHeatSource("heatSource");
ppHeatSource.query("size", gaussian_heat_source_size);
ppHeatSource.query("width", gaussian_heat_source_width);
ppHeatSource.query("depth", gaussian_heat_source_depth);
// ppHeatSource.query("depth", gaussian_heat_source_depth);
ppHeatSource.query("xpos", gaussian_heat_source_xpos);
ppHeatSource.query("xpos", gaussian_heat_source_xpos);

if (gaussian_heat_source_size != 0.0)
{
for (DataIterator dit = m_grids.dataIterator(); dit.ok(); ++dit)
{
for (BoxIterator bit = BoxIterator(m_grids[dit]); bit.ok(); ++bit)
// enthalpy is in the first component of the source term
int Hcomp = 0;

if (gaussian_heat_source_size != 0.0)
{
IntVect iv = bit();
RealVect loc;
::getLocation(iv, loc, m_dx);
for (DataIterator dit = m_grids.dataIterator(); dit.ok(); ++dit)
{
for (BoxIterator bit = BoxIterator(m_grids[dit]); bit.ok(); ++bit)
{
IntVect iv = bit();
RealVect loc;
::getLocation(iv, loc, m_dx);

// Set the 0th component (enthalpy)
src[dit](iv, 0) =
gaussian_heat_source_size /
(gaussian_heat_source_width * sqrt(2 * M_PI)) *
exp(-0.5 * pow((loc[0] - gaussian_heat_source_xpos) /
gaussian_heat_source_width,
2)) *
0.5 *
(1 + tanh(10 * (loc[1] -
(m_domainHeight - gaussian_heat_source_depth))));
Real porosity = (*m_scalarNew[ScalarVars::m_porosity])[dit](iv);

src[dit](iv, Hcomp) = (1-porosity)*gaussian_heat_source_size/(gaussian_heat_source_width*sqrt(2*M_PI))
* exp(-0.5*pow((loc[0]-gaussian_heat_source_xpos)/gaussian_heat_source_width, 2))
* 0.5*(1 + tanh(10*(loc[1]-(m_domainHeight-gaussian_heat_source_depth) ) ));

}

}
}
}
}
}


void AMRLevelMushyLayer::setVelZero(FArrayBox &a_vel,
const FArrayBox &a_porosity,
const Real a_limit, const int a_radius)
Expand Down
27 changes: 27 additions & 0 deletions srcSubcycle/AMRLevelMushyLayerInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,30 @@ void AMRLevelMushyLayer::initialDataLens()

}

void AMRLevelMushyLayer::initialDataLinearGradient()
{
// Iterate over the different boxes on this level of refinement
DataIterator dit = m_grids.dataIterator();
for (dit.reset(); dit.ok(); ++dit)
{
// Iterate over the cells within each box
BoxIterator bit((*m_scalarNew[0])[dit].box());
for (bit.reset(); bit.ok(); ++bit)
{
// This is the location of the grid cell in indexing space
IntVect iv = bit();
// Get the location of this grid cell in x-y space
RealVect loc;
getLocation(iv, loc, m_dx);
// Set the enthalpy = -stefan number*z, where z is the vertical co-ordinate
// note that loc[1] is the vertical co-ordinate
(*m_scalarNew[ScalarVars::m_enthalpy])[dit](iv) = -m_parameters.stefan*loc[1];
// Set the bulk concentration
(*m_scalarNew[ScalarVars::m_bulkConcentration])[dit](iv) = -1.0;
}
}
}

void AMRLevelMushyLayer::initialDataSidewallHeating()
{
// heating in x direction, i.e. left/right walls;
Expand Down Expand Up @@ -2139,6 +2163,9 @@ void AMRLevelMushyLayer::initialData()
case 2:
initialDataLens();
break;
case 3: // if main.initData = 2, use this function:
initialDataLinearGradient();
break;
default:
initialDataDefault();
}
Expand Down