|
[Sponsors] |
September 21, 2013, 13:30 |
What happen with this square root??
|
#1 |
New Member
Darío López
Join Date: Oct 2011
Location: Vigo, Spain
Posts: 10
Rep Power: 15 |
Hi everybody!
I want to write a simple operation in my solver: Tension = zF*sqrt(1-(calcDistance0-0.5)/2.4*(calcDistance0-0.5)/2.4); + forceStatic*(calcDistance0-0.5)/2.4; Where Tension, zF, calcDistance0 and forceStatic are scalars (static scalar ...) When I try to compile I find this error: solveForceBalance.H:154: error: call of overloaded 'sqrt(Foam::scalar)' is ambiguous /usr/include/bits/mathcalls.h:157: note: candidates are: double sqrt(double) Help me please!!! |
|
September 21, 2013, 13:40 |
|
#2 |
New Member
Darío López
Join Date: Oct 2011
Location: Vigo, Spain
Posts: 10
Rep Power: 15 |
Solved!
scalar aux = Foam:: sqrt(....) |
|
May 16, 2018, 22:15 |
|
#3 |
Member
Join Date: Oct 2013
Posts: 92
Rep Power: 13 |
||
November 7, 2019, 04:59 |
|
#4 |
Member
David Andersson
Join Date: Oct 2019
Posts: 46
Rep Power: 7 |
I have a similar problem. I tried to simplify it to see if sqrt() works at all for me so now I am basically writing sqrt(4) to a vector and that's it. It still doesn't work and I get the following error message:
Code:
error: no matching function for call to ‘Foam::Vector<double>::Vector(<brace-enclosed initializer list>)’ Foam::Vector<double> testVec{1, 2, sqrt(4)}; Can someone tell me what I am doing wrong here? |
|
November 7, 2019, 18:52 |
|
#5 | |
Member
Join Date: Oct 2013
Posts: 92
Rep Power: 13 |
Quote:
And also use Foam::sqrt for clarity |
||
March 12, 2020, 03:59 |
|
#6 |
Senior Member
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19 |
Hi,
I got the same error and I'm trying to do my correction. However, it doesn't seem to work. I need to change the Turbulent frequency equation from : fvm::ddt(alpha, rho, omega_) + fvm::div(alphaRhoPhi, omega_) - fvm::laplacian(alpha*rho*DomegaEff(F1), omega_) ... to fvm::ddt(alpha, rho, omega_) + fvm::div(alphaRhoPhi, omega_) - fvm::laplacian(alpha*sqrt(rho)*DomegaEff(F1), sqrt(rho)*omega_) I got the error and I changed to: fvm::ddt(alpha, rho, omega_) + fvm::div(alphaRhoPhi, omega_) - fvm::laplacian(alpha*Foam::sqrt(rho)*DomegaEff(F1), Foam::sqrt(rho)*omega_) but the error remains. So how should I change it? Thanks. |
|
March 12, 2020, 04:56 |
|
#7 |
Senior Member
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19 |
Hi, I followed the corrections recommended here too:
https://openfoamwiki.net/index.php/F...9_is_ambiguous Possible solutions, instead of simply using sqrt(2.0): ::sqrt(2.0) scalar(::sqrt(2.0)) ::sqrt(scalar(2.0)) but it still can't work, although the error msg has changed: In file included from ../turbulenceModels/lnInclude/kOmegaSSTBase.H:350:0, from ../turbulenceModels/lnInclude/kOmegaSST.H:111, from turbulentTransportModels/turbulentTransportModels.C:73: ../turbulenceModels/lnInclude/kOmegaSSTBase.C: In instantiation of ‘void Foam::kOmegaSSTBase<BasicEddyViscosityModel>::corr ect() [with BasicEddyViscosityModel = Foam::LESModels:ESModel<Foam::IncompressibleTurb ulenceModel<Foam::transportModel> >]’: turbulentTransportModels/turbulentTransportModels.C:130:29: required from here ../turbulenceModels/lnInclude/kOmegaSSTBase.C:469:95: error: no matching function for call to ‘laplacian(Foam::tmp<Foam::GeometricField<dou ble, Foam::fvPatchField, Foam::volMesh> >, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’ - fvm::laplacian(alpha*::sqrt(scalar(rho))*DomegaEff (F1), ::sqrt(scalar(rho))*omega_) ^ ../turbulenceModels/lnInclude/kOmegaSSTBase.C:469:95: note: candidates are: In file included from /home/users/nus/tsltaywb/OpenFOAM/OpenFOAM-v1706_mod/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0, from /home/users/nus/tsltaywb/OpenFOAM/OpenFOAM-v1706_mod/src/finiteVolume/lnInclude/fvm.H:46, from ../turbulenceModels/lnInclude/linearViscousStress.C:28, from ../turbulenceModels/lnInclude/linearViscousStress.H:114, from ../turbulenceModels/lnInclude/Stokes.H:39, from ../turbulenceModels/lnInclude/laminarModel.C:27, from ../turbulenceModels/lnInclude/laminarModel.H:201, from turbulentTransportModels/turbulentTransportModels.H:31, from turbulentTransportModels/turbulentTransportModels.C:26: /home/users/nus/tsltaywb/OpenFOAM/OpenFOAM-v1706_mod/src/finiteVolume/lnInclude/fvmLaplacian.C:45:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) laplacian ^ /home/users/nus/tsltaywb/OpenFOAM/OpenFOAM-v1706_mod/src/finiteVolume/lnInclude/fvmLaplacian.C:45:1: note: template argument deduction/substitution failed: In file included from ../turbulenceModels/lnInclude/kOmegaSSTBase.H:350:0, from ../turbulenceModels/lnInclude/kOmegaSST.H:111, from turbulentTransportModels/turbulentTransportModels.C:73: ../turbulenceModels/lnInclude/kOmegaSSTBase.C:469:95: note: ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ is not derived from ‘const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>’ - fvm::laplacian(alpha*::sqrt(scalar(rho))*DomegaEff (F1), ::sqrt(scalar(rho))*omega_) |
|
March 14, 2020, 20:16 |
|
#8 | |
Member
Join Date: Oct 2013
Posts: 92
Rep Power: 13 |
Quote:
Code:
- fvm::laplacian(alpha*sqrt(rho)*DomegaEff(F1), sqrt(rho)*omega_) Code:
- fvm::laplacian(alpha*Foam::sqrt(2.0)*DomegaEff(F1), omega_) Code:
- fvc::laplacian(alpha*Foam::sqrt(2.0)*DomegaEff(F1), Foam::sqrt(2.0)*omega_) Last edited by fedvasu; March 14, 2020 at 20:17. Reason: clarity and context |
||
March 18, 2020, 22:54 |
|
#9 |
Senior Member
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19 |
I realised that actually using
::sqrt(rho) scalar(::sqrt(rho)) ::sqrt(scalar(rho)) for the sqrt part can work. My error is due to representing the Laplacian as: fvm::laplacian(alpha*::sqrt(rho)*DomegaEff(F1), ::sqrt(rho)*omega_) The omega and sqrt(rho) are grouped together. Someone seems to have similar enquires: How to represent laplacian of a product of multiple terms? Anyone has a solution? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
RMS root mean square velocity Fluent | C.C | FLUENT | 4 | August 29, 2022 22:10 |
root mean square velocity | Far | CFX | 12 | June 1, 2016 09:58 |
Environment errors with .deb install and ubuntu 13.04 64 bit | jonathanbyrn | OpenFOAM Installation | 14 | September 26, 2013 06:22 |
missing vtf3.h BPatch.h papi.h | linch | OpenFOAM Installation | 41 | July 24, 2012 15:45 |
root mean square | John | FLUENT | 4 | May 30, 2002 17:14 |