|
[Sponsors] |
dividing a dimensioned vectorfield by a dimensioned scalar |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 8, 2021, 08:58 |
dividing a dimensioned vectorfield by a dimensioned scalar
|
#1 |
New Member
Wiebke Scholz
Join Date: Feb 2021
Posts: 2
Rep Power: 0 |
Hi,
I am aiming to write a chemistry-solver (I am still with OpenFoam v4.1) , that is solving the reaction and scalar transport on a (RANS averaged turbulent) incompressible flow field, that is already in steady state. Therefore I need to solve the YEqn only, but adjust it by giving it a reaction source term. Since I am working with incompressible flow, the dimensions of the terms are all in s⁻¹. But dimension of reaction->R(Yi) is in kgm⁻³s⁻¹. Therefore I would like to calculate volScalarField& reactionRate = (reaction->R(Yi)) / rhoRef; with 'rhoRef' being a scalar with dimensions kgm⁻³ to end up with reactionRate in dimension s⁻¹. But when I try, it doesn't compile and gives me the error no match for ‘operator/’ (operand types are ‘Foam::tmp<Foam::fvMatrix<double> >’ and ‘Foam::dimensionedScalar {aka Foam::dimensioned<double>}’) Because I didn't find a lot of information on this in the OpenFOAM programmers' guide, I naively thought, this should work, but it seems like I was wrong. Maybe you have an idea, on how to fix this? Thanks already in advance! Wiebke |
|
February 8, 2021, 09:31 |
|
#2 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
The problem you encounter here is that the ::R() function will not return a volScalarField but it will rather be a fvScalarMatrix and for the fvScalarMatrix we don´t have the operator/ defined. Out of the box, I am not sure about the conversions implemented. However, I don´t think that even this line will work:
Code:
volScalarField& reactionRate = reaction->R(Yi)
__________________
Keep foaming, Tobias Holzmann |
|
February 8, 2021, 09:47 |
|
#3 |
New Member
Wiebke Scholz
Join Date: Feb 2021
Posts: 2
Rep Power: 0 |
Hi Tobias,
thanks for the quick answer. In that case, it is probably best to leave the result of ::R() as it is and multiply all the other fields in the equation with a constant density. I just tried it and that seems to work. Thanks for clarifying the types there. Wiebke |
|
February 8, 2021, 09:55 |
|
#4 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
A work around could be to make it in that way:
Code:
fvScalarMatrix reactionRates = reaction->R(); fvScalarMatrix tmp(reactionRates.size(), dimensionSet("tmp", dimensions(Your Dimensions), scalar(0)); // Not sure about the constructor of that class right now // Create loop and copy only the data without the units into the new one.
__________________
Keep foaming, Tobias Holzmann |
|
Tags |
dimensioned scalars, dimensioned vectorfields, incompressible flow, reaction |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' | muth | OpenFOAM Running, Solving & CFD | 3 | August 27, 2018 05:18 |
Division by zero exception - loop over scalarField | Pat84 | OpenFOAM Programming & Development | 6 | February 18, 2017 06:57 |
Issue symmetryPlane 2.5d extruded airfoil simulation | 281419 | OpenFOAM Running, Solving & CFD | 5 | November 28, 2015 14:09 |
Diverging solution in transonicMRFDyMFoam | tsalter | OpenFOAM Running, Solving & CFD | 30 | July 7, 2014 07:20 |
compressible flow in turbocharger | riesotto | OpenFOAM | 50 | May 26, 2014 02:47 |