adflow
adflow copied to clipboard
Complex instance will not run when a real instance exists
Description
Complex ADflow will not run properly when a real instance exists at the same time.
Steps to reproduce issue
Here is a MWE:
from baseclasses import AeroProblem
from adflow import ADFLOW, ADFLOW_C
aeroOptions = {
"gridfile": "../../input_files/naca0012_rans-L2.cgns",
"MGCycle": "sg",
}
ap = AeroProblem(
name="mdo_tutorial",
alpha=1.8,
mach=0.80,
P=20000.0,
T=220.0,
areaRef=45.5,
chordRef=3.25,
beta=0.0,
R=287.87,
xRef=0.0,
yRef=0.0,
zRef=0.0,
)
# Create solvers
CFDSolver_real = ADFLOW(options=aeroOptions)
CFDSolver_complex = ADFLOW_C(options=aeroOptions)
# Try to use run the complex solver
CFDSolver_complex(ap)
Current behavior
Running the example above will result in errors like the following:
[0]PETSC ERROR: PetscTrFreeDefault() called from VecDestroy_MPI() line 21 in packages/petsc-3.15.1/src/vec/vec/impls/mpi/pdvec.c
[0]PETSC ERROR: Block [id=1190(92160)] at address 0x5636dfd7cf30 is corrupted (probably write past end of array)
[0]PETSC ERROR: Block allocated in VecCreate_MPI_Private() line 515 in packages/petsc-3.15.1/src/vec/vec/impls/mpi/pbvec.c
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Memory corruption: https://www.mcs.anl.gov/petsc/documentation/installation.html#valgrind
[0]PETSC ERROR: Corrupted memory
[0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.15.1, Jun 17, 2021
Expected behavior
The solver should run properly.
Alternatively, you may not see the PETSc error but the output will still look something like this:
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Grid | Iter | Iter | Iter | CFL | Step | Lin | Wall | Res rho | Res nuturb | C_lift | C_drag | totalRes |
# level | | Tot | Type | | | Res | Clock (s) | | | | | |
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 0 0 None ---- ---- ---- 2.07740E-02 1.13015344E+04 +0.00000000E+000i 3.32615714E-03 +2.60904357E-013i 6.8466006356124846E-05 +0.0000000000000000E+000i 7.0971742351251341E-03 +0.0000000000000000E+000i 2.27337349E+06 +1.25234091E-007i
1 1 55 *ANK 5.00E+00 0.00 1.000 5.83825E-01 1.09682100E+04 +1.10448447E+004i 3.54857453E-03 +9.83040045E-004i 1.3023263830557331E-04 -2.7857663014588233E-005i 1.3699228808258107E-02 -1.0626147556127646E-003i 3.51385273E+06 +2.59208780E+006i
1 2 56 DADI 1.70E+00 1.00 ---- 5.98672E-01 1.01115616E+04 +1.03597200E+004i NaN NaNi NaN NaNi NaN NaNi NaN NaNi
Nan occured in Convergence Info on proc: 0
#
#--------------------------- !!! Error !!! ----------------------------
#* returnFail called by processor 0
#* Run-time error in procedure convergenceInfo
#* Error message: A NaN occurred during the computation.
#*
#----------------------------------------------------------------------
#