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

manipulating field values at the boundaries

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 7, 2020, 22:27
Default manipulating field values at the boundaries
  #1
New Member
 
Christoph Kammer
Join Date: Jun 2020
Posts: 4
Rep Power: 5
chkammer1989 is on a distinguished road
Hello everyone!


I defined a field


volTensorField Q
(
IOobject
(
"Q",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionSet(0,0,0,0,0,0),
"codedFixedValue" //"calculated"
);


I need to manipulate the entries of Q at the boundary patches and thought I would do something like this


forAll(mesh.boundaryMesh(), patchI){

forAll(mesh.boundary()[patchI], facei){
//Q.boundaryField()[patchI][facei] = tensor(1,0,0,0,1,0,0,0,1);
Q.boundaryField()[patchI][facei].xx() = Foam::cos(..) // ..some assignment
}
}


This won't compile throwing back the error "assignment of read-only location". Apparently the reference above doesn't allow assignments.. Does anyone have an idea how to resolve this issue?


Any help is greatly appreciated,


Thank you!
chkammer1989 is offline   Reply With Quote

Old   August 7, 2020, 22:45
Default
  #2
New Member
 
Christoph Kammer
Join Date: Jun 2020
Posts: 4
Rep Power: 5
chkammer1989 is on a distinguished road
Never Mind,


changing



Q.boundaryField()[patchI][facei].xx() = Foam::cos(..) // ..some assignment


to


Q.boundaryFieldRef()[patchI][facei].xx() = Foam::cos(..) // ..some assignment


does the trick!
chkammer1989 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
How to obtain pressure values on the zeroGradient boundaries of the domain? deepbandivadekar OpenFOAM Running, Solving & CFD 2 June 22, 2021 12:17
Field values at the boundary cells vcvedant OpenFOAM Running, Solving & CFD 4 August 2, 2017 17:50
display contour/map of differences for different field values (T, U, etc.) msarkar Main CFD Forum 9 August 30, 2013 09:43
display contour/map of differences for different field values (T, U, etc.) msarkar OpenFOAM Post-Processing 0 July 17, 2013 04:45
Appending field values to a file teopetre Fluent UDF and Scheme Programming 2 April 21, 2012 09:13


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