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

Store data in a different field from a custom BC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2017, 11:14
Default Store data in a different field from a custom BC
  #1
New Member
 
Chris
Join Date: Dec 2016
Location: Cambridge, UK
Posts: 2
Rep Power: 0
cstuart is on a distinguished road
I have a custom boundary condition for a mass diffusion solver of mine. The boundary condition calculates the gradient based on an empirical formula for the outflowing mass flux. I want my end user to be able to view in Paraview the changing outflow mass flux as well as the total quantity of mass escaped (i.e. integral of mass flux with time).

To achieve this, I want to have a separate volScalarField in my solver which holds only this integrated quantity in its boundary field and nothing else. (So in fact I should probably be using a surface field but I'm trying to keep things simple for me for the moment.)

My problem is accessing that storage field from within the boundary condition of a different field. So, say I have mass concentration C_T with my custom BC, I need to get a writeable reference to storage field 'store'. The closest I have worked out how to get to this is:
Code:
    const fvPatchField<scalar>& storageField =
        patch().lookupPatchField<volScalarField, scalar>("store");
This gives me the right section of the boundary field of the storage volScalarField, but lookupPatchField() returns a const reference, so I cannot store anything in it!
Is there a way of getting a non-const reference?
cstuart 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
Utility to export field data tbrycekelly OpenFOAM Post-Processing 1 November 23, 2024 08:48
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 22:00
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 05:49
External magnetic field data Richard Lee FLUENT 7 January 11, 2019 05:43
UDF vs Custom field function andrew FLUENT 5 June 24, 2011 11:53


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