CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

convert dimensioned<double>’ to ‘double’

Register Blogs Community New Posts Updated Threads Search

Like Tree13Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 29, 2013, 16:24
Default
  #21
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Thamali: Unfortunately, I can't make figure out where the problem is in the file you had attached, just by looking at the source code

As for the latest error, seems to either it's a very strange problem. It suggests that it's missing an indication of a library that has got the object-class "Foam::fv::laplacianScheme", which should already be present in "libOpenFOAM" or "libfiniteVolume".

If possible, can you share the whole source code package of your modified solver?
And knowing which OpenFOAM version or variant you are using, as well as knowing how you installed it and in which Linux Distribution and version, would all come in handing as well, so that I can reproduce the same error.

Because from what I can deduce, the latest error can be related to any of the details I asked above, namely: OpenFOAM version, how it was installed, which Linux Distribution and version, and access to the source code.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 30, 2013, 01:40
Default
  #22
Member
 
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 12
Thamali is on a distinguished road
Thank you very much for the wishes and Wish you all a very happy new year.....!!
wyldckat,
I will send my code through a private message to you cannot attach all file at once.

If anyone interested pls send me a message.
I am eager for your reply wyldckat.
Thanks again.
Thamali is offline   Reply With Quote

Old   January 5, 2014, 11:47
Default
  #23
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Thamali,

I've finally managed to have a look into this. Here are the steps I've taken to diagnose and sort-of solve the problem:
  1. Prepared a copy of fireFoam from OpenFOAM 2.2.x for comparison with your modified solver. Conclusion: Too many changes were made, in order to figure out the problem.
  2. Tried building with other versions of OpenFOAM. Did not seem to be a version problem (although I didn't check with 1.6-ext nor foam-extend 3.0).
  3. Applied the technique of isolate-and-conquer. I commented out the entries for "laplacian", to see which one is triggering the problem. Had to comment out the inclusion of "YghgEqn.H" as well, since it's loaded with "laplacian" calls.
  4. After gradually removing the comments from the "laplacian" entries, the first one to pick up the problem was the one in the file "YshsEqn.H". Note: the file "YghgEqn.H" was not yet included.
  5. The problem line is this one:
    Code:
    fvm::laplacian(kappa,ts)
    Looking for its variable definitions within it:
    • "volVectorField kappa"
    • "volScalarField ts"
  6. Looking at the error message:
    Code:
    Foam::fv::laplacianScheme<double, Foam::Vector<double> >
    this indicates that it's trying to create a class instance based off the template characteristics "<double, Foam::Vector<double>". This is likely so that it is compatible with the structure of the preceding code:
    Code:
    fvm::div(phi2,ts)
    Where: "surfaceScalarField phi2"
  7. So, what is exactly the problem? If you have a look into the OpenFOAM Programmer's Guide (here's an indirect link for it: http://openfoamwiki.net/index.php/Op...s_Guide_Errata ), you'll see what the Divergence and Laplacian operators do:
    • Divergence will essentially reduce the rank by one, turning rank-1 tensors into vectors and vectors into scalars.
    • Laplacian does not change the rank, therefore a vector remains a vector and a scalar remains a scalar.
  8. The problem is that you are trying to add a scalar "div(phi2,ts)" with a vector "laplacian(kappa,ts)".
  9. The quick fix was to switch the "kappa" field into a scalar, by using "mag":
    Code:
    fvm::laplacian(mag(kappa),ts)
    This no longer gave any building problems.
  10. The big question is: what is the equation you are trying to solve here? Because the equation on paper should have given you the perfect notion that the ranks of each item were incompatible.
I did not continue with the diagnosis, since all of the other Laplacian problems are in the file "YghgEqn.H", which I assume of the same nature of problems.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   January 7, 2014, 00:35
Default Thanking
  #24
Member
 
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 12
Thamali is on a distinguished road
Dear Bruno,

I am very much grateful to you.
  • I always tried to find an answer to this error on searching about "ld returned 1 exit status".What I understood is some error on incompatibility of compiler versions vs OpenFoam versions(although it is not possible in Ubuntu 12.04LTS).
Therefore I never tried to looking to my code again.(my bad-sorry if I took your time on a foolish error.)
  • What I am trying to do here is making an anisotropic thermal conductivity field.The equation is for "enthalpy of solid phase" in a packed bed combusting wood chips.
  • In here I am trying to use a homogeneous model for the thermal conductivity of bed and therefore using same values for the gas phase too.
  • After changing same in the YghgEqn now my code is compiling.
  • If I went through the code at very early stage what exaclty happens when applying anisotropic thermal conductivity,I would not wasting time on developing a volVectorField and I will directly use a volScalarField with magnitude of volVectorField.(this will be a lesson for me and all new users as well)
Thank you very much again.
With Regards,
Thamali
wyldckat likes this.
Thamali is offline   Reply With Quote

Old   August 16, 2016, 05:50
Default
  #25
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Hi
Yes this method works.
But I have a question:
If I have volScalarField T and then I want to assign

T[celli] = a*b; // a and b are dimensionedScalars

so then do I always use .value() method? I lose in this way dimensions checking or I am wrong?
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   September 1, 2016, 03:03
Default
  #26
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
yep. value() returns only value of variable not its dimension
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   August 29, 2017, 03:44
Unhappy similar problem in conversion
  #27
New Member
 
krishna kant
Join Date: Aug 2017
Location: hyderabad
Posts: 4
Rep Power: 8
krishna_kant_IITH is on a distinguished road
Send a message via Skype™ to krishna_kant_IITH
Hello Everyone
I am trying to solve laplace equation without using laplacian function. So I am stuck in multiplying the area vector to the grad of scalar T.

I am including the line of the code below which is showing problem

T[cellid]=T[cellid]-runTime.deltaT()*1.00*(gradT.value()*mesh.Sf()[faceid].value());
here T is the volScalarField, gradT is the volVectorField
This shows the error that they don't have any member named "value"
I have tried other ways too

T[cellid]=T[cellid]-runTime.deltaT()*1.00*(gradT*mesh.Sf()[faceid]);
This shows the following error
note: mismatched types ‘const Foam::dimensioned<Type>’ and ‘double’

T[cellid]=T[cellid]-runTime.deltaTValue()*1.00*(gradT*mesh.Sf()[faceid]);
This shows the same error as above.

T[cellid]=T[cellid]-runTime.deltaTValue()*1.00*(gradT.component(0)*mes h.Sf()[faceid].x()+gradT.component(1)*mesh.Sf()[faceid].y()+gradT.component(2)*mesh.Sf()[faceid].z());
This shows the following error
error: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘double’ in assignment

Any help is deeply appreciated.
krishna_kant_IITH is offline   Reply With Quote

Old   August 29, 2017, 11:27
Default
  #28
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Hi,
gradT is a vector so you can only access its component no value. Try this:
Accessing a vector in a volVectorField by cell label
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   August 6, 2020, 07:28
Default
  #29
New Member
 
Azad
Join Date: Nov 2019
Posts: 6
Rep Power: 6
azad_786 is on a distinguished road
Hi All,
I am trying to generate a random number r between zero to one at the interface where phi lies between 0.01 to 0.99 as follows

volScalarField r;
forAll( r, cellID)
{
//r[cellID] = DO SOMETHING
if (phi[cellID] > 0.01)
{
r[cellI] =random number;
}

if (phi[cellI] <0.99)
{
r[cellId] =random number;
}
else
{
r[cellId] =0;
}

}


for this I am getting error

error: cannot convert 'long int() throw ()' to 'double' in assignment
r[cellID]=random number;

could you please suggest me how to resolve?
Thanks
azad_786 is offline   Reply With Quote

Old   September 20, 2020, 06:00
Question no suitable user-defined conversion
  #30
New Member
 
sujata
Join Date: Dec 2019
Posts: 10
Rep Power: 6
sujata is on a distinguished road
Hi foamers,
I am trying to put a condition that if after a certain height in a twophaseflow the properties of the fluid will be interchanged and the drag will be calculated using that changed property. My code is mentioned below and I am getting the following error:
error: no suitable user-defined conversion from "Foam::tmp<Foam::GeometricField<Foam::scalar={Foam ::doubleScalar={double}}, Foam::fvPatchField, Foam::volMesh>>" to "const Foam::volVectorField" exists
const volVectorField y_dist2=U.mesh().C().component(1);
^

dragModels/Tsuchiya2/Tsuchiya2.C(98): error: no suitable user-defined conversion from "Foam::tmp<Foam::volVectorField>" to "const Foam::volScalarField" exists
const volScalarField y_dist = y_dist2/l_unit;




*................................................. ......................* //Code starts here
#include "Tsuchiya2.H"
#include "phasePair.H"
#include "addToRunTimeSelectionTable.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
namespace dragModels
{
defineTypeNameAndDebug(Tsuchiya2, 0);
addToRunTimeSelectionTable(dragModel, Tsuchiya2, dictionary);
}
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::dragModels::Tsuchiya2::Tsuchiya2
(
const dictionary& dict,
const phasePair& pair,
const bool registerObject
)
:
dragModel(dict, pair, registerObject),
residualRe_("residualRe", dimless, dict),
residualEo_("residualEo", dimless, dict)
{}


// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

Foam::dragModels::Tsuchiya2::~Tsuchiya2()
{}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

Foam::tmp<Foam::volScalarField>
Foam::dragModels::Tsuchiya2::CdRe() const
{
volScalarField Re(max(pair_.Re(), residualRe_));
//volScalarField Re(pair_.Re());
volScalarField Eo(max(pair_.Eo(), residualEo_));

Info<< "Re =" <<Re[0] << endl;
Info<< "Eo =" <<Eo[0] << endl;
volScalarField temp
{
max
(
24.0*(1.0 + 0.15*pow(Re, 0.687))/Re,
8.0*Eo/(3.0*(Eo + 4.0))
)
};

Info<< "Cd=" <<temp[0] <<endl;


return
temp*Re;

dimensionedScalar l_unit
(
"l_unit",
dimensionSet (0, 1, 0, 0, 0, 0, 0),
scalar(1.0)
);

const volVectorField U= this->db().objectRegistry::lookupObject<volVectorField> ("U.water");
const volVectorField y_dist2=U.mesh().C().component(1);
const volScalarField y_dist = y_dist2/l_unit;

dimensionedScalar h_i
(
"h_i",
dimensionSet (0, 0, 0, 0, 0, 0, 0),
scalar (1.1)
);

const volScalarField f_highUG
(
pos(y_dist-h_i)*
(
1e-06
)
+ neg(y_dist-h_i)*1.0
);
sujata is offline   Reply With Quote

Old   September 21, 2020, 06:36
Default
  #31
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 15
ybapat is on a distinguished road
U.mesh().C().component(1) is returning tmp<volScalarField > not volScalarField
sujata likes this.
ybapat is offline   Reply With Quote

Old   September 21, 2020, 06:43
Post
  #32
New Member
 
sujata
Join Date: Dec 2019
Posts: 10
Rep Power: 6
sujata is on a distinguished road
Quote:
Originally Posted by ybapat View Post
U.mesh().C().component(1) is returning tmp<volScalarField > not volScalarField
Hey, Thank you for your response. Could you please tell me the correct form.
sujata is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert virtual volume to a real one djalil FLUENT 0 January 22, 2009 15:07
Convert Real edges to Virtual in Gambit Freeman FLUENT 6 October 24, 2005 15:14
Convert from StarCD 3.10 to StarCD 3.15 Jing Siemens 1 April 17, 2002 09:22


All times are GMT -4. The time now is 08:00.