CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Error while compiling a solidParticle library based on interFoam in OF5x (https://www.cfd-online.com/Forums/openfoam-programming-development/241975-error-while-compiling-solidparticle-library-based-interfoam-of5x.html)

wind_ March 30, 2022 04:05

Error while compiling a solidParticle library based on interFoam in OF5x
 
In order to simulate the movement of bubbles in fluids, I am trying to couple the solidParticle library based on the interFoam. Follow the steps of this tutorial,http://www.tfd.chalmers.se/~hani/kur...Ghahramani.pdf and compile successfully in OF3.0.0.:)
But when I compile the same code in the new version OF5.x, I get the following compilation error,:mad:
Code:

solidParticleCloudI.H:77:79: error: no match for ‘operator=’ (operand types are ‘const Internal {aka const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>}’ and ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’)
  tsource().internalField() = -smom_/(mesh_.time().deltaT().value()*mesh_.V());
                                                                              ^
In file included from /home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.H:366:0,
                from /home/fxr/OpenFOAM/OpenFOAM-5.x/src/finiteVolume/lnInclude/fvMesh.H:58,
                from /home/fxr/OpenFOAM/OpenFOAM-5.x/src/finiteVolume/lnInclude/fvCFD.H:7,
                from interFoam.C:40:
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:424:6: note: candidate: void Foam::DimensionedField<Type, GeoMesh>::operator=(const Foam::DimensionedField<Type, GeoMesh>&) [with Type = Foam::Vector<double>; GeoMesh = Foam::volMesh]
 void DimensionedField<Type, GeoMesh>::operator=
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:424:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&’
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:445:6: note: candidate: void Foam::DimensionedField<Type, GeoMesh>::operator=(const Foam::tmp<Foam::DimensionedField<Type, GeoMesh> >&) [with Type = Foam::Vector<double>; GeoMesh = Foam::volMesh]
 void DimensionedField<Type, GeoMesh>::operator=
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:445:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::tmp<Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> >&’
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:469:6: note: candidate: void Foam::DimensionedField<Type, GeoMesh>::operator=(const Foam::dimensioned<Type>&) [with Type = Foam::Vector<double>; GeoMesh = Foam::volMesh]
 void DimensionedField<Type, GeoMesh>::operator=
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:469:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::dimensioned<Foam::Vector<double> >&’
In file included from solidParticleCloud.H:153:0,
                from interFoam.C:47:
solidParticleCloudI.H: In member function ‘Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> > Foam::solidParticleCloud::AddToU() const’:
solidParticleCloudI.H:146:31: error: no match for ‘operator=’ (operand types are ‘const Internal {aka const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>}’ and ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’)
  Usource().internalField() = correctU_;
                              ^~~~~~~~~
In file included from /home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.H:366:0,
                from /home/fxr/OpenFOAM/OpenFOAM-5.x/src/finiteVolume/lnInclude/fvMesh.H:58,
                from /home/fxr/OpenFOAM/OpenFOAM-5.x/src/finiteVolume/lnInclude/fvCFD.H:7,
                from interFoam.C:40:
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:424:6: note: candidate: void Foam::DimensionedField<Type, GeoMesh>::operator=(const Foam::DimensionedField<Type, GeoMesh>&) [with Type = Foam::Vector<double>; GeoMesh = Foam::volMesh]
 void DimensionedField<Type, GeoMesh>::operator=
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:424:6: note:  no known conversion for argument 1 from ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ to ‘const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&’
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:445:6: note: candidate: void Foam::DimensionedField<Type, GeoMesh>::operator=(const Foam::tmp<Foam::DimensionedField<Type, GeoMesh> >&) [with Type = Foam::Vector<double>; GeoMesh = Foam::volMesh]
 void DimensionedField<Type, GeoMesh>::operator=
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:445:6: note:  no known conversion for argument 1 from ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ to ‘const Foam::tmp<Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> >&’
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:469:6: note: candidate: void Foam::DimensionedField<Type, GeoMesh>::operator=(const Foam::dimensioned<Type>&) [with Type = Foam::Vector<double>; GeoMesh = Foam::volMesh]
 void DimensionedField<Type, GeoMesh>::operator=
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/fxr/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude/DimensionedField.C:469:6: note:  no known conversion for argument 1 from ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ to ‘const Foam::dimensioned<Foam::Vector<double> >&’
/home/fxr/OpenFOAM/OpenFOAM-5.x/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt64Opt/interFoam.o' failed
make: *** [Make/linux64GccDPInt64Opt/interFoam.o] Error 1

And the part of source code solidParticleCloudI.H:
Code:

// 2Way Coupling- Momentum Source:
inline tmp<volVectorField> solidParticleCloud::momentumSource() const
{
        tmp<volVectorField> tsource
        (
            new volVectorField
            (
              IOobject
              (
                  "smom",
                  mesh_.time().timeName(),
                  mesh_,
                  IOobject::NO_READ,
                  IOobject::NO_WRITE
              ),
              mesh_,
              dimensionedVector
                  (
                    "zero",
                    dimensionSet(1, -2, -2, 0, 0),
                    vector::zero
                  )
            )
  );
  tsource().internalField() = -smom_/(mesh_.time().deltaT().value()*mesh_.V());

 //tsource().primitiveFieldRef() = -smom_/(mesh_.time().deltaT().value()*mesh_.V());

  return tsource;
}

Anyone can help me?:confused:
Thanks in advance


All times are GMT -4. The time now is 11:25.