|
[Sponsors] |
Dynamic Mesh Refinement - Sizes of two fields differ |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 4, 2013, 11:54 |
Dynamic Mesh Refinement - Sizes of two fields differ
|
#1 |
Member
Nicklas Linder
Join Date: Jul 2012
Location: Germany
Posts: 35
Rep Power: 14 |
Hi Foamers,
I am using (a modified) interDyMFoam solver. After all the meshMovement stuff, or just before "twoPhaseProperties.correct();" is called, I make some calculations. One of them is Code:
scalarField Ca = mag(mup)*mag(uwall)/sigma; Code:
scalarField mup = mu.boundaryField()[wallPatchID]; Code:
vectorField Uwall = U.boundaryField()[wallPatchID]; This works fine without dynamic mesh refinement. When I do the same calculation with dynamic mesh refinement, the size of the fields differ if the mesh is refined. Or more precisely: The size of uwall relates to the refined mesh, mu remains unchanged. Mu is created in createFields.H as Code:
volScalarField mu ( IOobject ( "mu", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT ), twoPhaseProperties.mu() ); Thanks for any hints! Greetings Nicklas |
|
February 8, 2019, 06:56 |
|
#2 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
Hi
I have similar problem after mesh refinement one of the field is unchanged Code:
--> FOAM FATAL ERROR: index 10240 out of range 0 ... 10239 From function void Foam::UList<T>::checkIndex(Foam::label) const [with T = double; Foam::label = int] in file /home/przemek/OpenFOAM/OpenFOAM-v1612+/src/OpenFOAM/lnInclude/UListI.H at line 106. FOAM aborting Code:
volVectorField gradAlpha(fvc::grad(smoothAlpha_)); Code:
Foam::smoothInterfaceProperties::smoothInterfaceProperties ( const volScalarField& alpha1, const volVectorField& U, const IOdictionary& dict ) : transportPropertiesDict_(dict), cAlpha_ ( readScalar ( alpha1.mesh().solverDict(alpha1.name()).lookup("cAlpha") ) ), smoothItr_ ( readScalar ( alpha1.mesh().solutionDict().subDict("PIMPLE").lookup("smoothItr") ) ), kSmoothItr_ ( readScalar ( alpha1.mesh().solutionDict().subDict("PIMPLE").lookup("kSmoothItr") ) ), sigma_("sigma", dimensionSet(1, 0, -2, 0, 0), dict), deltaN_ ( "deltaN", 1e-8/pow(average(alpha1.mesh().V()), 1.0/3.0) ), smoothAlpha_(alpha1), alpha1_(alpha1), U_(U), nHatf_ ( IOobject ( "nHatf", alpha1_.time().timeName(), alpha1_.mesh() ), alpha1_.mesh(), dimensionedScalar("nHatf", dimArea, 0.0) ), K_ ( IOobject ( "smoothInterfaceProperties:K", alpha1_.time().timeName(), alpha1_.mesh() ), alpha1_.mesh(), dimensionedScalar("K", dimless/dimLength, 0.0) ) { calculateK(); } Code:
class smoothInterfaceProperties { // Private data //- Keep a reference to the transportProperties dictionary const dictionary& transportPropertiesDict_; //- Compression coefficient scalar cAlpha_; // iteration numbers over smooth function scalar smoothItr_; // iteration numbers over smooth function for curvature, 0 represent no smooth scalar kSmoothItr_; //- Surface tension dimensionedScalar sigma_; //- Stabilisation for normalisation of the interface normal const dimensionedScalar deltaN_; volScalarField smoothAlpha_; const volScalarField& alpha1_; const volVectorField& U_; surfaceScalarField nHatf_; volScalarField K_; // Private Member Functions //- Disallow default bitwise copy construct and assignment smoothInterfaceProperties(const smoothInterfaceProperties&); void operator=(const smoothInterfaceProperties&); //- Correction for the boundary condition on the unit normal nHat on // walls to produce the correct contact dynamic angle // calculated from the component of U parallel to the wall void correctContactAngle ( surfaceVectorField::Boundary& nHat, surfaceVectorField::Boundary& gradAlphaf ) const; //- Re-calculate the interface curvature void calculateK(); public: //- Conversion factor for degrees into radians static const scalar convertToRad; // Constructors //- Construct from volume fraction field gamma and IOdictionary smoothInterfaceProperties ( const volScalarField& alpha1, const volVectorField& U, const IOdictionary& ); // Member Functions scalar cAlpha() const { return cAlpha_; } const dimensionedScalar& deltaN() const { return deltaN_; } const surfaceScalarField& nHatf() const { return nHatf_; } const volScalarField& K() const { return K_; } const volScalarField& smoothAlpha() const { return smoothAlpha_; } const dimensionedScalar& sigma() const { return sigma_; } tmp<volScalarField> sigmaK() const { return sigma_*K_; } tmp<surfaceScalarField> surfaceTensionForce() const; //- Indicator of the proximity of the interface // Field values are 1 near and 0 away for the interface. tmp<volScalarField> nearInterface() const; void correct() { calculateK(); } //- Read transportProperties dictionary bool read(); }; Code:
volVectorField gradAlpha(fvc::grad(alpha1_)); Code:
volVectorField gradAlpha(fvc::grad(smoothAlpha_));
__________________
best regards pblasiak Last edited by gaza; February 8, 2019 at 11:23. |
|
February 8, 2019, 07:54 |
|
#3 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
I checked the size of smoothAlpha_ and it is updated
so what is wrong?
__________________
best regards pblasiak |
|
February 8, 2019, 08:57 |
|
#4 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
I do not understand the difference between smoothAlpha_ and alpha1_
why with alpha1_ works and with smoothAlpha_ does not?
__________________
best regards pblasiak Last edited by gaza; February 8, 2019 at 12:05. |
|
February 9, 2019, 08:08 |
|
#5 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
OK I found solution
I had to change constructor I do not know why the previous version did not work Code:
... alpha1_(alpha1), smoothAlpha_ ( IOobject ( "smoothAlpha", alpha1_.time().timeName(), alpha1_.mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), alpha1_.mesh(), dimensionedScalar("smoothAlpha", dimless, 0.0) ), ...
__________________
best regards pblasiak |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
Dynamic mesh, interDymFoam : refinement on 2 fields | tek_cfd | OpenFOAM Pre-Processing | 1 | May 30, 2013 04:07 |
How to know mesh size after dynamic refinement | tayo | OpenFOAM | 16 | May 22, 2013 14:39 |
[snappyHexMesh] Adding layers goes wrong with SnappyHexMesh | Elise | OpenFOAM Meshing & Mesh Conversion | 1 | April 22, 2013 03:32 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 20:43 |