Skip to content

Commit

Permalink
Added option for initial dilsocation density and skeleton of dislo de…
Browse files Browse the repository at this point in the history
…nsity equation in the PSI network (ORNL-Fusion#112).
  • Loading branch information
Sophie Blondel committed Aug 17, 2023
1 parent 3bad2aa commit d293466
Show file tree
Hide file tree
Showing 21 changed files with 376 additions and 26 deletions.
4 changes: 4 additions & 0 deletions test/options/OptionsTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ BOOST_AUTO_TEST_CASE(goodParamFile)
<< "fissionYield=0.3" << std::endl
<< "heVRatio=5.0" << std::endl
<< "migrationThreshold=1.0" << std::endl
<< "disloDensity=0.5" << std::endl
<< "fluxDepthProfileFilePath=path/to/the/flux/profile/file.txt"
<< std::endl;
goodParamFile.close();
Expand Down Expand Up @@ -229,6 +230,9 @@ BOOST_AUTO_TEST_CASE(goodParamFile)
// Check the migration threshold option
BOOST_REQUIRE_EQUAL(opts.getMigrationThreshold(), 1.0);

// Check the initial dislocation density option
BOOST_REQUIRE_EQUAL(opts.getDislocationDensity(), 0.5);

// Check the network filename
BOOST_REQUIRE_EQUAL(opts.getFluxDepthProfileFilePath(),
"path/to/the/flux/profile/file.txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class AlloyReactionNetwork : public ReactionNetwork<AlloyReactionNetwork>
{
}

KOKKOS_INLINE_FUNCTION
void
setConnectivity(Connectivity)
{
}

private:
double
checkLatticeParameter(double latticeParameter);
Expand Down
6 changes: 6 additions & 0 deletions xolotl/core/include/xolotl/core/network/FeReactionNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class FeReactionNetwork : public ReactionNetwork<FeReactionNetwork>
IndexType
checkLargestClusterId();

KOKKOS_INLINE_FUNCTION
void
setConnectivity(Connectivity)
{
}

private:
double
checkLatticeParameter(double latticeParameter);
Expand Down
3 changes: 3 additions & 0 deletions xolotl/core/include/xolotl/core/network/IReactionNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ class IReactionNetwork
virtual IndexType
getLargestClusterId() = 0;

virtual IndexType
getDisloDensityId() = 0;

/**
* @brief Returns an object representing the the bounds of each
* cluster in each dimension of the phase space.
Expand Down
6 changes: 6 additions & 0 deletions xolotl/core/include/xolotl/core/network/NEReactionNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ class NEReactionNetwork : public ReactionNetwork<NEReactionNetwork>
IndexType
checkLargestClusterId();

KOKKOS_INLINE_FUNCTION
void
setConnectivity(Connectivity)
{
}

private:
double
checkLatticeParameter(double latticeParameter);
Expand Down
27 changes: 27 additions & 0 deletions xolotl/core/include/xolotl/core/network/PSIReactionNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class PSIReactionNetwork :
using IndexType = typename Superclass::IndexType;
using ConcentrationsView = typename Superclass::ConcentrationsView;
using FluxesView = typename Superclass::FluxesView;
using Connectivity = typename Superclass::Connectivity;

using Superclass::Superclass;

Expand Down Expand Up @@ -134,6 +135,9 @@ class PSIReactionNetwork :
updateDesorptionLeftSideRate(
ConcentrationsView concentrations, IndexType gridIndex);

KOKKOS_INLINE_FUNCTION
void setConnectivity(Connectivity);

private:
double
checkLatticeParameter(double latticeParameter);
Expand All @@ -154,6 +158,25 @@ class PSIReactionNetwork :
return detail::PSIReactionGenerator<Species>{*this};
}

KOKKOS_INLINE_FUNCTION
double
getClimbVelocity(ConcentrationsView concentrations, IndexType gridIndex);

KOKKOS_INLINE_FUNCTION
double
getClimbVelocityPartialRho(
ConcentrationsView concentrations, IndexType gridIndex);

KOKKOS_INLINE_FUNCTION
double
getClimbVelocityPartialV(
ConcentrationsView concentrations, IndexType gridIndex);

KOKKOS_INLINE_FUNCTION
double
getClimbVelocityPartialI(ConcentrationsView concentrations,
IndexType gridIndex, IndexType clusterId);

private:
std::unique_ptr<detail::TrapMutationHandler> _tmHandler;
};
Expand All @@ -173,6 +196,7 @@ class PSIReactionGenerator :
using Subpaving = typename NetworkType::Subpaving;
using IndexType = typename NetworkType::IndexType;
using AmountType = typename NetworkType::AmountType;
using Connectivity = typename NetworkType::Connectivity;

using Superclass = ReactionGenerator<PSIReactionNetwork<TSpeciesEnum>,
PSIReactionGenerator<TSpeciesEnum>>;
Expand All @@ -189,6 +213,9 @@ class PSIReactionGenerator :
void
addSinks(IndexType i, TTag tag) const;

void
addConnectivity(Connectivity& conn);

private:
ReactionCollection<NetworkType>
getReactionCollection() const;
Expand Down
7 changes: 7 additions & 0 deletions xolotl/core/include/xolotl/core/network/ReactionNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ class ReactionNetwork : public ReactionNetworkInterface<TImpl>::Type
return asDerived()->checkLargestClusterId();
}

IndexType
getDisloDensityId() override
{
return getClusterDataMirror().DisloId();
}

Bounds
getAllClusterBounds() override;

Expand Down Expand Up @@ -695,6 +701,7 @@ class ReactionNetwork : public ReactionNetworkInterface<TImpl>::Type
std::map<std::string, SpeciesId> _speciesLabelMap;

ConnectivitiesView _constantConns;
Kokkos::View<IndexType*> _connEntries;

double _currentTime;
};
Expand Down
9 changes: 6 additions & 3 deletions xolotl/core/include/xolotl/core/network/ZrReactionNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ class ZrReactionNetwork : public ReactionNetwork<ZrReactionNetwork>
void
initializeExtraClusterData(const options::IOptions& options);

KOKKOS_INLINE_FUNCTION
void
setConnectivity(Connectivity)
{
}

private:
double
checkLatticeParameter(double latticeParameter);
Expand All @@ -66,9 +72,6 @@ class ZrReactionNetwork : public ReactionNetwork<ZrReactionNetwork>

detail::ZrReactionGenerator
getReactionGenerator() const noexcept;

void
defineReactions(Connectivity& connectivity);
};

namespace detail
Expand Down
7 changes: 3 additions & 4 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,8 @@ struct ClusterDataCommon
};

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

KOKKOS_INLINE_FUNCTION
IndexType
DisloId() const
Expand All @@ -238,7 +238,6 @@ struct ClusterDataCommon
setVal(_intVals, DISLO_ID, val);
}


KOKKOS_INLINE_FUNCTION
IndexType
heliumDisloId() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ class ReactionGeneratorBase
return _connectivity;
}

KOKKOS_INLINE_FUNCTION
void
addConnectivity(Connectivity& conn)
{
return;
}

protected:
TDerived*
asDerived()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ ReactionGeneratorBase<TNetwork, TDerived>::generateConnectivity(
DEVICE_LAMBDA(
auto&& reaction) { reaction.contributeConnectivity(tmpConn); });
}

Kokkos::fence();

this->asDerived()->addConnectivity(tmpConn);

// Get row map
auto counts = tmpConn.row_map;
auto nEntries =
Expand Down Expand Up @@ -242,6 +244,8 @@ ReactionGeneratorBase<TNetwork, TDerived>::generateConnectivity(
}
Kokkos::fence();

this->asDerived()->addConnectivity(tmpConn);

// Shrink to fit
Connectivity connectivity;
Kokkos::count_and_fill_crs(
Expand Down
6 changes: 3 additions & 3 deletions xolotl/core/include/xolotl/core/network/impl/PSIReaction.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ KOKKOS_INLINE_FUNCTION
double
PSIDisloSinkReaction<TSpeciesEnum>::getSinkStrength()
{
constexpr double pi = ::xolotl::core::pi;
constexpr double pi = ::xolotl::core::pi;
double grainSize = 50000.0; // 50 um
return 1.0 / (pi * grainSize * grainSize);
}
Expand All @@ -324,8 +324,8 @@ PSIDisloSinkReaction<TSpeciesEnum>::computeRate(
double dc = cl.getDiffusionCoefficient(gridIndex);

// Define the dislocation density
double disl = 1E-6; // #/nm-2
double disl = 1E-6; // #/nm-2

// Dislocation sink strength
double disl_strength = this->asDerived()->getSinkBias() * disl * dc;

Expand Down
Loading

0 comments on commit d293466

Please sign in to comment.