|
[Sponsors] |
Multiple volScalarFields using List<volScalarField> |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 15, 2013, 17:47 |
Multiple volScalarFields using List<volScalarField>
|
#1 |
Member
Chris L
Join Date: Sep 2012
Posts: 53
Rep Power: 13 |
I would like to initialize a list of volScalarFields. This will be used for the calculation of concentrations of multiple species.
I used the following code to initialize the volScalarFields in createFields.h I also thought about using ptrlist<volScalarField>. What I thought the code would do is create a list size 3 (to be size n) of volScalarField objects called T. T[1] was used in the solver code by using the intermediate Ti. Code:
volScalarField Temp_field ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); List<volScalarField> T; T.setSize(3); for (label i=0; i<3; i++) { T[i] = Temp_field; } Code:
while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; while (simple.correctNonOrthogonal()) { volScalarField& Ti = T[1]; solve ( fvm::ddt(Ti) ///HERE + fvm::div(phi, Ti) ///HERE - fvm::laplacian(DT, Ti) ///HERE ); Code:
Making dependency list for source file myScalarTransportFoam.C SOURCE=myScalarTransportFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/finiteVolume/lnInclude -I/opt/openfoam211/src/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/myScalarTransportFoam.o myScalarTransportFoam.C: In function ‘int main(int, char**)’: myScalarTransportFoam.C:67:27: error: no matching function for call to ‘ddt(Foam::List<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&)’ myScalarTransportFoam.C:67:27: note: candidates are: /opt/openfoam211/src/finiteVolume/lnInclude/fvmDdt.C:45:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::ddt(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmDdt.C:60:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::ddt(const Foam::one&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmDdt.C:72:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::ddt(const dimensionedScalar&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmDdt.C:88:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::ddt(const volScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) myScalarTransportFoam.C:68:32: error: no matching function for call to ‘div(Foam::surfaceScalarField&, Foam::List<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&)’ myScalarTransportFoam.C:68:32: note: candidates are: /opt/openfoam211/src/finiteVolume/lnInclude/fvmDiv.C:45:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmDiv.C:62:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmDiv.C:77:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmDiv.C:88:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) myScalarTransportFoam.C:69:37: error: no matching function for call to ‘laplacian(Foam::dimensionedScalar&, Foam::List<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&)’ myScalarTransportFoam.C:69:37: note: candidates are: /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:45:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:70:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:99:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::zero&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:115:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::zero&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:130:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::one&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:143:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::one&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:155:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::dimensioned<Type2>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:181:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::dimensioned<Type2>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:208:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:240:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:225:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:257:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:273:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:290:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:305:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) /opt/openfoam211/src/finiteVolume/lnInclude/fvmLaplacian.C:322:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) myScalarTransportFoam.C:80:68: error: ‘class Foam::List<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ has no member named ‘boundaryField’ In file included from /opt/openfoam211/src/OpenFOAM/lnInclude/List.H:259:0, from /opt/openfoam211/src/OpenFOAM/lnInclude/labelList.H:48, from /opt/openfoam211/src/OpenFOAM/lnInclude/UPstream.H:43, from /opt/openfoam211/src/OpenFOAM/lnInclude/Pstream.H:42, from /opt/openfoam211/src/OpenFOAM/lnInclude/parRun.H:35, from /opt/openfoam211/src/finiteVolume/lnInclude/fvCFD.H:4, from myScalarTransportFoam.C:32: /opt/openfoam211/src/OpenFOAM/lnInclude/List.C: In member function ‘void Foam::List<T>::setSize(Foam::label) [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::label = int]’: createFields.H:21:16: instantiated from here /opt/openfoam211/src/OpenFOAM/lnInclude/List.C:331:41: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’ /opt/openfoam211/src/OpenFOAM/lnInclude/List.C:331:41: note: candidates are: /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:625:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::wordList = Foam::List<Foam::word>] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:625:1: note: candidate expects 4 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:590:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:590:1: note: candidate expects 3 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:560:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:560:1: note: candidate expects 2 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:527:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:527:1: note: candidate expects 2 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:495:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:495:1: note: candidate expects 2 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:464:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:464:1: note: candidate expects 1 argument, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:432:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:432:1: note: candidate expects 1 argument, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:393:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dictionary&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:393:1: note: candidate expects 3 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:353:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:353:1: note: candidate expects 2 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:326:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::Field<TypeR>&, const Foam::PtrList<PatchField<Type> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:326:1: note: candidate expects 5 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:296:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:296:1: note: candidate expects 5 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:267:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:267:1: note: candidate expects 4 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:239:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:239:1: note: candidate expects 5 arguments, 0 provided /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:209:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:209:1: note: candidate expects 4 arguments, 0 provided make: *** [Make/linux64GccDPOpt/myScalarTransportFoam.o] Error 1 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to set periodic boundary conditions | Ganesh | FLUENT | 15 | November 18, 2020 06:09 |
[ICEM] Multiple edges | asal | ANSYS Meshing & Geometry | 2 | March 22, 2013 10:10 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 12:21 |
Multiple domain/Multiple material problems... possible or not? | Amiga500 | OpenFOAM | 1 | April 14, 2010 15:32 |
Multiple reference frames? | Moon | Siemens | 0 | March 4, 2003 06:32 |