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

dimensionedScalar Dimension setting in lookup

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 29, 2016, 09:51
Post dimensionedScalar Dimension setting in lookup
  #1
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10
13msmemusman is on a distinguished road
In creatFields.H i want to specify dimensions of a specific variable which i am getting from controlDict using lookupOrDefault. But i am unable to set proper dimensions to the variable. what i did is

dimensionedScalar heightOfOrigin
(
runTime.controlDict().lookup("heightOfOrigin"),
dimensionSet( 0, 1, 0, 0, 0, 0, 0),
);

But it gives me error.

Please help me
13msmemusman is offline   Reply With Quote

Old   March 1, 2016, 03:38
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 37
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Since you are constructing dimensionedScalar, use one of the constructors of the class (http://foam.sourceforge.net/docs/cpp/a00525.html) instead random attempts to guess the syntax:

Code:
dimensionedScalar heightOfOrigin 
( 
"heightOfOrigin",
dimLength,
readScalar(runTime.controlDict().lookup("heightOfOrigin"))
);
so in controlDict you just put "heightOfOrigin 1.0;", or you can have default value:

Code:
dimensionedScalar heightOfOrigin 
( 
"heightOfOrigin",
dimLength,
runTime.controlDict().lookupOrDefault<scalar>("heightOfOrigin", 0.0)
);
or you can set dimensions in controlDict like "heightOfOrigin heightOfOrigin [ m ] 1.0" and use constructor from Istream like:

Code:
dimensionedScalar heightOfOrigin(runTime.controlDict().lookup("heightOfOrigin"));
13msmemusman likes this.
alexeym is offline   Reply With Quote

Old   March 1, 2016, 08:48
Default
  #3
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10
13msmemusman is on a distinguished road
Sir thank you i understand now. But please guide me how you get help from sourceforge???? the link you sent.
13msmemusman is offline   Reply With Quote

Old   March 1, 2016, 08:56
Default
  #4
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10
13msmemusman is on a distinguished road
I am sorry i am a new member........ Learning......
13msmemusman is offline   Reply With Quote

Old   February 21, 2022, 08:45
Default Error compiling lookup
  #5
Member
 
Rosario Arnau
Join Date: Feb 2017
Location: Spain
Posts: 57
Rep Power: 7
rarnaunot is on a distinguished road
Dear foamers,

We have a problem compiling a solver in v2006 that was previously compiled in v1806 version.

This is the problem shown:
Code:
createFields.H:247:1 warning 'Foam::dimensioned<Type>::dimensioned(Foam::Istream&) [with Type = double]' is depracted (declared at 7share/apps/OpenFOAM-v2006/src/OpenFOAM/lnInclude/dimensionedType.C:305): Since 2018-11 [-Wdeprecated-declarations] );
This problem is repeated some times and it is related with this code:

Code:
IOdictionary diffusionProperties
(
	IOobject
	(
		"diffusionProperties",
		runTime.constant(),
		mesh,
		IOobject::MUST_READ_IF_MODIFIED,
		IOobject::NO_WRITE
	)
);


Info<< "Reading diffusivity DX\n" << endl;
dimensionedScalar DX
(
	diffusionProperties.lookup("DX")
);
Thanks a lot,
rarnaunot is offline   Reply With Quote

Old   February 21, 2022, 10:17
Default
  #6
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,518
Rep Power: 35
olesen will become famous soon enougholesen will become famous soon enough
Quote:
Originally Posted by rarnaunot View Post
Dear foamers,

We have a problem compiling a solver in v2006 that was previously compiled in v1806 version.

This is the problem shown:
Code:
createFields.H:247:1 warning 'Foam::dimensioned<Type>::dimensioned(Foam::Istream&) [with Type = double]' is depracted (declared at 7share/apps/OpenFOAM-v2006/src/OpenFOAM/lnInclude/dimensionedType.C:305): Since 2018-11 [-Wdeprecated-declarations] );
This problem is repeated some times and it is related with this code:
[/CODE]

As the message states it is a deprecation, which means that it not a compilation error, but a suggestion. The message furthermore states "deprecated since 2018-11", which is a clear indication why it compiled without warnings in v1806 but now starts emitting warnings with a new version.


From the docs (https://www.openfoam.com/documentati...d.html#details) it states


Quote:

Deprecated(2018-11) Construct from Istream with given name (expects dimensions, value)
Deprecated:(2018-11) - should generally use construct from dictionary or primitiveEntry instead (additional checks on the input stream).

Which further information should we provide???
olesen is offline   Reply With Quote

Old   February 21, 2022, 12:22
Default
  #7
Member
 
Rosario Arnau
Join Date: Feb 2017
Location: Spain
Posts: 57
Rep Power: 7
rarnaunot is on a distinguished road
Thanks olesen for your quick reply. I thought it was wrong in my code so it is enough to know that it is just a suggestion.

rarnaunot
rarnaunot is offline   Reply With Quote

Reply

Tags
lookup, lookupordefault

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
DPMFoam - Serious Error --particle-laden flow in simple geometric config benz25 OpenFOAM Running, Solving & CFD 27 December 19, 2017 21:47
[snappyHexMesh] determining displacement for added points CFDnewbie147 OpenFOAM Meshing & Mesh Conversion 1 October 22, 2013 10:53
Convergence on anisotropic tetahedral meshes pbo OpenFOAM Running, Solving & CFD 12 December 14, 2010 12:59
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 22:58
Warning 097- AB Siemens 6 November 15, 2004 05:41


All times are GMT -4. The time now is 09:59.