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: Invalid Initialization (https://www.cfd-online.com/Forums/openfoam-programming-development/106595-error-invalid-initialization.html)

matari September 3, 2012 05:45

Error: Invalid Initialization
 
Hi,

I have a mesh with multiple regions and need to solve different chemical reactions in different fluid regions. Therefore I would like to modify the chtMultiRegionFoam solver in a way that it solves chemical reactions in fluid regions. I got the following error during the compilation:


In file included from rhoPorousMultiRegionReactingFoam.C:107:0:
fluid/setRegionFluidFields.H:6:65: error: invalid initialization of reference of type ‘Foam::DimensionedField<double, Foam::volMesh>&’ from expression of type ‘double’
make: *** [Make/linux64GccDPOpt/rhoPorousMultiRegionReactingFoam.o] Error 1

In my createFluidFields.H I have for chemistrySh:

PtrList<DimensionedField<scalar, volMesh> > chemistrySh(fluidRegions.size());

forAll(fluidRegions, i)
{
...

chemistrySh.set
(
i,
new DimensionedField<scalar, volMesh>
(
IOobject
(
"chemistry::Sh",
runTime.timeName(),
fluidRegions[i],
IOobject::NO_READ,
IOobject::NO_WRITE
),
fluidRegions[i],
dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0)
)
);
...
}

In my setRegionFluidFields.H I added this line that seems to be wrong:

DimensionedField<scalar, volMesh>& chemistrySh = chemistrySh[i];

Can anybody help me to overcome this problem? Thanks in advance for any suggestions,

Matari

matari September 3, 2012 09:12

Hi again,

I modified the line in my setRegionFluidFields.H:


DimensionedField<scalar, volMesh>& chem = chemistrySh[i];

Now it compiles without errors.

Hanzo November 14, 2012 00:48

Hey Matari,

I also currently work on different chemical reactions for different regions.
I am still wondering if I should use the chtMultiRegionFoam because I am not interested in fluid-solid but only fluid-fluid coupling. I simply need the multi region feature.

Let's assume one has two fluid zones with different reactions. How do you define the interface boundaries between the regions for the species?


All times are GMT -4. The time now is 02:38.