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

scalarField defined in BC file to paraview

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 21, 2021, 06:24
Question scalarField defined in BC file to paraview
  #1
Member
 
Join Date: Jun 2019
Posts: 41
Rep Power: 7
Voulet is on a distinguished road
Hello everybody.
I would like to print out some scalarFields defined in boundary conditions files in paraview. I use OF8.

I'm coding my own boundary condition for a volScalarField called pa.

In the void Foam::myOwnBC::updateCoeffs() member function, I've defined some intermediate scalarField and vectorField, for example :

Code:
 scalarField Un = phip / patch().magSf();
Then I update my pa BC field with the usual

Code:
operate==myCustomField1 + Un + myCustomField2 + ... ;
For a debbuging purpose I would like to see in paraview the intermediate fields Un or myCustomField1.

My first attempt was to create a volScalarField in CreateFields.H :
Code:
volScalarField testField
(
   IOobject
   (
     "testField",
    runTime.timeName(),
    mesh,
    IOobject::READ_IF_PRESENT,
    IOobject::AUTO_WRITE
  ),
  mesh,
  dimensionedScalar("test", dimless, 0.0)
);
and access it in my BC file inside the ::updateCoeffs() :
Code:
 const fvPatchField<scalar> &testFieldp =
                patch().lookupPatchField<volScalarField, scalar>("testField");
and then I try to update his value (still inside ::updateCoeffs() ) :
Code:
testFieldp = Un ;
but it doesn't work :
Code:
error: passing ‘const Foam::fvPatchField<double>’ as ‘this’ argument discards qualifiers [-fpermissive]
      testFieldp = Un ;
I don't understand this error. Does anyone can advice me in order to see these fields in paraview ?

Last edited by Voulet; July 21, 2021 at 08:59.
Voulet is offline   Reply With Quote

Reply

Tags
boundaries definition


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
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 36 July 16, 2024 03:52
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 11:44
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08


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