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

Use v2 field values in dispersion model

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By CGuaq

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 6, 2023, 05:11
Default Use v2 field values in dispersion model
  #1
New Member
 
Charles Guaquiere
Join Date: Sep 2022
Posts: 14
Rep Power: 3
CGuaq is on a distinguished road
Hello everyone,

I'm working on a turbulent particulate flow in a horizontal 2D channel, I use v2f model for turbulence and I would like to use v2 field values (returned by v2f model) in my dispersion model. For now I use correlations from DNS to calculate velocity fluctuations on fluid but I want to be more general with v2 values.

I tried to add v2 values in file "momentumTransportModel.H" like this (same way as for k, epsilon, ...):

Code:
virtual tmp<volScalarField> v2() const = 0;
And I also modified DispersioRASModel.C by adding :

Code:
template<class CloudType>
Foam::tmp<Foam::volScalarField>
Foam::DispersionRASModel<CloudType>::v2Model() const
{
    const objectRegistry& obr = this->owner().mesh();
    const word turbName =
        IOobject::groupName
        (
            momentumTransportModel::typeName,
            this->owner().U().group()
        );

    if (obr.foundObject<momentumTransportModel>(turbName))
    {
        const momentumTransportModel& model =
            obr.lookupObject<momentumTransportModel>(turbName);
        return model.v2();
    }
    else
    {
        FatalErrorInFunction
            << "Turbulence model not found in mesh database" << nl
            << "Database objects include: " << obr.sortedToc()
            << abort(FatalError);

        return tmp<volScalarField>(nullptr);
    }
}
To finish, in my dispersion model code I use following line to call v2 values in each cell (again like k and espilon in stochasticDispersionRAS model)

Code:
const scalar v2_ = this->v2Ptr_->primitiveField()[celli];
I can compile my code and launch my simulation but when I display (on parafoam) what returns me this line I have a very strange scalar field ...

So can someone help me to find an other solution to access to my v2 field values and use them in my dispersion code ?? Or tell me if I made a mistake in my code.

Thanks in advance for your help !!

Best regards
CGuaq is offline   Reply With Quote

Old   February 6, 2023, 09:26
Default
  #2
New Member
 
Charles Guaquiere
Join Date: Sep 2022
Posts: 14
Rep Power: 3
CGuaq is on a distinguished road
Problem solved
CGuaq is offline   Reply With Quote

Old   February 10, 2023, 06:31
Default
  #3
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
Can you consider adding your solution, instead of just saying that you solved it? It will help others in the future if they have the same problem, and therefore helps increase the utility of the site? Thanks in advance.
Tobermory is offline   Reply With Quote

Old   February 10, 2023, 08:20
Default
  #4
New Member
 
Charles Guaquiere
Join Date: Sep 2022
Posts: 14
Rep Power: 3
CGuaq is on a distinguished road
Yes of course, Sorry.
To solve my problem and add v2 field values, I just added following lines in my turbulent dispersion file:

Code:
const objectRegistry& obr = this->owner().mesh();
const volScalarField& v2_ = obr.lookupObject<volScalarField>("v2");    
const scalar v2 = v2_[celli];
I guess it's possible to get others volScalarFields "saved" in the mesh with this method.
Tobermory likes this.
CGuaq is offline   Reply With Quote

Reply


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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 91 December 21, 2022 04:50
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 06:20
Error in Two phase (condensation) modeling adilsyyed CFX 15 June 24, 2015 19:42
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL AndoniBM OpenFOAM Running, Solving & CFD 2 March 25, 2015 18:44
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 14:32


All times are GMT -4. The time now is 16:57.