diff --git a/framework/doc/content/media/meshmodifiers/esm_ic.jpg b/framework/doc/content/media/meshmodifiers/esm_ic.jpg deleted file mode 100644 index 4ecb5868797d..000000000000 Binary files a/framework/doc/content/media/meshmodifiers/esm_ic.jpg and /dev/null differ diff --git a/framework/doc/content/media/meshmodifiers/esm_irreversible.jpg b/framework/doc/content/media/meshmodifiers/esm_irreversible.jpg deleted file mode 100644 index 535e359dca1e..000000000000 Binary files a/framework/doc/content/media/meshmodifiers/esm_irreversible.jpg and /dev/null differ diff --git a/framework/doc/content/media/meshmodifiers/esm_material.jpg b/framework/doc/content/media/meshmodifiers/esm_material.jpg deleted file mode 100644 index 486a7df9f6ea..000000000000 Binary files a/framework/doc/content/media/meshmodifiers/esm_material.jpg and /dev/null differ diff --git a/framework/doc/content/media/meshmodifiers/esm_nodeset.jpg b/framework/doc/content/media/meshmodifiers/esm_nodeset.jpg deleted file mode 100644 index b8d132081999..000000000000 Binary files a/framework/doc/content/media/meshmodifiers/esm_nodeset.jpg and /dev/null differ diff --git a/framework/doc/content/media/meshmodifiers/esm_reversible.jpg b/framework/doc/content/media/meshmodifiers/esm_reversible.jpg deleted file mode 100644 index 8ca1463a8cdd..000000000000 Binary files a/framework/doc/content/media/meshmodifiers/esm_reversible.jpg and /dev/null differ diff --git a/framework/doc/content/media/meshmodifiers/esm_sideset.jpg b/framework/doc/content/media/meshmodifiers/esm_sideset.jpg deleted file mode 100644 index 3553ab92d5f8..000000000000 Binary files a/framework/doc/content/media/meshmodifiers/esm_sideset.jpg and /dev/null differ diff --git a/framework/doc/content/media/meshmodifiers/ext.png b/framework/doc/content/media/meshmodifiers/ext.png new file mode 100644 index 000000000000..3a7d4b792865 Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/ext.png differ diff --git a/framework/doc/content/media/meshmodifiers/from_into.png b/framework/doc/content/media/meshmodifiers/from_into.png new file mode 100644 index 000000000000..a9252d950bc4 Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/from_into.png differ diff --git a/framework/doc/content/media/meshmodifiers/init_cond.png b/framework/doc/content/media/meshmodifiers/init_cond.png new file mode 100644 index 000000000000..9882ee890191 Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/init_cond.png differ diff --git a/framework/doc/content/media/meshmodifiers/into.png b/framework/doc/content/media/meshmodifiers/into.png new file mode 100644 index 000000000000..acb6035d9bfa Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/into.png differ diff --git a/framework/doc/content/media/meshmodifiers/irrev.png b/framework/doc/content/media/meshmodifiers/irrev.png new file mode 100644 index 000000000000..37afa95a3e6a Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/irrev.png differ diff --git a/framework/doc/content/media/meshmodifiers/nodeset.png b/framework/doc/content/media/meshmodifiers/nodeset.png new file mode 100644 index 000000000000..84ef309692a2 Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/nodeset.png differ diff --git a/framework/doc/content/media/meshmodifiers/none.png b/framework/doc/content/media/meshmodifiers/none.png new file mode 100644 index 000000000000..cef04f9a51b4 Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/none.png differ diff --git a/framework/doc/content/media/meshmodifiers/orig.png b/framework/doc/content/media/meshmodifiers/orig.png new file mode 100644 index 000000000000..7f54d56f39bd Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/orig.png differ diff --git a/framework/doc/content/media/meshmodifiers/rev.png b/framework/doc/content/media/meshmodifiers/rev.png new file mode 100644 index 000000000000..66a624703283 Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/rev.png differ diff --git a/framework/doc/content/media/meshmodifiers/stateful_prop.png b/framework/doc/content/media/meshmodifiers/stateful_prop.png new file mode 100644 index 000000000000..9e04719ca36b Binary files /dev/null and b/framework/doc/content/media/meshmodifiers/stateful_prop.png differ diff --git a/framework/doc/content/source/meshmodifiers/CoupledVarThresholdElementSubdomainModifier.md b/framework/doc/content/source/meshmodifiers/CoupledVarThresholdElementSubdomainModifier.md index 839edd62dfcb..bc92a45c1286 100644 --- a/framework/doc/content/source/meshmodifiers/CoupledVarThresholdElementSubdomainModifier.md +++ b/framework/doc/content/source/meshmodifiers/CoupledVarThresholdElementSubdomainModifier.md @@ -13,12 +13,12 @@ The `CoupledVarThresholdElementSubdomainModifier` can model The `CoupledVarThresholdElementSubdomainModifier` changes the element subdomain based on the given criterion. It also handles the corresponding - Moving boundary/interface nodeset/sideset modification, -- Solution initialization, and -- Stateful material property initialization, +- Solution reinitialization, and +- Stateful material property reinitialization, -all of which are demonstrated using the following example. +all of which are demonstrated below. -Consider a unit square domain, and an auxiliary variable defined by the function $\phi(x,y,t) = (x-t)^2+y^2-0.5^2$. The function represents a signed-distance function of a circle of radius $0.5$ whose center is moving along the x-axis towards right. +Consider a unit square domain, and an auxiliary variable defined by the function $\phi(x,y,t) = (x-t)^2+y^2-0.5^2$. The function represents a signed-distance function of a circle of radius $0.5$ whose center is moving along the x-axis towards the right. Initially, the domain is decomposed by a vertical line $x=0.25$. The elements on the left side of the vertical line have subdomain ID of 1, and the elements on the right side have subdomain ID of 2. The `CoupledVarThresholdElementSubdomainModifier` is used to change the subdomain ID from 2 to 1 for elements within the circle. @@ -28,42 +28,77 @@ If the `CoupledVarThresholdElementSubdomainModifier` is applied onto the entire !listing test/tests/meshmodifiers/element_subdomain_modifier/reversible.i start=[moving_circle] end=[] include-end=true -!media media/meshmodifiers/esm_reversible.jpg style=float:center;width:100%; caption=The result of a reversible element subdomain modifier at three different time steps +!media media/meshmodifiers/rev.png style=float:center;width:100%; caption=The result of a reversible element subdomain modifier at three different time steps However, in many applications, e.g. element death and activation, the equivalent movement of element subdomains is not reversible. In this case, omitting the parameter `complement_subdomain_id` will make the subdomain modification irreversible: -!listing test/tests/meshmodifiers/element_subdomain_modifier/block_restricted.i start=[moving_circle] end=[] include-end=true +!listing test/tests/meshmodifiers/element_subdomain_modifier/irreversible.i start=[moving_circle] end=[] include-end=true -!media media/meshmodifiers/esm_irreversible.jpg style=float:center;width:100%; caption=The result of an irreversible element subdomain modifier at three different time steps +!media media/meshmodifiers/irrev.png style=float:center;width:100%; caption=The result of an irreversible element subdomain modifier at three different time steps ## Moving boundary/interface nodeset/sideset modification -The change of element subdomains will alter the definition of certain sidesets and nodesets. The `CoupledVarThresholdElementSubdomainModifier` optionally takes the parameter `moving_boundary_name` to help modify the corresponding sideset/nodeset. If the boundary provided through the `moving_boundary_name` parameter already exists, the modifier will attempt to modify the provided sideset/nodeset whenever an element changes subdomain. If the boundary does not exist, the modifier will create a sideset and a nodeset with the provided name. +The change of element subdomains will alter the definitions of certain sidesets and nodesets. The parameters `moving_boundaries` and `moving_boundary_subdomain_pairs` can optionally be used to modify the corresponding sidesets/nodesets. The pair of subdomains that each boundary in `moving_boundaries` lies between must be specified in the corresponding `moving_boundary_subdomain_pairs`, with the element side from the first subdomain added to the boundary. -!media media/meshmodifiers/esm_sideset.jpg style=float:center;width:100%; caption=The evolving sideset (green) at three different time steps +If the boundaries provided through `moving_boundaries` already exist, the modifier will attempt to modify the provided sidesets/nodesets whenever an element changes subdomain ID. If the boundaries do not exist, the modifier will create sidesets and nodesets with the provided names. -!media media/meshmodifiers/esm_nodeset.jpg style=float:center;width:100%; caption=The evolving nodeset (green) at three different time steps +!listing test/tests/meshmodifiers/element_subdomain_modifier/moving_boundary.i start=[moving_circle] end=[] include-end=true -Nodal and integrated BCs can be applied on the moving boundary. +!media media/meshmodifiers/nodeset.png style=float:center;width:100%; caption=The evolving nodeset (green) between subdomains 1 and 2, as created by the modifier without an existing boundary. + +If only one boundary is provided but multiple pairs of subdomains are specified, then all the pairs are applied to the one boundary. Element sides on a subdomain's external boundary can be added by specifying only one subdomain. + +!listing test/tests/meshmodifiers/element_subdomain_modifier/external_moving_boundary.i start=[ext] end=[AuxVariables] include-end=false -## Solution initialization +!media media/meshmodifiers/ext.png style=float:center;width:100%; caption=The evolving sideset (green) around subdomain 1, including the external element sides, from an existing boundary. + +Nodal and integrated BCs can be applied on the moving boundary. -Depending on the physics, one may or may not want to initialize the solution when an element and its related nodes change subdomain. -The parameter `apply_initial_conditions` defaults to true and determines whether the initial conditions should be re-evaluated. +## Solution reinitialization -Suppose initially there is an auxiliary variable $u=1$ everywhere inside the domain, and the variable value in subdomain 1 (blue) doubles at each time step: +By default, all elements that change subdomain ID are reinitialized to the new subdomain's initial condition. Suppose the auxiliary variable $u$ has an initial variable value of $1$ in subdomain 1 and $-0.5$ in subdomain 2, and the variable value doubles at each timestep in subdomain 1: -!listing test/tests/meshmodifiers/element_subdomain_modifier/initial_condition.i start=[AuxVariables] end=[Executioner] +!listing test/tests/meshmodifiers/element_subdomain_modifier/initial_condition.i start=[ICs] end=[Postprocessors] -!media media/meshmodifiers/esm_ic.jpg style=float:center;width:100%; caption=The auxiliary variable $u$ at three different time steps +!media media/meshmodifiers/init_cond.png style=float:center;width:100%; caption=The auxiliary variable $u$ is reinitialized to $1$, which doubles over the timestep to $2$, for all the elements that change subdomain ID to 1 -## Stateful material property initialization +## Stateful material property reinitialization -Similarly, all stateful material properties will be re-initialized when an element changes subdomain. Suppose initially the diffusivity is $0.5$ everywhere, and the diffusivity doubles at each time step: +Similarly, all stateful material properties will be re-initialized when an element changes subdomain ID. Suppose initially the diffusivity is $0.5$ in subdomain 1 and $-1$ in subdomain 2, and the diffusivity doubles at each time step in subdomain 1: !listing test/tests/meshmodifiers/element_subdomain_modifier/stateful_property.i start=[Materials] end=[Executioner] -!media media/meshmodifiers/esm_material.jpg style=float:center;width:100%; caption=The diffusivity at three different time steps +!media media/meshmodifiers/stateful_prop.png style=float:center;width:100%; caption=The diffusivity is reinitialized to $0.5$, which doubles over the timestep to $1$, for all the elements that change subdomain ID to 1. + +## Reinitialization restrictions + +Depending on the physics, one may or may not want to reinitialize the solution when an element and its related nodes change subdomain ID. For the below examples, consider a unit square domain decomposed by vertical lines $x=0.3$ and $x=0.6$. The elements on the left have subdomain ID of 1, the elements in the middle have subdomain ID of 2, and the elements on the right have subdomain ID of 3. + +Two auxiliary variables are defined by the functions $\phi(x,y,t) = (x-t)^2+y^2-0.3^2$ and $\phi(x,y,t) = (x-t)^2+(y-1)^2-0.3^2$, which represent the signed-distance functions of circles of radius $0.3$ whose centers are moving along the bottom and top of the square respectively. The `CoupledVarThresholdElementSubdomainModifier` is used to change the subdomain ID to 1 for elements within the bottom circle, and to subdomain ID 2 for elements within the top circle. + +An auxiliary variable $u$ is defined over the domain, with initial values of 1, 2, and 3 in subdomains 1, 2, and 3 respectively: + +!listing test/tests/meshmodifiers/element_subdomain_modifier/reinitialization.i start=[MeshModifiers] end=[AuxVariables] + +!media media/meshmodifiers/orig.png style=float:center;width:100%; caption=The default behaviour of the modifier is to reinitializate all elements that change subdomain ID. + +However, if a list of subdomains (IDs or names) is provided through the parameter `reinitialize_subdomains`, the reinitialization only occurs if an element changes subdomain ID, and the new subdomain ID is in the list: + +!listing test/tests/meshmodifiers/element_subdomain_modifier/reinitialization_into.i start=[MeshModifiers] end=[AuxVariables] + +!media media/meshmodifiers/into.png style=float:center;width:100%; caption=Reinitialization of only the elements that change subdomain ID to 1. + +If an empty list is given in `reinitialize_subdomains`, then there is no reinitialization of any elements that change subdomain ID. + +!listing test/tests/meshmodifiers/element_subdomain_modifier/no_reinitialization.i start=[MeshModifiers] end=[AuxVariables] + +!media media/meshmodifiers/none.png style=float:center;width:100%; caption=No reinitialization of any elements that change subdomain ID. + +Reinitialization can be further restricted by setting the parameter `previous_subdomain_reinitialized` to `false`. The modifier will then additionally check the changing element's previous subdomain ID. Reinitialization will only occur if the previous subdomain ID was not in the list provided in the parameter `reinitialize_subdomains`. + +!listing test/tests/meshmodifiers/element_subdomain_modifier/reinitialization_from_into.i start=[MeshModifiers] end=[AuxVariables] + +!media media/meshmodifiers/from_into.png style=float:center;width:100%; caption=Reinitialization of only the elements which change subdomain ID from 3, to subdomain IDs 1 or 2. !syntax parameters /MeshModifiers/CoupledVarThresholdElementSubdomainModifier diff --git a/framework/include/meshmodifiers/ElementSubdomainModifier.h b/framework/include/meshmodifiers/ElementSubdomainModifier.h index e40983edc8ac..a360bd220004 100644 --- a/framework/include/meshmodifiers/ElementSubdomainModifier.h +++ b/framework/include/meshmodifiers/ElementSubdomainModifier.h @@ -9,149 +9,33 @@ #pragma once -#include "ElementUserObject.h" -#include "NonlinearSystemBase.h" -#include "AuxiliarySystem.h" +#include "ElementSubdomainModifierBase.h" -class ElementSubdomainModifier : public ElementUserObject +class ElementSubdomainModifier : public ElementSubdomainModifierBase { public: static InputParameters validParams(); ElementSubdomainModifier(const InputParameters & parameters); - virtual void initialSetup() override; virtual void initialize() override; virtual void execute() override; virtual void threadJoin(const UserObject & /*uo*/) override; virtual void finalize() override; protected: - /// Compute the subdomain ID of the current element + /** + * Compute the subdomain ID of the current element + * + * If the computed subdomain ID is different from the current element's current subdomain ID, the + * current element WILL be "moved" from its current subdomain to the computed subdomain. + * + * If the computed subdomain ID is (1) the same as the current element's current subdomain ID or + * (2) Moose::INVALID_BLOCK_ID, the current element does not participate in subdomain modification + * activities. + */ virtual SubdomainID computeSubdomainID() = 0; - /// The ID of the moving boundary that this object creates/modifies. - BoundaryID movingBoundaryID() const - { - if (!_moving_boundary_specified) - mooseError("no moving boundary specified"); - return _moving_boundary_id; - } - - /// The ID of the complement moving boundary that this object creates/modifies. - BoundaryID complementMovingBoundaryID() const - { - if (!_complement_moving_boundary_specified) - mooseError("no complement moving boundary specified"); - return _complement_moving_boundary_id; - } - - /// The name of the moving boundary that this object creates/modifies. - const BoundaryName movingBoundaryName() const - { - if (!_moving_boundary_specified) - mooseError("no moving boundary specified"); - return _moving_boundary_name; - } - - /// The name of the complement moving boundary that this object creates/modifies. - const BoundaryName complementMovingBoundaryName() const - { - if (!_complement_moving_boundary_specified) - mooseError("no complement moving boundary specified"); - return _complement_moving_boundary_name; - } - - /// Range of the elements who changed their subdomain ID - ConstElemRange & movedElemsRange() const { return *_moved_elems_range; } - - /// Range of the boundary nodes on moved elements - ConstBndNodeRange & movedBndNodesRange() const { return *_moved_bnd_nodes_range; } - - /// Pointer to the displaced problem - DisplacedProblem * _displaced_problem; - -private: - /// Set the name of the moving boundary. Create the nodeset/sideset if not exist. - void setMovingBoundaryName(MooseMesh & mesh); - - /// Set the name of the complement moving boundary. Create the nodeset/sideset if not exist. - void setComplementMovingBoundaryName(MooseMesh & mesh); - - /// Update the moving boundary (both the underlying sideset and nodeset) - void updateMovingBoundaryInfo(MooseMesh & mesh, const std::vector & moved_elems); - - /// Update the complement boundary (both the underlying sideset and nodeset) - void updateComplementBoundaryInfo(MooseMesh & mesh, - const std::vector & moved_elems); - - /// Remove ghosted element sides - void pushBoundarySideInfo(MooseMesh & mesh); - - /// Remove ghosted boundary nodes - void pushBoundaryNodeInfo(MooseMesh & mesh); - - /// synchronize boundary information across processors - void synchronizeBoundaryInfo(MooseMesh & mesh); - - /// Change the subdomain ID of all ancestor elements - void setAncestorsSubdomainIDs(const SubdomainID & subdomain_id, const dof_id_type & elem_id); - - /// Helper function to build the range of moved elements - void buildMovedElemsRange(); - - /// Helper function to build the range of boundary nodes on moved elements - void buildMovedBndNodesRange(); - - /// Set old and older solutions to be the same as the current solution - void setOldAndOlderSolutionsForMovedNodes(SystemBase & sys); - - /// Elements on the undisplaced mesh whose subdomain IDs have changed - std::vector _moved_elems; - - /// Elements on the displaced mesh whose subdomain IDs have changed - std::vector _moved_displaced_elems; - - /// Nodes on the moved elements - std::set _moved_nodes; - - /// Range of the moved elements - std::unique_ptr _moved_elems_range; - - /// Range of the boundary nodes on the moved elements - std::unique_ptr _moved_bnd_nodes_range; - - /// Whether to re-apply ICs on moved elements and moved nodes - const bool _apply_ic; - - /// Whether a moving boundary name is provided - const bool _moving_boundary_specified; - - /// Whether a complement moving boundary name is provided - const bool _complement_moving_boundary_specified; - - /// The name of the moving boundary - BoundaryName _moving_boundary_name; - - /// The name of the complement moving boundary - BoundaryName _complement_moving_boundary_name; - - /// The Id of the moving boundary - BoundaryID _moving_boundary_id; - - /// The Id of the complement moving boundary - BoundaryID _complement_moving_boundary_id; - - /// save the added/removed ghost sides to sync across processors - std::unordered_map>> - _complement_ghost_sides_to_remove, _complement_ghost_sides_to_add, _ghost_sides_to_add; - - /// save the added/removed ghost nodes to sync across processors - std::unordered_map> _complement_ghost_nodes_to_remove; - - /// Any subdomain change is stored in this map and only applied in finalize to avoid messing up other UOs - std::vector> _cached_subdomain_assignments; - - /// Subdomains between that the moving boundary is - std::set _moving_boundary_subdomains; + /// Element subdomain assignments + std::unordered_map> _moved_elems; }; diff --git a/framework/include/meshmodifiers/ElementSubdomainModifierBase.h b/framework/include/meshmodifiers/ElementSubdomainModifierBase.h new file mode 100644 index 000000000000..db361f90b002 --- /dev/null +++ b/framework/include/meshmodifiers/ElementSubdomainModifierBase.h @@ -0,0 +1,138 @@ +//* 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 "ElementUserObject.h" +#include "NonlinearSystemBase.h" +#include "AuxiliarySystem.h" + +class ElementSubdomainModifierBase : public ElementUserObject +{ +public: + static InputParameters validParams(); + + ElementSubdomainModifierBase(const InputParameters & parameters); + + virtual void initialSetup() override; + virtual void meshChanged() override; + +protected: + /** + * Modify the element subdomains + * + * This method performs the following mesh/system modifications given the list of element + * subdomain assignment: + * 1. Moving boundaries are created (if it doesn't already exist) according to the specified + * subdomain pairs. + * 2. Active (in the context of adaptivity) elements' subdomain IDs are modified per request. + * 3. Existing moving boundaries are updated according to the new subdomains. + * 4. The equation system is reinitialized to (de)allocate for the new subdomains. + * 5. Variables and stateful material properties on elements which have moved into specified + subdomains are reinitialized. + * + * @param moved_elems A dictionary of element subdomain assignments. Key of this dictionary is the + * element ID, first entry of the value pair is the subdomain ID this element is moving _from_, + * and the second entry of the value pair is the subdomain ID this element is moving _to_. + */ + virtual void + modify(const std::unordered_map> & moved_elems); + + /// Determine if a subdomain is to be reinitialized + bool subdomainIsReinitialized(SubdomainID id) const; + + /// Pointer to the displaced problem + DisplacedProblem * _displaced_problem; + + /// Displaced mesh + MooseMesh * _displaced_mesh; + + /// Boundary names associated with each moving boundary ID + std::unordered_map _moving_boundary_names; + +private: + /// Create moving boundaries + void createMovingBoundaries(MooseMesh & mesh); + + void applySubdomainChanges( + const std::unordered_map> & moved_elems, + MooseMesh & mesh); + + /// Change the subdomain ID of all ancestor elements + void setAncestorsSubdomainIDs(Elem * elem, const SubdomainID subdomain_id); + + void gatherMovingBoundaryChanges( + const std::unordered_map> & moved_elems); + + void gatherMovingBoundaryChangesHelper(const Elem * elem, + unsigned short side, + const Elem * neigh, + unsigned short neigh_side); + + void applyMovingBoundaryChanges(MooseMesh & mesh); + + void removeInactiveMovingBoundary(MooseMesh & mesh); + + void findReinitializedElemsAndNodes( + const std::unordered_map> & moved_elems); + + /// Set old and older solutions to reinitialized elements and nodes + void setOldAndOlderSolutions(SystemBase & sys, + ConstElemRange & elem_range, + ConstBndNodeRange & bnd_node_range); + + /// Determine if a node is newly activated + bool nodeIsNewlyReinitialized(dof_id_type node_id) const; + + void applyIC(bool displaced); + + void initElementStatefulProps(bool displaced); + + /// Range of reinitialized elements + ConstElemRange & reinitializedElemRange(bool displaced = false); + + /// Range of reinitialized boundary nodes + ConstBndNodeRange & reinitializedBndNodeRange(bool displaced = false); + + /// Reinitialize moved elements whose new subdomain is in this list + std::vector _subdomain_ids_to_reinitialize; + + /// Whether to reinitialize moved elements whose old subdomain was in _reinitialize_subdomains + const bool _previous_subdomain_reinitialized; + + /// Moving boundaries associated with each subdomain pair + typedef std::pair SubdomainPair; + std::unordered_map _moving_boundaries; + + /// Element sides to be added + std::unordered_map> + _add_element_sides; + + /// Element sides to be removed + std::unordered_map> + _remove_element_sides; + + /// Neighbor sides to be added + std::unordered_map> + _add_neighbor_sides; + + /// Neighbor sides to be removed + std::unordered_map> + _remove_neighbor_sides; + + /// Range of reinitialized elements + std::unordered_set _reinitialized_elems; + std::unique_ptr _reinitialized_elem_range; + std::unique_ptr _reinitialized_displaced_elem_range; + + /// Range of reinitialized boundary nodes + std::unordered_set _reinitialized_nodes; + std::unique_ptr _reinitialized_bnd_node_range; + std::unique_ptr _reinitialized_displaced_bnd_node_range; +}; diff --git a/framework/src/meshmodifiers/ElementSubdomainModifier.C b/framework/src/meshmodifiers/ElementSubdomainModifier.C index af15d62d75df..b8b23b67cc52 100644 --- a/framework/src/meshmodifiers/ElementSubdomainModifier.C +++ b/framework/src/meshmodifiers/ElementSubdomainModifier.C @@ -8,138 +8,39 @@ //* https://www.gnu.org/licenses/lgpl-2.1.html #include "ElementSubdomainModifier.h" -#include "DisplacedProblem.h" - -#include "libmesh/parallel_algebra.h" -#include "libmesh/parallel.h" -#include "libmesh/dof_map.h" -#include "libmesh/remote_elem.h" -#include "libmesh/parallel_ghost_sync.h" InputParameters ElementSubdomainModifier::validParams() { - InputParameters params = ElementUserObject::validParams(); - params.addClassDescription( - "Modify element subdomain ID. This userobject only runs on the undisplaced mesh, and it will " - "modify both the undisplaced and the displaced mesh."); - params.addParam("apply_initial_conditions", - true, - "Whether to apply initial conditions on the moved nodes and elements"); - params.addParam( - "moving_boundary_name", - "Boundary to modify when an element is moved. A boundary with the provided name will be " - "created if not already exists on the mesh."); - params.addParam("complement_moving_boundary_name", - "Boundary that associated with the unmoved domain when neighbor " - "element(s) is moved. A boundary with the provided name will be " - "created if not already exists on the mesh."); - params.set("use_displaced_mesh") = false; - params.suppressParameter("use_displaced_mesh"); - params.registerBase("MeshModifier"); + InputParameters params = ElementSubdomainModifierBase::validParams(); return params; } ElementSubdomainModifier::ElementSubdomainModifier(const InputParameters & parameters) - : ElementUserObject(parameters), - _displaced_problem(_fe_problem.getDisplacedProblem().get()), - _apply_ic(getParam("apply_initial_conditions")), - _moving_boundary_specified(isParamValid("moving_boundary_name")), - _complement_moving_boundary_specified(isParamValid("complement_moving_boundary_name")), - _moving_boundary_id(-1) -{ -} - -void -ElementSubdomainModifier::initialSetup() -{ - if (_moving_boundary_specified) - { - _moving_boundary_name = getParam("moving_boundary_name"); - setMovingBoundaryName(_mesh); - if (_displaced_problem) - setMovingBoundaryName(_displaced_problem->mesh()); - } - - if (_complement_moving_boundary_specified) - { - _complement_moving_boundary_name = getParam("complement_moving_boundary_name"); - setComplementMovingBoundaryName(_mesh); - if (_displaced_problem) - setComplementMovingBoundaryName(_displaced_problem->mesh()); - } -} - -void -ElementSubdomainModifier::setMovingBoundaryName(MooseMesh & mesh) -{ - // We only need one boundary to modify. Create a dummy vector just to use the API. - const std::vector boundary_ids = mesh.getBoundaryIDs({{_moving_boundary_name}}, true); - mooseAssert(boundary_ids.size() == 1, "Expect exactly one boundary ID."); - _moving_boundary_id = boundary_ids[0]; - mesh.setBoundaryName(_moving_boundary_id, _moving_boundary_name); - mesh.getMesh().get_boundary_info().sideset_name(_moving_boundary_id) = _moving_boundary_name; - mesh.getMesh().get_boundary_info().nodeset_name(_moving_boundary_id) = _moving_boundary_name; -} - -void -ElementSubdomainModifier::setComplementMovingBoundaryName(MooseMesh & mesh) + : ElementSubdomainModifierBase(parameters) { - // We only need one boundary to modify. Create a dummy vector just to use the API. - const std::vector boundary_ids = - mesh.getBoundaryIDs({{_complement_moving_boundary_name}}, true); - mooseAssert(boundary_ids.size() == 1, "Expect exactly one boundary ID."); - _complement_moving_boundary_id = boundary_ids[0]; - mesh.setBoundaryName(_complement_moving_boundary_id, _complement_moving_boundary_name); - mesh.getMesh().get_boundary_info().sideset_name(_complement_moving_boundary_id) = - _complement_moving_boundary_name; - mesh.getMesh().get_boundary_info().nodeset_name(_complement_moving_boundary_id) = - _complement_moving_boundary_name; } void ElementSubdomainModifier::initialize() { + // Clear moved elements from last execution _moved_elems.clear(); - _moved_displaced_elems.clear(); - _moved_nodes.clear(); - _cached_subdomain_assignments.clear(); - _moving_boundary_subdomains.clear(); } void ElementSubdomainModifier::execute() { - // First, compute the desired subdomain ID for the current element. + // Compute the desired subdomain ID for the current element. SubdomainID subdomain_id = computeSubdomainID(); - // If the current element's subdomain ID isn't what we want - if (subdomain_id != std::numeric_limits::max() && - _current_elem->subdomain_id() != subdomain_id) - { - _moving_boundary_subdomains.insert(subdomain_id); - _moving_boundary_subdomains.insert(_current_elem->subdomain_id()); - // Current element ID, used to index both the element on the displaced and undisplaced meshes. - dof_id_type elem_id = _current_elem->id(); - // Change the element's subdomain - Elem * elem = _mesh.elemPtr(elem_id); - Elem * displaced_elem = - _displaced_problem ? _displaced_problem->mesh().elemPtr(elem_id) : nullptr; + // Don't do anything if subdomain ID is invalid + if (subdomain_id == Moose::INVALID_BLOCK_ID) + return; - // Save the affected nodes so that we can later update/initialize the solution - for (unsigned int i = 0; i < elem->n_nodes(); ++i) - _moved_nodes.insert(elem->node_id(i)); - _cached_subdomain_assignments.emplace_back(elem, subdomain_id); - _moved_elems.push_back(elem); - if (displaced_elem) - { - _cached_subdomain_assignments.emplace_back(displaced_elem, subdomain_id); - _moved_displaced_elems.push_back(displaced_elem); - } - // Change the parent's subdomain, if any - // We do not save the parent info since they are inactive - setAncestorsSubdomainIDs(subdomain_id, elem_id); - } + // If the current element's subdomain ID isn't what we want + if (_current_elem->subdomain_id() != subdomain_id) + _moved_elems[_current_elem->id()] = {_current_elem->subdomain_id(), subdomain_id}; } void @@ -148,509 +49,11 @@ ElementSubdomainModifier::threadJoin(const UserObject & in_uo) // Join the data from uo into _this_ object: const auto & uo = static_cast(in_uo); - _moved_elems.insert(_moved_elems.end(), uo._moved_elems.begin(), uo._moved_elems.end()); - - _moved_displaced_elems.insert(_moved_displaced_elems.end(), - uo._moved_displaced_elems.begin(), - uo._moved_displaced_elems.end()); - - _moved_nodes.insert(uo._moved_nodes.begin(), uo._moved_nodes.end()); - _cached_subdomain_assignments.insert(_cached_subdomain_assignments.end(), - uo._cached_subdomain_assignments.begin(), - uo._cached_subdomain_assignments.end()); + _moved_elems.insert(uo._moved_elems.begin(), uo._moved_elems.end()); } void ElementSubdomainModifier::finalize() { - // apply cached subdomain changes - for (auto & [elem, subdomain_id] : _cached_subdomain_assignments) - elem->subdomain_id() = subdomain_id; - - _ghost_sides_to_add.clear(); - _complement_ghost_sides_to_add.clear(); - _complement_ghost_sides_to_remove.clear(); - _complement_ghost_nodes_to_remove.clear(); - - /* - Synchronize ghost element subdomain ID - Note: this needs to be done before updating boundary info because - updating boundary requires the updated element subdomain ids - */ - SyncSubdomainIds sync(_mesh.getMesh()); - Parallel::sync_dofobject_data_by_id(_mesh.getMesh().comm(), - _mesh.getMesh().elements_begin(), - _mesh.getMesh().elements_end(), - sync); - if (_moving_boundary_specified) - updateMovingBoundaryInfo(_mesh, _moved_elems); - if (!_moved_elems.empty() && _complement_moving_boundary_specified) - updateComplementBoundaryInfo(_mesh, _moved_elems); - - // Similarly for the displaced mesh - if (_displaced_problem) - { - SyncSubdomainIds sync_displaced(_displaced_problem->mesh().getMesh()); - Parallel::sync_dofobject_data_by_id(_displaced_problem->mesh().getMesh().comm(), - _displaced_problem->mesh().getMesh().elements_begin(), - _displaced_problem->mesh().getMesh().elements_end(), - sync_displaced); - if (_moving_boundary_specified) - updateMovingBoundaryInfo(_displaced_problem->mesh(), _moved_displaced_elems); - if (!_moved_displaced_elems.empty() && _complement_moving_boundary_specified) - updateComplementBoundaryInfo(_displaced_problem->mesh(), _moved_displaced_elems); - } - - // Synchronize boundary information after mesh update - synchronizeBoundaryInfo(_mesh); - - if (_displaced_problem) - synchronizeBoundaryInfo(_displaced_problem->mesh()); - - // Reinit equation systems - _fe_problem.meshChanged(); - - // Apply initial condition for the newly moved elements and boundary nodes - buildMovedElemsRange(); - buildMovedBndNodesRange(); - - if (_apply_ic) - { - _fe_problem.projectInitialConditionOnCustomRange(movedElemsRange(), movedBndNodesRange()); - - // Set old and older solution on the initialized dofs - setOldAndOlderSolutionsForMovedNodes(_fe_problem.getNonlinearSystemBase(_sys.number())); - setOldAndOlderSolutionsForMovedNodes(_fe_problem.getAuxiliarySystem()); - } - - // Initialize stateful material properties for the newly activated elements - _fe_problem.initElementStatefulProps(movedElemsRange(), false); -} - -void -ElementSubdomainModifier::updateMovingBoundaryInfo(MooseMesh & mesh, - const std::vector & moved_elems) -{ - if (_moving_boundary_subdomains.size()) - mooseAssert(_moving_boundary_subdomains.size() == 2, - "The number of moving subdomains should be two"); - /* - There are a couple of steps to reconstruct the moving boundary. - 1) Retrieve all the active elements associated with the moving boundary - in a previous step. These elements and their neighbors will serve as - boundary element candidates for the current step. - 2) Remove all the elements from the moving boundary. That literately - deletes the moving boundary from the database. - 3) Append moved elements to the boundary element candidates. - 4) Reconstruct the moving boundary using the boundary element candidates by - computing the sides that are shared by two subdomains - 5) Delete the old nodeset. - 6) Reconstruct a new nodeset using the new sideset. - 7) Sync boundary information - */ - - BoundaryInfo & bnd_info = mesh.getMesh().get_boundary_info(); - - /* - * Names can be deleted in the previous step if there is no side on this boundary - */ - bnd_info.sideset_name(_moving_boundary_id) = _moving_boundary_name; - bnd_info.nodeset_name(_moving_boundary_id) = _moving_boundary_name; - - auto & elem_side_bnd_ids = bnd_info.get_sideset_map(); - std::set boundary_elem_candidates; - std::vector> elem_sides_to_be_cleared; - /* - Check all the elements in the current moving boundary. - If an element is active, add it to the boundary element list; - otherwise, add active family members. - At the same time, append all the elements, including the active and - inactive, to a list being deleted later. - */ - for (const auto & [elem, side_bnd] : elem_side_bnd_ids) - { - auto side = side_bnd.first; - auto boundary_id = side_bnd.second; - if (boundary_id == _moving_boundary_id) - { - if (elem->active()) - boundary_elem_candidates.insert(elem); - else - { - auto top_parent = elem->top_parent(); - std::vector active_family; - top_parent->active_family_tree(active_family); - for (auto felem : active_family) - boundary_elem_candidates.insert((Elem *)felem); - } - elem_sides_to_be_cleared.emplace_back(elem, side); - } - } - - /* Delete the old moving boundary */ - for (auto & [elem, side] : elem_sides_to_be_cleared) - bnd_info.remove_side(elem, side, _moving_boundary_id); - - /* Append moved elements to the boundary element candidate list */ - for (auto elem : moved_elems) - boundary_elem_candidates.insert(elem); - - /* Go through the boundary element candidate list */ - for (auto elem : boundary_elem_candidates) - { - for (auto side : elem->side_index_range()) - { - const Elem * neighbor = elem->neighbor_ptr(side); - - /* - If elem's neighbor is active and has a different subdomain, we add the current side - to the moving boundary - */ - if (neighbor && neighbor->active() && neighbor != libMesh::remote_elem) - { - if (neighbor->subdomain_id() != elem->subdomain_id()) - { - /* - * If there is no new moved element, and then the elements from the original - * moving boundary should be safe to use - * If there are some new moved elements, then we need to check whether or not the - * interface is between the moving subdomains - */ - if (!_moving_boundary_subdomains.size() || - (_moving_boundary_subdomains.size() && - _moving_boundary_subdomains.find(neighbor->subdomain_id()) != - _moving_boundary_subdomains.end() && - _moving_boundary_subdomains.find(elem->subdomain_id()) != - _moving_boundary_subdomains.end())) - { - bnd_info.add_side(elem, side, _moving_boundary_id); - } - } - } - /* - If elem's neighbor is not active, we need to check family members of the neighbor. - In this case, the neighbor's children are on the current side and the children are - "smaller" than the current element. We so add the neighboring children to the moving - boundary list. Assigning "smaller" elements to the moving_boundary list is necessary in - order to correctly represent the moving boundary. - */ - else if (neighbor && !neighbor->active() && neighbor != libMesh::remote_elem) - { - std::vector active_family; - auto top_parent = neighbor->top_parent(); - top_parent->active_family_tree_by_neighbor(active_family, elem); - for (auto felem : active_family) - { - if (felem->subdomain_id() != elem->subdomain_id()) - { - auto cside = felem->which_neighbor_am_i(elem); - // Add all the sides to the boundary first and remove excessive sides later - bnd_info.add_side(felem, cside, _moving_boundary_id); - if (felem->processor_id() != this->processor_id()) - _ghost_sides_to_add[felem->processor_id()].emplace_back(felem->id(), cside); - } - } - } - } - } - - /* Delete the corresponding nodeset as well */ - auto & nodeset_map = bnd_info.get_nodeset_map(); - std::vector nodes_elem_sides_to_be_cleared; - for (const auto & pair : nodeset_map) - if (pair.second == _moving_boundary_id) - nodes_elem_sides_to_be_cleared.push_back(pair.first); - - for (const auto node : nodes_elem_sides_to_be_cleared) - bnd_info.remove_node(node, _moving_boundary_id); - - /* Reconstruct a new nodeset from the updated sideset */ - std::set boundary_nodes; - for (const auto & [elem, side_bnd] : elem_side_bnd_ids) - { - auto side = side_bnd.first; - auto boundary_id = side_bnd.second; - if (boundary_id == _moving_boundary_id) - { - auto nodes = elem->nodes_on_side(side); - for (auto node : nodes) - boundary_nodes.insert(&(elem->node_ref(node))); - } - } - - for (const auto node : boundary_nodes) - bnd_info.add_node(node, _moving_boundary_id); -} - -void -ElementSubdomainModifier::updateComplementBoundaryInfo( - MooseMesh & mesh, const std::vector & moved_elems) -{ - BoundaryInfo & bnd_info = mesh.getMesh().get_boundary_info(); - - // The logic below updates the side set and the node set associated with the moving boundary. - std::set added_nodes, removed_nodes; - for (auto elem : moved_elems) - { - // First loop over all the sides of the element - for (auto side : elem->side_index_range()) - { - const Elem * neighbor = elem->neighbor_ptr(side); - bnd_info.remove_side(elem, side, _complement_moving_boundary_id); - if (neighbor && neighbor != libMesh::remote_elem) - { - // If the neighbor has a different subdomain ID, then this side should be added to - // the moving boundary - if (neighbor->subdomain_id() != elem->subdomain_id()) - { - - unsigned int neighbor_side = neighbor->which_neighbor_am_i(elem); - bnd_info.add_side(neighbor, neighbor_side, _complement_moving_boundary_id); - if (neighbor->processor_id() != this->processor_id()) - { - _complement_ghost_sides_to_add[neighbor->processor_id()].emplace_back(neighbor->id(), - neighbor_side); - } - } - // Otherwise remove this side and the neighbor side from the boundary. - else - { - // this will destroy any overlapping third side sets! - bnd_info.remove_side(elem, side, _complement_moving_boundary_id); - unsigned int neighbor_side = neighbor->which_neighbor_am_i(elem); - bnd_info.remove_side(neighbor, neighbor_side); - if (neighbor->processor_id() != this->processor_id()) - _complement_ghost_sides_to_remove[neighbor->processor_id()].emplace_back(neighbor->id(), - neighbor_side); - } - } - } - - // Then loop over all the nodes of the element - for (auto node : elem->node_index_range()) - { - // Find the point neighbors - std::set neighbor_set; - elem->find_point_neighbors(elem->node_ref(node), neighbor_set); - for (auto neighbor : neighbor_set) - if (neighbor != libMesh::remote_elem) - { - // If the neighbor has a different subdomain ID, then this node should be added to - // the moving boundary - if (neighbor->subdomain_id() != elem->subdomain_id()) - added_nodes.insert(elem->node_id(node)); - // Otherwise remove this node from the boundary. - else - { - removed_nodes.insert(elem->node_id(node)); - if (neighbor->processor_id() != this->processor_id()) - _complement_ghost_nodes_to_remove[neighbor->processor_id()].push_back( - elem->node_id(node)); - } - } - } - } - - // make sure to remove only nodes that are not in the add set - std::set nodes_to_remove; - std::set_difference(removed_nodes.begin(), - removed_nodes.end(), - added_nodes.begin(), - added_nodes.end(), - std::inserter(nodes_to_remove, nodes_to_remove.end())); - for (auto node_id : nodes_to_remove) - { - if (_complement_moving_boundary_specified) - mesh.getMesh().get_boundary_info().remove_node(mesh.nodePtr(node_id), - _complement_moving_boundary_id); - } -} - -void -ElementSubdomainModifier::synchronizeBoundaryInfo(MooseMesh & mesh) -{ - pushBoundarySideInfo(mesh); - pushBoundaryNodeInfo(mesh); - mesh.getMesh().get_boundary_info().parallel_sync_side_ids(); - mesh.getMesh().get_boundary_info().parallel_sync_node_ids(); - mesh.update(); -} - -void -ElementSubdomainModifier::pushBoundarySideInfo(MooseMesh & moose_mesh) -{ - auto & mesh = moose_mesh.getMesh(); - auto elem_remove_functor = - [&mesh, this](processor_id_type, - const std::vector> & received_elem) - { - // remove the side - for (const auto & pr : received_elem) - mesh.get_boundary_info().remove_side( - mesh.elem_ptr(pr.first), pr.second, _complement_moving_boundary_id); - }; - - // We create a tempalte functor to add with custom boundary IDs - auto elem_add_functor_with_boundary_id = - [&mesh](const std::vector> & received_elem, - const BoundaryID boundary_id) - { - // add the side - for (const auto & pr : received_elem) - mesh.get_boundary_info().add_side(mesh.elem_ptr(pr.first), pr.second, boundary_id); - }; - - // Then we use it with the regular and the complement boundary id - auto complement_elem_add_functor = - [this, elem_add_functor_with_boundary_id]( - processor_id_type, - const std::vector> & received_elem) - { elem_add_functor_with_boundary_id(received_elem, _complement_moving_boundary_id); }; - - auto elem_add_functor = - [this, elem_add_functor_with_boundary_id]( - processor_id_type, - const std::vector> & received_elem) - { elem_add_functor_with_boundary_id(received_elem, _moving_boundary_id); }; - - // Push/pull the ghost cell sides for the regular and complement boundaries - Parallel::push_parallel_vector_data( - mesh.get_boundary_info().comm(), _ghost_sides_to_add, elem_add_functor); - Parallel::push_parallel_vector_data( - mesh.get_boundary_info().comm(), _complement_ghost_sides_to_remove, elem_remove_functor); - if (_complement_moving_boundary_specified) - Parallel::push_parallel_vector_data(mesh.get_boundary_info().comm(), - _complement_ghost_sides_to_add, - complement_elem_add_functor); -} - -void -ElementSubdomainModifier::pushBoundaryNodeInfo(MooseMesh & moose_mesh) -{ - auto & mesh = moose_mesh.getMesh(); - auto node_remove_functor = - [&mesh, this](processor_id_type, const std::vector & received_nodes) - { - for (const auto & pr : received_nodes) - { - if (_moving_boundary_specified) - mesh.get_boundary_info().remove_node(mesh.node_ptr(pr), _moving_boundary_id); - if (_complement_moving_boundary_specified) - mesh.get_boundary_info().remove_node(mesh.node_ptr(pr), _complement_moving_boundary_id); - } - }; - - Parallel::push_parallel_vector_data( - mesh.get_boundary_info().comm(), _complement_ghost_nodes_to_remove, node_remove_functor); -} - -void -ElementSubdomainModifier::buildMovedElemsRange() -{ - // Clear the object first - _moved_elems_range.reset(); - - // Make some fake element iterators defining this vector of elements - Elem * const * elem_itr_begin = const_cast(_moved_elems.data()); - Elem * const * elem_itr_end = elem_itr_begin + _moved_elems.size(); - - const auto elems_begin = MeshBase::const_element_iterator( - elem_itr_begin, elem_itr_end, Predicates::NotNull()); - const auto elems_end = MeshBase::const_element_iterator( - elem_itr_end, elem_itr_end, Predicates::NotNull()); - - _moved_elems_range = std::make_unique(elems_begin, elems_end); -} - -void -ElementSubdomainModifier::buildMovedBndNodesRange() -{ - // This is more involved than building the element range, because not all moved nodes are - // necessarily associated with a boundary initial condition. We need to first build a set of - // boundary nodes. Clear the object first: - _moved_bnd_nodes_range.reset(); - - // create a vector of the newly activated nodes - std::set moved_bnd_nodes_set; - for (auto & bnd_node : *_mesh.getBoundaryNodeRange()) - { - dof_id_type bnd_node_id = bnd_node->_node->id(); - if (_moved_nodes.find(bnd_node_id) != _moved_nodes.end()) - moved_bnd_nodes_set.insert(bnd_node); - } - - // Dump all the boundary nodes into a vector so that we can build a range out of it - std::vector moved_bnd_nodes; - moved_bnd_nodes.assign(moved_bnd_nodes_set.begin(), moved_bnd_nodes_set.end()); - - // Make some fake node iterators defining this vector of nodes - BndNode * const * bnd_node_itr_begin = const_cast(moved_bnd_nodes.data()); - BndNode * const * bnd_node_itr_end = bnd_node_itr_begin + moved_bnd_nodes.size(); - - const auto bnd_nodes_begin = MooseMesh::const_bnd_node_iterator( - bnd_node_itr_begin, bnd_node_itr_end, Predicates::NotNull()); - const auto bnd_nodes_end = MooseMesh::const_bnd_node_iterator( - bnd_node_itr_end, bnd_node_itr_end, Predicates::NotNull()); - - _moved_bnd_nodes_range = std::make_unique(bnd_nodes_begin, bnd_nodes_end); -} - -void -ElementSubdomainModifier::setOldAndOlderSolutionsForMovedNodes(SystemBase & sys) -{ - // Don't do anything if this is a steady simulation - if (!sys.hasSolutionState(1)) - return; - - ConstBndNodeRange & bnd_node_range = movedBndNodesRange(); - - NumericVector & current_solution = *sys.system().current_local_solution; - NumericVector & old_solution = sys.solutionOld(); - NumericVector * older_solution = sys.hasSolutionState(2) ? &sys.solutionOlder() : nullptr; - - DofMap & dof_map = sys.dofMap(); - - // Get dofs for the newly added elements - std::vector dofs; - for (auto & bnd_node : bnd_node_range) - { - std::vector bnd_node_dofs; - dof_map.dof_indices(bnd_node->_node, bnd_node_dofs); - dofs.insert(dofs.end(), bnd_node_dofs.begin(), bnd_node_dofs.end()); - } - - // Set the old and older solution to match the IC. - for (auto dof : dofs) - { - old_solution.set(dof, current_solution(dof)); - if (older_solution) - older_solution->set(dof, current_solution(dof)); - } - - old_solution.close(); - if (older_solution) - older_solution->close(); -} - -void -ElementSubdomainModifier::setAncestorsSubdomainIDs(const SubdomainID & subdomain_id, - const dof_id_type & elem_id) -{ - Elem * curr_elem = _mesh.elemPtr(elem_id); - - unsigned int lv = curr_elem->level(); - - for (unsigned int i = lv; i > 0; --i) - { - // Change the parent's subdomain, if any - curr_elem = curr_elem->parent(); - dof_id_type id = curr_elem->id(); - Elem * elem = _mesh.elemPtr(id); - elem->subdomain_id() = subdomain_id; - - // displaced parent element - Elem * displaced_elem = _displaced_problem ? _displaced_problem->mesh().elemPtr(id) : nullptr; - if (displaced_elem) - displaced_elem->subdomain_id() = subdomain_id; - } + ElementSubdomainModifierBase::modify(_moved_elems); } diff --git a/framework/src/meshmodifiers/ElementSubdomainModifierBase.C b/framework/src/meshmodifiers/ElementSubdomainModifierBase.C new file mode 100644 index 000000000000..5b2cd9649c7e --- /dev/null +++ b/framework/src/meshmodifiers/ElementSubdomainModifierBase.C @@ -0,0 +1,632 @@ +//* 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 + +#include "ElementSubdomainModifierBase.h" +#include "DisplacedProblem.h" + +#include "libmesh/parallel_algebra.h" +#include "libmesh/parallel.h" +#include "libmesh/dof_map.h" +#include "libmesh/remote_elem.h" +#include "libmesh/parallel_ghost_sync.h" +#include "libmesh/petsc_vector.h" + +InputParameters +ElementSubdomainModifierBase::validParams() +{ + InputParameters params = ElementUserObject::validParams(); + + // ESMs only operate on the undisplaced mesh to gather subdomain and sideset information. This + // information is used to modify both the undisplaced and the displaced meshes. It is the + // developer's responsibility to make sure the element IDs and sideset info are consistent across + // both meshes. + params.set("use_displaced_mesh") = false; + params.suppressParameter("use_displaced_mesh"); + + params.addParam>( + "moving_boundaries", + {}, + "Moving boundaries between subdomains. These boundaries (both sidesets and nodesets) will be " + "updated as elements change their subdomain. The corresponding subdomains of each moving " + "boundary shall be specified using the parameter 'moving_boundary_subdomain_pairs'. If one " + "boundary and multiple subdomain pairs are specified, then it is assumed that the pairs all " + "apply to the boundary. A boundary will be created on the mesh if it does not already " + "exist."); + params.addParam>>( + "moving_boundary_subdomain_pairs", + {}, + "The subdomain pairs associated with each moving boundary. For each pair of subdomains, only " + "the element side from the first subdomain will be added to the moving boundary, i.e., the " + "side normal is pointing from the first subdomain to the second subdomain. The pairs shall " + "be delimited by ';'. If a pair only has one subdomain, the moving boundary is associated " + "with the subdomain's external boundary, i.e., when the elements have no neighboring " + "elements."); + + params.addParam>( + "reinitialize_subdomains", + {"ANY_BLOCK_ID"}, + "By default, any element which changes subdomain is reinitialized. If a list of subdomains " + "(IDs or names) is set, then only elements which change to a subdomain in the list will be " + "reinitialized. If an empty list is set, then no elements will be reinitialized."); + params.addParam( + "previous_subdomain_reinitialized", + true, + "If set to false, only elements which change from subdomains not listed in " + "'reinitialize_subdomains', to ones that are listed, are reinitialized. " + "This parameter must be set with a non-empty list in 'reinitialize_subdomains'."); + + params.registerBase("MeshModifier"); + + return params; +} + +ElementSubdomainModifierBase::ElementSubdomainModifierBase(const InputParameters & parameters) + : ElementUserObject(parameters), + _displaced_problem(_fe_problem.getDisplacedProblem().get()), + _displaced_mesh(_displaced_problem ? &_displaced_problem->mesh() : nullptr), + _previous_subdomain_reinitialized(getParam("previous_subdomain_reinitialized")) +{ +} + +void +ElementSubdomainModifierBase::initialSetup() +{ + const std::vector subdomain_names_to_reinitialize = + getParam>("reinitialize_subdomains"); + if (std::find(subdomain_names_to_reinitialize.begin(), + subdomain_names_to_reinitialize.end(), + "ANY_BLOCK_ID") != subdomain_names_to_reinitialize.end()) + _subdomain_ids_to_reinitialize.push_back(Moose::ANY_BLOCK_ID); + else + _subdomain_ids_to_reinitialize = _mesh.getSubdomainIDs(subdomain_names_to_reinitialize); + + std::set set_subdomain_ids_to_reinitialize(_subdomain_ids_to_reinitialize.begin(), + _subdomain_ids_to_reinitialize.end()); + + if (_previous_subdomain_reinitialized == false && + (std::find(_subdomain_ids_to_reinitialize.begin(), + _subdomain_ids_to_reinitialize.end(), + Moose::ANY_BLOCK_ID) != _subdomain_ids_to_reinitialize.end() || + set_subdomain_ids_to_reinitialize == _mesh.meshSubdomains())) + paramError("previous_subdomain_reinitialized", + "'previous_subdomain_reinitialized' can only be set to false if " + "reinitialize_subdomains does " + "not cover the whole model, otherwise no elements will be reinitialized as it is " + "impossible for an element to begin in a subdomain not in the list."); + else if (_previous_subdomain_reinitialized == false && _subdomain_ids_to_reinitialize.empty()) + paramError("previous_subdomain_reinitialized", + "'previous_subdomain_reinitialized' can only be set to false if " + "reinitialize_subdomains is set to a non-empty list of subdomains, otherwise no " + "elements will be reinitialized as it is impossible for an element to change to a " + "subdomain in the list."); + + auto bnd_names = getParam>("moving_boundaries"); + auto bnd_ids = _mesh.getBoundaryIDs(bnd_names, true); + const auto bnd_subdomains = + getParam>>("moving_boundary_subdomain_pairs"); + + if (bnd_names.size() == 1 && bnd_subdomains.size() > 1) + { + bnd_names.insert(bnd_names.end(), bnd_subdomains.size() - 1, bnd_names[0]); + bnd_ids.insert(bnd_ids.end(), bnd_subdomains.size() - 1, bnd_ids[0]); + } + else if (bnd_names.size() != bnd_subdomains.size()) + paramError("moving_boundary_subdomain_pairs", + "Each moving boundary must correspond to a pair of subdomains. ", + bnd_names.size(), + " boundaries are specified by the parameter 'moving_boundaries', while ", + bnd_subdomains.size(), + " subdomain pairs are provided. Alternatively, if one boundary and multiple " + "subdomain pairs are provided, then the subdomain pairs all apply to one boundary."); + + for (auto i : index_range(bnd_names)) + { + _moving_boundary_names[bnd_ids[i]] = bnd_names[i]; + + if (bnd_subdomains[i].size() == 2) + _moving_boundaries[{_mesh.getSubdomainID(bnd_subdomains[i][0]), + _mesh.getSubdomainID(bnd_subdomains[i][1])}] = bnd_ids[i]; + else if (bnd_subdomains[i].size() == 1) + _moving_boundaries[{_mesh.getSubdomainID(bnd_subdomains[i][0]), Moose::INVALID_BLOCK_ID}] = + bnd_ids[i]; + else + paramError("moving_boundary_subdomain_pairs", + "Each subdomain pair must contain 1 or 2 subdomain names, but ", + bnd_subdomains[i].size(), + " are given."); + } +} + +void +ElementSubdomainModifierBase::modify( + const std::unordered_map> & moved_elems) +{ + // Create moving boundaries on the undisplaced and displaced meshes + // + // Note: We do this _everytime_ because previous execution might have removed the sidesets and + // nodesets. Most of the moving boundary algorithms below assume that the moving sidesets and + // nodesets already exist on the mesh. + createMovingBoundaries(_mesh); + if (_displaced_mesh) + createMovingBoundaries(*_displaced_mesh); + + // If nothing need to change, just return. + // This will skip all mesh changes, and so no adaptivity mesh files will be written. + auto n_moved_elem = moved_elems.size(); + gatherSum(n_moved_elem); + if (n_moved_elem == 0) + return; + + // This has to be done _before_ subdomain changes are applied + findReinitializedElemsAndNodes(moved_elems); + + // Apply cached subdomain changes + applySubdomainChanges(moved_elems, _mesh); + if (_displaced_mesh) + applySubdomainChanges(moved_elems, *_displaced_mesh); + + // Update moving boundaries + gatherMovingBoundaryChanges(moved_elems); + applyMovingBoundaryChanges(_mesh); + if (_displaced_mesh) + applyMovingBoundaryChanges(*_displaced_mesh); + + // Reinit equation systems + _fe_problem.meshChanged(); + + // Initialize solution and stateful material properties + applyIC(/*displaced=*/false); + initElementStatefulProps(/*displaced=*/false); + + if (_displaced_mesh) + { + applyIC(/*displaced=*/true); + initElementStatefulProps(/*displaced=*/true); + } +} + +void +ElementSubdomainModifierBase::createMovingBoundaries(MooseMesh & mesh) +{ + auto & bnd_info = mesh.getMesh().get_boundary_info(); + for (const auto & [bnd_id, bnd_name] : _moving_boundary_names) + { + bnd_info.sideset_name(bnd_id) = bnd_name; + bnd_info.nodeset_name(bnd_id) = bnd_name; + } +} + +void +ElementSubdomainModifierBase::applySubdomainChanges( + const std::unordered_map> & moved_elems, + MooseMesh & mesh) +{ + for (const auto & [elem_id, subdomain] : moved_elems) + { + // Change the element's subdomain ID + auto elem = mesh.elemPtr(elem_id); + const auto & [from, to] = subdomain; + mooseAssert(elem->subdomain_id() == from, "Inconsistent element subdomain ID."); + elem->subdomain_id() = to; + + // Change the ancestors' (if any) subdomain ID + setAncestorsSubdomainIDs(elem, to); + } + + // Synchronize ghost element subdomain changes + SyncSubdomainIds sync(mesh.getMesh()); + Parallel::sync_dofobject_data_by_id( + mesh.getMesh().comm(), mesh.getMesh().elements_begin(), mesh.getMesh().elements_end(), sync); +} + +void +ElementSubdomainModifierBase::setAncestorsSubdomainIDs(Elem * elem, const SubdomainID subdomain_id) +{ + auto curr_elem = elem; + + for (unsigned int i = curr_elem->level(); i > 0; --i) + { + // Change the parent's subdomain + curr_elem = curr_elem->parent(); + curr_elem->subdomain_id() = subdomain_id; + } +} + +void +ElementSubdomainModifierBase::gatherMovingBoundaryChanges( + const std::unordered_map> & moved_elems) +{ + // Clear moving boundary changes from last execution + _add_element_sides.clear(); + _add_neighbor_sides.clear(); + _remove_element_sides.clear(); + _remove_neighbor_sides.clear(); + + const auto & sidesets = _mesh.getMesh().get_boundary_info().get_sideset_map(); + + for (const auto & [elem_id, subdomain_assignment] : moved_elems) + { + auto elem = _mesh.elemPtr(elem_id); + + // The existing moving boundaries on the element side should be removed + for (auto itr = sidesets.lower_bound(elem); itr != sidesets.upper_bound(elem); itr++) + if (_moving_boundary_names.count(itr->second.second)) + _remove_element_sides[elem->id()].emplace(itr->second.first, itr->second.second); + + for (auto side : elem->side_index_range()) + { + auto neigh = elem->neighbor_ptr(side); + + // Don't mess with remote element neighbor + if (neigh && neigh == libMesh::remote_elem) + continue; + // If neighbor doesn't exist + else if (!neigh) + gatherMovingBoundaryChangesHelper(elem, side, nullptr, 0); + // If neighbor exists + else + { + auto neigh_side = neigh->which_neighbor_am_i(elem); + + if (neigh->active()) + gatherMovingBoundaryChangesHelper(elem, side, neigh, neigh_side); + else + { + std::vector active_neighs; + neigh->top_parent()->active_family_tree_by_neighbor(active_neighs, elem); + for (auto active_neigh : active_neighs) + gatherMovingBoundaryChangesHelper(elem, side, active_neigh, neigh_side); + } + } + } + } +} + +void +ElementSubdomainModifierBase::gatherMovingBoundaryChangesHelper(const Elem * elem, + unsigned short side, + const Elem * neigh, + unsigned short neigh_side) +{ + const auto & sidesets = _mesh.getMesh().get_boundary_info().get_sideset_map(); + + // Detect element side change + SubdomainPair subdomain_pair = {elem->subdomain_id(), + neigh ? neigh->subdomain_id() : Moose::INVALID_BLOCK_ID}; + if (_moving_boundaries.count(subdomain_pair)) + _add_element_sides[elem->id()].emplace(side, _moving_boundaries.at(subdomain_pair)); + + if (neigh) + { + // The existing moving boundaries on the neighbor side should be removed + for (auto itr = sidesets.lower_bound(neigh); itr != sidesets.upper_bound(neigh); itr++) + if (itr->second.first == neigh_side && _moving_boundary_names.count(itr->second.second)) + _remove_neighbor_sides[neigh->id()].emplace(itr->second.first, itr->second.second); + + // Detect neighbor side change (by reversing the subdomain pair) + subdomain_pair = {subdomain_pair.second, subdomain_pair.first}; + if (_moving_boundaries.count(subdomain_pair)) + _add_neighbor_sides[neigh->id()].emplace(neigh_side, _moving_boundaries.at(subdomain_pair)); + } +} + +void +ElementSubdomainModifierBase::applyMovingBoundaryChanges(MooseMesh & mesh) +{ + auto & bnd_info = mesh.getMesh().get_boundary_info(); + + // Remove all boundary nodes from the previous moving boundaries + auto nodesets = bnd_info.get_nodeset_map(); + for (const auto & [node_id, bnd] : nodesets) + if (_moving_boundary_names.count(bnd)) + bnd_info.remove_node(node_id, bnd); + + // Keep track of ghost element changes + std::unordered_map>> + add_ghost_sides, remove_ghost_sides; + + // Remove element sides from moving boundaries + for (const auto & [elem_id, sides] : _remove_element_sides) + for (const auto & [side, bnd] : sides) + bnd_info.remove_side(mesh.elemPtr(elem_id), side, bnd); + + // Remove neighbor sides from moving boundaries + for (const auto & [elem_id, sides] : _remove_neighbor_sides) + { + auto elem = mesh.elemPtr(elem_id); + for (const auto & [side, bnd] : sides) + { + bnd_info.remove_side(elem, side, bnd); + // Keep track of changes to ghosted elements + if (elem->processor_id() != processor_id()) + remove_ghost_sides[elem->processor_id()].push_back({elem_id, side, bnd}); + } + } + + // Add element sides to moving boundaries + for (const auto & [elem_id, sides] : _add_element_sides) + for (const auto & [side, bnd] : sides) + bnd_info.add_side(mesh.elemPtr(elem_id), side, bnd); + + // Add neighbor sides to moving boundaries + for (const auto & [elem_id, sides] : _add_neighbor_sides) + { + auto elem = mesh.elemPtr(elem_id); + for (const auto & [side, bnd] : sides) + { + bnd_info.add_side(elem, side, bnd); + // Keep track of changes to ghosted elements + if (elem->processor_id() != processor_id()) + add_ghost_sides[elem->processor_id()].push_back({elem_id, side, bnd}); + } + } + + Parallel::push_parallel_vector_data( + bnd_info.comm(), + add_ghost_sides, + [&mesh, + &bnd_info](processor_id_type, + const std::vector> & received) + { + for (const auto & [elem_id, side, bnd] : received) + bnd_info.add_side(mesh.elemPtr(elem_id), side, bnd); + }); + + Parallel::push_parallel_vector_data( + bnd_info.comm(), + remove_ghost_sides, + [&mesh, + &bnd_info](processor_id_type, + const std::vector> & received) + { + for (const auto & [elem_id, side, bnd] : received) + bnd_info.remove_side(mesh.elemPtr(elem_id), side, bnd); + }); + + bnd_info.parallel_sync_side_ids(); + bnd_info.parallel_sync_node_ids(); + mesh.update(); +} + +void +ElementSubdomainModifierBase::meshChanged() +{ + // Clear cached ranges + _reinitialized_elem_range.reset(); + _reinitialized_displaced_elem_range.reset(); + _reinitialized_bnd_node_range.reset(); + _reinitialized_displaced_bnd_node_range.reset(); + + removeInactiveMovingBoundary(_mesh); + if (_displaced_mesh) + removeInactiveMovingBoundary(*_displaced_mesh); +} + +void +ElementSubdomainModifierBase::removeInactiveMovingBoundary(MooseMesh & mesh) +{ + auto & bnd_info = mesh.getMesh().get_boundary_info(); + auto sidesets = bnd_info.get_sideset_map(); + for (const auto & i : sidesets) + { + auto elem = i.first; + auto side = i.second.first; + auto bnd = i.second.second; + if (_moving_boundary_names.count(bnd) && !elem->active()) + { + bnd_info.remove_side(elem, side, bnd); + + std::vector elem_family; + elem->active_family_tree_by_side(elem_family, side); + for (auto felem : elem_family) + bnd_info.add_side(felem, side, bnd); + } + } + + bnd_info.parallel_sync_side_ids(); + bnd_info.parallel_sync_node_ids(); +} + +void +ElementSubdomainModifierBase::findReinitializedElemsAndNodes( + const std::unordered_map> & moved_elems) +{ + // Clear cached element reinitialization data + _reinitialized_elems.clear(); + _reinitialized_nodes.clear(); + + for (const auto & [elem_id, subdomain] : moved_elems) + { + // Default: any element that changes subdomain is reinitialized + if (std::find(_subdomain_ids_to_reinitialize.begin(), + _subdomain_ids_to_reinitialize.end(), + Moose::ANY_BLOCK_ID) != _subdomain_ids_to_reinitialize.end()) + _reinitialized_elems.insert(elem_id); + else // Reinitialize if new subdomain is in list of subdomains to be reinitialized + { + const auto & [from, to] = subdomain; + if (subdomainIsReinitialized(to) && _previous_subdomain_reinitialized) + _reinitialized_elems.insert(elem_id); + // Only reinitialize if original subdomain is not in list of subdomains + else if (subdomainIsReinitialized(to) && !_previous_subdomain_reinitialized && + !subdomainIsReinitialized(from)) + _reinitialized_elems.insert(elem_id); + else // New subdomain is not in list of subdomains + continue; + } + + const auto elem = _mesh.elemPtr(elem_id); + for (unsigned int i = 0; i < elem->n_nodes(); ++i) + if (nodeIsNewlyReinitialized(elem->node_id(i))) + _reinitialized_nodes.insert(elem->node_id(i)); + } +} + +bool +ElementSubdomainModifierBase::subdomainIsReinitialized(SubdomainID id) const +{ + // Default: any element that changes subdomain is reinitialized + if (std::find(_subdomain_ids_to_reinitialize.begin(), + _subdomain_ids_to_reinitialize.end(), + Moose::ANY_BLOCK_ID) != _subdomain_ids_to_reinitialize.end()) + return true; + + // Is subdomain in list of subdomains to be reinitialized + return std::find(_subdomain_ids_to_reinitialize.begin(), + _subdomain_ids_to_reinitialize.end(), + id) != _subdomain_ids_to_reinitialize.end(); +} + +bool +ElementSubdomainModifierBase::nodeIsNewlyReinitialized(dof_id_type node_id) const +{ + // If any of the node neighbors are already reinitialized, then the node is NOT newly + // reinitialized. + for (auto neighbor_elem_id : _mesh.nodeToElemMap().at(node_id)) + if (subdomainIsReinitialized(_mesh.elemPtr(neighbor_elem_id)->subdomain_id())) + return false; + return true; +} + +void +ElementSubdomainModifierBase::applyIC(bool displaced) +{ + _fe_problem.projectInitialConditionOnCustomRange(reinitializedElemRange(displaced), + reinitializedBndNodeRange(displaced)); + + // Set old and older solutions on the reinitialized dofs to the reinitialized values + setOldAndOlderSolutions(_fe_problem.getNonlinearSystemBase(_sys.number()), + reinitializedElemRange(displaced), + reinitializedBndNodeRange(displaced)); + setOldAndOlderSolutions(_fe_problem.getAuxiliarySystem(), + reinitializedElemRange(displaced), + reinitializedBndNodeRange(displaced)); + + // Note: Need method to handle solve failures at timesteps where subdomain changes. The old + // solutions are now set to the reinitialized values. Does this impact restoring solutions +} + +void +ElementSubdomainModifierBase::initElementStatefulProps(bool displaced) +{ + _fe_problem.initElementStatefulProps(reinitializedElemRange(displaced), /*threaded=*/true); +} + +ConstElemRange & +ElementSubdomainModifierBase::reinitializedElemRange(bool displaced) +{ + if (!displaced && _reinitialized_elem_range) + return *_reinitialized_elem_range.get(); + + if (displaced && _reinitialized_displaced_elem_range) + return *_reinitialized_displaced_elem_range.get(); + + // Create a vector of the newly reinitialized elements + std::vector elems; + for (auto elem_id : _reinitialized_elems) + elems.push_back(displaced ? _displaced_mesh->elemPtr(elem_id) : _mesh.elemPtr(elem_id)); + + // Make some fake element iterators defining this vector of elements + Elem * const * elem_itr_begin = const_cast(elems.data()); + Elem * const * elem_itr_end = elem_itr_begin + elems.size(); + + const auto elems_begin = MeshBase::const_element_iterator( + elem_itr_begin, elem_itr_end, Predicates::NotNull()); + const auto elems_end = MeshBase::const_element_iterator( + elem_itr_end, elem_itr_end, Predicates::NotNull()); + + if (!displaced) + _reinitialized_elem_range = std::make_unique(elems_begin, elems_end); + else + _reinitialized_displaced_elem_range = std::make_unique(elems_begin, elems_end); + + return reinitializedElemRange(displaced); +} + +ConstBndNodeRange & +ElementSubdomainModifierBase::reinitializedBndNodeRange(bool displaced) +{ + if (!displaced && _reinitialized_bnd_node_range) + return *_reinitialized_bnd_node_range.get(); + + if (displaced && _reinitialized_displaced_bnd_node_range) + return *_reinitialized_displaced_bnd_node_range.get(); + + // Create a vector of the newly reinitialized boundary nodes + std::vector nodes; + auto bnd_nodes = + displaced ? _displaced_mesh->getBoundaryNodeRange() : _mesh.getBoundaryNodeRange(); + for (auto bnd_node : *bnd_nodes) + if (bnd_node->_node) + if (_reinitialized_nodes.count(bnd_node->_node->id())) + nodes.push_back(bnd_node); + + // Make some fake node iterators defining this vector of nodes + BndNode * const * bnd_node_itr_begin = const_cast(nodes.data()); + BndNode * const * bnd_node_itr_end = bnd_node_itr_begin + nodes.size(); + + const auto bnd_nodes_begin = MooseMesh::const_bnd_node_iterator( + bnd_node_itr_begin, bnd_node_itr_end, Predicates::NotNull()); + const auto bnd_nodes_end = MooseMesh::const_bnd_node_iterator( + bnd_node_itr_end, bnd_node_itr_end, Predicates::NotNull()); + + if (!displaced) + _reinitialized_bnd_node_range = + std::make_unique(bnd_nodes_begin, bnd_nodes_end); + else + _reinitialized_displaced_bnd_node_range = + std::make_unique(bnd_nodes_begin, bnd_nodes_end); + + return reinitializedBndNodeRange(displaced); +} + +void +ElementSubdomainModifierBase::setOldAndOlderSolutions(SystemBase & sys, + ConstElemRange & elem_range, + ConstBndNodeRange & bnd_node_range) +{ + // Don't do anything if this is a steady simulation + if (!sys.hasSolutionState(1)) + return; + + NumericVector & current_solution = *sys.system().current_local_solution; + NumericVector & old_solution = sys.solutionOld(); + NumericVector * older_solution = sys.hasSolutionState(2) ? &sys.solutionOlder() : nullptr; + + // Get dofs for the reinitialized elements and nodes + DofMap & dof_map = sys.dofMap(); + std::vector dofs; + + for (auto & elem : elem_range) + { + std::vector elem_dofs; + dof_map.dof_indices(elem, elem_dofs); + dofs.insert(dofs.end(), elem_dofs.begin(), elem_dofs.end()); + } + + for (auto & bnd_node : bnd_node_range) + { + std::vector bnd_node_dofs; + dof_map.dof_indices(bnd_node->_node, bnd_node_dofs); + dofs.insert(dofs.end(), bnd_node_dofs.begin(), bnd_node_dofs.end()); + } + + // Set the old and older solutions to match the reinitialization + for (auto dof : dofs) + { + old_solution.set(dof, current_solution(dof)); + if (older_solution) + older_solution->set(dof, current_solution(dof)); + } + + old_solution.close(); + if (older_solution) + older_solution->close(); +} diff --git a/framework/src/meshmodifiers/ThresholdElementSubdomainModifier.C b/framework/src/meshmodifiers/ThresholdElementSubdomainModifier.C index 3cfd3d9377f7..7bdf62098a86 100644 --- a/framework/src/meshmodifiers/ThresholdElementSubdomainModifier.C +++ b/framework/src/meshmodifiers/ThresholdElementSubdomainModifier.C @@ -36,7 +36,7 @@ ThresholdElementSubdomainModifier::ThresholdElementSubdomainModifier( _subdomain_id(getParam("subdomain_id")), _complement_subdomain_id(isParamValid("complement_subdomain_id") ? getParam("complement_subdomain_id") - : std::numeric_limits::max()) + : Moose::INVALID_BLOCK_ID) { } diff --git a/framework/src/meshmodifiers/TimedElementSubdomainModifier.C b/framework/src/meshmodifiers/TimedElementSubdomainModifier.C index d2bda8b74401..6a3528489edd 100644 --- a/framework/src/meshmodifiers/TimedElementSubdomainModifier.C +++ b/framework/src/meshmodifiers/TimedElementSubdomainModifier.C @@ -25,6 +25,9 @@ TimedElementSubdomainModifier::TimedElementSubdomainModifier(const InputParamete void TimedElementSubdomainModifier::initialize() { + // clear number of moved elements + ElementSubdomainModifier::initialize(); + // ask for all times (must NOT be sorted) const auto times = getTimes(); diff --git a/modules/stochastic_tools/examples/paper/results/weak.tex b/modules/stochastic_tools/examples/paper/results/weak.tex index 6ab2ba0e2f1a..e04321108b18 100644 --- a/modules/stochastic_tools/examples/paper/results/weak.tex +++ b/modules/stochastic_tools/examples/paper/results/weak.tex @@ -12,4 +12,4 @@ 32 & 4096 & 74.9 (69.3, 76.4) & 73.2 (73.1, 73.3) & 68.6 (67.0, 70.8) \\ 64 & 8192 & 80.1 (72.6, 84.1) & 77.6 (77.4, 77.7) & 73.6 (70.5, 76.3) \\ \bottomrule -\end{tabular} \ No newline at end of file +\end{tabular} diff --git a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e index dfdb6d5386ef..fa7fdc037e00 100644 Binary files a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e and b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e differ diff --git a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s002 b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s002 index c219e31aa2ec..fa9fee753771 100644 Binary files a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s002 and b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s002 differ diff --git a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s003 b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s003 index 2f65ce4885eb..015e8375ab46 100644 Binary files a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s003 and b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s003 differ diff --git a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s004 b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s004 index 28a6519d329d..7ae7a94be49c 100644 Binary files a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s004 and b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s004 differ diff --git a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s005 b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s005 index cbd136b92c1e..9e98fc550ec7 100644 Binary files a/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s005 and b/modules/xfem/test/tests/moving_interface/gold/moving_bimaterial_finite_strain_esm_out.e-s005 differ diff --git a/modules/xfem/test/tests/moving_interface/moving_bimaterial_finite_strain_esm.i b/modules/xfem/test/tests/moving_interface/moving_bimaterial_finite_strain_esm.i index 4bae03e1391a..e7762a425120 100644 --- a/modules/xfem/test/tests/moving_interface/moving_bimaterial_finite_strain_esm.i +++ b/modules/xfem/test/tests/moving_interface/moving_bimaterial_finite_strain_esm.i @@ -20,7 +20,7 @@ [esm] type = CutElementSubdomainModifier geometric_cut_userobject = level_set_cut_uo - apply_initial_conditions = false + reinitialize_subdomains = '' #no reinitialization of variables or material properties [] [] diff --git a/python/MooseDocs/test/gold/latex/extensions/bibtex.tex b/python/MooseDocs/test/gold/latex/extensions/bibtex.tex index 80d12ffdb2fb..90ab96846a05 100644 --- a/python/MooseDocs/test/gold/latex/extensions/bibtex.tex +++ b/python/MooseDocs/test/gold/latex/extensions/bibtex.tex @@ -5,4 +5,4 @@ \chapter{\label{bibtex-extension}Bibtex Extension} \par \cite{slaughter2014framework,slaughter2015continuous,gaston2015physics} \par \citep{slaughter2014framework} \par \citep{slaughter2014framework,slaughter2015continuous} -\section{\label{references}References} \ No newline at end of file +\section{\label{references}References} diff --git a/python/MooseDocs/test/gold/latex/extensions/common.tex b/python/MooseDocs/test/gold/latex/extensions/common.tex index 202da86cb908..79397d69f648 100644 --- a/python/MooseDocs/test/gold/latex/extensions/common.tex +++ b/python/MooseDocs/test/gold/latex/extensions/common.tex @@ -1,3 +1,3 @@ \chapter{\label{common-extension}Common Extension} -\par Did you know that \href{https:://mooseframework.org}{MOOSE} is based on \href{https://libmesh.github.io/}{libMesh}? \ No newline at end of file +\par Did you know that \href{https:://mooseframework.org}{MOOSE} is based on \href{https://libmesh.github.io/}{libMesh}? diff --git a/python/MooseDocs/test/gold/latex/extensions/config.tex b/python/MooseDocs/test/gold/latex/extensions/config.tex index 1001cbc03ef6..8abb58199b6a 100644 --- a/python/MooseDocs/test/gold/latex/extensions/config.tex +++ b/python/MooseDocs/test/gold/latex/extensions/config.tex @@ -1,3 +1,3 @@ \chapter{\label{config-extension}Config Extension} -\par The page name has been modified. \ No newline at end of file +\par The page name has been modified. diff --git a/python/MooseDocs/test/gold/latex/extensions/core.tex b/python/MooseDocs/test/gold/latex/extensions/core.tex index 679ad089ecae..c004a4ac4234 100644 --- a/python/MooseDocs/test/gold/latex/extensions/core.tex +++ b/python/MooseDocs/test/gold/latex/extensions/core.tex @@ -28,16 +28,16 @@ \subsection{\label{nested-quotations-and-lists}Nested Quotations and Lists} \end{quote} \begin{itemize} -\item -\par A list. -\item +\item +\par A list. +\item \par With two items \begin{quote} \par The second contains a quote as well, which has a numbered list. \begin{enumerate} -\item -\par one -\item +\item +\par one +\item \par two \end{enumerate} @@ -58,46 +58,46 @@ \section{\label{heading-with-style}Heading with Style} \section{\label{unordered-lists}Unordered Lists} \subsection{\label{unordered-single-level-lists}Single level lists} \begin{itemize} -\item -\par Item 1 -\item -\par Item 2 -\item +\item +\par Item 1 +\item +\par Item 2 +\item \par Item 3 The third items has some content, this content contains paragraphs. \par This is a second paragraph in the list. -\par -\item +\par +\item \par Item 4 should be apart of the same list. \end{itemize} \begin{itemize} -\item -\par Item 1b: This should start a new list, because of the two blank lines. -\item +\item +\par Item 1b: This should start a new list, because of the two blank lines. +\item \par Item 2b \end{itemize} \subsection{\label{unordered-nested-lists}Nested lists} \begin{itemize} -\item +\item \par Item 1 \begin{itemize} -\item -\par Item 1.1 -\item +\item +\par Item 1.1 +\item \par Item 1.2 \end{itemize} -\par -\item +\par +\item \par Item 2 \begin{itemize} -\item +\item \par Item 2.1 \begin{itemize} -\item -\par Item 2.1.1 -\item +\item +\par Item 2.1.1 +\item \par Item 2.1.2 \begin{quote} \par A quotation. @@ -105,53 +105,53 @@ \subsection{\label{unordered-nested-lists}Nested lists} \end{itemize} -\par -\item +\par +\item \par Item 2.2 \end{itemize} -\par -\item +\par +\item \par Item 3 \end{itemize} \section{\label{ordered-list}Ordered List} \subsection{\label{ordered-single-level-lists}Single level lists} \begin{enumerate} -\item -\par One -\item -\par Two -\item +\item +\par One +\item +\par Two +\item \par Three Just like above, this should contain two paragraphs. \par This is a new paragraph. -\par -\item +\par +\item \par Four \end{enumerate} \subsection{\label{starting-number}Starting number} \begin{enumerate} -\item -\par Two -\item +\item +\par Two +\item \par Three \end{enumerate} \begin{enumerate} -\item -\par Forty-two -\item +\item +\par Forty-two +\item \par Forty-three \end{enumerate} \begin{enumerate} -\item -\par Twelve thousand \emph{three} hundred and forty-five -\item +\item +\par Twelve thousand \emph{three} hundred and forty-five +\item \par Twelve thousand three hundred and forty-six \begin{enumerate} -\item +\item \par A nested item within a \textbf{huge} number. \end{enumerate} @@ -159,38 +159,38 @@ \subsection{\label{starting-number}Starting number} \subsection{\label{ordered-nested-lists}Nested lists} \begin{enumerate} -\item +\item \par One \begin{enumerate} -\item -\par 1.1 -\item -\par 1.2 -\item +\item +\par 1.1 +\item +\par 1.2 +\item \par 1.3 \end{enumerate} -\par -\item +\par +\item \par Two \begin{enumerate} -\item -\par 2.1 -\item +\item +\par 2.1 +\item \par 2.2 \begin{enumerate} -\item -\par \st{2.2.1} -\item -\par 2.2.2 -\item +\item +\par \st{2.2.1} +\item +\par 2.2.2 +\item \par 2.2.3 \begin{quote} \par A quote. \begin{quote} \par Go deeper. \begin{enumerate} -\item +\item \par Fifty-four \end{enumerate} @@ -218,4 +218,4 @@ \section{\label{inline-formatting}Inline formatting} \section{\label{links}Links} \par This is a link to \href{https://www.google.com}{google}. \subsubsection{\label{skip-the-level}Skip the level} -\par This heading is to testing \ No newline at end of file +\par This heading is to testing diff --git a/python/MooseDocs/test/gold/latex/extensions/folder/index.tex b/python/MooseDocs/test/gold/latex/extensions/folder/index.tex index 420c75bae55c..2aff760687f1 100644 --- a/python/MooseDocs/test/gold/latex/extensions/folder/index.tex +++ b/python/MooseDocs/test/gold/latex/extensions/folder/index.tex @@ -1,4 +1,4 @@ \section{\label{folder}Folder} \par Content for testing navigation. -\par extensions/folder/index.md \ No newline at end of file +\par extensions/folder/index.md diff --git a/python/MooseDocs/test/gold/latex/extensions/include.tex b/python/MooseDocs/test/gold/latex/extensions/include.tex index efccf6a6f279..251d79aee259 100644 --- a/python/MooseDocs/test/gold/latex/extensions/include.tex +++ b/python/MooseDocs/test/gold/latex/extensions/include.tex @@ -1,9 +1,9 @@ \chapter{\label{include-extension}Include Extension} -\par We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. -\par We hold these truths to be self-evident, that all men are created equal, that they are endowed by +\par We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. +\par We hold these truths to be self-evident, that all men are created equal, that they are endowed by \par Header {\textasciicircum} Right of the People to alter or to abolish it, and to institute new Government\$ Footer \begin{quote} -\par Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances. -\par A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed. +\par Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances. +\par A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed. \end{quote} diff --git a/python/MooseDocs/test/gold/latex/extensions/materialicon.tex b/python/MooseDocs/test/gold/latex/extensions/materialicon.tex index 83644e094b2e..d3102cab685d 100644 --- a/python/MooseDocs/test/gold/latex/extensions/materialicon.tex +++ b/python/MooseDocs/test/gold/latex/extensions/materialicon.tex @@ -3,4 +3,4 @@ \chapter{\label{material-icon}Material Icon} \par This is a paragraph. \par \faicon{question-circle} \par This is an icon \faicon{home} that is inline with the text. -\section{\label{this-icon-inherits-style-settings-from-its-parent}This icon \faicon{error} inherits style settings from its parent} \ No newline at end of file +\section{\label{this-icon-inherits-style-settings-from-its-parent}This icon \faicon{error} inherits style settings from its parent} diff --git a/python/MooseDocs/test/gold/latex/extensions/navigation.tex b/python/MooseDocs/test/gold/latex/extensions/navigation.tex index c0a2ce9e4eae..5b8794466c2a 100644 --- a/python/MooseDocs/test/gold/latex/extensions/navigation.tex +++ b/python/MooseDocs/test/gold/latex/extensions/navigation.tex @@ -1,3 +1,3 @@ \chapter{\label{navigation-extension}Navigation Extension} -\par \hyperref[folder]{Folder} \ No newline at end of file +\par \hyperref[folder]{Folder} diff --git a/python/MooseDocs/test/gold/latex/extensions/plotly.tex b/python/MooseDocs/test/gold/latex/extensions/plotly.tex index 3fc266bf2485..e90aac07eda5 100644 --- a/python/MooseDocs/test/gold/latex/extensions/plotly.tex +++ b/python/MooseDocs/test/gold/latex/extensions/plotly.tex @@ -1,2 +1,2 @@ -\chapter{\label{plotly-extension}Plotly Extension} \ No newline at end of file +\chapter{\label{plotly-extension}Plotly Extension} diff --git a/python/MooseDocs/test/gold/latex/extensions/style.tex b/python/MooseDocs/test/gold/latex/extensions/style.tex index b0e69e703b7f..d315697887f2 100644 --- a/python/MooseDocs/test/gold/latex/extensions/style.tex +++ b/python/MooseDocs/test/gold/latex/extensions/style.tex @@ -10,8 +10,8 @@ \chapter{\label{style-extension}Style Extension} \par This text has a border and is blue.} \end{fbox} -\par This text includes inline +\par This text includes inline \begin{fbox} {\color{red}red} \end{fbox} - text with a border. \ No newline at end of file + text with a border. diff --git a/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e b/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e index e8f0301735a8..c43237c02d48 100644 Binary files a/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e and b/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e differ diff --git a/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s006 b/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s002 similarity index 80% rename from test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s006 rename to test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s002 index 36592ae2a1f6..60be3837ddae 100644 Binary files a/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s006 and b/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s002 differ diff --git a/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s003 b/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s003 new file mode 100644 index 000000000000..09023d3603d2 Binary files /dev/null and b/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s003 differ diff --git a/test/tests/mesh/add_subdomain_ids/tests b/test/tests/mesh/add_subdomain_ids/tests index d69da680868b..9a29bdb7c6e1 100644 --- a/test/tests/mesh/add_subdomain_ids/tests +++ b/test/tests/mesh/add_subdomain_ids/tests @@ -19,7 +19,7 @@ [add_subdomain_names] type = Exodiff input = add_subdomain_names.i - exodiff = 'add_subdomain_names_out.e add_subdomain_names_out.e-s004 add_subdomain_names_out.e-s006' + exodiff = 'add_subdomain_names_out.e add_subdomain_names_out.e-s002 add_subdomain_names_out.e-s003' exodiff_opts = '-pedantic' issues = '#27474' design = MooseMesh.md diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/adaptivity_moving_boundary.i b/test/tests/meshmodifiers/element_subdomain_modifier/adaptivity_moving_boundary.i index db254d7c37ac..0d6325ed53b6 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/adaptivity_moving_boundary.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/adaptivity_moving_boundary.i @@ -17,6 +17,7 @@ type = SubdomainBoundingBoxGenerator input = 'gen' block_id = 1 + block_name = 'left' bottom_left = '-1 -1 0' top_right = '0 1 1' [] @@ -24,71 +25,65 @@ type = SubdomainBoundingBoxGenerator input = 'left' block_id = 2 + block_name = 'right' bottom_left = '0 -1 0' top_right = '1 1 1' [] [moving_boundary] - type = SideSetsAroundSubdomainGenerator + type = SideSetsBetweenSubdomainsGenerator input = 'right' - block = 1 new_boundary = 'moving_boundary' - normal = '1 0 0' + primary_block = 'left' + paired_block = 'right' [] [] -[UserObjects] +[MeshModifiers] [moving_circle] type = CoupledVarThresholdElementSubdomainModifier coupled_var = 'phi' block = 2 - criterion_type = ABOVE + criterion_type = 'ABOVE' threshold = 0.5 subdomain_id = 1 - moving_boundary_name = moving_boundary - execute_on = 'TIMESTEP_BEGIN' - [] -[] - -[Functions] - [moving_gauss] - type = ParsedFunction - value = 'exp(-((x+0.5-t)^2+(y)^2)/0.25)' + moving_boundaries = 'moving_boundary' + moving_boundary_subdomain_pairs = 'left right' + execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] [AuxVariables] [phi] - [] -[] - -[AuxKernels] - [phi] - type = FunctionAux - variable = phi - function = moving_gauss - execute_on = 'INITIAL TIMESTEP_BEGIN TIMESTEP_END' + [AuxKernel] + type = ParsedAux + expression = 'exp(-((x+0.5-t)^2+(y)^2)/0.25)' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] [] [] [Adaptivity] steps = 1 - marker = marker - initial_marker = marker + marker = 'marker' + initial_marker = 'marker' max_h_level = 1 - [Indicators/indicator] - type = GradientJumpIndicator - variable = phi + [Indicators] + [indicator] + type = GradientJumpIndicator + variable = 'phi' + [] [] [Markers] [efm] type = ErrorFractionMarker - indicator = indicator + indicator = 'indicator' coarsen = 0.2 refine = 0.5 [] [marker] type = BoundaryPreservedMarker - preserved_boundary = moving_boundary + preserved_boundary = 'moving_boundary' marker = 'efm' [] [] @@ -97,7 +92,7 @@ [Executioner] type = Transient dt = 0.1 - num_steps = 10 + num_steps = 5 [] [Outputs] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/adaptivity_moving_boundary_3d.i b/test/tests/meshmodifiers/element_subdomain_modifier/adaptivity_moving_boundary_3d.i index 3a2764b16e1d..3a7baadf2dfe 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/adaptivity_moving_boundary_3d.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/adaptivity_moving_boundary_3d.i @@ -18,6 +18,7 @@ type = SubdomainBoundingBoxGenerator input = 'gen' block_id = 1 + block_name = 'left' bottom_left = '-1 -1 0' top_right = '0 1 1' [] @@ -25,28 +26,30 @@ type = SubdomainBoundingBoxGenerator input = 'left' block_id = 2 + block_name = 'right' bottom_left = '0 -1 0' top_right = '1 1 1' [] [moving_boundary] - type = SideSetsAroundSubdomainGenerator + type = SideSetsBetweenSubdomainsGenerator input = 'right' - block = 1 new_boundary = 'moving_boundary' - normal = '1 0 0' + primary_block = 'left' + paired_block = 'right' [] [] -[UserObjects] +[MeshModifiers] [moving_circle] type = CoupledVarThresholdElementSubdomainModifier coupled_var = 'phi' block = 2 - criterion_type = ABOVE + criterion_type = 'ABOVE' threshold = 0.5 subdomain_id = 1 - moving_boundary_name = moving_boundary - execute_on = 'TIMESTEP_BEGIN' + moving_boundaries = 'moving_boundary' + moving_boundary_subdomain_pairs = 'left right' + execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] @@ -59,37 +62,34 @@ [AuxVariables] [phi] - [] -[] - -[AuxKernels] - [phi] - type = FunctionAux - variable = phi - function = moving_gauss - execute_on = 'INITIAL TIMESTEP_BEGIN TIMESTEP_END' + [AuxKernel] + type = ParsedAux + expression = 'exp(-((x+0.5-t)^2+(y)^2)/0.25)' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] [] [] [Adaptivity] steps = 1 - marker = marker - initial_marker = marker + marker = 'marker' + initial_marker = 'marker' max_h_level = 1 [Indicators/indicator] type = GradientJumpIndicator - variable = phi + variable = 'phi' [] [Markers] [efm] type = ErrorFractionMarker - indicator = indicator + indicator = 'indicator' coarsen = 0.2 refine = 0.5 [] [marker] type = BoundaryPreservedMarker - preserved_boundary = moving_boundary + preserved_boundary = 'moving_boundary' marker = 'efm' [] [] @@ -103,5 +103,4 @@ [Outputs] exodus = true - [] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/amr_bc.i b/test/tests/meshmodifiers/element_subdomain_modifier/amr_bc.i index d3d6fb3e97b0..8905354d89a1 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/amr_bc.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/amr_bc.i @@ -13,6 +13,7 @@ type = SubdomainBoundingBoxGenerator input = 'gen' block_id = 1 + block_name = 'left_block' bottom_left = '-1 -1 0' top_right = '0 1 1' [] @@ -20,6 +21,7 @@ type = SubdomainBoundingBoxGenerator input = 'left' block_id = 2 + block_name = 'right_block' bottom_left = '0 -1 0' top_right = '1 1 1' [] @@ -32,95 +34,87 @@ [] [] -[UserObjects] +[MeshModifiers] [moving_circle] type = CoupledVarThresholdElementSubdomainModifier coupled_var = 'phi' block = 2 - criterion_type = ABOVE + criterion_type = 'ABOVE' threshold = 0.5 subdomain_id = 1 - moving_boundary_name = moving_boundary - execute_on = 'TIMESTEP_BEGIN' - [] -[] - -[Functions] - [moving_gauss] - type = ParsedFunction - value = 'exp(-((x+0.5-t)^2+(y)^2)/0.25)' + moving_boundaries = 'moving_boundary' + moving_boundary_subdomain_pairs = 'left_block right_block' + execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] [AuxVariables] [phi] - [] -[] - -[AuxKernels] - [phi] - type = FunctionAux - variable = phi - function = moving_gauss - execute_on = 'INITIAL TIMESTEP_BEGIN TIMESTEP_END' + [AuxKernel] + type = ParsedAux + expression = 'exp(-((x+0.5-t)^2+(y)^2)/0.25)' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] [] [] [Adaptivity] steps = 1 - marker = marker - initial_marker = marker + marker = 'marker' + initial_marker = 'marker' max_h_level = 1 [Indicators/indicator] type = GradientJumpIndicator - variable = phi + variable = 'phi' [] [Markers] [efm] type = ErrorFractionMarker - indicator = indicator + indicator = 'indicator' coarsen = 0.2 refine = 0.5 [] [marker] type = BoundaryPreservedMarker - preserved_boundary = moving_boundary + preserved_boundary = 'moving_boundary' marker = 'efm' [] [] [] [Variables] - [u][] + [u] + [] [] [Kernels] [diff] type = Diffusion - variable = u + variable = 'u' [] [] [BCs] - active = 'mbc leftright' - [mbc] - type = DirichletBC - variable = u - boundary = moving_boundary - value = 1 - [] - [nbc] - type = NeumannBC - variable = u - boundary = moving_boundary - value = 10 - [] - [leftright] - type = DirichletBC - variable = u - boundary = 'left right' - value = 0 - [] + active = 'mbc leftright' + [mbc] + type = DirichletBC + variable = 'u' + boundary = 'moving_boundary' + value = 1 + [] + [nbc] + type = NeumannBC + variable = u + boundary = 'moving_boundary' + value = 10 + [] + [leftright] + type = DirichletBC + variable = u + boundary = 'left right' + value = 0 + [] [] [Executioner] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/complement_boundary.i b/test/tests/meshmodifiers/element_subdomain_modifier/complement_boundary.i deleted file mode 100644 index 982d1ada15a8..000000000000 --- a/test/tests/meshmodifiers/element_subdomain_modifier/complement_boundary.i +++ /dev/null @@ -1,113 +0,0 @@ -[Mesh] - [right_block] - type = GeneratedMeshGenerator - dim = 2 - ymin = -1 - ny = 2 - boundary_name_prefix = '1' - [] - [right_block_sidesets] - type = RenameBoundaryGenerator - input = right_block - old_boundary = '0 1 2 3' - new_boundary = '10 11 12 13' - [] - [right_block_id] - type = SubdomainIDGenerator - input = right_block_sidesets - subdomain_id = 1 - [] - - [left_block] - type = GeneratedMeshGenerator - dim = 2 - xmin = -1.0 - xmax = -0.5 - boundary_name_prefix = '2' - [] - [left_block_sidesets] - type = RenameBoundaryGenerator - input = left_block - old_boundary = '0 1 2 3' - new_boundary = '20 21 22 23' - [] - [left_block_id] - type = SubdomainIDGenerator - input = left_block_sidesets - subdomain_id = 2 - [] - - [combined_mesh] - type = MeshCollectionGenerator - inputs = 'right_block_id left_block_id' - [] -[] - -[Variables] - [temperature] - initial_condition = 298 - [] -[] - -[Kernels] - [Tdot] - type = TimeDerivative - variable = temperature - [] - [heat_conduction] - type = Diffusion - variable = temperature - [] -[] - -[UserObjects] - [w_complement_mvg_bnd] - type = CoupledVarThresholdElementSubdomainModifier - coupled_var = 'temperature' - block = '1' - criterion_type = ABOVE - threshold = 400 - subdomain_id = 2 - complement_moving_boundary_name = 10 - execute_on = 'TIMESTEP_BEGIN' - [] -[] - -[BCs] - [tempBC] - type = DirichletBC - variable = temperature - boundary = '12' - value = 300 - [] - [fluxBC] - type = NeumannBC - variable = temperature - boundary = '10' - value = '100' - [] -[] - -[Postprocessors] - [temp_top_element] - type = PointValue - variable = temperature - point = '0 0.5 0' - [] -[] - -[Executioner] - type = Transient - end_time = 5 - dtmin = 1 - solve_type = 'PJFNK' - petsc_options = '-snes_ksp_ew -snes_converged_reason' - petsc_options_iname = '-pc_type -pc_f./moactor_mat_solver_package -pc_factor_shift_type -pc_factor_shift_amount' - petsc_options_value = 'lu superlu_dist NONZERO 1000' - line_search = none - -[] - -[Outputs] - exodus = true -[] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/external_moving_boundary.i b/test/tests/meshmodifiers/element_subdomain_modifier/external_moving_boundary.i new file mode 100644 index 000000000000..368a6c697fc4 --- /dev/null +++ b/test/tests/meshmodifiers/element_subdomain_modifier/external_moving_boundary.i @@ -0,0 +1,67 @@ +[Problem] + solve = false +[] + +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 2 + nx = 16 + ny = 16 + [] + [left] + type = SubdomainBoundingBoxGenerator + input = 'gen' + block_id = 1 + bottom_left = '0 0 0' + top_right = '0.25 1 1' + [] + [right] + type = SubdomainBoundingBoxGenerator + input = 'left' + block_id = 2 + bottom_left = '0.25 0 0' + top_right = '1 1 1' + [] + [ext] + type = SideSetsAroundSubdomainGenerator + input = 'right' + block = 1 + new_boundary = 'moving_boundary' + [] +[] + +[MeshModifiers] + [moving_circle] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 1 + moving_boundaries = 'moving_boundary' + moving_boundary_subdomain_pairs = '1 2; 1' + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[AuxVariables] + [phi] + [AuxKernel] + type = ParsedAux + expression = '(x-t)^2+(y)^2-0.5^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [] +[] + +[Executioner] + type = Transient + dt = 0.3 + num_steps = 3 +[] + +[Outputs] + exodus = true +[] + diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e index fddf6e1fa7a5..067c372e291b 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s002 index 191db90d4959..93264cdd9a4b 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s003 index 4f3e65cb7a73..2b06d11ce3c2 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s004 index 540d0df017d0..d90c9c9ed05c 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s005 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s005 index 9ee9c20e8af3..7c86a45c64df 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s005 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_3d_out.e-s005 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e index da4200ee253a..8aed6dcb922b 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s002 index d90af53bce9d..0abf9b0a5527 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s003 index 28f660b87244..57e2e7028548 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s004 index b62200ef4854..9c92c3a1232b 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s005 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s005 index b7da689e8b15..8e2ebb9e3c39 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s005 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/adaptivity_moving_boundary_out.e-s005 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e index 03811c0a5431..962d2fe24aee 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s002 index ff1497db2300..306d678322f9 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s003 index 8673f6332fd7..35433a1a0ef7 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s004 index 8fa34d0ce0d3..863bad427663 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s005 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s005 index 62ea18c09b31..f0611f72998a 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s005 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_bc_out.e-s005 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e index 4806e51f2231..946139ca23c0 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s002 index 6b5beb943c1e..74d5a14a469a 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s003 index fb1bda744816..778fa4fea666 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s004 index da6f2af412e5..a5e0e4ef59fe 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s005 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s005 index 1452e94a2b92..bcade135ebde 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s005 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/amr_integral_bc_out.e-s005 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s002 index 15c21e5ee24e..0593e0b75da8 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s003 index a03fb2d2c56e..afd13137f2ee 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s004 index 1e895f2b43b2..188d284886cc 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/block_restricted_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e new file mode 100644 index 000000000000..055134b4ce32 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s002 new file mode 100644 index 000000000000..e400379ed3f1 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s003 new file mode 100644 index 000000000000..de4114c13d1c Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s004 new file mode 100644 index 000000000000..e4c5a6a411a2 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/complement_moving_boundary_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e index 8ce024154fe9..88ecbcdca91f 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s002 index 7668b772c261..7ca6cae4d786 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s003 index 298ed030fdc5..b05c1f3ac12c 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s004 index 21c5e9a8d351..ec47ef947718 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/displaced_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e new file mode 100644 index 000000000000..c33d6c4c97df Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s002 new file mode 100644 index 000000000000..ca5021b4309c Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s003 new file mode 100644 index 000000000000..e76491736e7a Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s004 new file mode 100644 index 000000000000..92882eec4567 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/external_moving_boundary_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e index c671957cd004..06ec94da3d3b 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s002 index 045a7855d359..a4e1d4f3d8a8 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s003 index da32c5dfcd27..5f05b036b8b0 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s004 index 2402da37229b..d0e292c6ed1e 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/initial_condition_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e new file mode 100644 index 000000000000..e5cd7e9754b8 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s002 new file mode 100644 index 000000000000..869516276610 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s003 new file mode 100644 index 000000000000..a7e45d7f012c Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s004 new file mode 100644 index 000000000000..92e99974cef8 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/irreversible_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e new file mode 100644 index 000000000000..490b6fc9ff1f Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s002 new file mode 100644 index 000000000000..188d284886cc Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s003 new file mode 100644 index 000000000000..afd13137f2ee Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s004 new file mode 100644 index 000000000000..0593e0b75da8 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/moving_boundary_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s002 index cbdfc98f6367..92e99974cef8 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s003 index 79cb51445288..a7e45d7f012c 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s004 index abe05e05f622..869516276610 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_moving_boundary_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e new file mode 100644 index 000000000000..9040226994a4 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s002 new file mode 100644 index 000000000000..f153a4e6ddbd Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s003 new file mode 100644 index 000000000000..ca1573faf63a Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s004 new file mode 100644 index 000000000000..fb40ae8b2ce9 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/no_reinitialization_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/parallel_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/parallel_out.e new file mode 100644 index 000000000000..655cbc1eaa42 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/parallel_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/parallel_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/parallel_out.e-s002 new file mode 100644 index 000000000000..1cc572a1693d Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/parallel_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e new file mode 100644 index 000000000000..211acf7966e7 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s002 new file mode 100644 index 000000000000..f153a4e6ddbd Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s003 new file mode 100644 index 000000000000..0d4a48a8026c Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s004 new file mode 100644 index 000000000000..cf4361d697bd Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_from_into_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e new file mode 100644 index 000000000000..b0fbcf2909a8 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s002 new file mode 100644 index 000000000000..ca8ae1b46c62 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s003 new file mode 100644 index 000000000000..4e6b1f0157c3 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s004 new file mode 100644 index 000000000000..416fc5bae4b9 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_into_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e new file mode 100644 index 000000000000..06af59ae11e7 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s002 new file mode 100644 index 000000000000..219e80e3c5c7 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s003 new file mode 100644 index 000000000000..400d47c96426 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s004 new file mode 100644 index 000000000000..597f67d42d70 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reinitialization_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e index 3cf24deb1fd2..08890f2c64eb 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s002 index 6fa065c412c9..7616947c85ee 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s003 index 4a5b95282e8c..33adbf6daddb 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s004 index 2e780d85291e..f5bedc872781 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/reversible_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e index f69401a2d031..04275fdc6c73 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s002 index 8f17f8753789..6b8612c667bf 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s002 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s003 index 0f55508e1b0d..07ede41210d0 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s003 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s004 index 73cc403b985d..bc3b4143bb83 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/stateful_property_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/steady_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/steady_out.e index efb9e2083c75..1902361ad7e6 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/steady_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/steady_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e index 0b936637964d..55de00dbc95b 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e-s002 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e-s002 new file mode 100644 index 000000000000..99b9cb703faa Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e-s003 new file mode 100644 index 000000000000..56665bf984a4 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_csv_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e new file mode 100644 index 000000000000..e23c4ff6838e Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e differ diff --git a/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s002 similarity index 80% rename from test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s004 rename to test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s002 index 9f8fe245047d..7288425f9d33 100644 Binary files a/test/tests/mesh/add_subdomain_ids/gold/add_subdomain_names_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s002 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s003 new file mode 100644 index 000000000000..6ff91f8a465f Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s004 index 1e82519cf10d..6ff91f8a465f 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s004 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s006 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s006 index 18b6a653e0b1..60be3837ddae 100644 Binary files a/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s006 and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/tsm_direct_out.e-s006 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e new file mode 100644 index 000000000000..59b2502f0171 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e-s003 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e-s003 new file mode 100644 index 000000000000..b660ce9b2cc2 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e-s003 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e-s004 b/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e-s004 new file mode 100644 index 000000000000..34680a9bcd04 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_out.e-s004 differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_warning_out.e b/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_warning_out.e new file mode 100644 index 000000000000..5f4195fff009 Binary files /dev/null and b/test/tests/meshmodifiers/element_subdomain_modifier/gold/var_block_id_warning_out.e differ diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/initial_condition.i b/test/tests/meshmodifiers/element_subdomain_modifier/initial_condition.i index 5cdfa0c7a6e5..21bf68ae294c 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/initial_condition.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/initial_condition.i @@ -13,6 +13,7 @@ type = SubdomainBoundingBoxGenerator input = 'gen' block_id = 1 + block_name = 'left' bottom_left = '0 0 0' top_right = '0.25 1 1' [] @@ -20,37 +21,14 @@ type = SubdomainBoundingBoxGenerator input = 'left' block_id = 2 + block_name = 'right' bottom_left = '0.25 0 0' top_right = '1 1 1' [] [] -[UserObjects] - [moving_circle] - type = CoupledVarThresholdElementSubdomainModifier - coupled_var = 'phi' - block = 2 - criterion_type = BELOW - threshold = 0 - subdomain_id = 1 - moving_boundary_name = moving_boundary - execute_on = 'INITIAL TIMESTEP_BEGIN' - [] -[] - -[Functions] - [moving_circle] - type = ParsedFunction - expression = '(x-t)^2+(y)^2-0.5^2' - [] -[] - [AuxVariables] [u] - [InitialCondition] - type = ConstantIC - value = 1 - [] [] [phi] [] @@ -63,17 +41,44 @@ [] [] +[ICs] + [u_1] + type = ConstantIC + variable = 'u' + value = 1 + block = 1 + [] + [u_2] + type = ConstantIC + variable = 'u' + value = -0.5 + block = 2 + [] +[] + +[MeshModifiers] + [moving_circle] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 1 + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + [AuxKernels] [phi] - type = FunctionAux - variable = phi - function = moving_circle + type = ParsedAux + variable = 'phi' + expression = '(x-t)^2+(y)^2-0.5^2' + use_xyzt = true execute_on = 'INITIAL TIMESTEP_BEGIN' [] [double_u] type = StatefulAux - variable = u - coupled = u + variable = 'u' + coupled = 'u' block = 1 [] [] @@ -83,8 +88,8 @@ active = '' [average] type = SideAverageValue - variable = u - boundary = bottom + variable = 'u' + boundary = 'bottom' execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/block_restricted.i b/test/tests/meshmodifiers/element_subdomain_modifier/irreversible.i similarity index 66% rename from test/tests/meshmodifiers/element_subdomain_modifier/block_restricted.i rename to test/tests/meshmodifiers/element_subdomain_modifier/irreversible.i index e38ab5a2a857..6b8ed6a9716a 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/block_restricted.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/irreversible.i @@ -25,46 +25,35 @@ [] [] -[UserObjects] +[MeshModifiers] [moving_circle] type = CoupledVarThresholdElementSubdomainModifier coupled_var = 'phi' - block = 2 - criterion_type = BELOW + criterion_type = 'BELOW' threshold = 0 subdomain_id = 1 - moving_boundary_name = moving_boundary execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] -[Functions] - [moving_circle] - type = ParsedFunction - expression = '(x-t)^2+(y)^2-0.5^2' - [] -[] - [AuxVariables] [phi] - [] -[] - -[AuxKernels] - [phi] - type = FunctionAux - variable = phi - function = moving_circle - execute_on = 'INITIAL TIMESTEP_BEGIN' + [AuxKernel] + type = ParsedAux + expression = '(x-t)^2+(y)^2-0.5^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] [] [] [Executioner] type = Transient - dt = 0.1 + dt = 0.3 num_steps = 3 [] [Outputs] exodus = true [] + diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/moving_boundary.i b/test/tests/meshmodifiers/element_subdomain_modifier/moving_boundary.i new file mode 100644 index 000000000000..44d3ed445692 --- /dev/null +++ b/test/tests/meshmodifiers/element_subdomain_modifier/moving_boundary.i @@ -0,0 +1,60 @@ +[Problem] + solve = false +[] + +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 2 + nx = 16 + ny = 16 + [] + [left] + type = SubdomainBoundingBoxGenerator + input = 'gen' + block_id = 1 + bottom_left = '0 0 0' + top_right = '0.25 1 1' + [] + [right] + type = SubdomainBoundingBoxGenerator + input = 'left' + block_id = 2 + bottom_left = '0.25 0 0' + top_right = '1 1 1' + [] +[] + +[MeshModifiers] + [moving_circle] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 1 + moving_boundaries = 'moving_boundary' + moving_boundary_subdomain_pairs = '1 2' + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[AuxVariables] + [phi] + [AuxKernel] + type = ParsedAux + expression = '(x-t)^2+(y)^2-0.5^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [] +[] + +[Executioner] + type = Transient + dt = 0.3 + num_steps = 3 +[] + +[Outputs] + exodus = true +[] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/no_moving_boundary.i b/test/tests/meshmodifiers/element_subdomain_modifier/no_moving_boundary.i index ad6072ba7fae..265ef9b5f5c7 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/no_moving_boundary.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/no_moving_boundary.i @@ -3,65 +3,65 @@ [] [Mesh] - [gen] + [gmg] type = GeneratedMeshGenerator dim = 2 - nx = 16 - ny = 16 + nx = 3 + ny = 1 + xmax = 3 + ymax = 1 [] - [left] + [block_1] type = SubdomainBoundingBoxGenerator - input = 'gen' + input = 'gmg' block_id = 1 + block_name = 'block_1' bottom_left = '0 0 0' - top_right = '0.25 1 1' + top_right = '1 1 0' [] - [right] + [block_2] type = SubdomainBoundingBoxGenerator - input = 'left' + input = 'block_1' block_id = 2 - bottom_left = '0.25 0 0' - top_right = '1 1 1' + block_name = 'block_2' + bottom_left = '1 0 0' + top_right = '2 1 0' [] -[] - -[UserObjects] - [moving_circle] - type = CoupledVarThresholdElementSubdomainModifier - coupled_var = 'phi' - block = 2 - criterion_type = BELOW - threshold = 0 - subdomain_id = 1 - execute_on = 'INITIAL TIMESTEP_BEGIN' - [] -[] - -[Functions] - [moving_circle] - type = ParsedFunction - expression = '(x-t)^2+(y)^2-0.5^2' + [block_3] + type = SubdomainBoundingBoxGenerator + input = 'block_2' + block_id = 3 + block_name = 'block_3' + bottom_left = '2 0 0' + top_right = '3 1 0' [] [] [AuxVariables] - [phi] + [u] + [AuxKernel] + type = FunctionAux + function = 't-x' + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] [] [] -[AuxKernels] - [phi] - type = FunctionAux - variable = phi - function = moving_circle +[MeshModifiers] + [w_mvg_bnd] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'u' + criterion_type = 'ABOVE' + threshold = 0 + subdomain_id = 1 execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] [Executioner] type = Transient - dt = 0.1 - num_steps = 3 + end_time = 3 + dt = 1 [] [Outputs] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/no_reinitialization.i b/test/tests/meshmodifiers/element_subdomain_modifier/no_reinitialization.i new file mode 100644 index 000000000000..7955321c66b5 --- /dev/null +++ b/test/tests/meshmodifiers/element_subdomain_modifier/no_reinitialization.i @@ -0,0 +1,117 @@ +[Problem] + kernel_coverage_check = false +[] + +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 2 + xmax = 1 + ymax = 1 + nx = 25 + ny = 25 + [] + [left] + type = SubdomainBoundingBoxGenerator + input = 'gen' + block_id = 1 + bottom_left = '0 0 0' + top_right = '0.3 1 0' + [] + [middle] + type = SubdomainBoundingBoxGenerator + input = 'left' + block_id = 2 + bottom_left = '0.3 0 0' + top_right = '0.6 1 0' + [] + [right] + type = SubdomainBoundingBoxGenerator + input = 'middle' + block_id = 3 + bottom_left = '0.6 0 0' + top_right = '1 1 0' + [] +[] + +[Variables] + [u] + [] +[] + +[ICs] + [u_1] + type = ConstantIC + variable = 'u' + value = 1 + block = 1 + [] + [u_2] + type = ConstantIC + variable = 'u' + value = 2 + block = 2 + [] + [u_3] + type = ConstantIC + variable = 'u' + value = 3 + block = 3 + [] +[] + +[MeshModifiers] + [moving_circle_bottom] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi_1' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 1 + reinitialize_subdomains = '' + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [moving_circle_top] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi_2' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 2 + reinitialize_subdomains = '' + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[AuxVariables] + [phi_1] + [] + [phi_2] + [] +[] + +[AuxKernels] + [phi_1] + type = ParsedAux + variable = 'phi_1' + expression = '(x-t)^2+(y)^2-0.3^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [phi_2] + type = ParsedAux + variable = 'phi_2' + expression = '(x-t)^2+(y-1)^2-0.3^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[Executioner] + type = Transient + dt = 0.3 + num_steps = 3 +[] + +[Outputs] + exodus = true +[] + diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/parallel.i b/test/tests/meshmodifiers/element_subdomain_modifier/parallel.i new file mode 100644 index 000000000000..aa9909df3c16 --- /dev/null +++ b/test/tests/meshmodifiers/element_subdomain_modifier/parallel.i @@ -0,0 +1,70 @@ +[Problem] + solve = false +[] + +[Mesh] + [gmg] + type = GeneratedMeshGenerator + dim = 2 + nx = 2 + ny = 2 + xmax = 2 + ymax = 2 + [] + [block_1] + type = SubdomainBoundingBoxGenerator + input = 'gmg' + block_id = 1 + bottom_left = '0 0 0' + top_right = '2 1 0' + [] + [block_2] + type = SubdomainBoundingBoxGenerator + input = 'block_1' + block_id = 2 + bottom_left = '0 1 0' + top_right = '2 2 0' + [] +[] + +[Variables] + [dummy] + block = 1 + [] +[] + +[AuxVariables] + [u] + [] +[] + +[AuxKernels] + [cut] + type = ParsedAux + variable = 'u' + expression = 'if (t>=1 & x<1 & y<1, 0, 1)' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[MeshModifiers] + [cut] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'u' + criterion_type = 'BELOW' + threshold = 0.99 + subdomain_id = 2 + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[Executioner] + type = Transient + end_time = 2 + dt = 1 +[] + +[Outputs] + exodus = true +[] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization.i b/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization.i new file mode 100644 index 000000000000..acedd3d589fc --- /dev/null +++ b/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization.i @@ -0,0 +1,115 @@ +[Problem] + kernel_coverage_check = false +[] + +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 2 + xmax = 1 + ymax = 1 + nx = 25 + ny = 25 + [] + [left] + type = SubdomainBoundingBoxGenerator + input = 'gen' + block_id = 1 + bottom_left = '0 0 0' + top_right = '0.3 1 0' + [] + [middle] + type = SubdomainBoundingBoxGenerator + input = 'left' + block_id = 2 + bottom_left = '0.3 0 0' + top_right = '0.6 1 0' + [] + [right] + type = SubdomainBoundingBoxGenerator + input = 'middle' + block_id = 3 + bottom_left = '0.6 0 0' + top_right = '1 1 0' + [] +[] + +[Variables] + [u] + [] +[] + +[ICs] + [u_1] + type = ConstantIC + variable = 'u' + value = 1 + block = 1 + [] + [u_2] + type = ConstantIC + variable = 'u' + value = 2 + block = 2 + [] + [u_3] + type = ConstantIC + variable = 'u' + value = 3 + block = 3 + [] +[] + +[MeshModifiers] + [moving_circle_bottom] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi_1' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 1 + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [moving_circle_top] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi_2' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 2 + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[AuxVariables] + [phi_1] + [] + [phi_2] + [] +[] + +[AuxKernels] + [phi_1] + type = ParsedAux + variable = 'phi_1' + expression = '(x-t)^2+(y)^2-0.3^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [phi_2] + type = ParsedAux + variable = 'phi_2' + expression = '(x-t)^2+(y-1)^2-0.3^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[Executioner] + type = Transient + dt = 0.3 + num_steps = 3 +[] + +[Outputs] + exodus = true +[] + diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization_from_into.i b/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization_from_into.i new file mode 100644 index 000000000000..df0545888344 --- /dev/null +++ b/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization_from_into.i @@ -0,0 +1,119 @@ +[Problem] + kernel_coverage_check = false +[] + +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 2 + xmax = 1 + ymax = 1 + nx = 25 + ny = 25 + [] + [left] + type = SubdomainBoundingBoxGenerator + input = 'gen' + block_id = 1 + bottom_left = '0 0 0' + top_right = '0.3 1 0' + [] + [middle] + type = SubdomainBoundingBoxGenerator + input = 'left' + block_id = 2 + bottom_left = '0.3 0 0' + top_right = '0.6 1 0' + [] + [right] + type = SubdomainBoundingBoxGenerator + input = 'middle' + block_id = 3 + bottom_left = '0.6 0 0' + top_right = '1 1 0' + [] +[] + +[Variables] + [u] + [] +[] + +[ICs] + [u_1] + type = ConstantIC + variable = 'u' + value = 1 + block = 1 + [] + [u_2] + type = ConstantIC + variable = 'u' + value = 2 + block = 2 + [] + [u_3] + type = ConstantIC + variable = 'u' + value = 3 + block = 3 + [] +[] + +[MeshModifiers] + [moving_circle_bottom] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi_1' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 1 + reinitialize_subdomains = '1 2' + previous_subdomain_reinitialized = false + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [moving_circle_top] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi_2' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 2 + reinitialize_subdomains = '1 2' + previous_subdomain_reinitialized = false + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[AuxVariables] + [phi_1] + [] + [phi_2] + [] +[] + +[AuxKernels] + [phi_1] + type = ParsedAux + variable = 'phi_1' + expression = '(x-t)^2+(y)^2-0.3^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [phi_2] + type = ParsedAux + variable = 'phi_2' + expression = '(x-t)^2+(y-1)^2-0.3^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[Executioner] + type = Transient + dt = 0.3 + num_steps = 3 +[] + +[Outputs] + exodus = true +[] + diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization_into.i b/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization_into.i new file mode 100644 index 000000000000..8136c9829d21 --- /dev/null +++ b/test/tests/meshmodifiers/element_subdomain_modifier/reinitialization_into.i @@ -0,0 +1,116 @@ +[Problem] + kernel_coverage_check = false +[] + +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 2 + xmax = 1 + ymax = 1 + nx = 25 + ny = 25 + [] + [left] + type = SubdomainBoundingBoxGenerator + input = 'gen' + block_id = 1 + bottom_left = '0 0 0' + top_right = '0.3 1 0' + [] + [middle] + type = SubdomainBoundingBoxGenerator + input = 'left' + block_id = 2 + bottom_left = '0.3 0 0' + top_right = '0.6 1 0' + [] + [right] + type = SubdomainBoundingBoxGenerator + input = 'middle' + block_id = 3 + bottom_left = '0.6 0 0' + top_right = '1 1 0' + [] +[] + +[Variables] + [u] + [] +[] + +[ICs] + [u_1] + type = ConstantIC + variable = 'u' + value = 1 + block = 1 + [] + [u_2] + type = ConstantIC + variable = 'u' + value = 2 + block = 2 + [] + [u_3] + type = ConstantIC + variable = 'u' + value = 3 + block = 3 + [] +[] + +[MeshModifiers] + [moving_circle_bottom] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi_1' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 1 + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [moving_circle_top] + type = CoupledVarThresholdElementSubdomainModifier + coupled_var = 'phi_2' + criterion_type = 'BELOW' + threshold = 0 + subdomain_id = 2 + reinitialize_subdomains = '1' + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[AuxVariables] + [phi_1] + [] + [phi_2] + [] +[] + +[AuxKernels] + [phi_1] + type = ParsedAux + variable = 'phi_1' + expression = '(x-t)^2+(y)^2-0.3^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] + [phi_2] + type = ParsedAux + variable = 'phi_2' + expression = '(x-t)^2+(y-1)^2-0.3^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] +[] + +[Executioner] + type = Transient + dt = 0.3 + num_steps = 3 +[] + +[Outputs] + exodus = true +[] + diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/reversible.i b/test/tests/meshmodifiers/element_subdomain_modifier/reversible.i index e4d21b00ce70..03330c6d3b17 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/reversible.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/reversible.i @@ -25,44 +25,29 @@ [] [] -[UserObjects] +[MeshModifiers] [moving_circle] type = CoupledVarThresholdElementSubdomainModifier coupled_var = 'phi' - criterion_type = BELOW + criterion_type = 'BELOW' threshold = 0 subdomain_id = 1 complement_subdomain_id = 2 - moving_boundary_name = moving_boundary execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] -[Functions] - [moving_circle] - type = ParsedFunction - expression = '(x-t)^2+(y)^2-0.5^2' - [] -[] - [AuxVariables] [phi] - [InitialCondition] - type = FunctionIC - function = moving_circle + [AuxKernel] + type = ParsedAux + expression = '(x-t)^2+(y)^2-0.5^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] [] -[AuxKernels] - [phi] - type = FunctionAux - variable = phi - function = moving_circle - execute_on = 'INITIAL TIMESTEP_BEGIN' - [] -[] - [Executioner] type = Transient dt = 0.3 diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/stateful_property.i b/test/tests/meshmodifiers/element_subdomain_modifier/stateful_property.i index 19f6c47aa6bf..f305bc594cda 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/stateful_property.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/stateful_property.i @@ -13,6 +13,7 @@ type = SubdomainBoundingBoxGenerator input = 'gen' block_id = 1 + block_name = 'left' bottom_left = '0 0 0' top_right = '0.25 1 1' [] @@ -20,6 +21,7 @@ type = SubdomainBoundingBoxGenerator input = 'left' block_id = 2 + block_name = 'right' bottom_left = '0.25 0 0' top_right = '1 1 1' [] @@ -29,33 +31,21 @@ [moving_circle] type = CoupledVarThresholdElementSubdomainModifier coupled_var = 'phi' - block = 2 - criterion_type = BELOW + criterion_type = 'BELOW' threshold = 0 subdomain_id = 1 - moving_boundary_name = moving_boundary execute_on = 'INITIAL TIMESTEP_BEGIN' [] [] -[Functions] - [moving_circle] - type = ParsedFunction - expression = '(x-t)^2+(y)^2-0.5^2' - [] -[] - [AuxVariables] [phi] - [] -[] - -[AuxKernels] - [phi] - type = FunctionAux - variable = phi - function = moving_circle - execute_on = 'INITIAL TIMESTEP_BEGIN' + [AuxKernel] + type = ParsedAux + expression = '(x-t)^2+(y)^2-0.5^2' + use_xyzt = true + execute_on = 'INITIAL TIMESTEP_BEGIN' + [] [] [] @@ -64,15 +54,15 @@ type = StatefulMaterial initial_diffusivity = 0.5 multiplier = 2 - block = 1 - outputs = exodus + block = 'left' + outputs = 'exodus' [] [non_stateful] type = GenericConstantMaterial prop_names = 'diffusivity' - prop_values = '0.5' - block = 2 - outputs = exodus + prop_values = '-1' + block = 'right' + outputs = 'exodus' [] [] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/steady.i b/test/tests/meshmodifiers/element_subdomain_modifier/steady.i index 03f8f89b3dfc..b104b214c547 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/steady.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/steady.i @@ -13,6 +13,7 @@ type = SubdomainBoundingBoxGenerator input = 'gen' block_id = 1 + block_name = 'left' bottom_left = '0 0 0' top_right = '0.25 1 1' [] @@ -20,42 +21,40 @@ type = SubdomainBoundingBoxGenerator input = 'left' block_id = 2 + block_name = 'right' bottom_left = '0.25 0 0' top_right = '1 1 1' [] + [moving_boundary] + type = SideSetsBetweenSubdomainsGenerator + input = 'right' + new_boundary = 'moving_boundary' + primary_block = 'left' + paired_block = 'right' + [] [] -[UserObjects] +[MeshModifiers] [moving_circle] type = CoupledVarThresholdElementSubdomainModifier coupled_var = 'phi' - block = 2 - criterion_type = BELOW + criterion_type = 'BELOW' threshold = 0 subdomain_id = 1 - moving_boundary_name = moving_boundary + moving_boundaries = 'moving_boundary' + moving_boundary_subdomain_pairs = 'left right' execute_on = 'INITIAL' [] [] -[Functions] - [moving_circle] - type = ParsedFunction - expression = '(x-t)^2+(y)^2-0.5^2' - [] -[] - [AuxVariables] [phi] - [] -[] - -[AuxKernels] - [phi] - type = FunctionAux - variable = phi - function = moving_circle - execute_on = 'INITIAL' + [AuxKernel] + type = ParsedAux + expression = '(x-t)^2+(y)^2-0.5^2' + use_xyzt = true + execute_on = 'INITIAL' + [] [] [] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/tests b/test/tests/meshmodifiers/element_subdomain_modifier/tests index 042cf2d624c5..9e62b3583e31 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/tests +++ b/test/tests/meshmodifiers/element_subdomain_modifier/tests @@ -4,39 +4,55 @@ [group] requirement = 'The framework shall include the ability to change element subdomain during simulation' - [complement_moving_boundary] - type = 'Exodiff' - input = 'complement_boundary.i' - exodiff = 'complement_boundary_out.e complement_boundary_out.e-s002 complement_boundary_out.e-s003 complement_boundary_out.e-s004 complement_boundary_out.e-s005 complement_boundary_out.e-s006' - detail = 'with complement moving boundary,' - [] - [reversible] type = 'Exodiff' input = 'reversible.i' exodiff = 'reversible_out.e reversible_out.e-s002 reversible_out.e-s003 reversible_out.e-s004' - detail = 'reversibly,' + detail = 'reversibly, ' [] - [block_restricted] + [irreversible] type = 'Exodiff' - input = 'block_restricted.i' - exodiff = 'block_restricted_out.e block_restricted_out.e-s002 block_restricted_out.e-s003 block_restricted_out.e-s004' + input = 'irreversible.i' + exodiff = 'irreversible_out.e irreversible_out.e-s002 irreversible_out.e-s003 irreversible_out.e-s004' detail = 'irreversibly, ' [] - [no_moving_boundary] + [moving_boundary] + type = 'Exodiff' + input = 'moving_boundary.i' + exodiff = 'moving_boundary_out.e moving_boundary_out.e-s002 moving_boundary_out.e-s003 moving_boundary_out.e-s004' + detail = 'with a moving boundary, ' + [] + + [complement_moving_boundary] + type = 'Exodiff' + input = 'moving_boundary.i' + cli_args = "MeshModifiers/moving_circle/moving_boundary_subdomain_pairs='2 1' " + "Outputs/file_base='complement_moving_boundary_out'" + exodiff = 'complement_moving_boundary_out.e complement_moving_boundary_out.e-s002 complement_moving_boundary_out.e-s003 complement_moving_boundary_out.e-s004' + detail = 'with a complement moving boundary, ' + [] + + [external_moving_boundary] + type = 'Exodiff' + input = 'external_moving_boundary.i' + exodiff = 'external_moving_boundary_out.e external_moving_boundary_out.e-s002 external_moving_boundary_out.e-s003 external_moving_boundary_out.e-s004' + detail = 'with an external moving boundary, ' + [] + + [parallel] type = 'Exodiff' - input = 'no_moving_boundary.i' - exodiff = 'no_moving_boundary_out.e no_moving_boundary_out.e-s002 no_moving_boundary_out.e-s003 no_moving_boundary_out.e-s004' - detail = 'with and without a specified boundary,' + input = 'parallel.i' + exodiff = 'parallel_out.e parallel_out.e-s002' + requirement = 'run in parallel, ' [] [initial_condition] type = 'Exodiff' input = 'initial_condition.i' exodiff = 'initial_condition_out.e initial_condition_out.e-s002 initial_condition_out.e-s003 initial_condition_out.e-s004' - detail = 'with solution' + detail = 'with solution, ' [] [displaced] @@ -44,7 +60,7 @@ input = 'initial_condition.i' cli_args = 'AuxVariables/inactive="" Mesh/displacements="disp_x disp_y" Outputs/file_base=displaced_out Outputs/out/use_displaced=true' exodiff = "displaced_out.e displaced_out.e-s002 displaced_out.e-s003 displaced_out.e-s004" - detail = 'with a displaced mesh' + detail = 'with a displaced mesh, ' [] [stateful_property] @@ -55,6 +71,38 @@ [] [] + [reinitialization] + requirement = 'The framework shall include the ability to change element subdomain during simulation with reinitialization of' + + [all] + type = 'Exodiff' + input = 'reinitialization.i' + exodiff = 'reinitialization_out.e reinitialization_out.e-s002 reinitialization_out.e-s003 reinitialization_out.e-s004' + requirement = 'all the changed elements, ' + [] + + [none] + type = 'Exodiff' + input = 'no_reinitialization.i' + exodiff = 'no_reinitialization_out.e no_reinitialization_out.e-s002 no_reinitialization_out.e-s003 no_reinitialization_out.e-s004' + requirement = 'none of the changed elements, ' + [] + + [into] + type = 'Exodiff' + input = 'reinitialization_into.i' + exodiff = 'reinitialization_into_out.e reinitialization_into_out.e-s002 reinitialization_into_out.e-s003 reinitialization_into_out.e-s004' + requirement = 'only the elements that change into particular subdomains, ' + [] + + [from_into] + type = 'Exodiff' + input = 'reinitialization_from_into.i' + exodiff = 'reinitialization_from_into_out.e reinitialization_from_into_out.e-s002 reinitialization_from_into_out.e-s003 reinitialization_from_into_out.e-s004' + requirement = 'only the elements that change from outside of to into particular subdomains, ' + [] + [] + [steady] type = 'Exodiff' input = 'steady.i' @@ -76,9 +124,7 @@ type = 'Exodiff' input = 'adaptivity_moving_boundary.i' exodiff = 'adaptivity_moving_boundary_out.e - adaptivity_moving_boundary_out.e-s002 adaptivity_moving_boundary_out.e-s003 adaptivity_moving_boundary_out.e-s004 - adaptivity_moving_boundary_out.e-s005 adaptivity_moving_boundary_out.e-s006 adaptivity_moving_boundary_out.e-s007 - adaptivity_moving_boundary_out.e-s008 adaptivity_moving_boundary_out.e-s009 adaptivity_moving_boundary_out.e-s010' + adaptivity_moving_boundary_out.e-s002 adaptivity_moving_boundary_out.e-s003 adaptivity_moving_boundary_out.e-s004 adaptivity_moving_boundary_out.e-s005' mesh_mode = 'REPLICATED' requirement = 'The framework shall support adaptive mesh refinement in the element subdomain modifier' [] @@ -87,8 +133,7 @@ type = 'Exodiff' input = 'adaptivity_moving_boundary_3d.i' exodiff = 'adaptivity_moving_boundary_3d_out.e - adaptivity_moving_boundary_3d_out.e-s002 adaptivity_moving_boundary_3d_out.e-s003 adaptivity_moving_boundary_3d_out.e-s004 - adaptivity_moving_boundary_3d_out.e-s005 adaptivity_moving_boundary_3d_out.e-s006' + adaptivity_moving_boundary_3d_out.e-s002 adaptivity_moving_boundary_3d_out.e-s003 adaptivity_moving_boundary_3d_out.e-s004 adaptivity_moving_boundary_3d_out.e-s005' mesh_mode = 'REPLICATED' requirement = 'The framework shall support adaptive mesh refinement in the element subdomain modifier for 3D problems' [] @@ -96,7 +141,7 @@ [amr_bc] type = 'Exodiff' input = 'amr_bc.i' - exodiff = 'amr_bc_out.e amr_bc_out.e-s002 amr_bc_out.e-s003 amr_bc_out.e-s004 amr_bc_out.e-s005 amr_bc_out.e-s006' + exodiff = 'amr_bc_out.e amr_bc_out.e-s002 amr_bc_out.e-s003 amr_bc_out.e-s004 amr_bc_out.e-s005' mesh_mode = 'REPLICATED' requirement = 'The framework shall support applying nodal BCs on the moving boundary with AMR in the element subdomain modifier' [] @@ -104,9 +149,9 @@ [amr_nbc] type = 'Exodiff' input = 'amr_bc.i' - cli_args = "BCs/active='mbc leftright' Outputs/file_base=amr_integral_bc_out" + cli_args = "BCs/active='nbc leftright' Outputs/file_base=amr_integral_bc_out" exodiff = 'amr_integral_bc_out.e amr_integral_bc_out.e-s002 - amr_integral_bc_out.e-s003 amr_integral_bc_out.e-s004 amr_integral_bc_out.e-s005 amr_integral_bc_out.e-s006' + amr_integral_bc_out.e-s003 amr_integral_bc_out.e-s004 amr_integral_bc_out.e-s005' mesh_mode = 'REPLICATED' requirement = 'The framework shall support applying integral BCs on the moving boundary with AMR in the element subdomain modifier' [] @@ -123,7 +168,7 @@ [var_block_id] type = 'Exodiff' input = 'var_block_id.i' - exodiff = 'var_block_id_out.e-s002 var_block_id_out.e-s005' + exodiff = 'var_block_id_out.e var_block_id_out.e-s002 var_block_id_out.e-s003 var_block_id_out.e-s004 var_block_id_out.e-s005' requirement = 'The system shall be able to change element subdomain IDs based on the average coupled variable value in the element.' recover = false # some blocks may become empty during the simulation therefore recover would fail in such cases [] @@ -132,8 +177,8 @@ type = 'Exodiff' input = 'var_block_id.i' cli_args = "Functions/fcn/expression='100' Executioner/num_steps=1 " - "Outputs/file_base='var_block_id_warning'" - exodiff = 'var_block_id_warning.e-s002' + "Outputs/file_base='var_block_id_warning_out'" + exodiff = 'var_block_id_warning_out.e' requirement = 'When the desired value is not present in the subdomain ID list, the closest existing subdomain ID value will be assigned to the element with a warning.' allow_warnings = true recover = false # some blocks may become empty during the simulation therefore recover would fail in such cases @@ -144,7 +189,7 @@ [direct] type = 'Exodiff' input = 'tsm_direct.i' - exodiff = 'tsm_direct_out.e-s004 tsm_direct_out.e-s006' + exodiff = 'tsm_direct_out.e tsm_direct_out.e-s002 tsm_direct_out.e-s003' detail = 'listed in the input file,' exodiff_opts = '-pedantic' [] @@ -152,7 +197,7 @@ [csv] type = 'Exodiff' input = 'tsm_csv.i' - exodiff = 'tsm_csv_out.e' + exodiff = 'tsm_csv_out.e tsm_csv_out.e-s002 tsm_csv_out.e-s003' detail = 'listed in a CSV file.' exodiff_opts = '-pedantic' [] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/tsm_csv.i b/test/tests/meshmodifiers/element_subdomain_modifier/tsm_csv.i index 2b554515c6a8..d2d945478c5c 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/tsm_csv.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/tsm_csv.i @@ -1,9 +1,5 @@ -# testing TimedSubdomainModifier - [Problem] solve = false - kernel_coverage_check = false - material_coverage_check = false [] Box2_inactive_id = '3' @@ -12,7 +8,6 @@ inactive_domain_block_ids = ${Box2_inactive_id} inactive_domain_block_names = ${Box2_inactive_name} [Mesh] - [BaseMesh] type = GeneratedMeshGenerator elem_type = TET4 @@ -21,34 +16,30 @@ inactive_domain_block_names = ${Box2_inactive_name} ny = 3 nz = 2 xmin = -10 - xmax = +10 + xmax = 10 ymin = -10 - ymax = +10 + ymax = 10 zmin = -2 - zmax = +2 + zmax = 2 [] - [Box1] type = SubdomainBoundingBoxGenerator input = "BaseMesh" block_id = 1 location = "INSIDE" bottom_left = "-20 -20 -2" - top_right = "+20 +20 +2" + top_right = "20 20 2" [] - [Box2] type = SubdomainBoundingBoxGenerator input = "Box1" block_id = 2 location = "INSIDE" - bottom_left = "-2 -2 +2" - top_right = "+2 +2 0" + bottom_left = "-2 -2 2" + top_right = "2 2 0" [] - add_subdomain_ids = ${inactive_domain_block_ids} add_subdomain_names = ${inactive_domain_block_names} - [] [AuxVariables] @@ -70,25 +61,8 @@ inactive_domain_block_names = ${Box2_inactive_name} [Executioner] type = Transient - + dt = 0.1 end_time = 1.0 - [TimeSteppers] - [BlockEventTimeStepper] - type = TimeSequenceStepper - time_sequence = '0.0 0.2 0.4 0.5 0.6 1.0' - [] - [] - - solve_type = 'PJFNK' - petsc_options = '-snes_converged_reason' - petsc_options_iname = '-pc_type -pc_factor_mat_solver_package' - petsc_options_value = ' lu mumps' - - nl_abs_tol = 1E-3 - nl_max_its = 400 - - l_tol = 1E-3 - l_max_its = 200 [] [Outputs] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/tsm_direct.i b/test/tests/meshmodifiers/element_subdomain_modifier/tsm_direct.i index 41075648dc6b..c04e03083980 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/tsm_direct.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/tsm_direct.i @@ -1,9 +1,5 @@ -# testing TimedSubdomainModifier - [Problem] solve = false - kernel_coverage_check = false - material_coverage_check = false [] Box2_inactive_id = '4' @@ -22,40 +18,36 @@ inactive_domain_block_names = '${Box2_inactive_name} ${Box3_inactive_name}' ny = 3 nz = 2 xmin = -10 - xmax = +10 + xmax = 10 ymin = -10 - ymax = +10 + ymax = 10 zmin = -2 - zmax = +2 + zmax = 2 [] - [Box1] type = SubdomainBoundingBoxGenerator input = "BaseMesh" block_id = 1 location = "INSIDE" bottom_left = "-20 -20 -2" - top_right = "+20 +20 +2" + top_right = "20 20 +2" [] - [Box2] type = SubdomainBoundingBoxGenerator input = "Box1" block_id = 2 location = "INSIDE" - bottom_left = "-4 -3 +3" - top_right = "0 +3 0" + bottom_left = "-4 -3 3" + top_right = "0 3 0" [] - [Box3] type = SubdomainBoundingBoxGenerator input = "Box2" block_id = 3 location = "INSIDE" - bottom_left = "0 -3 +2" - top_right = "+4 +3 0" + bottom_left = "0 -3 2" + top_right = "4 3 0" [] - add_subdomain_ids = ${inactive_domain_block_ids} add_subdomain_names = ${inactive_domain_block_names} [] @@ -66,7 +58,6 @@ inactive_domain_block_names = '${Box2_inactive_name} ${Box3_inactive_name}' [] [] -# move elements between subdomains back and forth [MeshModifiers] [GlobalSubdomainModifier] type = TimedSubdomainModifier @@ -78,26 +69,9 @@ inactive_domain_block_names = '${Box2_inactive_name} ${Box3_inactive_name}' [] [Executioner] + dt = 0.1 type = Transient - end_time = 1.0 - [TimeSteppers] - [BlockEventTimeStepper] - type = TimeSequenceStepper - time_sequence = '0.0 0.2 0.4 0.5 0.6 1.0' - [] - [] - - solve_type = 'PJFNK' - petsc_options = '-snes_converged_reason' - petsc_options_iname = '-pc_type -pc_factor_mat_solver_package' - petsc_options_value = ' lu mumps' - - nl_abs_tol = 1E-3 - nl_max_its = 400 - - l_tol = 1E-3 - l_max_its = 200 [] [Outputs] diff --git a/test/tests/meshmodifiers/element_subdomain_modifier/var_block_id.i b/test/tests/meshmodifiers/element_subdomain_modifier/var_block_id.i index a26e7b0c90ce..b2881825756f 100644 --- a/test/tests/meshmodifiers/element_subdomain_modifier/var_block_id.i +++ b/test/tests/meshmodifiers/element_subdomain_modifier/var_block_id.i @@ -65,7 +65,7 @@ [] [] -[UserObjects] +[MeshModifiers] [assign_block_id] type = VariableValueElementSubdomainModifier coupled_var = 'block_id'