# Forcing the value of a point in internal Domain to remain fixed.

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
April 16, 2017, 03:10
Forcing the value of a point in internal Domain to remain fixed.
#1
New Member

Mehdi Aminyavari
Join Date: Feb 2016
Location: Milan
Posts: 18
Rep Power: 3
Hello dear Foamers,
I am developing a twophase flow solver where I solve species balance (binary mixture) for both phases; YlEqn and YgEqn.
Lets take the YgEqn as an example:

Code:
```    fvScalarMatrix YgEqn
(
fvm::ddt(alpha2*rho2, yg)
+ fvm::div(rho2Phialpha2, yg, "div(rhoPhiAlpha,yg)")
- fvm::laplacian(alpha2*rho2*Dg, yg)
);

ygEqn.relax();
ygEqn.solve();```
Now if you look at the picture that I attached, there is a line called interface which I can know it's location inside the domain with Alpha (volume fraction).

what I want to do now is to force yg to be equal to ygi (which I calculate from an external function) on the interface. so basically it is like a fixed value boundary condition, but inside the domain and not on the boundary.
the good point is that I know where inside the domain and which cell, but I am not sure how I should force it's value to remain constant and not be affected by the other cells.

Any hint would be really appreciated.
Attached Images
 InterfaceY.jpg (79.0 KB, 12 views)

 April 16, 2017, 07:13 #2 Senior Member     Sergei Join Date: Dec 2009 Posts: 183 Rep Power: 10 Possibly, ExplicitSetValue is what you need. Code: ```fvScalarMatrix YgEqn ( fvm::ddt(alpha2*rho2, yg) + fvm::div(rho2Phialpha2, yg, "div(rhoPhiAlpha,yg)") - fvm::laplacian(alpha2*rho2*Dg, yg) == fvOptions(rho, yg) ); fvOptions.constrain(YgEqn); ygEqn.relax(); ygEqn.solve();``` Then add fvOptions file with an entry of type ExplicitSetValue to your case (search on the forum to learn how to use it and ask here if need more info).

April 17, 2017, 05:09
#3
New Member

Mehdi Aminyavari
Join Date: Feb 2016
Location: Milan
Posts: 18
Rep Power: 3
Quote:
 Originally Posted by Zeppo Possibly, ExplicitSetValue is what you need. Code: ```fvScalarMatrix YgEqn ( fvm::ddt(alpha2*rho2, yg) + fvm::div(rho2Phialpha2, yg, "div(rhoPhiAlpha,yg)") - fvm::laplacian(alpha2*rho2*Dg, yg) == fvOptions(rho, yg) ); fvOptions.constrain(YgEqn); ygEqn.relax(); ygEqn.solve();``` Then add fvOptions file with an entry of type ExplicitSetValue to your case (search on the forum to learn how to use it and ask here if need more info).
hello Zeppo,
Thank you so much for your reply, I actually thought of that at the beginning, but the point is that these values of Ygi are a function of P and T and I solve also energy equation and these values should get updated on runtime after energy equation is solved in each timestep.
Yg[celli]=Function_Ygi(T[celli],p[celli])
where celli is the index of the cells where there is interface.
So I need to force the values of Yg to be Ygi from the solver.
Can you think of any way to revise the YgEgn in the solver to do that?

Once again I really appreciate your help.
Happy Easter

 April 18, 2017, 13:42 How about this? #4 New Member   Mehdi Aminyavari Join Date: Feb 2016 Location: Milan Posts: 18 Rep Power: 3 I figured out something but I am not sure if it is correct or not, I read on another post that this should work like this by using "setValues": Code: ``` fvScalarMatrix ygEqn ( fvm::ddt(alpha2*rho2, yg) + fvm::div(rho2Phialpha2, yg, "div(rhoPhiAlpha,yg)") - fvm::laplacian(alpha2*rho2*Dg, yg) ); forAll(alpha2,celli){ if ( alpha2[celli] != 0 && alpha2[celli] != 1) { label ref = celli; labelList refCells (1,ref); scalarField refValues (1, ygi[celli]); ygEqn.setValues(refCells, refValues); } } ygEqn.relax(); ygEqn.solve();``` but when I do this and I print the values of yg and ygi of the interface cells as following, they are not equal. Any idea what am I doing wrong? Code: ```forAll(alpha2,celli){ Info << " alpha2 = " << alpha2[celli] << " yg = " << yg[celli] << " =? ygi = " << ygi[celli] << endl; }```

 April 21, 2017, 15:23 #5 Senior Member     Sergei Join Date: Dec 2009 Posts: 183 Rep Power: 10 What is the code between the snippets from your latest post? ygi might somehow be modified there or something?

April 22, 2017, 09:45
#6
New Member

Mehdi Aminyavari
Join Date: Feb 2016
Location: Milan
Posts: 18
Rep Power: 3
Quote:
 Originally Posted by Zeppo What is the code between the snippets from your latest post? ygi might somehow be modified there or something?
Dear Zeppo, Thank you for your reply, Actually the problem was with a source term that I had on the same cell, When I cancelled the source term, setValue was working perfectly.
Thank you so much

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post volleyHC CFX 5 April 3, 2016 05:41 darazsbence CFX 17 October 6, 2015 10:38 Saima CFX 45 September 22, 2015 10:53 Ahmed Saeed CFX 1 November 20, 2013 10:32 Chie Min CFX 5 July 12, 2001 23:19

All times are GMT -4. The time now is 22:56.

 Contact Us - CFD Online - Top