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

Run each simulation based on initial condition of previous run results

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 9, 2015, 01:55
Default Run each simulation based on initial condition of previous run results
  #1
Member
 
Hamidreza Bijanyar
Join Date: Jun 2015
Posts: 40
Rep Power: 11
bejanyar is on a distinguished road
Hello.
I face a new problem !
I have a simulation that contain a fixed geometry and mesh and several pressure boundary condition.
I reed other post in this forum to automatically change pressure and run several time.
I did this:
I made a cfx analyze system and defined parameter for pressure boundary condition. then i duplicate it and change the parameters and continue to duplicating and changing parameters until all pressure finished.
Updating setup cells and updating solution cell.
Runs send to RSM and execute 1 by 1 automatically.
The problem in that i want each run based on initial condition of previous run result. But because cfx , cfx 1 , cfx 2 , cfx 3 , cfx 4 , ..... have different working directory this not happen.
How can i do this ???
And is my way for doing some repetitive job for several pressure correct ?
bejanyar is offline   Reply With Quote

Old   September 9, 2015, 04:23
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
This is easy to do using the command line to start the jobs. Just define the initial condition as the result file from the previous run.

I am no expert on running this stuff under RSM so I cannot say for how it is done that way.
ghorrocks is offline   Reply With Quote

Old   September 9, 2015, 04:48
Default
  #3
Member
 
Hamidreza Bijanyar
Join Date: Jun 2015
Posts: 40
Rep Power: 11
bejanyar is on a distinguished road
Yes, I know i can set initial condition on "Update from current solution data if possible" .
But problem is that this option use current solution data in that case.
but in my problem there is cfx , cfx1 , cfx2 , ...
how to use last result of cfx , in initial condition of cfx 1 ??
And about command line , i know nothing !!! How can i do this using command ? and where is it ?? in WorkBench ? in cfx setup ??
bejanyar is offline   Reply With Quote

Old   September 9, 2015, 07:08
Default
  #4
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
I always prefer the command line options when doing anything like what you propose. That way you can directly specify what is input to what.

Have a look in the documentation under "Starting CFX from the Command Line".
ghorrocks is offline   Reply With Quote

Old   September 15, 2015, 15:16
Default
  #5
Member
 
Hamidreza Bijanyar
Join Date: Jun 2015
Posts: 40
Rep Power: 11
bejanyar is on a distinguished road
Ok,
I did it using command line:

Code:
# encoding: utf-8
# Release 16.1
SetScriptVersion(Version="16.1.91")
i = 1
while (i < 3):
	
	j=1
	while (j < 10):
		designPoint1 = Parameters.GetDesignPoint(Name="0")
		p1 = Parameters.GetParameter(Name="P1")
		p2 = Parameters.GetParameter(Name="P7")
		p3 = Parameters.GetParameter(Name="P8")
		p1v = designPoint1.GetParameterValue(Parameter=p1)
		p2v = designPoint1.GetParameterValue(Parameter=p2)
		p3v = designPoint1.GetParameterValue(Parameter=p3)
		dp1 = Quantity ("10 [degree]")
		dp2 = Quantity ("10000 [Pa]")
		dp3 = Quantity ("100000 [Pa]")
		p2v = p2v + dp2
		p93v=p2v
		p2v = str ( p2v )
		designPoint1.SetParameterExpression(
			Parameter=p2,
			Expression=p2v)

		system1 = GetSystem(Name="CFX")
		setup = system1.GetComponent(Name="Setup")
		setup.Update(AllDependencies=True)
		solution = system1.GetComponent(Name="Solution")
		solution.Update(AllDependencies=True)
		results = system1.GetComponent(Name="Results")
		results.Update(AllDependencies=True)
		solution = system1.GetContainer(ComponentName="Solution")
		solution.ClearOldSolutionData(KeepReferenced=False)
		
		p4 = Parameters.GetParameter(Name="P4")
		p5 = Parameters.GetParameter(Name="P5")
		p6 = Parameters.GetParameter(Name="P9")
		p7 = Parameters.GetParameter(Name="P10")
		p8 = Parameters.GetParameter(Name="P11")
		p9 = Parameters.GetParameter(Name="P12")
		p10 = Parameters.GetParameter(Name="P13")
		p11 = Parameters.GetParameter(Name="P94")
		p4v = designPoint1.GetParameterValue(Parameter=p4)
		p5v = designPoint1.GetParameterValue(Parameter=p5)
		p6v = designPoint1.GetParameterValue(Parameter=p6)
		p7v = designPoint1.GetParameterValue(Parameter=p7)
		p8v = designPoint1.GetParameterValue(Parameter=p8)
		p9v = designPoint1.GetParameterValue(Parameter=p9)
		p10v = designPoint1.GetParameterValue(Parameter=p10)
		p11v = designPoint1.GetParameterValue(Parameter=p11)
		f= open ("result.txt","a")
		f.write("%s %s %s %s %s %s %s %s %s %s %s  \n \n" %(round(p1v.Value),p93v.Value,p3v.Value,p4v.Value,p5v.Value,p6v.Value,p7v.Value,p8v.Value,p9v.Value,p10v.Value,p11v.Value))
		f.close()
		Save(
			FilePath="E:/2 Phase - all degree - 6 inch/%s [degree]---(%s).wbpj" %(round(p1v.Value),p2v),
			Overwrite=True)
			
		
		
		j=j+1
		
	p1v = p1v + dp1
	p1v=p1v.ConvertUnit("degree")
	p1v= str (p1v)
	designPoint1.SetParameterExpression(
		Parameter=p1,
		Expression=p1v)
	designPoint1.SetParameterExpression(
		Parameter=p2,
		Expression="100000")
		
	i=i+1
	
exit
It was better than using rsm.
bejanyar 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
transsonic nozzle with rhoSimpleFoam Unseen OpenFOAM Running, Solving & CFD 8 July 1, 2022 07:54
Wrong fluctuation of pressure in transient simulation caitao OpenFOAM Running, Solving & CFD 2 March 5, 2015 22:33
Simulation seems to converge but crashes suddenly xxxx OpenFOAM 16 September 12, 2014 09:07
should Courant number always be kept below 1? wc34071209 OpenFOAM Running, Solving & CFD 16 March 9, 2014 20:31
Error while running rhoPisoFoam.. nileshjrane OpenFOAM Running, Solving & CFD 8 August 26, 2010 13:50


All times are GMT -4. The time now is 14:53.