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

An array to store scalar value at every time step

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By überschwupper

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 12, 2023, 03:09
Default An array to store scalar value at every time step
  #1
New Member
 
Parth1999's Avatar
 
Parth
Join Date: Feb 2021
Posts: 14
Rep Power: 5
Parth1999 is on a distinguished road
Hi
i am new to OpenFOAM
i am trying to compile a solver, in which i need to store the the instantaneous
calculated variable (scalar) to array for every time step

I mean
CF_spatial = gsum(V_ecs)/gsum(por)
V_ecs and por are time dependent field variables, but CF_spatial is calculated at every time step and is a scalar value and it is not a field variable, i want to create an array where i can store CF_spatial value at every time step,

pls help
Parth1999 is offline   Reply With Quote

Old   February 12, 2023, 16:20
Default
  #2
Member
 
Join Date: Jan 2022
Location: Germany
Posts: 72
Rep Power: 4
überschwupper is on a distinguished road
Quote:
Originally Posted by Parth1999 View Post
Hi
i am new to OpenFOAM
i am trying to compile a solver, in which i need to store the the instantaneous
calculated variable (scalar) to array for every time step

I mean
CF_spatial = gsum(V_ecs)/gsum(por)
V_ecs and por are time dependent field variables, but CF_spatial is calculated at every time step and is a scalar value and it is not a field variable, i want to create an array where i can store CF_spatial value at every time step,

pls help

When you know the size, then why not using C++ arrays (or OpenFoam class List<T>), otherwise you could use vector from the standard library (std::vectory<T>) and then use the push_back() method.
Parth1999 likes this.
überschwupper 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
courant number increases to rather large values 6863523 OpenFOAM Running, Solving & CFD 22 July 5, 2023 23:48
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
Postprocess: sampleDict works but creates no output folder shock77 OpenFOAM Post-Processing 14 November 15, 2021 08:27
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 04:13
SU2 7.0.7 Built on CentOS 7, parallel computation pyscript mpi exit error? EternalSeekerX SU2 3 October 9, 2020 18:28


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