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

conditional solving of transport equation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 20, 2012, 09:41
Default conditional solving of transport equation
  #1
dzi
Member
 
Join Date: Nov 2011
Location: Berlin
Posts: 31
Rep Power: 5
dzi is on a distinguished road
hi people,
I would like to set up a solver for a solidification process with solving a transport equation for a species only in the liquid phase of the sytem.
There is a volScalarField alpha which defines the state of phase (0<alpha<1). alpha is the liquid fraction, alpha = 0 -> complete solid.

How can I define a solver which works only in the non solid part of the domain like:

// definition of eq.
{liqEqn = ....}
// conditional solving of liqEqn
if (alpha != 0) liqEqn.solve();

Is there somewhere a similar case/tutorial/documentation reference?
thank you for advice,
dzi

(I use OF 2.01)
dzi is offline   Reply With Quote

Old   January 22, 2012, 14:10
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
It is very difficult to only use portions of the mesh for the matrix solution in OpenFOAM. You'd probably have to create a new temporary mesh, and create new variables on it - then you'd have to create new boundaries where it is cut-off... Rather than that, you probably want to work with the full mesh, and modify the matrix so that the portion from the solid cells reduce to a trivial equation.

I'm thinking you could create a custom preconditioner for your matrix. I don't know exactly what you want to do to the matrix to achieve this, though.
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   January 23, 2012, 04:35
Default
  #3
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
I think the easiest solution is to multiply all terms in the equation with alpha.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   January 24, 2012, 11:51
Default
  #4
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by dzi View Post
hi people,
I would like to set up a solver for a solidification process with solving a transport equation for a species only in the liquid phase of the sytem.
There is a volScalarField alpha which defines the state of phase (0<alpha<1). alpha is the liquid fraction, alpha = 0 -> complete solid.

How can I define a solver which works only in the non solid part of the domain like:

// definition of eq.
{liqEqn = ....}
// conditional solving of liqEqn
if (alpha != 0) liqEqn.solve();

Is there somewhere a similar case/tutorial/documentation reference?
thank you for advice,
dzi

(I use OF 2.01)
You can simply define a flag in this way:

volScalarField solveEq(pos(alpha-alphaCutOff));
volScalarField doNotEq(1-solveEq);

which is 1 when alpha > alphaCutOff, and 0 elsewhere. Then there are two possible solutions, depending on what you are trying to do (momentum equation or scalar equation?)

- Momentum equation:

Code:
fvMatrix UEqn
(
   solveAlpha*
   (
       //Put your equation here
   )+
   doNotSolve*
   (
       fvm::Sp(coeff,yourVariable)   // Set the variable to zero or to a value here
   )
);
- Scalar equations: you can use what done above, or drop elements from the matrix and fix the value of the solution directly using
Code:
myEqn.setValues(...)
See for example OpenFOAM/OpenFOAM-2.1.x/applications/solvers/multiphase/bubbleFoam/wallDissipation.H for an example.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   January 25, 2012, 04:47
Default
  #5
dzi
Member
 
Join Date: Nov 2011
Location: Berlin
Posts: 31
Rep Power: 5
dzi is on a distinguished road
thank you for the replies,
for me the easiest solution is the suggestion from akidess to multiply all, or parts of the equation with alpha. Looks like it can be solved and I get something out which makes sense.

The other suggestions also sound interesting. I will try if I come to a limit with the first solution, but on the first glance they seem to be more sophisticated.

Thank you again for helping on this topic!
dzi
dzi is offline   Reply With Quote

Old   January 25, 2012, 11:19
Default
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by dzi View Post
thank you for the replies,
for me the easiest solution is the suggestion from akidess to multiply all, or parts of the equation with alpha. Looks like it can be solved and I get something out which makes sense.
This depends on what you are solving for, but in general, multiplying by zero both sides of the equation without doing anything else will introduce a (0 = 0) equation and make the linear system singular.

If you are solving the momentum equation, you will also have to deal with the problem of the central coefficient going to zero, which will lead to a segmentation fault when you calculate H/A. You can check how this problem is addressed in compressibleTwoPhaseEulerFoam.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   January 30, 2013, 02:57
Default Solidification in OpenFOAM
  #7
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
Hi
I am solving a binary alloy solidification problem with OpenFOAM. For the species equation, which seems to be the most critical equation especially at the region where channels form, I have used zero grad boundary conditions; which causes a flow into the wall. Have you guys also used grad(CL) = 0, and grad(C) = 0 at the boundaries?
hawkeye321 is offline   Reply With Quote

Reply

Tags
conditional, solidification, solving

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
transsonic nozzle with rhoSimpleFoam Unseen OpenFOAM Running, Solving & CFD 7 April 16, 2014 03:38
SimpleFoam k and epsilon bounded nedved OpenFOAM Running, Solving & CFD 13 November 4, 2013 15:13
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 9 January 3, 2012 09:06
Low Mach number Compressible jet flow using LES ankgupta8um OpenFOAM Running, Solving & CFD 7 January 15, 2011 14:38
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 23:02.