|
[Sponsors] |
March 2, 2023, 14:04 |
Patching a solution in CFX
|
#1 |
New Member
Join Date: Dec 2009
Posts: 8
Rep Power: 16 |
Dear all,
I have computed in CFX a developed multiphase flow in a pipe with multiple lateral inlets. Now I would like to define a region where one phase has volume fraction = 1 and start a simulation with the previous solution in all the domain except this region. In CFX I cannot patch the region in the solver manager (as I would in Fluent), and I do not find how I could initialize the domain with a previous solution in CFX-Pre in order to patch a region. Thank you for any help! |
|
March 2, 2023, 18:12 |
|
#2 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,854
Rep Power: 144 |
I cannot think of a nice way of doing this.
The best I can think of is to start a new run with all the solvers turned off except the multiphase one, with a source term used to set the region you want to VF=1 using if() statements and other functions to define the region. Run this for 1 iteration, and then use this as the initial condition for your actual simulation. This is a pretty yukky way of doing it, hopefully somebody can come up with something better.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
March 3, 2023, 13:42 |
|
#3 |
New Member
Join Date: Dec 2009
Posts: 8
Rep Power: 16 |
Thank you, Glenn, it seems indeed a possible way.
I can initialize a region with VF = 1 (for example, if x<10[m]...). But this initialization will be ignored if I start the run with my old solution. Is there a way to define a region in CFX-Pre for the new VF source terms, or is it imperative to do it in Meshing? |
|
March 3, 2023, 17:06 |
|
#4 |
Senior Member
Join Date: Jun 2009
Posts: 1,873
Rep Power: 33 |
Please read the documentation on how to access/patch existing regions using Ansys CFX.
You can always filter out a named mesh region using the inside()@Mesh Region Name using CEL expressions MyFluidisHere = inside()@Domain 1 MyFluidisNotHere = (1 - inside()@Domain 1) It is valid for 2D, and 3D volumes, Domains, Boundaries, SubVolumes, Subdomains. That is one part of your question, correct? Now the second part, how to overwrite an existing field in a given results file: 1 - You can do that in CFD-Post, check it out by looking at the Variables tab, double-click on the variable of interest and see the option to override the field. 2 - There is an option in Initialization panel to ignore a provided value. It seems was removed several releases ago because some confusion. You can create your initialization as usual using Automatic with Value. Right click on the initialization entry in the outline and select Edit in Command Editor, and remove the wording "Automatic with", and leave it as "Option = Value". It should work either way.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
March 8, 2023, 07:10 |
|
#5 |
New Member
Join Date: Dec 2009
Posts: 8
Rep Power: 16 |
Thank you. Opaque. I was able to overwrite the variable in the CFD-Post with your option 1 -, and contours show VF = 1 (or 0 for the other phase) where I want. But I am not able to overwrite the .res file (there is no such option as "save as..." or a warning, "Do you want to overwrite this .res file?". When I initialize the run with this file, with the VF overwritten in CFD-Post, the volume fraction in the solution is the old one. The changes I introduced (and see) in CFD-Post are totally ignored in the run. They appear in CFD-Post, but seem not to affect the initialization file, which is the same res.file!
Am I missing a crucial step? Thank you very much! |
|
March 8, 2023, 11:37 |
|
#6 |
Senior Member
Join Date: Jun 2009
Posts: 1,873
Rep Power: 33 |
Something is off.
I just took a results file, checked the creation date, opened it in CFD-Post, write a new expression for it (in the Variables tab), and check the creation date again. The file had been overwritten, and the size has increased. My understanding is the file contains the old data (renamed internally for restoring if request it), and the new data field with the recent values. Closed CFD-Post, reloaded the file, and expression values are there. The solver reads the new values as well.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
March 8, 2023, 14:19 |
|
#7 |
New Member
Join Date: Dec 2009
Posts: 8
Rep Power: 16 |
Maybe my new variable is not well defined. In order not to modify the existing solution for x > 40 m, I tried to overwrite Liquid.Volume Fraction with a variable LiqVFini defined as
if(x<40[m], 1, Liquid.Volume Fraction). A similar variable GasVFini is defined with value 0 for the gas volume fraction at x<40[m] and Gas.Volume Fraction above. When I see a VF contour, it is exactly what I want: below x = 40 m I have 0 gas, 1 liquid, and the computed values above x = 40. The .res file is saved with the actual creation date. In the CFD Post, when the res. file is loaded, I see the new data. But still, whe I take this file as initial values for the run, the solver takes the old solution. Maybe the self-referential variable definition is not adequate. Is there a better option to overwrite only a portion of the domain? A way to say "if the "if" logical statement is false, do nothing"? Or I am missing something else. In any case, I am learnig with your suggestions, so thank you very much! |
|
March 9, 2023, 04:24 |
|
#8 |
Senior Member
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,913
Rep Power: 28 |
Never tried this, but this might work......
From the CFX-launcher, you can open a command line from the Tools menu in the top ribbon. There type cfx5interp -help|more You will see commands to interpolate results on a definition file. You can read that it is possible to interpolate results fom multiple results files. Now take a clean definition file with two domains, and interpolate your initial results file and add a second results file on solely the domain where you want your solution to be changed. Here, I assume that when using 2 results file in the interpolation, the second interpolation overwrites the first one. But I'm not sure. As mentioned, I never tried You should of course first create the results file on the smaller domain with your changed volume fraction. Create that in a separate simulation with a tiny timestep and 1 iteration, provided you want all other variables to be around zero. The interpolation will provide a definition file with an initial guess (the file size has increased) from which you can start your simulation. Also from the CFX-launcher (forget Workbench). Be aware that in the domain with replaced results, all other variables have also changed, not solely the volume fraction. But I expect that is as intended. If not, then I really wonder what you are modelling, since it would be unrealistic. I cannot imagine a process where in a split second the volume fraction has changed without changing the rest. |
|
March 9, 2023, 11:38 |
|
#9 |
New Member
Join Date: Dec 2009
Posts: 8
Rep Power: 16 |
I did it! :-) Thanks a lot to you all!
I followed the path suggested by Opaque: overwrite with an expression the Volume Fraction of liquid and gas. The step I was missing was to overwrite not only the variables Liquid.Volume Fraction and Gas.Volume Fraction, but also their Conservative Volume Fractions (by the way, what is their difference?) and Conservative Volume Fraction Beta. Now it is running just as I wanted. In reply to Gert-Jan, I am modeling a gas well, where a mixture of oil and gas enters from lateral inlets. I need to study the flow for different levels of accumulated liquid at the bottom. Since the problem involves the multiphase flow of a compressible gas/liquid mixture, convergence takes considerable time. Therefore I thought to start each simulation from a developed solution, changing only the initial liquid level. I hope this will make convergence faster. Thank you very much again for answering so quickly and sharing your knowledge in this forum. |
|
Tags |
cfx, initializing, multiphase flow, patch by zone |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ofgpu v1.1: GPU Linear Solvers for OpenFOAM Released | gocarts | OpenFOAM Announcements from Other Sources | 4 | March 8, 2019 12:21 |
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch | gschaider | OpenFOAM Installation | 225 | August 25, 2015 20:43 |
patch error OF v2.2.2 mac | hewei | OpenFOAM Installation | 4 | November 30, 2013 17:55 |
2.0.x on Mac OSX | niklas | OpenFOAM Installation | 74 | March 28, 2012 17:46 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |