hystrath / hyStrath

Hypersonic / Rarefied gas dynamics code developments (GPL-3.0)
https://hystrath.github.io/
GNU General Public License v3.0
225 stars 109 forks source link

problems on dsmcfoam+ FreeStream Inflow Field Patch setup #84

Closed nanoR4K closed 2 years ago

nanoR4K commented 3 years ago

Good morning Vincent, I'm performing a validation experiment for a paper on dsmcFoam+ one of the simulation requirements is a non-uniform, vector list (U, T, numerical density) reading the source code I came across this boundary condition:

/*---------------------------------------------------------------------------*\
                           Class dsmcFreeStreamInflowFieldPatch Declaration
\*---------------------------------------------------------------------------*/

class dsmcFreeStreamInflowFieldPatch
:
    public dsmcGeneralBoundary
{

private:

    // Private data
        dictionary propsDict_;

    labelList typeIds_;

    //vector so different translational, rotational
    //vibrational temperatures can be set
    vectorField inletTemperatures_;

    vectorField inletVelocities_;

    // list of (one value) mass densities corresponding to the type Ids
    List <scalarField> numberDensities_;

    // list of species
    List <scalarField> accumulatedParcelsToInsert_;

    //- boundary temperatures
    volVectorField boundaryT_;

    //- boundary velocity
    volVectorField boundaryU_;

    //- list of inlet densities (one entry for each species)
    List<autoPtr<volScalarField> > boundaryNumberDensity_;

    void setProperties();

unfortunately, i wasn't able to run this condition with my code:

    boundary
    {
        generalBoundaryProperties
        {
        patchName                                                outflow;
        }

        boundaryModel                    dsmcFreeStreamInflowFieldPatch;

        dsmcFreeStreamInflowFieldPatchProperties
        {
                  typeIds                   (N2cold);                       
                              boundaryU
                              N2cold
                            100
                            (
                                (719.1304875090954 25.172575474152957 0)
                                (719.3627785226914 26.328806602546166 0)
                                (719.5950695362875 27.29233254287383 0)
                                (719.8273605498836 28.54491626529981 0)
                                (720.0596515634796 29.604794799660247 0)
                                (720.2919425770757 30.857378522086222 0) ...

                            );  

                  boundaryT
                              N2cold
                              100
                              (
                                (8.988987042333086 8.988987042333086)
                                (8.98943049818169 8.98943049818169)
                                (8.9907608657275 8.9907608657275)
                                (8.992638162153256 8.992638162153256) ...

                                );

                            boundaryNumberDensity
                            N2cold
                            100
                            (
                            (6.804743383294108)
                            (6.80455480107654) ...

                            );
          }
    }

the main errors are the following:

[0] cannot find file [0] [0] file: /home/nanor4k/openfoam/hyStrath/run/hyStrath/dsmcFoam+/supersonicFlatPlate2/processor0/0/boundaryT at line 0. [0] [0] From function regIOobject::readStream() [0] in file db/regIOobject/regIOobjectRead.C at line 237.

or

--> FOAM FATAL IO ERROR: [5] attempt to read beyond EOF I'm pretty sure this is some misunderstanding with the working and structure of this particular condition, How can I properly set up these boundary conditions with my vector data?

best regards nanoR4K.

vincentcasseau commented 3 years ago

Hi Lucas,

  1. In boundariesDict, add the suffix Field to the boundaryModel name (as you did already)
  2. Setup your boundaryModel as if it were to be uniform
  3. run dsmcInitialise+
  4. add the volScalarFields boundaryT and/or boundaryU in the 0/ folder. You can create a copy of dsmcSigmaTcRMax, then use the type fixedValue for the patch in question, \<nonuniform> and paste your list.

Please let me know if it works and if you managed to have non-uniform inlet number densities as well (I didn't check the source code). Thanks, Vincent

PS: once it's fixed, I'll improve the website

nanoR4K commented 3 years ago

Good night vincent !

It worked beautifully. All 3 parameters are working as intended (temperature, Ndensity, and velocity).

The temperature was the only "odd" one seeing that the first two temperature vector entries on the wall sum together:

obstacle { type calculated; value uniform (300 300 300); }

This results in a wall temperature of ~600K. Instead of equal temperatures for all entries (rotational, translational, vibrational). Besides that, the only other lesser issue was the symmetry patch condition not working as intended, but that was circumvented with the removal of those boundaries.

I will be including some templates on this thread, so others can use them in case of similar issues.

https://github.com/nanoR4K/dsmcFreeStreamInflowFieldPatch-templates

Thank you very much !

nanoR4K