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

Add value to a Foam::volScalarField list

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2014, 05:35
Default Add value to a Foam::volScalarField list
  #1
Member
 
Join Date: Jul 2014
Posts: 39
Rep Power: 11
PicklER is on a distinguished road
Hello

Is it possible to add a new value to an existing Foam::volScalarField nonuniform List<scalar>?

I have seen that a push_back() member exists for vectors in C++, but have not found a similiar member for volScalarField and I'm looking for something similar. If this is not possible, I will have to rewrite the variable in question file for each time step, but this is computationally expensive.

For example:
Pressure is created in createFields.H and is
Code:
p: dimensions      [1 -1 -2 0 0 0 0];

internalField   nonuniform List<scalar> 
32
(
10006.5
10010.5
10010.5
10009.3
10010.5
10012.3
10012.3
10012.3
10010.5
10012.3
10012.3
10012.3
10006.5
10010.5
10010.5
10009.3
99775.3
99545.7
99545.7
99676.7
99545.7
99419.7
99419.7
99469.8
99545.7
99419.7
99419.7
99469.8
99775.3
99545.7
99545.7
99676.7
)
;

boundaryField
{
    grain
    {
        type            zeroGradient;
    }
    walls
    {
        type            zeroGradient;
    }
    defaultFaces
    {
        type            empty;
    }
}
So this pressure list contains 32 entries for the internal field. Is it possible to add to this, in order for it to have 36 entries. I am aware the the number of entries will not match that of the number of cells, but still need to know this.

Thanks in advance
PicklER is offline   Reply With Quote

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

there's append method inherited from List class.
alexeym is offline   Reply With Quote

Old   December 11, 2014, 06:12
Default
  #3
Member
 
Join Date: Jul 2014
Posts: 39
Rep Power: 11
PicklER is on a distinguished road
Thank you Alexey

Just something else out of curiosity. Have you seen anyone adding cells in a solver to the blockMesh. I am able to add new cells now in my solver, so now I just need to set the new cell variables.

Hopefully it will not end up in total disaster.
PicklER is offline   Reply With Quote

Old   December 11, 2014, 07:14
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Yes, I've seen several people. Though they were adding cells to dynamicFvMesh not to blockMesh.
alexeym is offline   Reply With Quote

Reply

Tags
add value, volscalarfield list


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
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
[PyFoam] and paraview eelcovv OpenFOAM Community Contributions 28 May 30, 2016 09:23
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


All times are GMT -4. The time now is 11:38.