|
[Sponsors] |
January 29, 2016, 15:13 |
Exporting Local Values
|
#1 |
New Member
Dustin Ray
Join Date: Jan 2016
Posts: 6
Rep Power: 10 |
I am simulating heat transfer through a 3D channel. I'm wanting to plot the local values of heat flux, shear stress, temperature,etc. I know I can determine the values of these variables by creating a plane. Then create an expression. I have been able to create multiple planes using the command editor, but I'm unsure of how to export these values.
I saw in an earlier post about saving values to a text file in csv format. When I tried this I got errors. This is the code I tried !$outfile = "Results.csv"; !open(OUT, ">$outfile"); ! printf OUT "%5c,%5c\n",'Tw [m]', 'Tb [K]'; !$WallTemp=lengthAve(Temperature)@Wall1; !$BulkTemp=massFlowAve(Temperature)@FluidPlane1; ! printf OUT "%15.8e,%15.8e\n",$WallTemp,$BulkTemp; !close(OUT); ERROR CCL parser failed with message: Perl Syntax errors detected: syntax error at (eval 159) line 4, near ")@Wall1" syntax error at (eval 159) line 5, near ")@FluidPlane1" Any help is greatly appreciated. |
|
January 29, 2016, 17:59 |
|
#2 |
New Member
Dustin Ray
Join Date: Jan 2016
Posts: 6
Rep Power: 10 |
Well never mind I figured it out, but wanted to post my code for anyone else who is looking for this.
!$outfile = "Results.csv"; !open(OUT, ">$outfile"); ! printf OUT "%10s,%10s,%10s,%10s,%10s,%10s\n",'Z (m)','Tb [K]','Tw [K]','Qw [Wm^-2]','Tauw [Pa]','Um [ms^-1]'; !for ($z=0; $z<=0.0099;$z+=0.00001) !{ PLANE: Fluid_Plane_1 Apply Instancing Transform = On Apply Texture = Off Blend Texture = On Bound Radius = 0.5 [m] Colour = 0.75, 0.75, 0.75 Colour Map = Default Colour Map Colour Mode = Variable Colour Scale = Linear Colour Variable = Temperature Colour Variable Boundary Values = Conservative Culling Mode = No Culling Direction 1 Bound = 1.0 [m] Direction 1 Orientation = 0 [degree] Direction 1 Points = 10 Direction 2 Bound = 1.0 [m] Direction 2 Points = 10 Domain List = fluid_body Draw Faces = On Draw Lines = Off Instancing Transform = /DEFAULT INSTANCE TRANSFORMefault Transform Invert Plane Bound = Off Lighting = On Line Colour = 0, 0, 0 Line Colour Mode = Default Line Width = 1 Max = 0.0 [K] Min = 0.0 [K] Normal = 1 , 0 , 0 Option = XY Plane Plane Bound = None Plane Type = Slice Point = 0 [m], 0 [m], 0 [m] Point 1 = 0 [m], 0 [m], 0 [m] Point 2 = 1 [m], 0 [m], 0 [m] Point 3 = 0 [m], 1 [m], 0 [m] Range = Local Render Edge Angle = 0 [degree] Specular Lighting = On Surface Drawing = Smooth Shading Texture Angle = 0 Texture Direction = 0 , 1 , 0 Texture File = Texture Material = Metal Texture Position = 0 , 0 Texture Scale = 1 Texture Type = Predefined Tile Texture = Off Transform Texture = Off Transparency = 0.0 Visibility = On X = 0.0 [m] Y = 0.0 [m] Z = $z END POLYLINE: Wall_1 Apply Instancing Transform = On Boundary List = interface shadow Colour = 0, 1, 0 Colour Map = Default Colour Map Colour Mode = Constant Colour Scale = Linear Colour Variable = Pressure Colour Variable Boundary Values = Conservative Contour Level = 1 Domain List = fluid_body Input File = Instancing Transform = /DEFAULT INSTANCE TRANSFORMefault Transform Line Width = 2 Location = /PLANE:Fluid_Plane_1 Max = 0.0 Min = 0.0 Option = Boundary Intersection Range = Global Visibility = Off END !$Zp = $z; !$Tb = massFlowAve("Temperature","Fluid_Plane_1"); !$Tw = lengthAve("Temperature","Wall_1"); !$Qw = lengthAve("Wall Heat Flux","Wall_1"); !$Tauw = lengthAve("Wall Shear","Wall_1"); !$Um = massFlowAve("Velocity","Fluid_Plane_1"); ! printf OUT "%15.8e,%15.8e,%15.8e,%15.8e,%15.8e,%15.8e\n",$Zp, $Tb,$Tw,$Qw,$Tauw,$Um; !} !close(OUT); So the code above creates a plane at Z, and a polyline at the boundary intersection of the previous plane and the water interface with the wall (interface shadow) Z. It then calculates the Bulk Temp, Wall Temp, Heat flux, Mean Velocity, Shear Stress. This is then saved to a csv file and the process starts over again. I have the planes overwrite themselves so that once the code is done fluent itself isn't slowed down. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
High Courant Number @ icoFoam | Artex85 | OpenFOAM Running, Solving & CFD | 11 | February 16, 2017 14:40 |
NULL Coordinate Values when Exporting XYZ Internal Table | Muzz | STAR-CCM+ | 0 | April 15, 2014 14:15 |
Local values at BC cel-expressions | Wonderz | CFX | 7 | October 31, 2013 11:50 |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 23:40 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 05:03 |