What happen with this square root??
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!!! |
Solved!
scalar aux = Foam:: sqrt(....) |
Quote:
|
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>)’ Can someone tell me what I am doing wrong here? |
Quote:
And also use Foam::sqrt for clarity |
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. |
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::DESModel<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_) |
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_) |
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: https://www.cfd-online.com/Forums/op...ple-terms.html Anyone has a solution? |
All times are GMT -4. The time now is 19:33. |