Skip to content

Commit

Permalink
Addition of DOF for dislocation density (ORNL-Fusion#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun Shah authored and Varun Shah committed Aug 8, 2023
1 parent bb298c3 commit 3bad2aa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
19 changes: 17 additions & 2 deletions xolotl/core/include/xolotl/core/network/detail/ClusterData.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ struct ClusterDataCommon
};

enum IntValsIndex : int
{
HELIUM_DISLO_ID = 0,
{
DISLO_ID = 0,
HELIUM_DISLO_ID,
HELIUM_GB_ID,
NUM_INT_VALS
};
Expand Down Expand Up @@ -223,6 +224,20 @@ struct ClusterDataCommon
{
setVal(_floatVals, ZETA, val);
}

KOKKOS_INLINE_FUNCTION
IndexType
DisloId() const
{
return _intVals[DISLO_ID];
}

void
setDisloId(IndexType val)
{
setVal(_intVals, DISLO_ID, val);
}


KOKKOS_INLINE_FUNCTION
IndexType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ void
PSIReactionNetwork<TSpeciesEnum>::initializeExtraDOFs(
const options::IOptions& options)
{
this->_clusterData.h_view().setDisloId(this->_numDOFs);
this->_numDOFs += 1;

if (!this->_enableSink) {
return;
}

this->_clusterData.h_view().setHeliumDisloId(this->_numDOFs);
this->_clusterData.h_view().setHeliumGBId(this->_numDOFs + 1);
this->_numDOFs += 2;
Expand Down
21 changes: 12 additions & 9 deletions xolotl/solver/src/monitor/PetscMonitor1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ PetscMonitor1D::setup(int loop)
outputFile << speciesName << "_surface ";
}
}
outputFile << "Helium_burst Deuterium_burst Tritium_burst ";
outputFile << "Helium_burst Deuterium_burst Tritium_burst Disl_dens ";
if (_solverHandler->isSink())
outputFile << "He_dislo He_GB";
outputFile << std::endl;
Expand Down Expand Up @@ -981,7 +981,7 @@ PetscMonitor1D::computeHeliumRetention(
// Store the concentration over the grid
auto numSpecies = network.getSpeciesListSize();
auto specIdI = network.getInterstitialSpeciesId();
auto myConcData = std::vector<double>(numSpecies + 2 * isSink, 0.0);
auto myConcData = std::vector<double>(numSpecies + 1 + 2 * isSink, 0.0);

// Declare the pointer for the concentrations at a specific grid point
PetscReal* gridPointSolution;
Expand Down Expand Up @@ -1016,10 +1016,13 @@ PetscMonitor1D::computeHeliumRetention(
for (auto id = core::network::SpeciesId(numSpecies); id; ++id) {
myConcData[id()] += totals[id()] * hx;
}
// Summed over 1d profile as of now
myConcData[numSpecies] +=
gridPointSolution[dof - 3] * hx; // Dislocation density
if (isSink) {
myConcData[numSpecies] +=
gridPointSolution[dof - 2] * hx; // He dislo
myConcData[numSpecies + 1] +=
gridPointSolution[dof - 2] * hx; // He dislo
myConcData[numSpecies + 2] +=
gridPointSolution[dof - 1] * hx; // He GB
}
}
Expand All @@ -1030,9 +1033,9 @@ PetscMonitor1D::computeHeliumRetention(
MPI_Comm_rank(xolotlComm, &procId);

// Determine total concentrations for He, D, T.
auto totalConcData = std::vector<double>(numSpecies + 2 * isSink, 0.0);
auto totalConcData = std::vector<double>(numSpecies + 1 + 2 * isSink, 0.0);

MPI_Reduce(myConcData.data(), totalConcData.data(), numSpecies + 2 * isSink,
MPI_Reduce(myConcData.data(), totalConcData.data(), numSpecies + 1 + 2 * isSink,
MPI_DOUBLE, MPI_SUM, 0, xolotlComm);

// Get the delta time from the previous timestep to this timestep
Expand Down Expand Up @@ -1249,10 +1252,10 @@ PetscMonitor1D::computeHeliumRetention(
}
auto tempHandler = _solverHandler->getTemperatureHandler();
outputFile << _nHeliumBurst << " " << _nDeuteriumBurst << " "
<< _nTritiumBurst << " ";
<< _nTritiumBurst << " " << totalConcData[numSpecies] << " ";
if (isSink) {
outputFile << totalConcData[numSpecies] << " "
<< totalConcData[numSpecies + 1];
outputFile << totalConcData[numSpecies + 1] << " "
<< totalConcData[numSpecies + 2];
}
outputFile << std::endl;
outputFile.close();
Expand Down

0 comments on commit 3bad2aa

Please sign in to comment.