|
[Sponsors] |
January 15, 2019, 20:58 |
Unable to compile a source from an old repo?
|
#1 |
Senior Member
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13 |
Hello All,
I'm trying to get this code to compile so that I can see what it does but for some reason it's hung up over this Code:
solver.C:34:65: error: passing ‘const Internal {aka const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>}’ as ‘this’ argument discards qualifiers [-fpermissive] U.internalField() = axis ^ (centres.internalField() - origin); Code:
#include "fvCFD.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" Info<< "Time = " << runTime.value() << endl; Info<< " Reading U" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); // Do cells const volVectorField& centres = mesh.C(); point origin(1, 1, 0.05); vector axis(0, 0, -1); U.internalField() = axis ^ (centres.internalField() - origin); U.boundaryField()[0] == (axis ^ (centres.boundaryField()[0] - origin)); U.boundaryField()[1] == (axis ^ (centres.boundaryField()[1] - origin)); U.boundaryField()[2] == (axis ^ (centres.boundaryField()[2] - origin)); U.write(); Info<< "End\n" << endl; return(0); } Please let me know if there are other ways to do the same thing or something similar. |
|
January 15, 2019, 22:51 |
|
#2 |
Senior Member
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21 |
you haven't said what OpenFOAM version you are trying to compile this piece of code on, but if the latest version is involved, you may try this:
Code:
U.primitiveFieldRef() = axis ^ (centres.primitiveField() - origin); U.boundaryFieldRef()[0] == (axis ^ (centres.boundaryField()[0] - origin)); U.boundaryFieldRef()[1] == (axis ^ (centres.boundaryField()[1] - origin)); U.boundaryFieldRef()[2] == (axis ^ (centres.boundaryField()[2] - origin)); Last edited by Daniel_Khazaei; January 16, 2019 at 10:58. |
|
January 16, 2019, 11:13 |
|
#3 | |
Senior Member
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13 |
Quote:
|
||
Tags |
compilation error, internalfield |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] Installation Problem with OF 6 version | Aurel | OpenFOAM Community Contributions | 14 | November 18, 2020 17:18 |
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc | ofslcm | OpenFOAM Community Contributions | 25 | March 6, 2017 11:03 |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 17:02 |
SparceImage v1.7.x Issue on MAC OS X | rcarmi | OpenFOAM Installation | 4 | August 14, 2014 07:42 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 12:32 |