Hi all,
I updated PETSc to 3.22.1, and now my code run with the following error message.
Any idea this may happen?
In the entire code, VecGetArray() are used in the following places:
void
PETScApp::setupPETScIC()
{
PetscScalar
*uu;
VecGetArray(u,
&uu);
_sim->setupPETScIC(uu);
VecRestoreArray(u,
&uu);
}
PetscErrorCode
snesFormFunction(SNES
/*snes*/, Vec u, Vec f,
void
* appCtx)
{
PETScApp
* petscApp
= (PETScApp
*)appCtx;
// zero out residuals
VecZeroEntries(petscApp->res_tran);
VecZeroEntries(petscApp->res_spatial);
// get vectors
PetscScalar
*uu,
*res_tran,
*res_spatial;
VecGetArray(u,
&uu);
VecGetArray(petscApp->res_tran,
&res_tran);
VecGetArray(petscApp->res_spatial,
&res_spatial);
// use the most updated solution vector to update solution, to compute RHS and transient residuals
petscApp->_sim->updateSolutions(uu);
petscApp->_sim->updateAuxVariables();
petscApp->_sim->computeTranRes(res_tran);
petscApp->_sim->computeSpatialRes(res_spatial);
// restore vectors
VecRestoreArray(u,
&uu);
VecRestoreArray(petscApp->res_tran,
&res_tran);
VecRestoreArray(petscApp->res_spatial,
&res_spatial);
// assemble final residuals: f = transient + spatial
VecWAXPY(f,
1.0,
petscApp->res_tran,
petscApp->res_spatial);
PetscFunctionReturn(PETSC_SUCCESS);
}
PS: PETSc is available provided by moose env.
-Ling
Time Step 1, time = 0.1, dt = 0.1
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: Vector 'Vec_0x84000002_0' (argument #1) was locked for read-only access in unknown_function() at unknown file:0 (line numbers only accurate to function begin)
[0]PETSC ERROR: WARNING! There are unused option(s) set! Could be the program crashed before usage or a spelling mistake, etc!
[0]PETSC ERROR:
Option left: name:-i value: tests/hc1d.i source: command line
[0]PETSC ERROR: See
https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: unknown
GIT Date: unknown
[0]PETSC ERROR: ./open_phase-opt with 1 MPI process(es) and PETSC_ARCH
on CSI365324.local by lingzou Mon Jan 20 09:20:20 2025
[0]PETSC ERROR: Configure options: --with-64-bit-indices --with-cxx-dialect=C++17 --with-debugging=no --with-fortran-bindings=0 --with-mpi=1 --with-openmp=1 --with-strict-petscerrorcode=1 --with-shared-libraries=1 --with-sowing=0
--download-fblaslapack=1 --download-hpddm=1 --download-hypre=1 --download-metis=1 --download-mumps=1 --download-ptscotch=1 --download-parmetis=1 --download-scalapack=1 --download-slepc=1 --download-strumpack=1 --download-superlu_dist=1 --with-hdf5-dir=/Users/lingzou/miniforge/envs/moose
--with-make-np=8 --COPTFLAGS=-O3 --CXXOPTFLAGS=-O3 --FOPTFLAGS=-O3 --with-x=0 --with-ssl=0 --with-mpi-dir=/Users/lingzou/miniforge/envs/moose AR=arm64-apple-darwin20.0.0-ar RANLIB=arm64-apple-darwin20.0.0-ranlib CFLAGS="-ftree-vectorize -fPIC -fstack-protector-strong
-O2 -pipe -isystem /Users/lingzou/miniforge/envs/moose/include -fdebug-prefix-map=/opt/civet0/build_0/_env/conda-bld/moose-mpi_1735973237402/work=/usr/local/src/conda/moose-mpi-base-2024.12.23 -fdebug-prefix-map=/Users/lingzou/miniforge/envs/moose=/usr/local/src/conda-prefix
" CXXFLAGS="-ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/lingzou/miniforge/envs/moose/include -fdebug-prefix-map=/opt/civet0/build_0/_env/conda-bld/moose-mpi_1735973237402/work=/usr/local/src/conda/moose-mpi-base-2024.12.23
-fdebug-prefix-map=/Users/lingzou/miniforge/envs/moose=/usr/local/src/conda-prefix
" CPPFLAGS="-D_FORTIFY_SOURCE=2 -isystem /Users/lingzou/miniforge/envs/moose/include -mmacosx-version-min=11.3 " FFLAGS="-march=armv8.3-a -ftree-vectorize -fPIC -fno-stack-protector -O2 -pipe -isystem /Users/lingzou/miniforge/envs/moose/include
-fdebug-prefix-map=/opt/civet0/build_0/_env/conda-bld/moose-mpi_1735973237402/work=/usr/local/src/conda/moose-mpi-base-2024.12.23 -fdebug-prefix-map=/Users/lingzou/miniforge/envs/moose=/usr/local/src/conda-prefix " FCFLAGS="-march=armv8.3-a -ftree-vectorize
-fPIC -fno-stack-protector -O2 -pipe -isystem /Users/lingzou/miniforge/envs/moose/include -fdebug-prefix-map=/opt/civet0/build_0/_env/conda-bld/moose-mpi_1735973237402/work=/usr/local/src/conda/moose-mpi-base-2024.12.23 -fdebug-prefix-map=/Users/lingzou/miniforge/envs/moose=/usr/local/src/conda-prefix
" LDFLAGS="-Wl,-headerpad_max_install_names
-Wl,-rpath,/Users/lingzou/miniforge/envs/moose/lib -L/Users/lingzou/miniforge/envs/moose/lib
-Wl,-ld_classic -Wl,-commons,use_dylibs" --prefix=/Users/lingzou/miniforge/envs/moose/petsc
[0]PETSC ERROR: #1 VecSetErrorIfLocked() at /opt/civet0/build_0/_env/conda-bld/moose-petsc_1735976555173/work/include/petscvec.h:649
[0]PETSC ERROR: #2 VecGetArray() at /opt/civet0/build_0/_env/conda-bld/moose-petsc_1735976555173/work/src/vec/vec/interface/rvector.c:2020
NL Step =
0, fnorm =
1.10935E+30