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

acces to createfields-Volscalarfields

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 27, 2016, 13:51
Post acces to createfields-Volscalarfields
  #1
New Member
 
Steve
Join Date: Dec 2014
Posts: 6
Rep Power: 11
SteveFOAM is on a distinguished road
I Have a problem with my driftFluxFoam adaption:

Because of the modular construction of DriftFluxFoam, the viscosity Model has no direct acces to the volScalarFields of createfields. Can somebody help me to initialize a volScalarField out of createFields, or even better, get acces to createFields?
SteveFOAM is offline   Reply With Quote

Old   July 29, 2016, 10:11
Default
  #2
New Member
 
Steve
Join Date: Dec 2014
Posts: 6
Rep Power: 11
SteveFOAM is on a distinguished road
To solve my problem, i tried to save an load the Objects of a dictionary. Here is my code:

In the end of createfields.H:

Code:
IOdictionary bilineardict
(
    IOobject
    (
        "bilineardict",
        runTime.constant(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    )
);
volScalarField Konzentration
    (
        IOobject
        (
            "Konzentration",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        alpha1*rho1
    );
In my mixtureViscosityModel:

Code:
const objectRegistry& db = mesh.thisDb();
const dictionary& transportProperties = db().lookupObject<IOdictionary>
(
   "bilineardict"
);
But i got the error-massage: ’mesh’ was not declared in this scope.
SteveFOAM is offline   Reply With Quote

Old   July 29, 2016, 10:30
Default
  #3
New Member
 
Dominic
Join Date: May 2016
Posts: 27
Rep Power: 9
Verse is on a distinguished road
Can you post more of your solver (especially the beginning portion)? I presume you have either


Code:
#   include "createMesh.H"
or

Code:
#   include "createDynamicFvMesh.H"
in your code, so mesh should already be declared in one of those two headers.

If you want access to "Konzentration" in the main body of the code, you could use the lines:

Code:
volVectorField Konzentration
    (
        IOobject
        (
            "Konzentration",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
After the mesh initilization (if I understand your question correctly).
Verse is offline   Reply With Quote

Old   July 29, 2016, 11:03
Default
  #4
New Member
 
Steve
Join Date: Dec 2014
Posts: 6
Rep Power: 11
SteveFOAM is on a distinguished road
In my main function the only thing that comes near to your suggestions is
Code:
#include "createMesh.H"
The Includes of bilinear.C in the MixtureViscosityModel are:
Code:
#include "bilinear.H"
#include "addToRunTimeSelectionTable.H"
#include "fvcGrad.H"
I want to Use for example the Konzentration-value in bilinear.C.
If i write
Code:
volVectorField Konzentration
    (
        IOobject
        (
            "Konzentration",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
in my bilinear.C, I get the error Massages:

error: conflicting declaration ‘Foam::volVectorField Konzentration’
(
^
bilinear/bilinear.C:97:20: error: ‘Konzentration’ has a previous declaration as ‘Foam::volScalarField Konzentration’
volScalarField Konzentration = alpha_*rho_c_;
^
bilinear/bilinear.C:119:13: error: ‘runTime’ was not declared in this scope
runTime.timeName(),
^
bilinear/bilinear.C:120:13: error: ‘mesh’ was not declared in this scope
mesh,

I don´t get these error messages about runTime and mesh in my createFields.H
SteveFOAM is offline   Reply With Quote

Old   July 29, 2016, 11:21
Default
  #5
New Member
 
Dominic
Join Date: May 2016
Posts: 27
Rep Power: 9
Verse is on a distinguished road
Did you forget to include bilinear.H in your .dep file perhaps?
Verse is offline   Reply With Quote

Old   July 29, 2016, 11:25
Default
  #6
New Member
 
Join Date: Oct 2014
Posts: 26
Rep Power: 11
teuk is on a distinguished road
Hi SteveFOAM,

Quote:

bilinear/bilinear.C:97:20: error: ‘Konzentration’ has a previous declaration as ‘Foam::volScalarField Konzentration’
volScalarField Konzentration = alpha_*rho_c_;
This menas you already declared the variable Konzentration before. Probably in your bilinear.H ?

Quote:

bilinear/bilinear.C:119:13: error: ‘runTime’ was not declared in this scope
runTime.timeName(),
To use runTime in you object definition you neet the corresponding Header in your .C - file.


Quote:

bilinear/bilinear.C:120:13: error: ‘mesh’ was not declared in this scope
mesh,
Same thing here. Try "fvMesh.H"


regards,
teuk
teuk is offline   Reply With Quote

Old   August 1, 2016, 07:30
Default
  #7
New Member
 
Steve
Join Date: Dec 2014
Posts: 6
Rep Power: 11
SteveFOAM is on a distinguished road
The previous declaration of Konzentration was a mistake in the code. The inclusion of "fvMesh.H" had not helped me, same error. I want to be clear: I already defined everything properly in createfields. I just want to read them in bilinear.C.
The mesh and the runTime is within the main, but the inclusion of the mixtureViscosityModels is far before this runtime loop (not my idea, its driftfluxFoam)
SteveFOAM 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
create volTensorField out of volScalarFields anton_lias OpenFOAM Programming & Development 5 December 22, 2014 10:44
Multiple volScalarFields using List<volScalarField> vbchris OpenFOAM Programming & Development 6 September 14, 2014 06:38
Error with laplacian of two volScalarFields Hisham OpenFOAM Programming & Development 10 August 12, 2013 06:50
a reconstructPar issue immortality OpenFOAM Post-Processing 8 June 16, 2013 11:25
an odd(at least for me!) reconstructPar error on a field immortality OpenFOAM Running, Solving & CFD 3 June 3, 2013 22:36


All times are GMT -4. The time now is 21:06.