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

Modify pointDisplacement within a solver

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By dariodario32

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 19, 2017, 12:26
Default Modify pointDisplacement within a solver
  #1
New Member
 
dario
Join Date: Dec 2016
Posts: 24
Rep Power: 9
dariodario32 is on a distinguished road
Hi,
I'm working on a modified version of pimpleDyMFoam, in which i can access the pointDisplacement field and assign value to a boundary patch according to data calculated inside the solver. (I'm using OF 4.1)

after declaring the IOobject and the pointPatchVectorField referred to the patch:

Quote:
pointVectorField pointDisplacement_
(
IOobject
(
"pointDisplacement",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(mesh)
);

const pointPatchVectorField &pvf = pointDisplacement_.boundaryField()[patchI];
I would like to assign the value coming from displacements (a vectorField variable):

Quote:
pvf = displacements;
when I compile the solver I have the following error:

error: passing ‘const pointPatchVectorField {aka const Foam:ointPatchField<Foam::Vector<double> >}’ as ‘this’ argument discards qualifiers [-fpermissive]

Does anybody know why?
Thanks
dariodario32 is offline   Reply With Quote

Old   August 22, 2017, 07:18
Default
  #2
New Member
 
dario
Join Date: Dec 2016
Posts: 24
Rep Power: 9
dariodario32 is on a distinguished road
the solution is to use boundaryFieldRef instead of boundaryField to write into the boundary patch:

Quote:
pointVectorField& PointDisplacement = const_cast<pointVectorField&>
(
mesh.objectRegistry::lookupObject<pointVectorField >
(
"pointDisplacement"
)
);

PointDisplacement.boundaryFieldRef()[patchI] == displacements;
Lin Xiangfeng likes this.

Last edited by dariodario32; August 23, 2017 at 06:15.
dariodario32 is offline   Reply With Quote

Old   September 6, 2017, 13:10
Default
  #3
New Member
 
Xiangfeng Lin
Join Date: Sep 2017
Posts: 2
Rep Power: 0
Lin Xiangfeng is on a distinguished road
Quote:
Originally Posted by dariodario32 View Post
the solution is to use boundaryFieldRef instead of boundaryField to write into the boundary patch:
i want to say thank you, your solution really do me a help~
Lin Xiangfeng is offline   Reply With Quote

Old   September 13, 2017, 04:30
Default
  #4
New Member
 
ANKUR GARG
Join Date: Mar 2017
Posts: 23
Rep Power: 9
ankur_garg is on a distinguished road
Can Anyone help me, Where I am going wrong to write the below equation, where qem is the volScalarField and dfm is the class object:
error: passing ‘const volScalarField {aka const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ as ‘this’ argument discards qualifiers [-fpermissive]
scalarField& qem = dfm.qem().boundaryFieldRef()[patchi];
ankur_garg 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 set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
CFX solver workspace properties: modify default values zboud CFX 2 March 8, 2010 09:10
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 15:08
To modify the interFoam solver for cavitating zjucfd OpenFOAM Running, Solving & CFD 5 August 26, 2007 09:03


All times are GMT -4. The time now is 02:49.