Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimedSubdomainModifier fails for multiple idential times #27942

Closed
grunerjmeier opened this issue Jun 19, 2024 · 1 comment · Fixed by #27943
Closed

TimedSubdomainModifier fails for multiple idential times #27942

grunerjmeier opened this issue Jun 19, 2024 · 1 comment · Fixed by #27943
Assignees
Labels
C: Framework P: normal A defect affecting operation with a low possibility of significantly affects. T: defect An anomaly, which is anything that deviates from expectations.

Comments

@grunerjmeier
Copy link
Contributor

Bug Description

If one enters more than one identical times, Moose reports wrongly:

Parameter 'blocks_from' must contain the same number of items as parameter 'times'.

The corresponding input file looks like:

  [UserObjects]
    [GlobalSubdomainModifier]
      type = TimedSubdomainModifier
      times = '      0.4            0.6  0.4'
      blocks_from = '2              4    3'
      blocks_to = '  Box2_inactive  2    Box3_inactive' # Subdomain names are permitted ('Box2_inactive' = 4, etc)
      execute_on = 'INITIAL TIMESTEP_BEGIN'
    []
  []

The reason for this behavior is that the variable _times of type std::set<Real> singulates the "double" times. I'm proposing using a vector here as well.

Unfortunately, I did not see this error in #27092 at the right time. I apologize for this.

Steps to Reproduce

Adapting the test "tsm_direct.i" to have two blocks to be modified at the same time:

# testing TimedSubdomainModifier

[Problem]
    solve = false
    kernel_coverage_check = false
    material_coverage_check = false
  []
  
  Box2_inactive_id = '4'
  Box3_inactive_id = '5'
  Box2_inactive_name = 'Box2_inactive'
  Box3_inactive_name = 'Box3_inactive'
  inactive_domain_block_ids = '${Box2_inactive_id} ${Box3_inactive_id}'
  inactive_domain_block_names = '${Box2_inactive_name} ${Box3_inactive_name}'
  
  [Mesh]
    [BaseMesh]
      type = GeneratedMeshGenerator
      elem_type = TET4
      dim = 3
      nx = 5
      ny = 3
      nz = 2
      xmin = -10
      xmax = +10
      ymin = -10
      ymax = +10
      zmin = -2
      zmax = +2
    []
  
    [Box1]
      type = SubdomainBoundingBoxGenerator
      input = "BaseMesh"
      block_id = 1
      location = "INSIDE"
      bottom_left = "-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 = "0 0 0"
    []
  
    [Box3]
        type = SubdomainBoundingBoxGenerator
        input = "Box2"
        block_id = 3
        location = "INSIDE"
        bottom_left = "0 0 +2"
        top_right = "+2 +2 0"
    []

    add_subdomain_ids = ${inactive_domain_block_ids}
    add_subdomain_names = ${inactive_domain_block_names}
  []
  
  [AuxVariables]
    [dummy]
      type = MooseVariableFVReal
    []
  []
  
  # move elements between subdomains back and forth
  [UserObjects]
    [GlobalSubdomainModifier]
      type = TimedSubdomainModifier
      times = '      0.4            0.6  0.4'
      blocks_from = '2              4    3'
      blocks_to = '  Box2_inactive  2    Box3_inactive' # Subdomain names are permitted ('Box2_inactive' = 4, etc)
      execute_on = 'INITIAL TIMESTEP_BEGIN'
    []
  []
  
  [Executioner]
    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]
    exodus = true
  []

Impact

TimedSubdomainModifier fails if the user enters identical times in one TimedSubdomainModifier. Fixing this will have no negative side effects anywhere else.

[Optional] Diagnostics

No response

@grunerjmeier grunerjmeier added P: normal A defect affecting operation with a low possibility of significantly affects. T: defect An anomaly, which is anything that deviates from expectations. labels Jun 19, 2024
grunerjmeier added a commit to grunerjmeier/moose that referenced this issue Jun 19, 2024
@grunerjmeier
Copy link
Contributor Author

I've created an PR solving this issue: #27943

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Framework P: normal A defect affecting operation with a low possibility of significantly affects. T: defect An anomaly, which is anything that deviates from expectations.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants