Discussion Groups

Simulation CFD

Reply
Contributor
RAALVM
Posts: 25
Registered: ‎08-12-2013
Accepted Solution

Python and Mesh Enhancement

152 Views, 4 Replies
04-15-2014 11:05 AM

Hi,

 

I am trying to do a case study to see how mech enhancement can modify the results. I am writing a python script to generate designs and scenarios, but I have trouble in finding which is the property of the Scenario for layer gradation when it is not automatic.

I have found the Number of layers, layer factor, and also automaticLayerAdaptation which is a string On Off but if I have a layer gradatio of 1.2 what is the property which should I set?

 

Thanks for help

Please use plain text.
Product Support
Royce_adsk
Posts: 555
Registered: ‎08-24-2011

Re: Python and Mesh Enhancement

04-15-2014 01:57 PM in reply to: RAALVM

I don't believe that settings was available yet in the API.

 

You could use this flag: mesh_enhance_gradation

 

To set flags with the API refer to the code below:

 

 

def SetFlags(flagsList = None):
	# ""
	# flagsList = {flagName:Value,flagName2:Value}
	# ""
	if flagsList == None:
		CFD.DSE.UI.ShowMessage("Error: Needs Flags when using SetFlags")
	else:
		tempDir = tempfile.gettempdir()
		fileName = tempDir +"\\qtScript.script"
		try:
			f = open(fileName, "w")
			try:
				f.write("study = new DesignStudy;\n")
				f.write("scenario = study.activeScenario();\n")
				
				for flag in flagsList:
					f.write("scenario.addFlag(\"" + flag + "\"," + str(flagsList[flag]) + ", 0);\n")
			except:
				CFD.DSE.UI.ShowMessage("Error: Writing to: " + fileName)
			finally:
				f.close()
		except IOError:
			CFD.DSE.UI.ShowMessage("Error: Creating file: " + fileName)
			pass
		DSE.UI.ExecuteQtScript(fileName)	

 

 



Royce Abel
Please use plain text.
Contributor
RAALVM
Posts: 25
Registered: ‎08-12-2013

Re: Python and Mesh Enhancement

04-15-2014 09:38 PM in reply to: Royce_adsk

Thanks,

But I have observed that the flag mesh_enhance_gradation has the same value as enhancementStretching property of Scenario could be the same?

Please use plain text.
Contributor
RAALVM
Posts: 25
Registered: ‎08-12-2013

Re: Python and Mesh Enhancement

04-15-2014 10:21 PM in reply to: Royce_adsk

Some quick questions about the mesh_enhance falgs:

 

mesh_enhance_thick  I think it should be Layer Factor from Enhancement but the flag has values of 100 and in the layer factor I have values of 0.45 till 1.2

 

When these flags are applyed on the study, because I have manually modified the mesh_enhance_gradation and if I open the Boundary Mesh Engancement dialog box nothing is changed.

 

I presume that a value of 1 in mesh_enhance_gradation should account for the Auto value of Layer Gradation in the dialog box.

 

Thanks for help.

Please use plain text.
Product Support
Royce_adsk
Posts: 555
Registered: ‎08-24-2011

Re: Python and Mesh Enhancement

04-17-2014 04:28 PM in reply to: RAALVM

That flag doesn't change the UI, it just overrides the setting in the UI at the mesher executable level.



Royce Abel
Please use plain text.