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

Unable copy boundary values of the pressure field (p) to a new field (p1)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 28, 2024, 08:15
Default Unable copy boundary values of the pressure field (p) to a new field (p1)
  #1
New Member
 
RAJESH.P
Join Date: Feb 2011
Posts: 4
Rep Power: 15
rajesh001 is on a distinguished road
Hi, Foamers, I am making some modifications on the icoFoam solver and needs some help in copying the boundary values of pressure field p and velocity field U to a new pressure field p1 and velocity field U1. I tried the following following code.



Code:
forAll(U.boundaryField(),patchI)        
{
          U1.boundaryField()[patchI] == U.boundaryField()[patchI] ;
 }
forAll(p.boundaryField(),patchI)
{
          p1.boundaryField()[patchI] == p.boundaryField()[patchI] ;
}
Surprisingly, the first part of the code (for Velocity) works without any problem. But for pressure, OpenFoam throws up an error



HTML Code:
error: no match for ‘operator==’ (operand types are ‘const Foam::fvPatchField<double>’ and ‘const Foam::fvPatchField<double>’)   105 |           p1.boundaryField()[patchI] == p.boundaryField()[patchI] ; In file included from /home/proj/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude/volFields.H:40,                  from /home/proj/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:27,
I am a newbie in C++ and I am unable to understand the issue in this case. Is there any other method for this. I am using OpenFoam-9



Kindly help!
Thanks in advance.
rajesh001 is offline   Reply With Quote

Old   May 30, 2024, 09:09
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 770
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
How do you read the difference between = (one symbol) and == (two symbols)?
dlahaye is offline   Reply With Quote

Old   June 10, 2024, 07:33
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by dlahaye View Post
How do you read the difference between = (one symbol) and == (two symbols)?

You can read the double equals as "forced assignment" (ie, copy in the values even if the BC is nominally not assignable).
Of course, this also implies that the left-hand-side is actually assignable. For example,
Code:
U1.boundaryFieldRef() == U.boundaryField();

Info: https://www.openfoam.com/documentati...ea65c28097d3f6
dlahaye likes this.
olesen is offline   Reply With Quote

Reply

Tags
icofoam, openfoam 9, pressure, velocity


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
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 01:44
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 01:27
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 15:55


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