CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

How to adjust the velocity field during the CFX solver running?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2019, 09:55
Default How to adjust the velocity field during the CFX solver running?
  #1
New Member
 
tang lei
Join Date: Jan 2019
Location: Shenzhen China
Posts: 15
Rep Power: 7
tangleiplus is on a distinguished road
Hello everyone.
Recently I am simulating a case discribed as follows, (of course, I did some simplification)
I got a cylinder pipe here, it has an inlet, an outlet and a wall.
The temperature of the wall and the temperature of the inlet are constants.
And I am going to solve the temperature field of the fluid inside the pipe.(we got only fluid domain here.)
while solving this problem, I am not going to solve the momentum equation of x,y,z direction, I disable the momentum equation solving by adjust the "expert parameter". Because I write the analytic solution to the initial file by CEL. So the CFX just solve the energy equation with the given velocity field.
OK, now, the problem is coming.
This is a trasient case, during the CFX solver running, I wanna adjust the velocity field according to the volume average temperature of the fluid. For example, I want to increase the velocity and write another velocity field instead of the initial one when the tenperature reachs a certain point. how can I realize this?
Thank you all and best regards.
tangleiplus is offline   Reply With Quote

Old   January 16, 2019, 18:15
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
You could stop and restart, writing a new velocity field as initial condition on the restart. Take all other variables from the previous simulation as an initial condition.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   January 16, 2019, 18:48
Default
  #3
Senior Member
 
Join Date: Jun 2009
Posts: 1,880
Rep Power: 33
Opaque will become famous soon enough
This approach is conducive to a lot of subtle problems that will be difficult to diagnose later on.

Using a user-defined velocity field w/o solving the momentum+continuity equation is extremely dangerous since you MUST be certain it satisfy the continuity equation in discrete form for the given mesh; otherwise, there will be numerical sinks/sources due to the discretization coming from the discretization of the advection term in the energy equation.

Numerical sinks/sources can produce unpredictable temperature variations very difficult to pinpoint.

In addition, freezing the solution of the continuity+momentum equation in a transient problem can only be done for a case with constant properties and w/o temperature dependencies. Otherwise, the problem will come from a different angle.

What is your primary goal here?
Opaque is offline   Reply With Quote

Old   January 16, 2019, 19:34
Default
  #4
New Member
 
tang lei
Join Date: Jan 2019
Location: Shenzhen China
Posts: 15
Rep Power: 7
tangleiplus is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
You could stop and restart, writing a new velocity field as initial condition on the restart. Take all other variables from the previous simulation as an initial condition.
Thank you ghorrocks.
The solution you mentioned is realizable, But the problem is that, there is a lot of swicthes(velocity field changing) should be done during the whole trasient case, I can not stop the solve every time the velocity field needs to be change.
Do you have a better way to deal this problem automatically?
tangleiplus is offline   Reply With Quote

Old   January 16, 2019, 19:41
Default
  #5
New Member
 
tang lei
Join Date: Jan 2019
Location: Shenzhen China
Posts: 15
Rep Power: 7
tangleiplus is on a distinguished road
Quote:
Originally Posted by Opaque View Post
This approach is conducive to a lot of subtle problems that will be difficult to diagnose later on.

Using a user-defined velocity field w/o solving the momentum+continuity equation is extremely dangerous since you MUST be certain it satisfy the continuity equation in discrete form for the given mesh; otherwise, there will be numerical sinks/sources due to the discretization coming from the discretization of the advection term in the energy equation.

Numerical sinks/sources can produce unpredictable temperature variations very difficult to pinpoint.

In addition, freezing the solution of the continuity+momentum equation in a transient problem can only be done for a case with constant properties and w/o temperature dependencies. Otherwise, the problem will come from a different angle.

What is your primary goal here?
Thank you Opaque.
The rubust of the program is robust, I already did some test of the solution with some steady state simulation, I compared the solution of CFX FLUENT and my oven code. the result is coincident.
And for a triansient case. The velocity switch only cost 1 or 2 seconds. but the whole case lasts for half an hour, so I do not care about the numercial error during the swithing time.
tangleiplus is offline   Reply With Quote

Old   January 16, 2019, 20:31
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
It is simple to implement a stop/restart. It can be scripted so it all happens automatically, and it very simple to do. I would not dismiss it.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   January 16, 2019, 21:13
Default
  #7
New Member
 
tang lei
Join Date: Jan 2019
Location: Shenzhen China
Posts: 15
Rep Power: 7
tangleiplus is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
It is simple to implement a stop/restart. It can be scripted so it all happens automatically, and it very simple to do. I would not dismiss it.
Thanks again. Could you please tell me more about how to do this by compile a script. It my take times to tell the whole story. But Could you please give some brief guidance. I have been trapped here for a long time. Thank you for your time,Sir.
tangleiplus is offline   Reply With Quote

Old   January 16, 2019, 23:01
Default
  #8
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Look up running CFX from the command line. Your script will be something like:

cfx5solve -def DefinitionFile1.def
cfx5solve -def DefinitionFile2.def -initial DefinitionFile1_001.res
cfx5solve -def DefinitionFile3.def -initial DefinitionFile2_001.res
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   January 21, 2019, 10:30
Default
  #9
New Member
 
tang lei
Join Date: Jan 2019
Location: Shenzhen China
Posts: 15
Rep Power: 7
tangleiplus is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
Look up running CFX from the command line. Your script will be something like:

cfx5solve -def DefinitionFile1.def
cfx5solve -def DefinitionFile2.def -initial DefinitionFile1_001.res
cfx5solve -def DefinitionFile3.def -initial DefinitionFile2_001.res
I am still confused about how to do it. but thank you very much Sir.
tangleiplus is offline   Reply With Quote

Old   January 22, 2019, 05:12
Default
  #10
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,928
Rep Power: 28
Gert-Jan will become famous soon enough
Look at this thread:


Workbench And HPC Cluster
Gert-Jan is offline   Reply With Quote

Old   January 22, 2019, 05:40
Default
  #11
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,928
Rep Power: 28
Gert-Jan will become famous soon enough
In CFX-Pre (Outside Workbench), you should make a lot definition files with several profiles.

Then you should write a script (textfile) with the following content:
cfx5solve -def profile1.def
cfx5solve -def profile2.def
cfx5solve -def profile3.def
cfx5solve -def profile4.def

This results in 4 result files with 4 different profiles.
If you want to use an initial guess at the start of the calculation, do what Glenn suggested and add an initial guess:
cfx5solve -def profile4.def -ini profile3_001.res

In principle it is not necessary to write multiple def-files. You can also just modify the settings outside CFX-Pre using a .ccl-file (just copy the contents from a output file) and use this in the script file (see link given before). So, if you can manage to write your profile in simple text, you can get away with:

cfx5solve -def profile1.def -ccl profile4.ccl

Good Luck, Gert-Jan
Gert-Jan is offline   Reply With Quote

Old   January 22, 2019, 09:29
Default
  #12
New Member
 
tang lei
Join Date: Jan 2019
Location: Shenzhen China
Posts: 15
Rep Power: 7
tangleiplus is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
In CFX-Pre (Outside Workbench), you should make a lot definition files with several profiles.

Then you should write a script (textfile) with the following content:
cfx5solve -def profile1.def
cfx5solve -def profile2.def
cfx5solve -def profile3.def
cfx5solve -def profile4.def

This results in 4 result files with 4 different profiles.
If you want to use an initial guess at the start of the calculation, do what Glenn suggested and add an initial guess:
cfx5solve -def profile4.def -ini profile3_001.res

In principle it is not necessary to write multiple def-files. You can also just modify the settings outside CFX-Pre using a .ccl-file (just copy the contents from a output file) and use this in the script file (see link given before). So, if you can manage to write your profile in simple text, you can get away with:

cfx5solve -def profile1.def -ccl profile4.ccl

Good Luck, Gert-Jan
Thank you Gert-Jan, I think I got your point. But I still confused about the "script" thing. I have never written a script, How to write a script? Can I find the answear in this part of HELP," Using ANSYS Workbench Journaling and Scripting with ANSYS CFX"?
And an other thing is, I only want to change the velocity field of the fluid domain, and remain the temperature field . If the script file changs .def file during the running. Will the solver overwrite the temprature field with a initial value?

Thanks and regards
Tang Lei
tangleiplus is offline   Reply With Quote

Old   January 22, 2019, 10:08
Default
  #13
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,928
Rep Power: 28
Gert-Jan will become famous soon enough
Follow the link I send before. Alternatively take this one:
Workbench And HPC Cluster

So, learn to use CFX outside Workbench. Open the CFX-launcher and open a Command line the directory where your def-files are. This works like the good-old MS DOS.

A script sound very cryptic. It is not. It is nothing more than plain text. So:
- open a text editor (notepad)
- copy the command lines with cfx5solve (see query here above) into the text.
- Save the text as run.bat (or a.bat, or whatsoever.bat, or itdoesnotmatter.bat) in the directory where your def-files are.

Then in the command line type 'run' (or a, or whatsoever, or itdoesnotmatter) and off you go.

Now your calculation runs in the background. If you want to monitor it, open the solver manager from the Launcher and select "monitor run in Progress".
Gert-Jan is offline   Reply With Quote

Old   January 22, 2019, 10:14
Default
  #14
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,928
Rep Power: 28
Gert-Jan will become famous soon enough
Regarding the initialisation......
When changing the profile, do you run from a def file only or do you use a previous results-file as initial guess?
Gert-Jan is offline   Reply With Quote

Old   January 22, 2019, 10:31
Default
  #15
New Member
 
tang lei
Join Date: Jan 2019
Location: Shenzhen China
Posts: 15
Rep Power: 7
tangleiplus is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
Follow the link I send before. Alternatively take this one:
Workbench And HPC Cluster

So, learn to use CFX outside Workbench. Open the CFX-launcher and open a Command line the directory where your def-files are. This works like the good-old MS DOS.

A script sound very cryptic. It is not. It is nothing more than plain text. So:
- open a text editor (notepad)
- copy the command lines with cfx5solve (see query here above) into the text.
- Save the text as run.bat (or a.bat, or whatsoever.bat, or itdoesnotmatter.bat) in the directory where your def-files are.

Then in the command line type 'run' (or a, or whatsoever, or itdoesnotmatter) and off you go.

Now your calculation runs in the background. If you want to monitor it, open the solver manager from the Launcher and select "monitor run in Progress".
Ok Thank you very much.
I will try, and could you please give an answer about the other question I mentioned. Will CFX change all the physical field when I load another .def file?
thanks again.
tangleiplus is offline   Reply With Quote

Old   January 22, 2019, 10:47
Default
  #16
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,928
Rep Power: 28
Gert-Jan will become famous soon enough
I already did, see thread #14.
Gert-Jan is offline   Reply With Quote

Old   January 22, 2019, 11:21
Default
  #17
New Member
 
tang lei
Join Date: Jan 2019
Location: Shenzhen China
Posts: 15
Rep Power: 7
tangleiplus is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
I already did, see thread #14.
Actually I just want to adjust the velocity field during the running.
First, the momentum equation has been disabled. The solver only use the given velocity to deal with the energy equation.
After 10 time steps, I want to adjust the velocity field (for example,set u=0,v=0,w=0),
Such as pump on and pump off.
So what I want is
step1:I give a initial field.(pumo on)
step2:End the solution automatically when the pump should be shut down
step3:Change the velocity field(velocity=0) but remain the Temperature field, then continue calculating.
tangleiplus is offline   Reply With Quote

Old   January 22, 2019, 12:42
Default
  #18
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,928
Rep Power: 28
Gert-Jan will become famous soon enough
Like Glen already told, it is not possible to do this during the running, of a single run.
But is possible in a batch of multiple sequential runs, like I explained.
Step 1: just do what you always do.
Step 2: This run stops if the end time is reached (or you stop it manually beforehand)
Step 3: Start with a def file and take the results file as initial guess. In the def file you should set the Initial velocity files to "Value" (not "Automatic", or "Automatic with value"), and keep "solve fluids =f". Keep temperature to automatic to pick up the initial guess from the results file.
Gert-Jan is offline   Reply With Quote

Reply

Tags
i/o solver


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
Unsteady field advected by steady velocity field t.oliveira OpenFOAM Running, Solving & CFD 2 December 28, 2015 14:42
new workstation for running 5 Million size mesh on CFX with rigid body solver aks Hardware 5 August 20, 2013 08:12
Inlet Velocity in CFX aeroman CFX 12 August 6, 2009 19:42
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 03:15
Predefined velocity field implementation CFX 5.7 Matjaz CFX 3 September 13, 2004 08:26


All times are GMT -4. The time now is 01:25.