CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Dimensionless parameters (https://www.cfd-online.com/Forums/openfoam-programming-development/58098-dimensionless-parameters.html)

titio January 15, 2009 16:26

Dimensionless parameters
 
Hi all,

I need to define in the transport properties dictionary that do not have dimensions. My strategy was to define them as dimensioned, but placing only zeros in the dimensions definitions. Is this correct, or there is any command that can be used?

Thanks in advance,

Antonio

floooo January 16, 2009 02:59

Hi Put the following code i
 
Hi

Put the following code in createFields.H:

dimensionedScalar name
(
transportProperties.lookup("name")
);

and then this one in transportProperties files:

name name [0 0 0 0 0 0 0] 0.5;

Florian

olesen January 16, 2009 05:11

I'd first recommend adding a s
 
I'd first recommend adding a subdictionary to transport properties to avoid possible collision with existing or future names and to cleanly group your variables. I'd also assume that you'd like to enter dimensionless variables without needing to enter the "[0 0 0 0 0]" dimensions, or even bother with adding the name twice (once for the dictionary keyword and once for the dimensionedScalar).

In transportProperties (or somewhere else), add your subdictionary:

antonioSpecialDict
{
firstParam 1.0;
secondParam 2.0;
}


Then in your code (eg, createFields.H), use the lookupOrAddToDict static member:


dimensionedScalar param1
(
dimensionedScalar::lookupOrAddToDict
("firstParam", antonioDict, 10)
);

dimensionedScalar param2
(
dimensionedScalar::lookupOrAddToDict
( "secondParam", antonioDict, 20 )
);

dimensionedScalar param3
(
dimensionedScalar::lookupOrAddToDict
("thirdParam", antonioDict, 30)
);


This approach not only saves lots of typing in the dictionary, it also lets you specify default values.

If you wish to be extra safe, you'll want to check the original dictionary (eg, transportProperties) for the "antonioSpecialDict" first, and supply the code with an alternative place to edit if necessary.

I guess that dimensionedType should actually have a normal dict lookup (eg, lookupOrDefault) that doesn't alter the dictionary. Maybe you should submit a enhancement request for that.

13msmemusman February 29, 2016 03:26

Simply use

varible = runTime.controlDict().lookupOrDefault<scalar>("var ible", 0);

6863523 December 10, 2016 07:06

to use the dimensionless N-S equations in OpenFOAM
 
Dear,
I want to use the dimensionless equations in OpenFOAM. Anyone knows how to turn off the dimension checking? I have posted my problem here
https://www.cfd-online.com/Forums/op...tml#post629034
Thank you in advance for any suggestions.
Best Regards,
Bill


All times are GMT -4. The time now is 19:29.