CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Adding a Constructor to ThermoCloud (https://www.cfd-online.com/Forums/openfoam-programming-development/247440-adding-constructor-thermocloud.html)

schradc February 4, 2023 21:15

Adding a Constructor to ThermoCloud
 
Hello,

I have a novice question, I'm not quite sure how to articulate it.

I need to modify the ThermoCloud class to add a constructor with a modified list of arguments. Presently the constructor takes these arguments

Code:

        ThermoCloud
        (
            const word& cloudName,
            const volScalarField& rho,
            const volVectorField& U,
            const dimensionedVector& g,
            const SLGThermo& thermo,
            bool readFields = true
        );

I need to avoid passing an instance of SLGThermo and instead pass select data it contained individually.

Initially, I wanted to create a copy of ThermoCloud with the same inheritance and add the custom constructor, but there is a hitch.

src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H

Code:

#define makeHeatTransferModel(CloudType)                                      \
                                                                              \
    typedef Foam::CloudType::thermoCloudType thermoCloudType;                  \
    defineNamedTemplateTypeNameAndDebug                                        \
    (                                                                          \
        Foam::HeatTransferModel<thermoCloudType>,                              \
        0                                                                      \
    );                                                                        \
    namespace Foam                                                            \
    {                                                                          \
        defineTemplateRunTimeSelectionTable                                    \
        (                                                                      \
            HeatTransferModel<thermoCloudType>,                                \
            dictionary                                                        \
        );                                                                    \
    }

If I am understanding this correctly, the runTimeSelction stuff for the HeatTransferModel (and derived) can only be done for cloud classes which are templated based on and are derived from a ThermoCloud. Which means that no matter what I do, I will have to at some point construct a ThermoCloud using the SLGThermo constructor.

I could use some advice on how to proceed.
  1. Do I need to modify the heat transfer runTimeSelection macros to work with a custom "ThermoCloud adjacent" class?
  2. Can/should I add a constructor to the actual ThermoCloud class instead of deriving from it?
  3. Can I set the data inherited from ThermoCloud without using the ThermoCloud SLGThermo constructor? Perhaps using the default constructor? If I do, how do I construct the KinematicCloud on which ThermoCloud is based?

Thanks for taking a look.


All times are GMT -4. The time now is 01:32.