CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Problem adding rhoPhi

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 7, 2013, 05:46
Default Problem adding rhoPhi
  #1
Member
 
Join Date: Jul 2011
Posts: 92
Rep Power: 6
haze_1986 is on a distinguished road
I am trying to solve this:
Code:
fvScalarMatrix SEqn
    (
	fvm::ddt(rho,S)
	+ fvm::div(rhoPhi, S)
	- fvm::laplacian(DT, S)
    );
I need to add in rhoPhi in createFields.H, I used the code from interFoam as below:

Code:
    Info<< "Reading field rho\n" << endl;
    volScalarField rho
    (
        IOobject
        (
            "rho",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
	mesh
    );

    surfaceScalarField rhoPhi
    (
        IOobject
        (
            "rho*phi",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        rho*phi
    );
There is an error with compilation:
Code:
createFields.H:90: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::GeometricField(Foam::IOobject, Foam::tmp<Foam::Field<double> >)’
/opt/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/GeometricField.C:653: note: candidates are: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::wordList&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh]
Would appreciate if anyone can enlighten me on what went wrong. Will provide more info if needed. TIA.
haze_1986 is offline   Reply With Quote

Old   August 7, 2013, 10:34
Default
  #2
New Member
 
Michael Ranft
Join Date: Jun 2012
Location: Karlsruhe
Posts: 3
Rep Power: 5
Azur is on a distinguished road
In your case rho is a volScalarField while in interFoam rho1 is a dimensionedScalar.


You can't multiply a surfaceScalarField (phi) with a volScalarField (rho). For a volScalarField all values are defined at the cell centres and for surfaceScalarFields at the face centres of each cell.
So you first have to interpolate the centre values of the rho field to the face centres.
Afterwards you can multiply phi with this new rho field:

Code:
surfaceScalarField rhoPhi
(
    IOobject
    (
        "rho*phi",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    linearInterpolate(rho) * phi
);
or as ist is done in compressibleInterFoam:

Code:
surfaceScalarField rhoPhi
    (
        IOobject
        (
            "rho*phi",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        fvc::interpolate(rho)*phi
    );
The difference between linearInterpolate(rho) and fvc::interpolate(rho) is explained in:
http://openfoamwiki.net/index.php/Op...eInterpolation
Azur is offline   Reply With Quote

Old   August 7, 2013, 10:55
Default
  #3
Member
 
Join Date: Jul 2011
Posts: 92
Rep Power: 6
haze_1986 is on a distinguished road
Thank you very much, fixed.
haze_1986 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
conduction problem venkataramana OpenFOAM 3 December 1, 2013 08:30
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
area does not match neighbour by ... % -- possible face ordering problem St.Pacholak OpenFOAM 9 November 22, 2011 11:02
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13


All times are GMT -4. The time now is 10:31.