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

Access BC variable from another file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2022, 09:05
Default Access BC variable from another file
  #1
Member
 
UOCFD
Join Date: Oct 2020
Posts: 40
Rep Power: 5
uosilos is on a distinguished road
Hey foamers,


I am developing a customized code for lagrangian particles patchInteraction model.


I want to include a variable read from the activePressureForceBaffleVelocity BC, which is called openFraction_.


How can I call it from localInteraction.C??


Since now I have tried with:
U.mesh.boundary()[patchi].openFraction_();
U.patch().boundaryMesh()[patchi].openFraction_();

without success.


Any solution to his would be appreciated
uosilos is offline   Reply With Quote

Old   February 14, 2022, 09:31
Default
  #2
Member
 
Julio Pieri
Join Date: Sep 2017
Posts: 96
Rep Power: 8
JulioPieri is on a distinguished road
I don't know the proper way to do that, but can you access it like other dicts are called? something like

this->coeffDict().getOrDefault("openFraction", 0.001)

then you change the underlined text to your 0/U.patchName file?
JulioPieri is offline   Reply With Quote

Old   February 15, 2022, 03:29
Default
  #3
Member
 
UOCFD
Join Date: Oct 2020
Posts: 40
Rep Power: 5
uosilos is on a distinguished road
I think that is the way to read variables from the own model file, but not from other locations like a BC...
uosilos is offline   Reply With Quote

Old   March 7, 2022, 10:02
Default
  #4
Member
 
UOCFD
Join Date: Oct 2020
Posts: 40
Rep Power: 5
uosilos is on a distinguished road
By doing U.boundaryField()[patchID]:

Code:
type            activePressureForceBaffleVelocity;
cyclicPatch     baffleCyclic_half0;
orientation     1;
openingTime     0.005;
maxOpenFractionDelta 0.1;
openFraction    0;
minThresholdValue -3.78e+06;
forceBased      0;
value           uniform (0 0 0);
Output for entry U.boundaryField()[patchID].type() works fine, but not for the other variables since they are part of the derived fvPatchField, written by:

Code:
void Foam::activePressureForceBaffleVelocityFvPatchVectorField::
write(Ostream& os) const
{
    fvPatchVectorField::write(os);
      writeEntry(os, "cyclicPatch", cyclicPatchName_);
...
Any solution??
uosilos 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
[Other] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 03:50
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 towanda OpenFOAM Community Contributions 6 September 5, 2015 21:03
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
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 21:20.