|
[Sponsors] |
How to convert boundaryField into "double" floating point? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 14, 2018, 22:05 |
How to convert boundaryField into "double" floating point?
|
#1 |
Member
yehanyu
Join Date: Mar 2012
Location: Beijing, China
Posts: 48
Rep Power: 14 |
Hello everybody,
I am recently working on modifying the compressible solver "rhoCentralFoam". Here I want to retrieve the boundary field of "e" and "p", then substitute them into a user-defined function named "ep_d", then assigned the result to the boundary field "rho". ... p.correctBoundaryConditions(); forAll(rho.boundaryField(),i) { rho.boundaryField()[i] = pp.ep_d(e.boundaryField()[i], p.boundaryField()[i]); } runTime.write(); ... However I got a compilation error: nistCentralFoam.C: In function ‘int main(int, char**)’: nistCentralFoam.C:248:85: error: no matching function for call to ‘phys_property::ep_d(Foam::fvPatchField<double>&, Foam::fvPatchField<double>&)’ rho.boundaryField()[i] = pp.ep_d(e.boundaryField()[i], p.boundaryField()[i]); ^ In file included from nistCentralFoam.C:46:0: property.H:248:6: note: candidate: double phys_property::ep_d(double, double) REAL phys_property::ep_d(REAL e, REAL p) ^ property.H:248:6: note: no known conversion for argument 1 from ‘Foam::fvPatchField<double>’ to ‘double’ So what is the solution? Thank you very much. |
|
April 17, 2018, 01:34 |
|
#2 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Will this work:
Code:
forAll(rho.boundaryField(), patchI) { fvPatchScalarField& rhoPatch = rho.boundaryField()[patchI]; fvPatchScalarField& ePatch = e.boundaryField()[patchI]; fvPatchScalarField& pPatch = p.boundaryField()[patchI]; forAll(pPatch, faceI) { const scalar ei = ePatch[faceI]; const scalar pi = pPatch[faceI]; rhoPatch[faceI] = pp.ep_d(ei, pi); } } |
|
April 17, 2018, 21:21 |
|
#3 | |
Member
yehanyu
Join Date: Mar 2012
Location: Beijing, China
Posts: 48
Rep Power: 14 |
Quote:
|
||
Tags |
boundaryfield, rhocentralfoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] How to define to right point for locationInMesh | Mirage12 | OpenFOAM Meshing & Mesh Conversion | 7 | March 13, 2016 15:07 |
simpleFoam Floating point error (Core Dumped) | sam.ho | OpenFOAM Running, Solving & CFD | 2 | December 31, 2013 07:57 |
[snappyHexMesh] snappyHexMesh and cyclic boundaries | Ruli | OpenFOAM Meshing & Mesh Conversion | 2 | December 9, 2013 07:51 |
pimpleDyMFoam constantly giving floating point exception and solution divergence | fedvasu | OpenFOAM Running, Solving & CFD | 0 | November 28, 2013 01:53 |
[snappyHexMesh] determining displacement for added points | CFDnewbie147 | OpenFOAM Meshing & Mesh Conversion | 1 | October 22, 2013 10:53 |