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

Initalization of List<dimensionedScalar> with a proper dimensionSet

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 5, 2025, 10:35
Default Initalization of List<dimensionedScalar> with a proper dimensionSet
  #1
New Member
 
Maciej Marczak
Join Date: Sep 2020
Posts: 8
Rep Power: 7
MMarczak is on a distinguished road
Hi everyone,

I am developing a custom solver in which I need to load some values from the dictionary at the beginning of the simulation.

I have a variable:
Code:
List<dimensionedScalar> solidSpeciesMolarMass_;
that initially was initialized by:
Code:
solidSpeciesMolarMass_(lookup("solidSpeciesMolarMass")),
But I kept getting runtime error:
Code:
--> FOAM FATAL ERROR: 
Different dimensions for =
     dimensions : [0 0 0 0 0 0 0] = [1 0 0 0 -1 0 0]
I tried to find some workaround solution, like writing a helper function:
Code:
{
    List<scalar> vals(lookup("solidSpeciesMolarMass"));

    List<dimensionedScalar> mass;

    forAll(vals, i)
    {
        mass.append
        (
            dimensionedScalar
            (
                Foam::name(i) + "_molarMass",
                dimensionSet(1, 0, 0, 0, -1, 0, 0),
                vals[i] * 1e-3
            )
        );
    }

    return mass;
}
but it resulted with the same runtime error. I took a look at the constructors of the List class, but no solution came into my mind.
Is there any way that I can build a list of dimensionedScalar in this automatic way?

Thanks!
MMarczak is offline   Reply With Quote

Reply

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
What is the best proper value of second per iteration? dlalstnf SU2 1 April 6, 2023 13:54
[mesh manipulation] The extracted patch Labels in not proper for different test case. sunagra27 OpenFOAM Meshing & Mesh Conversion 0 May 31, 2021 04:08
how to get proper points location of geometry in CFD Post? teguhtf ANSYS 0 May 4, 2020 16:59
Proper cores number to be used in CFX simulation Anna Tian CFX 8 March 10, 2015 05:07
Constructing vector from three scalars mayank.dce2k7 OpenFOAM Running, Solving & CFD 8 January 28, 2014 17:07


All times are GMT -4. The time now is 14:30.