CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Problem while running interFoam with codedFixedValue and dynamicmesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 9, 2021, 00:16
Post Problem while running interFoam with codedFixedValue and dynamicmesh
  #1
New Member
 
Abhishek Mukherjee
Join Date: Sep 2014
Posts: 6
Rep Power: 12
absrocks is on a distinguished road
Hi, I am working on running interfoam simulation (multiphase flow) with custom boundary conditions. The geometry is a rectangular box that is filled with water by 50%. the inlet has a custom velocity boundary condition which is a cosine function of space and time. I am also using dynamicmeshdict which will refine the grid at the free surface.
The problem is when I use each option separately the case works, which means when I used dynamicmesh feature with a fixed velocity at the inlet it works. The same thing happens when I use custom boundary conditions without dynamic mesh. However, when I am using both features, the case breaks immediately.

The condition at leftWall (or inlet) is

Code:
	type            codedFixedValue;
    value           $internalField;

    name pistonvel;
    code
     #{
       const fvPatch& boundaryPatch = patch();
       vectorField& field = *this;
       const scalar t = this->db().time().timeOutputValue();

                     forAll(boundaryPatch, faceI)
	{
	        if (boundaryPatch.Cf()[faceI].z()>=0.0)
                {
                 	field[faceI] = vector((boundaryPatch.Cf([faceI].z()*cos(2*3.14*t),0,0);
                }
                else
                {
                        field[faceI] = vector(0,0,0);
                        }
                }
#};
When I changed the velocity boundary condition to fixedValue such as
Code:
type            fixedValue;

        value           uniform (0.2 0 0.2);
it works perfectly. Also, I have modified the inlet custom boundary condition which (see the 1st code) should give the identical results of fixedValue condition. The leftWall is XZ plane and I modified the condition to

Code:
field[faceI] = vector(0.2,0,0.2);

However, the case fails. The error starts at the 2nd time step.


Code:
Courant Number mean: 0.000835481 max: 0.0119044
Interface Courant Number mean: 0 max: 0
deltaT = 0.000143978
Time = 0.000263978

Selected 6000 cells for refinement out of 55500.
Refined from 55500 to 97500 cells.
Selected 0 split points out of a possible 6000.
#0  Foam::error::printStack(Foam::Ostream&)Segmentation fault (core dumped)

I am wondering whether the inlet takes into account the modified gridpoints,
since I am refining the mesh at the free surface.
I am using the following configuration of dynamicMeshdict.


Quote:
dynamicFvMesh dynamicRefineFvMesh;

dynamicRefineFvMeshCoeffs
{
// How often to refine
refineInterval 1;

// Field to be refinement on
field alpha.water;

// Refine field in between lower..upper
lowerRefineLevel 0.001;
upperRefineLevel 0.999;

// If value < unrefineLevel unrefine
unrefineLevel 10;

// Have slower than 2:1 refinement
nBufferLayers 1;

// Refine cells only up to maxRefinement levels
maxRefinement 2;

// Stop refinement if maxCells reached
maxCells 1000000;

// Flux field and corresponding velocity field. Fluxes on changed
// faces get recalculated by interpolating the velocity. Use 'none'
// on surfaceScalarFields that do not need to be reinterpolated.
correctFluxes
(
(phi none)
(nHatf none)
(rhoPhi none)
(alphaPhi0.water none)
(ghf none)
);

// Write the refinement level as a volScalarField
dumpLevel true;

Any help is appreciated!
absrocks is offline   Reply With Quote

Old   June 14, 2021, 17:55
Default
  #2
New Member
 
Abhishek Mukherjee
Join Date: Sep 2014
Posts: 6
Rep Power: 12
absrocks is on a distinguished road
Hi, anybody have idea?
absrocks is offline   Reply With Quote

Old   June 15, 2021, 06:31
Default
  #3
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 646
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

The one thing that comes to mind is that the fixedValue boundary condition can work with the changing topology of the mesh out of the box. You may need to account for this in your coded condition as well. I would not know how to do this however.

Maybe you could rewrite your boundary condition using the expression syntax?

Have a look at the documentation.

Hope this helps.
Best Regards,
Tom
tomf is offline   Reply With Quote

Old   August 20, 2023, 04:34
Default
  #4
New Member
 
Dengke Li
Join Date: Dec 2022
Posts: 16
Rep Power: 3
Iniesta8 is on a distinguished road
Quote:
Originally Posted by absrocks View Post
Hi, anybody have idea?
Hi,
Have you solved this issue? If so, please give me some suggestion, thanks. I just met this issue recently.
Iniesta8 is offline   Reply With Quote

Old   May 22, 2024, 08:54
Default
  #5
New Member
 
Hendrik Reese
Join Date: May 2024
Posts: 1
Rep Power: 0
hedare is on a distinguished road
I am now also facing the same problem. Either there is some way to load the updated mesh in the code of codedFixedValue, or the cells at the boundary need to be protected from refinement, for which the code of dynamicRefineFvMesh would need to be changed. I would prefer the first solution, however.
hedare is offline   Reply With Quote

Reply


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



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