CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

problems on dsmc FreeStream Inflow Field Patch setup

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By NanoR4K
  • 1 Post By AlexanderCushen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 23, 2021, 15:59
Post problems on dsmc FreeStream Inflow Field Patch setup
  #1
New Member
 
Lucas Lima
Join Date: Jan 2021
Posts: 2
Rep Power: 0
NanoR4K is on a distinguished road
Good morning, Im perfoming an 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:



Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2016-2021 hyStrath
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of hyStrath, a derivative work of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Class
    dsmcFreeStreamInflowFieldPatch

Description

    Fully deletion boundary patch: atomisticMolecules get deleted instantly upon
    collision with a face on the boundary. (aka vacuum boundary condition)

    Selective deletion of one specie is possible. Other species get
    specularly reflected.

SourceFiles
    dsmcFreeStreamInflowFieldPatch.C


\*---------------------------------------------------------------------------*/

#ifndef dsmcFreeStreamInflowFieldPatch_H
#define dsmcFreeStreamInflowFieldPatch_H

#include "dsmcGeneralBoundary.H"
#include "vector.H"
#include "polyMesh.H"
#include "volFields.H"
#include "dsmcCloud.H"
#include "distribution.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

/*---------------------------------------------------------------------------*\
                           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();

public:

    //- Runtime type information
    TypeName("dsmcFreeStreamInflowFieldPatch");

    // Constructors

        //- Construct from components
        dsmcFreeStreamInflowFieldPatch
        (
            Time& t,
            const polyMesh& mesh,
            dsmcCloud& cloud,
            const dictionary& dict
        );

    // Destructor

        ~dsmcFreeStreamInflowFieldPatch();


    // Member Functions

        void initialConfiguration();

        //- calculate any required properties
        void calculateProperties();

        //- control the mols
        void controlParcelsBeforeMove();
        void controlParcelsBeforeCollisions();
        void controlParcelsAfterCollisions();

        //- output data
        void output
        (
            const fileName& fixedPathName,
            const fileName& timePath
        );

        //- update properties from a modified dictionary
        void updateProperties(const dictionary&);

        //reset fields if mesh has changed
        void setNewBoundaryFields();



        // Access

};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

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

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:

Code:
[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.
and

Code:
--> FOAM FATAL IO ERROR:  [5] attempt to read beyond EOF
How can i properly setup this boundary conditions with my vector data ?

best regards nanoR4K.
R2P3 and AlexanderCushen like this.
NanoR4K is offline   Reply With Quote

Old   July 19, 2022, 11:38
Default
  #2
New Member
 
Alexander Cushen
Join Date: Jul 2022
Posts: 6
Rep Power: 4
AlexanderCushen is on a distinguished road
The usage of dsmcFreeStreamInflowFieldPatch boundary condition is a bit different. To operate it as you intend, I would recommend:

1. Setup your simulation to work normally with dsmcFreeStreamInflowPatch (ie a uniform boundary condition), and I strongly recommend you set the inlet mesh geometry to be a nice uniform square/rectangle.

2. Run your dsmcFreeStreamInflowPatch for a few time steps to generate directories which save the state of the system at a given time (ie "0.00355"). Inside these are a number of files of type "volVectorField" and "volScalarField". We need these as a template to set up the custom boundary conditions.

3. Stop your simulation, and in "boundariesDict" change the boundary type for your inlet patch from "dsmcFreeStreamInflowPatch" to "dsmcFreeStreamInflowFieldPatch" and also replace "dsmcFreeStreamInflowPatchProperties" with "dsmcFreeStreamInflowFieldPatchProperties"; don't change or add anything else in that file except for those names for the patches you want to modify.

4. Now you need to set up the 3 custom boundary condition files in the "0" directory. Using the files generated earlier as a template, create a file named "boundaryT" in the "0" directory which is a volVectorField (by copying in for instance a file from the state directory "0.00355" which corresponds to the velocity of all the cells). When you open this file, change its name next to "object" to "boundaryT". Below that, you will see a couple of large vector lists, one for the internalField, and more below for each other boundary. Go to the vector list corresponding to your inlet patch; each vector (x y z) corresponds to the translational, rotational, vibrational temperature of each cell on that boundary. You can now change the values of each vector to match your desired boundary profile (you might need to play around to see the order that dsmcFoam reads the list onto the 2D boundary). You can ignore the values for the other patches / internalField, as they will be ignored by Foam (although they need to be left there for the syntax to work).

5. Repeat analogously for the velocity profile, by adding a "boundaryU" file to the "0" directory, again using a volVectorField file as a template. Here, each vector (x y z) is just the 3D velocity vector on the boundary patch.

6. Lastly, for number density, you need a volScalarField file, named "boundaryNumberDensity_<species name>" (eg boundaryNumberDensity_O2).

7. All set!
R2P3 likes this.
AlexanderCushen is offline   Reply With Quote

Old   December 17, 2023, 05:03
Default
  #3
New Member
 
lihui
Join Date: Apr 2022
Posts: 7
Rep Power: 4
lihuihh is on a distinguished road
Hello, have you ever encountered a problem with the calculation of automatic stops when running dsmcfoam+? This question has been bothering me.
lihuihh is offline   Reply With Quote

Reply

Tags
boundary condition, dsmcfoam+, vector field, volvectorfield


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
[swak4Foam] swakExpression not writing to log alexfells OpenFOAM Community Contributions 3 March 16, 2020 19:19
[Other] dynamicTopoFVMesh and pointDisplacement RandomUser OpenFOAM Meshing & Mesh Conversion 6 April 26, 2018 08:30
[Commercial meshers] Mesh conversion problem (fluent3DMeshToFoam) Aadhavan OpenFOAM Meshing & Mesh Conversion 2 March 8, 2018 02:47
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51


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