|
[Sponsors] |
Multiple volScalarFields using List<volScalarField> |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 15, 2013, 18:47 |
Multiple volScalarFields using List<volScalarField>
|
#1 |
Member
Chris L
Join Date: Sep 2012
Posts: 53
Rep Power: 14 |
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 |
|
February 16, 2013, 13:54 |
|
#2 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
Hello, You made some mistakes:
1) You declared array of volScalarField - but List<template A> of A-template needs default constructor for A class, which is forbidden for volScalarField (A == volScalarField) 2) In the init and solution loop You are using reference assignment - wall variables will reference only to "T" field Solution - List of Pointers - List<autoPtr<volScalarField> >, i made easy example for laplacianFoam, You can use it to change Your own solver: createFields.H: Code:
Info<< "Reading field T\n" << endl; label N = 2; List<autoPtr<volScalarField> > TiPtr (N); forAll (TiPtr, iField) { word nameTi ("T" + name(iField)); TiPtr[iField].reset ( new volScalarField ( IOobject ( nameTi, runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ) ); } volScalarField T ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading transportProperties\n" << endl; IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); Info<< "Reading diffusivity DT\n" << endl; dimensionedScalar DT ( transportProperties.lookup("DT") ); Code:
#include "fvCFD.H" #include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating temperature distribution\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; while (simple.correctNonOrthogonal()) { solve ( fvm::ddt(T) - fvm::laplacian(DT, T) ); forAll(TiPtr, iField) { volScalarField& Ti = TiPtr[iField](); solve ( fvm::ddt(Ti) - fvm::laplacian(DT,Ti) ); } } #include "write.H" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; } |
|
February 16, 2013, 17:57 |
|
#3 |
Member
Chris L
Join Date: Sep 2012
Posts: 53
Rep Power: 14 |
Thanks,
I modified your solution a bit and used ptrlist<>. Do you have any comments on this method? Compiles fine, I will modify it later to read in from multiple files. Code:
PtrList<volScalarField> PopBal(bin_count); for(count = 0; count < bin_count; count++) { PopBal.set ( count, new volScalarField ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ) ); } |
|
February 17, 2013, 06:24 |
|
#4 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
PtrList is the same as List<volScalarField* >, which holds pure (hardware) pointers,
List<autoPtr<volScalarField> > holds list of software pointers (autoPtr<>), which is safer, for me, for different filenames, you can substitute string: word nameTi ("fieldName" + name(fieldCounter)) |
|
June 5, 2013, 11:13 |
question about creating a list
|
#6 |
New Member
Farah Yasmina
Join Date: Mar 2013
Location: France
Posts: 2
Rep Power: 0 |
Hello,
I am writing here because it is one of the only threads where Lists are mentioned. I want to create a List out of a class I made, ie. I want every object that I add or remove in my main program to be sorted out in a list in order to be able to apply the methods I have created on every single object. To be more specific, my class is called "Vessels" and one of the methods I use calculates the value of blood flow in a given vessel. My main program calculates pressure distribution and blood flow in my computational domain, and I want to be able to add as much arteries & veins as I like without having to calculate for everyone single one of them the corresponding blood flow. I'm new to OF & C++ and would really appreciate your help. Thanks! |
|
September 14, 2014, 07:38 |
|
#7 | |
Member
|
Quote:
I used the following code in my new solver that based on reactingFoam OF2.1.x. Code:
forAll(spNames, specieI) { word namemuIi ("muI" + name(specieI)); muI.set ( specieI, new volScalarField ( IOobject ( namemuIi, runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), dimensionedScalar("muI", dimensionSet(1, -1, -1, 0, 0, 0, 0), 2.6693E-05 * Foam::pow(composition.W(specieI) * T, 0.5)/ Foam::pow(sigmaI,2)/ om22) ) ); } Code:
PtrList<volScalarField> muI(Y.size()); After compiling the solver, I encounter the following error: Code:
... error: no matching function for call to ‘Foam::dimensioned<double>::dimensioned(const char [7], const Foam::dimensionSet&, Foam::volScalarField&)’ ... /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionedType.C:68:1: note: no known conversion for argument 3 from ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ to ‘double’ In file included from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionedScalar.H:38:0, ... Regards, Hossein |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to set periodic boundary conditions | Ganesh | FLUENT | 15 | November 18, 2020 07:09 |
[ICEM] Multiple edges | asal | ANSYS Meshing & Geometry | 2 | March 22, 2013 11:10 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 13:21 |
Multiple domain/Multiple material problems... possible or not? | Amiga500 | OpenFOAM | 1 | April 14, 2010 16:32 |
Multiple reference frames? | Moon | Siemens | 0 | March 4, 2003 07:32 |