CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

protected scalarList

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   April 16, 2018, 16:33
Default protected scalarList
Joaquín Neira
Join Date: Oct 2017
Posts: 38
Rep Power: 7
cojua8 is on a distinguished road
Hello, I'm trying to add a new member to KinematicParcel class of type List<scalar> to store all (or a defined number) the previous dt.

for this, I added, in file KinematicParcel.H:

            //- dt storage [s]
            List<scalar> dtList_;

            //- Return const access to the dtList
            inline List<scalar> dtList() const;

            //- Return access to the dtList
            inline List<scalar>& dtList();
In file KinematicParcelI.H:

template<class ParcelType>
inline Foam::List<Foam::scalar> Foam::KinematicParcel<ParcelType>::dtList() const
    return dtList_;

template<class ParcelType>
inline Foam::List<Foam::scalar>& Foam::KinematicParcel<ParcelType>::dtList()
    return dtList_;
the in file file KinematicParcel.C (move function), I need to do this:
        if (p.onBoundaryFace() && td.keepParticle)
            if (isA<processorPolyPatch>(pbMesh[p.patch()]))
                td.switchProcessor = true;
                std::cout << "cambio de procesador" << std::endl;
        p.age() += dt;
        p.dtList().append(dt); , celli, dt, start, td.keepParticle);

    return td.keepParticle;
This works fine when I don't run my problem in multiple processors, but when running it in parallel, after going to a new processor it crashes.

How should I include dtList in the constructors so that it works as I expect and doesn't reset and crash when running in parallel?

Also, how can I set a fixed sized based on variable NB (shown on files attached)?

thank you!
Attached Files
File Type: c KinematicParcel.C (12.6 KB, 0 views)
File Type: h KinematicParcel.H (19.0 KB, 3 views)
File Type: h KinematicParcelI.H (10.0 KB, 0 views)
File Type: c KinematicParcelIO.C (7.6 KB, 0 views)
File Type: h KinematicParcelTrackingDataI.H (3.2 KB, 0 views)
cojua8 is offline   Reply With Quote


list, parallel

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[snappyHexMesh] snappyHexMesh <-> dynamicMeshDict problem with protected cells Billy_16 OpenFOAM Meshing & Mesh Conversion 2 November 21, 2020 04:34
defining a protected variable blows the solution anishtain4 OpenFOAM Programming & Development 1 June 28, 2016 15:39
Failure to start from latest time when BC stores scalarlist Phicau OpenFOAM Bugs 2 February 26, 2014 04:43
Combining 2 scalarList into scalarListList? CKH OpenFOAM Programming & Development 1 May 30, 2013 10:39

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