ScalarCodedSource broke for energy equations
Summary
ScalarCodedSource is broke for energy equations.
Steps to reproduce
Take any case with an energy equation (e or h) and implement fvOptions scalarCodedSource (just take the example from the source code) and set the correct field (e for sensibleInternalEnergy, h for sensibleEnthalpy) and it will crash with a similar log to what is given below.
What is the current bug behaviour?
scalarCodedSource in fvOptions, placed in the system folder, gives a "Not implemented" despite the correct field being used.
What is the expected correct behavior?
The correct behavior (in previous versions) is that the error "Not Implemented" would arise when the field being referenced is not actually there. In this case, the field is there but the errors are mismatched to block the correct field.
Relevant logs and/or images
--> FOAM FATAL ERROR: (openfoam-2112)
Not implemented
From virtual void Foam::fv::sourceTimeFvOptionscalarSource::addSup(const volScalarField&, Foam::fvMatrix<double>&, Foam::label)
in file /home/ethan/OpenFOAM/ethan-v2112/MSR_1D_PK_newmesh/steadyState/system/fluidRegion/fvOptions.heatExchangeSource at line 84.
FOAM aborting
#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::error::simpleExit(int, bool) at ??:?
#2 Foam::fv::option::addSup(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::fvMatrix<double>&, int) at ??:?
#3 Foam::tmp<Foam::fvMatrix<double> > Foam::fv::optionList::operator()<double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::word const&) at ??:?
#4 Foam::thermalHydraulicsModels::onePhase::correctEnergy(double&) at ??:?
#5 ? in ~/OpenFOAM/ethan-v2112/platforms/linux64GccDPInt32Opt/bin/GeN-Foam
#6 ? in /lib/x86_64-linux-gnu/libc.so.6
#7 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#8 ? in ~/OpenFOAM/ethan-v2112/platforms/linux64GccDPInt32Opt/bin/GeN-Foam
Aborted (core dumped)
Environment information
Providing details of your set-up can help us identify any issues, e.g. OpenFOAM version : v2112 Operating system : ubuntu 20.04 and 22.04 (source) Hardware info : Compiler : gcc
Possible fixes
Revert back to previous version and it works.