Skip to content

Commit

Permalink
Adapt to ComponentAction -> ActionComponent rename
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed Sep 26, 2024
1 parent 5e78242 commit b8c4e17
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 32 deletions.
17 changes: 12 additions & 5 deletions include/components/Enclosure0D.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

#pragma once

#include "ComponentAction.h"
#include "PhysicsComponentHelper.h"
#include "ActionComponent.h"
#include "PhysicsComponentBase.h"

/**
* Enclosure component which can trap a species, e.g. Tritium
*/
class Enclosure0D : public virtual ComponentAction, public PhysicsComponentHelper
class Enclosure0D : public virtual ActionComponent, public PhysicsComponentBase
{
public:
Enclosure0D(const InputParameters & params);
Expand All @@ -34,9 +34,16 @@ class Enclosure0D : public virtual ComponentAction, public PhysicsComponentHelpe
/// Returns the scaled outer boundary surface area
virtual Real outerSurfaceArea() const override { return _surface_area; }
/// Returns the boundary of the enclosure, connecting with the structure
virtual const std::vector<BoundaryName> & outerSurfaceBoundaries() const override { _console << Moose::stringify(_outer_boundaries); return _outer_boundaries; }
virtual const std::vector<BoundaryName> & outerSurfaceBoundaries() const override
{
_console << Moose::stringify(_outer_boundaries);
return _outer_boundaries;
}
/// Get the connected structure name
ComponentName connectedStructure() const { return getParam<ComponentName>("connected_structure");}
ComponentName connectedStructure() const
{
return getParam<ComponentName>("connected_structure");
}

protected:
virtual void initComponentPhysics() override;
Expand Down
6 changes: 3 additions & 3 deletions include/components/Structure1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

#pragma once

#include "ComponentAction.h"
#include "PhysicsComponentHelper.h"
#include "ActionComponent.h"
#include "PhysicsComponentBase.h"

/**
* A 1D structure on which a species can diffuse
*/
class Structure1D : public virtual ComponentAction, public PhysicsComponentHelper
class Structure1D : public virtual ActionComponent, public PhysicsComponentBase
{
public:
Structure1D(const InputParameters & params);
Expand Down
4 changes: 3 additions & 1 deletion include/physics/FieldTrappingPhysics.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "SpeciesTrappingPhysicsBase.h"

class ActionComponent;

/**
* Creates all the objects needed to solve for the concentration of a scalar in traps distributed
* over a mesh.
Expand All @@ -22,7 +24,7 @@ class FieldTrappingPhysics : public SpeciesTrappingPhysicsBase

FieldTrappingPhysics(const InputParameters & parameters);

void addComponent(const ComponentAction & component) override;
void addComponent(const ActionComponent & component) override;

protected:
/// Return the name of the species variable
Expand Down
5 changes: 4 additions & 1 deletion include/physics/PointTrappingPhysics.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "SpeciesTrappingPhysicsBase.h"

// Forward declarations
class ActionComponent;

/**
* Creates all the objects needed to solve for the concentration of a scalar in 0D trap(s).
*/
Expand All @@ -21,7 +24,7 @@ class PointTrappingPhysics : public SpeciesTrappingPhysicsBase

PointTrappingPhysics(const InputParameters & parameters);

void addComponent(const ComponentAction & component) override;
void addComponent(const ActionComponent & component) override;

protected:
/// Equilibrium constants / solubilities?
Expand Down
1 change: 1 addition & 0 deletions src/bcs/EquilibriumBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ EquilibriumBC::EquilibriumBC(const InputParameters & parameters)
_Ko(getParam<Real>("Ko")),
_Ea(getParam<Real>("activation_energy")),
_p(getParam<Real>("p")),
_enclosure_var_bool_scalar(isCoupled("enclosure_scalar_var")),
_enclosure_var(adCoupledScalarValue("enclosure_scalar_var")),
_T(isParamValid("temp") ? &adCoupledValue("temp") : nullptr),
_T_function(isParamValid("temperature") ? &getFunction("temperature") : nullptr),
Expand Down
8 changes: 4 additions & 4 deletions src/components/Enclosure0D.C
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ registerMooseAction("TMAP8App", Enclosure0D, "init_component_physics");
InputParameters
Enclosure0D::validParams()
{
auto params = ComponentAction::validParams();
params += PhysicsComponentHelper::validParams();
auto params = ActionComponent::validParams();
params += PhysicsComponentBase::validParams();
params += TMAP::enclosureCommonParams();
params.makeParamRequired<std::vector<PhysicsName>>("physics");
return params;
}

Enclosure0D::Enclosure0D(const InputParameters & params)
: ComponentAction(params),
PhysicsComponentHelper(params),
: ActionComponent(params),
PhysicsComponentBase(params),
_species(getParam<std::vector<NonlinearVariableName>>("species")),
_scaling_factors(isParamValid("species_scaling_factors")
? getParam<std::vector<Real>>("species_scaling_factors")
Expand Down
10 changes: 5 additions & 5 deletions src/components/Structure1D.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ registerMooseAction("TMAP8App", Structure1D, "init_component_physics");
InputParameters
Structure1D::validParams()
{
auto params = ComponentAction::validParams();
params += PhysicsComponentHelper::validParams();
auto params = ActionComponent::validParams();
params += PhysicsComponentBase::validParams();
params += TMAP::structureCommonParams();
params.addRequiredParam<unsigned int>("nx", "The number of elements in the structure.");
params.addRequiredParam<Real>("xmax", "The maximum x-value.");
Expand All @@ -26,8 +26,8 @@ Structure1D::validParams()
}

Structure1D::Structure1D(const InputParameters & params)
: ComponentAction(params),
PhysicsComponentHelper(params),
: ActionComponent(params),
PhysicsComponentBase(params),
_species(getParam<std::vector<NonlinearVariableName>>("species")),
_ics(getParam<std::vector<Real>>("species_initial_concentrations")),
_length_unit(getParam<Real>("length_unit_scaling"))
Expand All @@ -52,7 +52,7 @@ Structure1D::addMeshGenerators()
"GeneratedMeshGenerator", name() + "_base", params);

// Keep track of the component mesh
_mg_name = name() + "_base";
_mg_names.push_back(name() + "_base");
_outer_boundaries.push_back(name() + "_left");
_outer_boundaries.push_back(name() + "_right");
_blocks.push_back(name());
Expand Down
4 changes: 2 additions & 2 deletions src/physics/FieldTrappingPhysics.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "FieldTrappingPhysics.h"
#include "ComponentAction.h"
#include "ActionComponent.h"
#include "MooseUtils.h"

// Register the actions for the objects actually used
Expand Down Expand Up @@ -85,7 +85,7 @@ FieldTrappingPhysics::FieldTrappingPhysics(const InputParameters & parameters)
}

void
FieldTrappingPhysics::addComponent(const ComponentAction & component)
FieldTrappingPhysics::addComponent(const ActionComponent & component)
{
for (const auto & block : component.blocks())
_blocks.push_back(block);
Expand Down
27 changes: 16 additions & 11 deletions src/physics/PointTrappingPhysics.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "PointTrappingPhysics.h"
#include "MooseUtils.h"
#include "ComponentAction.h"
#include "ActionComponent.h"
#include "Enclosure0D.h"

// For connecting to multi-D diffusion on other components
Expand All @@ -27,7 +27,8 @@ InputParameters
PointTrappingPhysics::validParams()
{
InputParameters params = SpeciesTrappingPhysicsBase::validParams();
params.addClassDescription("Add Physics for the trapping of species on enclosures / 0D components.");
params.addClassDescription(
"Add Physics for the trapping of species on enclosures / 0D components.");

params.addRequiredParam<std::vector<std::vector<Real>>>(
"equilibrium_constants",
Expand Down Expand Up @@ -64,7 +65,7 @@ PointTrappingPhysics::PointTrappingPhysics(const InputParameters & parameters)
}

void
PointTrappingPhysics::addComponent(const ComponentAction & component)
PointTrappingPhysics::addComponent(const ActionComponent & component)
{
checkComponentType<Enclosure0D>(component);
const auto & comp = dynamic_cast<const Enclosure0D &>(component);
Expand Down Expand Up @@ -94,8 +95,12 @@ PointTrappingPhysics::addComponent(const ComponentAction & component)
comp.ics(),
true,
std::vector<Real>(0, n_species_component));
processComponentParameters<MooseFunctorName>(
"temperatures", comp.name(), _component_temperatures, std::to_string(comp.temperature()), false, "0");
processComponentParameters<MooseFunctorName>("temperatures",
comp.name(),
_component_temperatures,
std::to_string(comp.temperature()),
false,
"0");

// TODO: check that inputs are consistent once all components have been added.
// - the pressure, temperature and the scaling factors should be positive (defense in depth from
Expand Down Expand Up @@ -149,7 +154,7 @@ PointTrappingPhysics::addScalarKernels()
{
// Get the boundary from the component
const auto & comp_name = _components[c_i];
const auto & component = getComponent(comp_name);
const auto & component = getActionComponent(comp_name);
const auto & structure_boundary = getConnectedStructureBoundary(c_i);
const auto scaled_volume = component.volume() * Utility::pow<3>(_length_unit);
const auto scaled_area = component.outerSurfaceArea() * Utility::pow<2>(_length_unit);
Expand Down Expand Up @@ -222,7 +227,7 @@ PointTrappingPhysics::addFEBCs()

void
PointTrappingPhysics::checkSingleBoundary(const std::vector<BoundaryName> & boundaries,
const ComponentName & comp_name) const
const ComponentName & comp_name) const
{
if (boundaries.size() != 1)
paramError("components",
Expand All @@ -234,7 +239,7 @@ const VariableName &
PointTrappingPhysics::getConnectedStructureVariableName(unsigned int c_i, unsigned int s_j)
{
const auto & comp_name = _components[c_i];
const auto & component = getComponent(comp_name);
const auto & component = getActionComponent(comp_name);
const auto multi_D_physics = getConnectedStructurePhysics(c_i);
if (multi_D_physics.empty())
component.paramError("connected_structure",
Expand All @@ -257,7 +262,7 @@ const BoundaryName &
PointTrappingPhysics::getConnectedStructureBoundary(unsigned int c_i)
{
const auto & comp_name = _components[c_i];
const auto & component = getComponent(comp_name);
const auto & component = getActionComponent(comp_name);
const auto & boundaries = component.outerSurfaceBoundaries();
checkSingleBoundary(boundaries, comp_name);
return boundaries[0];
Expand All @@ -267,8 +272,8 @@ const std::vector<PhysicsBase *>
PointTrappingPhysics::getConnectedStructurePhysics(unsigned int c_i)
{
const auto comp_name = _components[c_i];
const auto & component = dynamic_cast<const Enclosure0D &>(getComponent(comp_name));
const auto & structure = getComponent(component.connectedStructure());
const auto & component = dynamic_cast<const Enclosure0D &>(getActionComponent(comp_name));
const auto & structure = getActionComponent(component.connectedStructure());
checkComponentType<Structure1D>(structure);
return dynamic_cast<const Structure1D &>(structure).getPhysics();
}

0 comments on commit b8c4e17

Please sign in to comment.