@@ -745,7 +745,7 @@ void CFlowOutput::SetAnalyzeSurfaceSpeciesVariance(const CSolver* const*solver,
745745 SetHistoryOutputValue (" SURFACE_SPECIES_VARIANCE" , Tot_Surface_SpeciesVariance);
746746}
747747
748- void CFlowOutput::ConvertVariableSymbolsToIndices (const CPrimitiveIndices<unsigned long >& idx,
748+ void CFlowOutput::ConvertVariableSymbolsToIndices (const CPrimitiveIndices<unsigned long >& idx, const bool allowSkip,
749749 CustomOutput& output) const {
750750 const auto nameToIndex = PrimitiveNameToIndexMap (idx);
751751
@@ -796,23 +796,38 @@ void CFlowOutput::ConvertVariableSymbolsToIndices(const CPrimitiveIndices<unsign
796796 output.varIndices .back () += output.otherOutputs .size ();
797797 output.otherOutputs .push_back (GetPtrToHistoryOutput (var));
798798 if (output.otherOutputs .back () == nullptr ) {
799- SU2_MPI::Error (" Invalid history output or solver variable (" + var + " ) used in function " + output.name +
800- " \n Valid solvers variables:\n " + knownVariables.str (), CURRENT_FUNCTION);
799+ if (!allowSkip) {
800+ SU2_MPI::Error (" Invalid history output or solver variable (" + var + " ) used in function " + output.name +
801+ " \n Valid solvers variables:\n " + knownVariables.str (), CURRENT_FUNCTION);
802+ } else {
803+ if (rank == MASTER_NODE) {
804+ std::cout << " Info: Ignoring function " + output.name + " because it may be used by the primal/adjoint "
805+ " solver.\n If the function is ignored twice it is invalid." << std::endl;
806+ }
807+ output.skip = true ;
808+ break ;
809+ }
801810 }
802811 }
803812}
804813
805814void CFlowOutput::SetCustomOutputs (const CSolver* const * solver, const CGeometry *geometry, const CConfig *config) {
806815
816+ const bool adjoint = config->GetDiscrete_Adjoint ();
807817 const bool axisymmetric = config->GetAxisymmetric ();
808818 const auto * flowNodes = su2staticcast_p<const CFlowVariable*>(solver[FLOW_SOL]->GetNodes ());
809819
810820 for (auto & output : customOutputs) {
821+ if (output.skip ) continue ;
822+
811823 if (output.varIndices .empty ()) {
824+ const bool allowSkip = adjoint && (output.type == OperationType::FUNCTION);
825+
812826 /* --- Setup indices for the symbols in the expression. ---*/
813827 const auto primIdx = CPrimitiveIndices<unsigned long >(config->GetKind_Regime () == ENUM_REGIME::INCOMPRESSIBLE,
814828 config->GetNEMOProblem (), nDim, config->GetnSpecies ());
815- ConvertVariableSymbolsToIndices (primIdx, output);
829+ ConvertVariableSymbolsToIndices (primIdx, allowSkip, output);
830+ if (output.skip ) continue ;
816831
817832 /* --- Convert marker names to their index (if any) in this rank. Or probe locations to nearest points. ---*/
818833
0 commit comments