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

Preventing solving for Uz in axisymmetric cases

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By benham
  • 2 Post By bigphil
  • 1 Post By bigphil
  • 1 Post By Artur

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2008, 08:52
Default Dear fellow users, I am using
  #1
New Member
 
Tammo Wenterodt
Join Date: Mar 2009
Posts: 24
Rep Power: 17
wenterodt is on a distinguished road
Dear fellow users,
I am using simpleFoam for laminar calculations in axisymmetric domains. I set up the cases by the book, i.e.
-wedge shaped domain that straddles x-y-plane with an opening angle of 5deg
-only one cell in z-direction
-wedge BCs for front and back (separate patches)
-empty BC for axis.
The calculations converge beautifully, so far no problem.

BUT even though the axisymmetric problem is a 2d problem and Uz is initialized with 0, the solver tries to solve the system for the z-direction in every iteration. This does not only waste cpu-time, but it imposes an unnecessary error to the solution.

I would be very glad to know the answers to the following questions:
-Is this normal behavior for axisymmetric calculations or did I miss something in the setup?
-Can this be prevented in some way like using "empty" patches in plane 2d calculations?
-Are there naming conventions that have to be obeyed?
-Is it possible to manipulate the solver settings or the "solve(UEqn() == -fvc::grad(p))"-call to achieve this?

Thanks,
Tammo
wenterodt is offline   Reply With Quote

Old   June 17, 2008, 23:47
Default I assume that you have already
  #2
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
I assume that you have already seen a related thread on this issue: http://www.cfd-online.com/OpenFOAM_D...tml?1211878793
msrinath80 is offline   Reply With Quote

Old   June 18, 2008, 10:29
Default Correct me if I am wrong, but
  #3
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Correct me if I am wrong, but isn't the Y-axis your third direction according to this mesh definition?

The following statement seems to indicate the same:

hex (0 1 2 3 0 1 4 5) (10 1 10) simpleGrading (1 1 1)

I don't have the time to go over your setup at this point, but I do get the feeling that you're doing something fundamentally wrong here.
msrinath80 is offline   Reply With Quote

Old   June 18, 2008, 10:32
Default Of course the blocks-line has
  #4
New Member
 
Tammo Wenterodt
Join Date: Mar 2009
Posts: 24
Rep Power: 17
wenterodt is on a distinguished road
Of course the blocks-line has to read like this:

blocks
(
hex (0 1 2 3 0 1 4 5) (10 10 1) simpleGrading (1 1 1)
);

But this does not solve the problem...
wenterodt is offline   Reply With Quote

Old   June 18, 2008, 11:41
Default Hi Tammo, You can use a sim
  #5
New Member
 
Shivasubramanian Gopalakrishnan
Join Date: Mar 2009
Location: Amherst, Massachusetts, USA
Posts: 15
Rep Power: 17
shivasub is on a distinguished road
Hi Tammo,

You can use a simple hack to make the Uz=0. This is how we use it in our code if we are running wedge cases.

// Remove the swirl component of velocity for "wedge" cases
if (piso.found("removeSwirl"))
{
label swirlCmpt(readLabel(piso.lookup("removeSwirl")));

U.field().replace(swirlCmpt, 0.0);
}

regards
Shiva
shivasub is offline   Reply With Quote

Old   June 19, 2008, 04:05
Default Dear Shiva, thank you for you
  #6
New Member
 
Tammo Wenterodt
Join Date: Mar 2009
Posts: 24
Rep Power: 17
wenterodt is on a distinguished road
Dear Shiva,
thank you for your reply! I tried something alike before, but I wasn't aware that it is possible to set Uz=0 with only one line of code...

Setting Uz=0 in every iteration like you proposed does indeed help speeding up the iteration process since the number of iterations for Uz will decrease. However, I would like the solver not to bother about Uz at all since I am dealing with an axisymmetric (i.e. 2d) problem!

Does this hack prevent your solver from solving for Uz? In that case it would be clear that I set up my case wrongly, which would be good news, since that would propably be the easiest to correct...

As Hrvoje Jasak states here:
http://www.cfd-online.com/cgi-bin/Op...0697#POST10697
the "wedge"-BC will cause some transformations, but so far I can see no difference between using "wedge" and "cyclic" BC in an axisymmetric flow from the behavior of the solver.

I am puzzled...

Regards,
Tammo
wenterodt is offline   Reply With Quote

Old   June 19, 2008, 23:02
Default Hi Tammo, yes, the hack pr
  #7
New Member
 
Shivasubramanian Gopalakrishnan
Join Date: Mar 2009
Location: Amherst, Massachusetts, USA
Posts: 15
Rep Power: 17
shivasub is on a distinguished road
Hi Tammo,

yes, the hack provided from our code does not eliminate solving for Uz, it just reduces the number of iterations to something very small.

As Hrv says in his post, wedge is used only when the mesh is only one cell thick in the 3rd dimension, i.e the one face will map back to the opposite face of the same cell. Whilst cyclic will be used for periodic boundaries.

When you say you see no difference between using "wedge" and "cyclic", have you used both for axisymmetric cases and find no difference?

regards
Shiva
shivasub is offline   Reply With Quote

Old   June 20, 2008, 04:24
Default Shiva, I think my statement th
  #8
New Member
 
Tammo Wenterodt
Join Date: Mar 2009
Posts: 24
Rep Power: 17
wenterodt is on a distinguished road
Shiva, I think my statement there was ambigous. What I meant to say was that I can not see why there must be "wedge" type boundary condition at all, at least how it is implemented in OpenFOAM.

From a physical point of view the cyclic bc should be sufficient to model swirl in axisymmetric flows, since all variables must be the same (i.e. can be mapped directly) on the front and on the back of the domain, especially Uz.

Before my first calculations with the wedge bc, I thought it would simplify the problem as to not solve for Uz, thus eliminate any swirl. This would seem reasonable to me (with 1-cell-thickness in z-direction):
-with swirl: cyclic
-without swirl: symmetryPlane
-without swirl (not solve for Uz): wedge

But (and this at last is the answer to your question) OpenFOAM behaves quite differently:
-wedge: models swirl
-symmetryPlane: no swirl, looks ok
-cyclic: gives results that are physically impossible

Still I am wondering if there is a way to model axisymmetric flow without swirl and eliminate the uneccessary solving for Uz in that case...

Regards,
Tammo
wenterodt is offline   Reply With Quote

Old   August 2, 2016, 06:19
Default
  #9
New Member
 
Graham
Join Date: Feb 2016
Posts: 13
Rep Power: 10
benham is on a distinguished road
Hi there,

I am struggling with the same issue: I can't get the "tangential" velocity component to converge when using the wedge boundary type.

It seems from above that the only way to fix it is by forcing the component to vanish at each iteration. (I don't know how to implement this.)

Is there really still no official fix for this?

Best regards,
Graham
catelyn likes this.
benham is offline   Reply With Quote

Old   March 29, 2017, 07:34
Default
  #10
New Member
 
Join Date: Mar 2016
Posts: 7
Rep Power: 10
catelyn is on a distinguished road
Hi everybody,

did anyone solved this issue?

Regards.
catelyn is offline   Reply With Quote

Old   December 5, 2017, 04:59
Default
  #11
New Member
 
Graham
Join Date: Feb 2016
Posts: 13
Rep Power: 10
benham is on a distinguished road
No I never solved the issue. Whenever I use the wedge feature, I just run the solver for as many iterations it takes to get the other components to converge (Ux,Uy,k,epsilon,etc...). This is sort of annoying, but at least it is solving the problem correctly.
benham is offline   Reply With Quote

Old   December 6, 2017, 04:29
Default
  #12
Member
 
Franco Marra
Join Date: Mar 2009
Location: Napoli - Italy
Posts: 70
Rep Power: 17
francescomarra is on a distinguished road
Dear All,

it looks to me that a basic misunderstanding avoids to properly consider the issue. A 2D field means only that, assuming it is 2D in the x,y plane, \partial \phi/\partial z = 0 for any variable \phi. Therefore Uz not equal zero and even varying with x and y are perfectly admissible in a 2D field and need to be resolved. This actually occurs in swirled flows.

I think that the code is correctly programmed to deal with this and that to avoid solving for Uz=0 has to be enforced in some special way, as for instance suggested by Shiva, when the user know from physics that its field has Uz=0 everywhere.

Best regards,

Franco
francescomarra is offline   Reply With Quote

Old   January 9, 2018, 17:50
Default
  #13
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Although not the most elegant, you can disable solving in a particular direction by changing the "solutionD()" vector, which is accessible (as a const reference) from the mesh: for example, you could add the following code to the start of your solver to disable solution in the z direction:
Code:
        Vector<label>& solD = const_cast<Vector<label>&>(mesh.solutionD());

        Info<< "Disabling solution in the z direction" << endl;
        solD[2] = -1;
Of course, you can add some code to determine the wedge direction automagically.

Philip
crubio.abujas and lxufeishi like this.
bigphil is offline   Reply With Quote

Old   January 10, 2018, 08:49
Default
  #14
New Member
 
Graham
Join Date: Feb 2016
Posts: 13
Rep Power: 10
benham is on a distinguished road
Hi Philip,

Thanks for your help. Which file exactly should I put this code at the beginning?

I am using the simpleFoam solver on OF5.0.

Cheers,
Graham
benham is offline   Reply With Quote

Old   January 10, 2018, 09:01
Default
  #15
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by benham View Post
Hi Philip,

Thanks for your help. Which file exactly should I put this code at the beginning?

I am using the simpleFoam solver on OF5.0.

Cheers,
Graham
Hi Graham,

You can add this code just after '# include "createMesh.H"' in the simpleFoam.C file.

You then need to re-compile the solver (I suggest you make a copy of the solver and call it something like mySimpleFoam).

Philip
Artur likes this.
bigphil is offline   Reply With Quote

Old   November 6, 2019, 16:58
Default
  #16
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
Hi All,


Thanks for the pointer Phillip, the modified version of the solver works like a charm, but I also agree with the earlier point by Franco that such arbitrary disabling of the solution direction is better left to the user since in certain cases it's not necessarily correct.


For those who are interested, here's a full example of how I modified the simpleFoam solver to control which direction should be disabled on an axisymmetric grid:


Code:
    #include "createMesh.H"
     // - Added code here. -
    int iNormalDir(-1);
    word normalDirection;
    
    IOdictionary transportPropertiesDict
    (
        IOobject
        (
            "transportProperties",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );
    transportPropertiesDict.lookup("normalDirection") >> normalDirection;
    
    if (normalDirection == "x")
        iNormalDir = 0;
    else if (normalDirection == "y")
        iNormalDir = 1;
    else if (normalDirection == "z")
        iNormalDir = 2;
    else
        FatalErrorIn(args.executable().c_str())
            << "Unknown Cartesian direction " << normalDirection << " attempting to be disabled!"
            << exit(FatalError);

    Vector<label>& solD = const_cast<Vector<label>&>(mesh.solutionD());
    Info << "Disabling solution in the " << normalDirection << " direction" << endl;
    solD[iNormalDir] = -1;
     // ---

I'm still running my benchmark case but it seems to be converging considerably faster judging by the residuals.


Happy foaming,


Artur
2538sukham likes this.
Artur is offline   Reply With Quote

Old   March 18, 2022, 16:05
Default
  #17
New Member
 
Joaquín Aranciaga
Join Date: Oct 2018
Posts: 21
Rep Power: 8
joaran is on a distinguished road
Hi all,


The code provided by Artur makes convergence a charm in just a few iterations. I noticed, though, that the solution is quite different than the one obtained by solving in all directions (and not achieving convergence in the normal velocity). When running a very simple case in OpenFOAM v9 using rhoPimpleFoam, where I add a small energy input through fvModels, I see that energy is conserved perfectly in the non-converged case, but when incorporating the suggested modification (which as I said before converges perfectly) the amount of energy in the domain is greatly increased (i.e. is not conserved at all).



Does anyone have a clue on why this happens?


Best,
Joaquín
joaran 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preventing negative scalar (UDS) values?? Matthew Brannock FLUENT 5 September 1, 2020 13:32
Axisymmetric cases and cavitation solvers in OF 15 marta_colomer OpenFOAM Running, Solving & CFD 1 January 27, 2010 09:34
Icemcfd: Preventing prism inflation collisions? Joe CFX 1 July 31, 2007 10:13
Axisymmetric cases Test with blockmesh and icoFoam frackowi OpenFOAM Running, Solving & CFD 2 July 11, 2007 20:02
Benchmark problems for axisymmetric cases in 2D Malarvizhi Main CFD Forum 4 February 10, 2006 01:20


All times are GMT -4. The time now is 17:27.