idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.79k stars 1.05k forks source link

cannot simultaneously use mesh adaptivity and automatic scaling at each step #15785

Closed jessecarterMOOSE closed 4 years ago

jessecarterMOOSE commented 4 years ago

I came across this when trying to apply some mesh adaptivity to a phase field problem with automatic scaling. If trying to do BOTH mesh adaptivity AND recompute scaling at each step, I hit an assert at the beginning of the second time step. If I remove either the mesh adaptivity or set compute_scaling_once = true, then problem runs fine. I'm running with the latest moose master (34fb8fad) and I believe my conda environment is up-to-date.

Bug Description

Cannot run a problem with both adaptivity and automatic scaling computed every step.

Steps to Reproduce

Add the following lines to the Executioner block of both_split_2vars.i

  automatic_scaling = true
  compute_scaling_once = false

  [./Adaptivity]
    initial_adaptivity = 0
    cycles_per_step = 1
    refine_fraction = 0.95
    coarsen_fraction = 0.1
    max_h_level = 2
  [../]

Impact

Would expect to use both these features simultaneously.


Here's the output when I run in debug mode:

Time Step 2, time = 0.1, dt = 0.05
Assertion `i < size()' failed.
i = 1827
size() = 1827

Stack frames: 30
0: libMesh::print_trace(std::ostream&)
1: libMesh::MacroFunctions::report_error(char const*, int, char const*, char const*)
2: libMesh::PetscVector<double>::add(unsigned int, double)
3: libMesh::DiagonalMatrix<double>::add(unsigned int, unsigned int, double)
4: Assembly::addCachedJacobian()
5: FEProblemBase::addCachedJacobian(unsigned int)
6: ComputeJacobianThread::postElement(libMesh::Elem const*)
7: ComputeJacobianForScalingThread::operator()(libMesh::StoredRange<libMesh::MeshBase::const_element_iterator, libMesh::Elem const*> const&, bool)
8: /home/jesse/projects/moose/framework/.libs/libmoose-dbg.so.0(+0x356e768) [0x7fd95bdb2768]
9: NonlinearSystemBase::computeJacobianInternal(std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
10: NonlinearSystemBase::computeJacobianTags(std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
11: FEProblemBase::computeJacobianTags(std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
12: FEProblemBase::computeJacobianInternal(libMesh::NumericVector<double> const&, libMesh::SparseMatrix<double>&, std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
13: FEProblemBase::computeJacobian(libMesh::NumericVector<double> const&, libMesh::SparseMatrix<double>&)
14: FEProblemBase::computeJacobianSys(libMesh::NonlinearImplicitSystem&, libMesh::NumericVector<double> const&, libMesh::SparseMatrix<double>&)
15: NonlinearSystem::computeScalingJacobian()
16: NonlinearSystemBase::computeScaling()
17: NonlinearSystem::solve()
18: FEProblemBase::solve()
19: FEProblemSolve::solve()
20: PicardSolve::solveStep(double, double&, double, double&, bool, std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
21: PicardSolve::solve()
22: TimeStepper::step()
23: Transient::takeStep(double)
24: Transient::execute()
25: MooseApp::executeExecutioner()
26: MooseApp::run()
27: /home/jesse/projects/moose/modules/phase_field/.libs/phase_field-dbg(+0x1338c) [0x55a9a18e838c]
28: __libc_start_main
29: /home/jesse/projects/moose/modules/phase_field/.libs/phase_field-dbg(+0x12169) [0x55a9a18e7169]
[0] ../src/numerics/petsc_vector.C, line 190, compiled Aug 11 2020 at 09:54:30
Assertion `i < size()' failed.
i = 1827
size() = 1827

Stack frames: 27
0: libMesh::print_trace(std::ostream&)
1: libMesh::MacroFunctions::report_error(char const*, int, char const*, char const*)
2: libMesh::PetscVector<double>::add(unsigned int, double)
3: libMesh::DiagonalMatrix<double>::add(unsigned int, unsigned int, double)
4: Assembly::addCachedJacobian()
5: FEProblemBase::addCachedJacobian(unsigned int)
6: NonlinearSystemBase::computeJacobianInternal(std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
7: NonlinearSystemBase::computeJacobianTags(std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
8: FEProblemBase::computeJacobianTags(std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
9: FEProblemBase::computeJacobianInternal(libMesh::NumericVector<double> const&, libMesh::SparseMatrix<double>&, std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
10: FEProblemBase::computeJacobian(libMesh::NumericVector<double> const&, libMesh::SparseMatrix<double>&)
11: FEProblemBase::computeJacobianSys(libMesh::NonlinearImplicitSystem&, libMesh::NumericVector<double> const&, libMesh::SparseMatrix<double>&)
12: NonlinearSystem::computeScalingJacobian()
13: NonlinearSystemBase::computeScaling()
14: NonlinearSystem::solve()
15: FEProblemBase::solve()
16: FEProblemSolve::solve()
17: PicardSolve::solveStep(double, double&, double, double&, bool, std::__debug::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > const&)
18: PicardSolve::solve()
19: TimeStepper::step()
20: Transient::takeStep(double)
21: Transient::execute()
22: MooseApp::executeExecutioner()
23: MooseApp::run()
24: /home/jesse/projects/moose/modules/phase_field/.libs/phase_field-dbg(+0x1338c) [0x55a9a18e838c]
25: __libc_start_main
26: /home/jesse/projects/moose/modules/phase_field/.libs/phase_field-dbg(+0x12169) [0x55a9a18e7169]
[0] ../src/numerics/petsc_vector.C, line 190, compiled Aug 11 2020 at 09:54:30
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
loganharbour commented 4 years ago

Jesse,

Fande's actively working on this in #15655.

jessecarterMOOSE commented 4 years ago

Ah didn't know that. Should I check out his PR and see if that helps?

jessecarterMOOSE commented 4 years ago

I did and it does!

dschwen commented 4 years ago

Closing in favor of #15655

lindsayad commented 4 years ago

15655 is a PR, not an issue. When #15655 is merged, then we can close this