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

how to change boundaryType in volScalarField

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 16, 2017, 15:18
Default how to change boundaryType in volScalarField
  #1
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Hi All,
In constructor of GeometricField class we have
Code:
GeometricField            (           const IOobject &            io,                              
          
          const Mesh &            mesh,                              
          
          const dimensioned< Type > &            dt,                              
          
          const word &            patchFieldType = PatchField<Type>::calculatedType()                              
          )
where default boundaryType is calculatedType.

How can I define GeometricField with zeroGradient patchFieldType??
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   October 17, 2017, 15:41
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,933
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

You can use just "zeroGradient" string or zeroGradientFvPatchField<Type>::typeName if you would like to be sure your modification survives rename of zeroGradient.
alexeym is offline   Reply With Quote

Old   October 19, 2017, 15:30
Default
  #3
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

You can use just "zeroGradient" string or zeroGradientFvPatchField<Type>::typeName if you would like to be sure your modification survives rename of zeroGradient.
Hi Alexeym,
It tells me that zeroGradient was not declared in this scope...
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   October 19, 2017, 17:24
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,933
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

To use zeroGradientFvPatchField you have to include zeroGradientFvPatchFields.H. If you do not want to bother, use string "zeroGradient".
alexeym is offline   Reply With Quote

Old   October 20, 2017, 05:20
Default
  #5
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Hi Alexeym,
I added zeroGradientFvPatchFields.H but it still tells that zeroGradient was not declared in this scope.
My code is (in constructor)
Code:
A
(
    IOobject
    (
         "A",
         U.mesh().time().timeName(),
         IOobject::NO_READ,
         IOobject::NO_WRITE
    ),
    U.mesh(),
    dimensionedScalar("A", dimTemperature, 0.0),
    zeroGradient
),
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   October 20, 2017, 07:16
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,933
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

You could try to use more conventional C++ syntax (first one uses string, second uses static field):

Code:
A
(
    IOobject
    (
         "A",
         U.mesh().time().timeName(),
         IOobject::NO_READ,
         IOobject::NO_WRITE
    ),
    U.mesh(),
    dimensionedScalar("A", dimTemperature, 0.0),
    "zeroGradient"
),
or

Code:
A
(
    IOobject
    (
         "A",
         U.mesh().time().timeName(),
         IOobject::NO_READ,
         IOobject::NO_WRITE
    ),
    U.mesh(),
    dimensionedScalar("A", dimTemperature, 0.0),
    zeroGradientFvPatchScalarField::typeName
),
gaza and Mirza8 like this.
alexeym is offline   Reply With Quote

Old   October 20, 2017, 07:35
Default
  #7
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Now it works
Thank you so much Alexeym.
__________________
best regards
pblasiak
gaza 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
[openSmoke] libOpenSMOKE Tobi OpenFOAM Community Contributions 562 January 25, 2023 09:21
Can a solver change the type of a boundary/patch ? fredo490 OpenFOAM Programming & Development 6 June 24, 2021 11:14
if-loop, volScalarField comparison volker OpenFOAM 7 March 6, 2020 20:03
Radiation interface hinca CFX 15 January 26, 2014 17:11
dimensionedScalar + volScalarField is evaluated elementwisely ? tianyikillua OpenFOAM Programming & Development 1 March 30, 2012 03:12


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