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

seeking advice adapting old code to v2212

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 17, 2024, 17:01
Default seeking advice adapting old code to v2212
  #1
Member
 
Ken Darcovich
Join Date: Mar 2009
Location: Ottawa, Canada
Posts: 34
Rep Power: 17
kdarc is on a distinguished road
Hi.


I have a simulation adapted from simpleFoam for a chemical separation process. It was working fine in an old OpenFoam version, but our server has to be updated, and we are trying to get it to run with v2212.


Many problems have already been corrected, mainly involving adding more specific header files, as well as adding more items to the options file that the system seems to specifically seek.


We are now stuck with the following error, where the compiler won't accept an assignment statement for an inlet velocity on a surface patch. This kind of line was fine for decades, not sure why it's suddenly a problem.


>>>
U_BC.H:17:47: error: assignment of read-only location '(&(&(& U.Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::boundaryField())->Foam::GeometricBoundaryField<Foam::Vector<double> , Foam::fvPatchField, Foam::volMesh>::<anonymous>.Foam::FieldField<Foam: :fvPatchField, Foam::Vector<double> >::<anonymous>.Foam::PtrList<Foam::fvPatchField<Fo am::Vector<double> > >::<anonymous>.Foam::UPtrList<Foam::fvPatchField<F oam::Vector<double> > >:perator[](patchIn))->Foam::fvPatchField<Foam::Vector<double> >::<anonymous>.Foam::Field<Foam::Vector<double> >::<anonymous>.Foam::List<Foam::Vector<double> >::<anonymous>.Foam::UList<Foam::Vector<double> >:perator[](0))->Foam::Vector<double>::<anonymous>.Foam::VectorSpa ce<Foam::Vector<double>, double, 3>::component(0)'
17 | U.boundaryField()[patchIn][0].component(0) = Umax*(1.0 - r2);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ ~~~~~~~~~~~
In file included from simpleFoam.C:104:
<<<


Does anyone know how to get a v2212 compiler to accept this line? Do we need header files in v2212 related to fvPatchField? Normally, this was all part of standard OpenFoam internals that a simpler user didn't have to be concerned about.


thanks !
kdarc is offline   Reply With Quote

Old   September 17, 2024, 18:10
Default
  #2
Member
 
Ken Darcovich
Join Date: Mar 2009
Location: Ottawa, Canada
Posts: 34
Rep Power: 17
kdarc is on a distinguished road
figured it out !!



there were two header files required that were in createFields.H rather than in the .C file in my example, so they went unnoticed.


added:
#include "createMRF.H"
#include "createFvOptions.H"

to my createFields.H file, and the code compiles !!




thanks.
kdarc is offline   Reply With Quote

Old   Yesterday, 15:39
Default
  #3
Member
 
Ken Darcovich
Join Date: Mar 2009
Location: Ottawa, Canada
Posts: 34
Rep Power: 17
kdarc is on a distinguished road
actually, I was wrong, the problem persists, openfoam v2122 will not allow:


U.boundaryField()[patchIn][0].component(0) = Umax*(1.0 - r2);


it seems to report something like a casting error.

Strange, since this kind of assignment always worked in the past.


Any ideas on how to make that assignement I'm seeking??


thanks.
kdarc 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
water injection error (modify the position of water injection) wjchoi Main CFD Forum 0 January 17, 2022 07:17
First post and first project; seeking hints and advice! Cipherflak CFX 3 October 22, 2011 23:34
seeking advice ljp OpenFOAM 0 October 12, 2010 17:02
CFD Code Choice and General Advice Alex Pope Main CFD Forum 26 April 25, 2007 11:54
Advice for Buying CFD Code Ms. Veenaranjini Main CFD Forum 1 October 27, 2003 13:27


All times are GMT -4. The time now is 11:57.