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

Use Component & Physics syntax #139

Open
wants to merge 37 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fe4046f
Create Enclosure and Structure components
lindsayad Jun 16, 2021
b8b3a10
Remove flow components since this hasnt been done yet
GiudGiud May 14, 2024
00d6956
Rework 0D enclosure to leverage Physics system: lets a SpeciesTrappin…
GiudGiud May 17, 2024
ba0e725
Add an option for a function temperature in equilibrium BC
GiudGiud May 18, 2024
1cf3e11
Add a Physics for trapping an arbitrary number of species on an enclo…
GiudGiud May 18, 2024
8a73dc5
Adapt shared parameters to definition of components
GiudGiud May 18, 2024
6f3030b
Remove functional enclosure, nothing more than enclosure
GiudGiud May 18, 2024
425aeb4
Clean up ver-1a a bit
GiudGiud May 18, 2024
d05d803
Add a component version of ver-1a
GiudGiud May 18, 2024
7641b32
Add a component-physics version of ver1b
GiudGiud May 23, 2024
d1bff27
Format input files
GiudGiud May 23, 2024
1d30d51
Fixup 1D structure for physics interaction
GiudGiud May 23, 2024
9be7fd0
reduce number of parameters on 1D structure
GiudGiud May 23, 2024
a0faf58
Change sign on flux
GiudGiud May 23, 2024
822876e
Fixup ver1a component test
GiudGiud May 23, 2024
91d2955
Remove scaling error on surface area
GiudGiud May 23, 2024
b21413d
Add a component-physics version of ver1c
GiudGiud May 23, 2024
ceb581e
Remove function, PPs since unused
GiudGiud May 23, 2024
2309aa5
Re-order species trapping into 0D and field physics
GiudGiud May 24, 2024
b58303c
Move enclosure physics to PointTrappingPhysics
GiudGiud May 24, 2024
40cdbac
Add a nodal (field) physics for trapping in a multiD component
GiudGiud May 24, 2024
5f4854e
New syntax idea for organizing trapping physics
GiudGiud May 24, 2024
74b42d3
Remove initialization of physics from component
GiudGiud May 24, 2024
123ce13
Add release term in mobile equation from trapped physics
GiudGiud May 24, 2024
e74f5c1
Add a component-physics version of ver1d
GiudGiud May 24, 2024
5201383
Use functors for component temperatures in physics and accomodate for…
GiudGiud May 24, 2024
053b1c7
Add a component physics version of ver 1e
GiudGiud May 24, 2024
51d8319
Add a component physics version of ver 1fa
GiudGiud May 24, 2024
c44b40a
Add a component physics version of ver 1fb
GiudGiud May 24, 2024
3b30c70
Add a component physics version of ver 1fc
GiudGiud May 24, 2024
6014360
Add a component physics version of ver 1fd
GiudGiud May 24, 2024
95641c7
Add a migration physics to also handle the reaction term
GiudGiud Jun 9, 2024
abcba5a
Add a test
GiudGiud Jun 9, 2024
1d148db
Pick a name for the physics
GiudGiud Jun 9, 2024
448a3ba
Clean up physics and components tests to make them all match defaults
GiudGiud Jun 10, 2024
5e78242
Parameter adjustments for trapping physics
GiudGiud Jun 10, 2024
b8c4e17
Adapt to ComponentAction -> ActionComponent rename
GiudGiud Sep 26, 2024
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
22 changes: 22 additions & 0 deletions include/base/EnclosureAdvectionReaction1D.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/********************************************************/
/* DO NOT MODIFY THIS HEADER */
/* TMAP8: Tritium Migration Analysis Program, Version 8 */
/* */
/* Copyright 2021 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/********************************************************/

#include "FlowModelSinglePhase.h"

class EnclosureAdvectionReaction1D : public FlowModelSinglePhase
{
public:
EnclosureAdvectionReaction1D(const InputParameters & params);

virtual void init() override;
virtual void addVariables() override;
virtual void addInitialConditions() override;
virtual void addMooseObjects() override;

static InputParameters validParams();
};
15 changes: 15 additions & 0 deletions include/base/TMAPUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/********************************************************/
/* DO NOT MODIFY THIS HEADER */
/* TMAP8: Tritium Migration Analysis Program, Version 8 */
/* */
/* Copyright 2021 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/********************************************************/

class InputParameters;

namespace TMAP
{
InputParameters structureCommonParams();
InputParameters enclosureCommonParams();
}
7 changes: 5 additions & 2 deletions include/bcs/EquilibriumBC.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ class EquilibriumBC : public ADNodalBC
const bool _enclosure_var_bool_scalar;
const ADVariableValue & _enclosure_var;

/// The temperature (K)
const ADVariableValue & _T;
/// The temperature as a variable (K)
const ADVariableValue * const _T;

/// The temperature as a function (K)
const Function * _T_function;

/// The number of atoms that compose our arbitrary unit for quantity
const Real _var_scaling_factor;
Expand Down
65 changes: 65 additions & 0 deletions include/components/Enclosure0D.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/********************************************************/
/* DO NOT MODIFY THIS HEADER */
/* TMAP8: Tritium Migration Analysis Program, Version 8 */
/* */
/* Copyright 2021 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/********************************************************/

#pragma once

#include "ActionComponent.h"
#include "PhysicsComponentBase.h"

/**
* Enclosure component which can trap a species, e.g. Tritium
*/
class Enclosure0D : public virtual ActionComponent, public PhysicsComponentBase
{
public:
Enclosure0D(const InputParameters & params);

static InputParameters validParams();

/// Return the species living on this component
const std::vector<NonlinearVariableName> & species() const { return _species; }
/// Return the scaling factors to use for these species
const std::vector<Real> & scalingFactors() const { return _scaling_factors; }
/// Return the initial conditions to use for these species
const std::vector<Real> & ics() const { return _ics; }
/// Return the temperature of this enclosure
Real temperature() const { return _temperature; }
/// Returns the scaled volume of the enclosure
virtual Real volume() const override { return _volume; }
/// 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;
}
/// Get the connected structure name
ComponentName connectedStructure() const
{
return getParam<ComponentName>("connected_structure");
}

protected:
virtual void initComponentPhysics() override;

/// Vector of the names of the species to track
std::vector<NonlinearVariableName> _species;
/// Scaling factors for the nonlinear species equations
std::vector<Real> _scaling_factors;
/// Initial conditions for each species
std::vector<Real> _ics;
/// Temperature of the enclosure
const Real _temperature;
/// Outer surface area of the enclosure
const Real _surface_area;
/// Volume of the enclosure
const Real _volume;
/// Surface connecting the enclosure with the structure
const std::vector<BoundaryName> _outer_boundaries;
};
38 changes: 38 additions & 0 deletions include/components/Structure1D.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/********************************************************/
/* DO NOT MODIFY THIS HEADER */
/* TMAP8: Tritium Migration Analysis Program, Version 8 */
/* */
/* Copyright 2021 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/********************************************************/

#pragma once

#include "ActionComponent.h"
#include "PhysicsComponentBase.h"

/**
* A 1D structure on which a species can diffuse
*/
class Structure1D : public virtual ActionComponent, public PhysicsComponentBase
{
public:
Structure1D(const InputParameters & params);

static InputParameters validParams();

virtual void addMeshGenerators() override;

/// Return the species diffused on this structures
const std::vector<NonlinearVariableName> & species() const { return _species; }
/// Return the initial conditions fhe species concentrations on this structure
const std::vector<Real> & ics() { return _ics; };

protected:
/// Names of the variables for the species
const std::vector<NonlinearVariableName> _species;
/// Initial values for the variables
const std::vector<Real> _ics;
/// Unit for the mesh
const Real _length_unit;
};
58 changes: 58 additions & 0 deletions include/physics/FieldTrappingPhysics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#pragma once

#include "SpeciesTrappingPhysicsBase.h"

class ActionComponent;

/**
* Creates all the objects needed to solve for the concentration of a scalar in traps distributed
* over a mesh.
*/
class FieldTrappingPhysics : public SpeciesTrappingPhysicsBase
{
public:
static InputParameters validParams();

FieldTrappingPhysics(const InputParameters & parameters);

void addComponent(const ActionComponent & component) override;

protected:
/// Return the name of the species variable
/// @param c_i index of the component
/// @param s_j index of the species
VariableName getSpeciesVariableName(unsigned int c_i, unsigned int s_j) const;

/// The mobile species of interest
std::vector<std::vector<VariableName>> _mobile_species_names;

// Properties on each component
/// Trapping rate coefficient for each component (outer indexing) and species (inner)
std::vector<std::vector<Real>> _alpha_ts;
/// Atomic number density of the host material
std::vector<Real> _Ns;
/// Fraction of host sites that contribute to trapping
std::vector<Real> _Ct0s;
/// Estimate for the ratio of the concentration magnitude of trapped species to free species for each component
std::vector<Real> _trap_per_frees;
///
std::vector<std::vector<Real>> _alpha_rs;
std::vector<std::vector<Real>> _trapping_energies;

/// Whether to define a single variable for each species for all components, or a different one for each component
const bool _single_variable_set;

private:
virtual void addNonlinearVariables() override;
virtual void addInitialConditions() override;
virtual void addFEKernels() override;
};
27 changes: 27 additions & 0 deletions include/physics/MultiSpeciesMigrationCG.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#pragma once

#include "MultiSpeciesDiffusionCG.h"

/**
* Creates all the objects needed to solve diffusion equations for multiple species with a
* continuous Galerkin finite element discretization
*/
class MultiSpeciesMigrationCG : public MultiSpeciesDiffusionCG
{
public:
static InputParameters validParams();

MultiSpeciesMigrationCG(const InputParameters & parameters);

private:
virtual void addFEKernels() override;
};
58 changes: 58 additions & 0 deletions include/physics/PointTrappingPhysics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#pragma once

#include "SpeciesTrappingPhysicsBase.h"

// Forward declarations
class ActionComponent;

/**
* Creates all the objects needed to solve for the concentration of a scalar in 0D trap(s).
*/
class PointTrappingPhysics : public SpeciesTrappingPhysicsBase
{
public:
static InputParameters validParams();

PointTrappingPhysics(const InputParameters & parameters);

void addComponent(const ActionComponent & component) override;

protected:
/// Equilibrium constants / solubilities?
std::vector<std::vector<Real>> _species_Ks;

/// Scaling factor for lengths
const Real _length_unit;
/// Scaling factor for pressures
const Real _pressure_unit;

private:
virtual void addNonlinearVariables() override;
virtual void addInitialConditions() override;
virtual void addScalarKernels() override;
virtual void addFEBCs() override;

/// Returns an error message if more than one boundary exists on the component
void checkSingleBoundary(const std::vector<BoundaryName> & boundaries,
const ComponentName & comp) const;

/// Get the variable name for the structure connected to the component
/// @param c_i index of the component
/// @param s_j index of the species
const VariableName & getConnectedStructureVariableName(unsigned int c_i, unsigned int s_j);
/// Get the boundary name for the surface connecting the structure to the component
/// @param c_i index of the component
const BoundaryName & getConnectedStructureBoundary(unsigned int c_i);
/// Get the Physics active on the structure connected to the component
/// @param c_i index of the component
const std::vector<PhysicsBase *> getConnectedStructurePhysics(unsigned int c_i);
};
Loading