Skip to content

Commit

Permalink
update tests to moving circle; update markdown file
Browse files Browse the repository at this point in the history
  • Loading branch information
Wendy-Ji committed Jun 26, 2024
1 parent 4e9e1ab commit 0059e27
Show file tree
Hide file tree
Showing 30 changed files with 186 additions and 76 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,23 @@ If the `CoupledVarThresholdElementSubdomainModifier` is applied onto the entire

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/userobjects/element_subdomain_modifier/block_restricted.i start=[moving_circle] end=[] include-end=true
!listing test/tests/userobjects/element_subdomain_modifier/irreversible.i start=[moving_circle] end=[] include-end=true

!media media/userobjects/esm_irreversible.jpg 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 definition of certain sidesets and nodesets. The `CoupledVarThresholdElementSubdomainModifier` optionally takes the parameter `moving_boundaries` to help modify the corresponding sideset/nodeset. If the boundary provided through the `moving_boundaries` 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. This parameter must also be set with `moving_boundary_subdomain_pairs`, for the subdomains the boundary lies between.

!media media/userobjects/esm_sideset.jpg style=float:center;width:100%; caption=The evolving sideset (green) at three different time steps
!listing test/tests/userobjects/element_subdomain_modifier/moving_boundary.i start=[moving_circle] end=[] include-end=true

!media media/userobjects/esm_nodeset.jpg style=float:center;width:100%; caption=The evolving nodeset (green) at three different time steps
!media media/userobjects/esm_sideset.jpg style=float:center;width:100%; caption=The evolving sideset (green) at three different time steps, without a provided boundary from the user.

!media media/userobjects/esm_nodeset.jpg style=float:center;width:100%; caption=The evolving nodeset (green) at three different time steps, without a provided boundary from the user.

The parameter `moving_boundary_subdomain_pairs` also allows for the external parts of the boundary to be included by setting the subdomain pair to only one subdomain.

!listing test/tests/userobjects/element_subdomain_modifier/external_moving_boundary.i start=[moving_circle] end=[] include-end=true

Nodal and integrated BCs can be applied on the moving boundary.

Expand Down
Original file line number Diff line number Diff line change
@@ -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'
[]
[]

[UserObjects]
[moving_circle]
type = CoupledVarThresholdElementSubdomainModifier
coupled_var = 'phi'
criterion_type = 'BELOW'
threshold = 0
subdomain_id = 1
moving_boundaries = 'moving_boundary 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
[]

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
criterion_type = 'BELOW'
threshold = 0
subdomain_id = 1
complement_subdomain_id = 2
moving_boundaries = 'moving_boundary'
moving_boundary_subdomain_pairs = '1 2'
execute_on = 'INITIAL TIMESTEP_BEGIN'
[]
[]
Expand Down
75 changes: 29 additions & 46 deletions test/tests/userobjects/element_subdomain_modifier/moving_boundary.i
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,58 @@
[]

[Mesh]
[gmg]
[gen]
type = GeneratedMeshGenerator
dim = 2
nx = 3
ny = 1
xmax = 3
ymax = 1
nx = 16
ny = 16
[]
[block_1]
[left]
type = SubdomainBoundingBoxGenerator
input = 'gmg'
input = 'gen'
block_id = 1
block_name = 'block_1'
bottom_left = '0 0 0'
top_right = '1 1 0'
top_right = '0.25 1 1'
[]
[block_2]
[right]
type = SubdomainBoundingBoxGenerator
input = 'block_1'
input = 'left'
block_id = 2
block_name = 'block_2'
bottom_left = '1 0 0'
top_right = '2 1 0'
[]
[block_3]
type = SubdomainBoundingBoxGenerator
input = 'block_2'
block_id = 3
block_name = 'block_3'
bottom_left = '2 0 0'
top_right = '3 1 0'
[]
[moving_boundary]
type = SideSetsAroundSubdomainGenerator
input = 'block_3'
block = 1
new_boundary = 'moving'
[]
[]

[AuxVariables]
[u]
[AuxKernel]
type = FunctionAux
function = 't-x'
execute_on = 'INITIAL TIMESTEP_BEGIN'
[]
bottom_left = '0.25 0 0'
top_right = '1 1 1'
[]
[]

[UserObjects]
[w_mvg_bnd]
[moving_circle]
type = CoupledVarThresholdElementSubdomainModifier
coupled_var = 'u'
criterion_type = 'ABOVE'
coupled_var = 'phi'
criterion_type = 'BELOW'
threshold = 0
subdomain_id = 1
moving_boundaries = 'moving moving'
moving_boundary_subdomain_pairs = '1 3; 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
end_time = 3
dt = 1
dt = 0.3
num_steps = 3
[]

[Outputs]
exodus = true
[]
[]
59 changes: 59 additions & 0 deletions test/tests/userobjects/element_subdomain_modifier/reversible.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[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'
[]
[]

[UserObjects]
[moving_circle]
type = CoupledVarThresholdElementSubdomainModifier
coupled_var = 'phi'
criterion_type = 'BELOW'
threshold = 0
subdomain_id = 1
complement_subdomain_id = 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
[]
44 changes: 21 additions & 23 deletions test/tests/userobjects/element_subdomain_modifier/tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,40 @@
[group]
requirement = 'The framework shall include the ability to change element subdomain during simulation'

[moving_boundary]
[irreversible]
type = 'Exodiff'
input = 'moving_boundary.i'
exodiff = 'moving_boundary_out.e moving_boundary_out.e-s002 moving_boundary_out.e-s003'
detail = 'with a specified boundary, '
input = 'irreversible.i'
exodiff = 'irreversible_out.e irreversible_out.e-s002 irreversible_out.e-s003 irreversible_out.e-s004'
detail = 'irreversibly, '
[]

[complement_moving_boundary]
[reversible]
type = 'Exodiff'
input = 'moving_boundary.i'
cli_args = "UserObjects/w_mvg_bnd/moving_boundary_subdomain_pairs='3 1; 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'
detail = 'with a complement boundary, '
input = 'reversible.i'
exodiff = 'reversible_out.e reversible_out.e-s002 reversible_out.e-s003 reversible_out.e-s004'
detail = 'reversibly, '
[]

[no_moving_boundary]
[moving_boundary]
type = 'Exodiff'
input = 'moving_boundary.i'
cli_args = "UserObjects/w_mvg_bnd/moving_boundaries="" UserObjects/w_mvg_bnd/moving_boundary_subdomain_pairs="" Outputs/file_base='no_moving_boundary_out'"
exodiff = 'no_moving_boundary_out.e no_moving_boundary_out.e-s002 no_moving_boundary_out.e-s003'
detail = 'without a specified boundary, '
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, '
[]

[irreversible]
[complement_moving_boundary]
type = 'Exodiff'
input = 'irreversible.i'
exodiff = 'irreversible_out.e irreversible_out.e-s002 irreversible_out.e-s003 irreversible_out.e-s004'
detail = 'irreversibly, '
input = 'moving_boundary.i'
cli_args = "UserObjects/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, '
[]

[reversible]
[external_moving_boundary]
type = 'Exodiff'
input = 'irreversible.i'
cli_args = "UserObjects/moving_circle/complement_subdomain_id=2 Outputs/file_base='reversible_out'"
exodiff = 'reversible_out.e reversible_out.e-s002 reversible_out.e-s003 reversible_out.e-s004'
detail = 'reversibly, '
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]
Expand Down

0 comments on commit 0059e27

Please sign in to comment.