CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Modify SemiImplicitSource for time varying source (https://www.cfd-online.com/Forums/openfoam-solving/229704-modify-semiimplicitsource-time-varying-source.html)

ksgr August 20, 2020 10:21

Modify SemiImplicitSource for time varying source
 
Hello all!
I am trying to model a time varying mass source with reactingParcelFoam solver. I basically want to see what happens when the compactness of the source changes to the evolution of the species. For this I have removed the source which is computed from the evaporation of the parcels in the OpenFoam. I am trying to use fvOptions to multiply the source with sinusoid to make it vary in the time domain.

To add sin function, I am trying to add the sin(Time) to Su in the source file. I copied the SemiImplicitSource source files to my local working directory and then changed the file names to sineSource.C and sineSource.H and made changes accordingly everywhere including the Make folder. However, when I try to compile I get the following error
Code:

sources/general/sineSource/sineSource.C:38:18: error: redefinition of ‘const wordList Foam::fv::sineSource<Type>::volumeModeTypeNames_’
    IStringStream("(absolute specific)")()
                  ^
In file included from sources/general/sineSource/sineSource.H:221:0,
                from sources/general/sineSource/sineSource.C:27:
sources/general/sineSource/sineSource.C:36:22: note: ‘const wordList Foam::fv::sineSource<Type>::volumeModeTypeNames_’ previously declared here
 const Foam::wordList Foam::fv::sineSource<Type>::volumeModeTypeNames_
                      ^~~~
sources/general/sineSource/sineSource.C:46:1: error: redefinition of ‘Foam::fv::sineSource<Type>::volumeModeType Foam::fv::sineSource<Type>::wordToVolumeModeType(const Foam::word&) const’
 Foam::fv::sineSource<Type>::wordToVolumeModeType
 ^~~~
In file included from sources/general/sineSource/sineSource.H:221:0,
                from sources/general/sineSource/sineSource.C:27:
sources/general/sineSource/sineSource.C:46:1: note: ‘Foam::fv::sineSource<Type>::volumeModeType Foam::fv::sineSource<Type>::wordToVolumeModeType(const Foam::word&) const’ previously declared here
 Foam::fv::sineSource<Type>::wordToVolumeModeType
 ^~~~
sources/general/sineSource/sineSource.C:69:12: error: redefinition of ‘Foam::word Foam::fv::sineSource<Type>::volumeModeTypeToWord(const Foam::fv::sineSource<Type>::volumeModeType&) const’
 Foam::word Foam::fv::sineSource<Type>::volumeModeTypeToWord
            ^~~~
In file included from sources/general/sineSource/sineSource.H:221:0,
                from sources/general/sineSource/sineSource.C:27:
sources/general/sineSource/sineSource.C:69:12: note: ‘Foam::word Foam::fv::sineSource<Type>::volumeModeTypeToWord(const Foam::fv::sineSource<Type>::volumeModeType&) const’ previously declared here
 Foam::word Foam::fv::sineSource<Type>::volumeModeTypeToWord
            ^~~~
sources/general/sineSource/sineSource.C:86:6: error: redefinition of ‘void Foam::fv::sineSource<Type>::setFieldData(const Foam::dictionary&)’
 void Foam::fv::sineSource<Type>::setFieldData(const dictionary& dict)
      ^~~~
In file included from sources/general/sineSource/sineSource.H:221:0,
                from sources/general/sineSource/sineSource.C:27:
sources/general/sineSource/sineSource.C:86:6: note: ‘void Foam::fv::sineSource<Type>::setFieldData(const Foam::dictionary&)’ previously declared here
 void Foam::fv::sineSource<Type>::setFieldData(const dictionary& dict)
      ^~~~
sources/general/sineSource/sineSource.C:112:1: error: redefinition of ‘Foam::fv::sineSource<Type>::sineSource(const Foam::word&, const Foam::word&, const Foam::dictionary&, const Foam::fvMesh&)’
 Foam::fv::sineSource<Type>::sineSource
 ^~~~
In file included from sources/general/sineSource/sineSource.H:221:0,
                from sources/general/sineSource/sineSource.C:27:
sources/general/sineSource/sineSource.C:112:1: note: ‘Foam::fv::sineSource<Type>::sineSource(const Foam::word&, const Foam::word&, const Foam::dictionary&, const Foam::fvMesh&)’ previously declared here
 Foam::fv::sineSource<Type>::sineSource
 ^~~~
sources/general/sineSource/sineSource.C:132:6: error: redefinition of ‘void Foam::fv::sineSource<Type>::addSup(Foam::fvMatrix<Type>&, Foam::label)’
 void Foam::fv::sineSource<Type>::addSup
      ^~~~
In file included from sources/general/sineSource/sineSource.H:221:0,
                from sources/general/sineSource/sineSource.C:27:
sources/general/sineSource/sineSource.C:132:6: note: ‘virtual void Foam::fv::sineSource<Type>::addSup(Foam::fvMatrix<Type>&, Foam::label)’ previously declared here
 void Foam::fv::sineSource<Type>::addSup
      ^~~~
sources/general/sineSource/sineSource.C:195:6: error: redefinition of ‘void Foam::fv::sineSource<Type>::addSup(const volScalarField&, Foam::fvMatrix<Type>&, Foam::label)’
 void Foam::fv::sineSource<Type>::addSup
      ^~~~
In file included from sources/general/sineSource/sineSource.H:221:0,
                from sources/general/sineSource/sineSource.C:27:
sources/general/sineSource/sineSource.C:195:6: note: ‘virtual void Foam::fv::sineSource<Type>::addSup(const volScalarField&, Foam::fvMatrix<Type>&, Foam::label)’ previously declared here
 void Foam::fv::sineSource<Type>::addSup
      ^~~~
/home/sagar/OpenFOAM/OpenFOAM-4.x/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/sources/general/sineSource/sineSource.o' failed
make: *** [Make/linux64GccDPInt32Opt/sources/general/sineSource/sineSource.o] Error 1

I think that with the new sineSource type it is still referencing to the semiImplicitSource by the redefinition error. I am not so sure of it. I don't know whether any other changes needs to be made as this is a general source. Any help would be appreciated

Thank you


All times are GMT -4. The time now is 17:15.