|
[Sponsors] |
March 30, 2018, 11:14 |
Minor issue compiling solver
|
#1 |
Member
Join Date: Jun 2017
Posts: 58
Rep Power: 9 |
Hi all
I'm having a minor issue compiling UEqn for a solver I'm working on. I want to add a force and I'm putting it in the momentum predictor, but I've run into a strange problem. When my code is like this: Code:
volVectorField F("F",Fx*vector(1,0,0)+Fy*vector(0,1,0)+Fz*vector(0,0,1)); surfaceScalarField Ff = fvc::interpolate(F) & mesh.Sf(); if (pimple.momentumPredictor()) { solve(UEqn == fvc::reconstruct ( ( fvc::interpolate(rhok-1)*(g & mesh.Sf()) + Ff - fvc::snGrad(p)*mesh.magSf() ) ) ); fvOptions.correct(U); } Code:
volVectorField F("F",Fx*vector(1,0,0)+Fy*vector(0,1,0)+Fz*vector(0,0,1)); if (pimple.momentumPredictor()) { solve(UEqn == fvc::reconstruct ( ( fvc::interpolate(rhok-1)*(g & mesh.Sf()) + fvc::interpolate(F) & mesh.Sf() - fvc::snGrad(p)*mesh.magSf() ) ) ); fvOptions.correct(U); } I know this is minor but I'm interested as to why this error happens to improve my knowledge of C++ and OF development. Thanks |
|
March 30, 2018, 11:37 |
|
#2 |
Senior Member
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 125
Rep Power: 13 |
The "*" operator is outer product and "&" is inner product and you're adding output of these two operators. So I guess the difference could be because of mismatching of types. In the upper case you declared the type whereas in the lower one the compiler is taking care of that.
|
|
March 30, 2018, 12:29 |
|
#3 | |
Member
Join Date: Jun 2017
Posts: 58
Rep Power: 9 |
Quote:
Thank you! |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
make: Clock skew detected. build may be incomplete. while compiling new solver. | savee | OpenFOAM Programming & Development | 1 | May 27, 2017 07:23 |
Hybrid discretisation - blend factor | gcoopermax | CFX | 5 | September 23, 2016 09:05 |
fluent divergence for no reason | sufjanst | FLUENT | 2 | March 23, 2016 17:08 |
Compiling meltFoam solver | mick223 | OpenFOAM Programming & Development | 12 | July 31, 2015 11:33 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 21:02 |