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

Problem adding rhoPhi

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

Like Tree1Likes
  • 1 Post By Azur

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 7, 2013, 05:46
Default Problem adding rhoPhi
  #1
Senior Member
 
Join Date: Jul 2011
Posts: 120
Rep Power: 14
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: 13
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
Saturne_User likes this.
Azur is offline   Reply With Quote

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

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
area does not match neighbour by ... % -- possible face ordering problem St.Pacholak OpenFOAM 10 February 7, 2024 21:50
conduction problem venkataramana OpenFOAM 3 December 1, 2013 07:30
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
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 19:45.