|
[Sponsors] |
September 12, 2022, 03:54 |
Compilation error
|
#1 |
New Member
Join Date: Mar 2010
Posts: 11
Rep Power: 16 |
I'm not familiar with openfoam and trying to compile a new solver which outputs the following error. Can anyone give me hint on what needs to be fixed. best
modeFFTuw.C:81:12: error: no viable conversion from 'dimensioned<Foam::Vector<double>>' to 'Foam::vector' (aka 'Vector<double>') vector cornerCellCentre = ::Foam::max(mesh.C().internalField()); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/OpenFOAM/OpenFOAM-v2112/src/OpenFOAM/lnInclude/Vector.H:91:9: note: candidate constructor not viable: no known conversion from 'dimensioned<Foam::Vector<double>>' to 'const Foam::Vector<double> &' for 1st argument Vector(const Vector&) = default; ^ /Users/OpenFOAM/OpenFOAM-v2112/src/OpenFOAM/lnInclude/Vector.H:100:16: note: candidate constructor not viable: no known conversion from 'dimensioned<Foam::Vector<double>>' to 'const Foam::zero' for 1st argument inline Vector(const Foam::zero); ^ /Users/OpenFOAM/OpenFOAM-v2112/src/OpenFOAM/lnInclude/Vector.H:104:16: note: candidate template ignored: could not match 'VectorSpace' against 'dimensioned' inline Vector(const VectorSpace<Vector<Cmpt2>, Cmpt2, 3>& vs); ^ /Users/OpenFOAM/OpenFOAM-v2112/src/OpenFOAM/lnInclude/Vector.H:110:25: note: explicit constructor is not a candidate inline explicit Vector(Istream& is); ^ modeFFTuw.C:41:9: warning: 'sprintf' will always overflow; destination buffer has size 5, but format string expands to at least 13 [-Wfortify-source] sprintf(filename,"%1s_sans_mode%1u",champ ,mode); ^ modeFFTuw.C:44:9: warning: 'sprintf' will always overflow; destination buffer has size 5, but format string expands to at least 8 [-Wfortify-source] sprintf(filename,"%1s_mode%1u",champ ,mode); ^ 2 warnings and 1 error generated. make: *** [Make/darwin64ClangDPInt32Opt/modeFFTuw.o] Error 1 |
|
September 12, 2022, 06:04 |
|
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,737
Rep Power: 66 |
Your units (dimensions) don't match and that's why it's refusing to build.
|
|
September 12, 2022, 06:33 |
|
#3 |
New Member
Join Date: Mar 2010
Posts: 11
Rep Power: 16 |
I found that solver on the forums site https://www.cfd-online.com/Forums/at...ft-modefftuw.c. Can you guide me on how to match the units. Thanks
|
|
September 13, 2022, 06:52 |
|
#4 | |
New Member
Join Date: Mar 2010
Posts: 11
Rep Power: 16 |
Quote:
I found that solver on the forums site https://www.cfd-online.com/Forums/at...ft-modefftuw.c. Can you guide me on how to match the units. Thanks |
||
September 13, 2022, 07:24 |
|
#5 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,737
Rep Power: 66 |
Check out the OpenFOAM guide on basic rules regarding dimensions.
In your case the problems start at Code:
vector cornerCellCentre = ::Foam::max(mesh.C().internalField()); You cannot assign a dimensioned anything to a dimensionless anything because they are different classes. It is equivalent to trying to take an int and store it in a float. Your compiler can clearly see this upfront and that's why it refuses to build. There are simple workarounds such as gutting the dimensions or arbitrarily adding dimensions or recasting but if you managed to arrive here then it usually means you overlooked the basic I/O patterns in OpenFOAM in the first place. |
|
September 13, 2022, 07:47 |
|
#6 | |
New Member
Join Date: Mar 2010
Posts: 11
Rep Power: 16 |
Quote:
I think the code compiled and attached above was correct, maybe some headers were missing or there are libraries that needs to be linked. It is not my code I'm just examining it to learn from it. |
||
September 13, 2022, 09:20 |
|
#7 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,737
Rep Power: 66 |
I mean you clearly show an error from wmake which shows the code not compiling
|
|
September 13, 2022, 10:21 |
|
#8 |
New Member
Join Date: Mar 2010
Posts: 11
Rep Power: 16 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] blockMesh with double grading. | spwater | OpenFOAM Meshing & Mesh Conversion | 92 | January 12, 2019 09:00 |
Pressure outlet boundary condition | rolando | OpenFOAM Running, Solving & CFD | 62 | September 18, 2017 06:45 |
DPM udf error | haghshenasfard | FLUENT | 0 | April 13, 2016 06:35 |
[OpenFOAM] Native ParaView Reader Bugs | tj22 | ParaView | 270 | January 4, 2016 11:39 |
Compiling problems with hello worldC | fw407 | OpenFOAM Installation | 21 | January 6, 2008 17:38 |