6 Replies Latest reply on Jul 18, 2013 9:23 AM by Martin Herling

    Obtain and Use InitialConditions Object

    Martin Herling

      Hi there,

       

      I'm trying to make use of the FlowSimulation API on SW2011 Premium x64. I think I understand how most of the methods and obejcts described in the API help file and used in the examples are used and what they do, but that's not true for the objects derived from ParametrizedFeature (ComputationalDomainSettings, InitialConditions, MeshSettings). I'm especially interested in the InitialConditions object, since I want to change flow direction for an external problem. It's stated that "You can obtain a InitialConditions object directly from a ParametrizedFeature object.", but until now this didn't really make sense to me...

       

      So the question is: How do I obtain this object for my currently active configuration?

       

      Thanks in advance,

       

       

      Martin

        • Re: Obtain and Use InitialConditions Object
          Jared Conway

          don't know much about the API, but you might want to post your code here to have someone take a look and/or in the API section of the forum. if it is something you want to outsource, we have programmers in-house that could take a look at your code and complete it. Otherwise, i'd throw it to your VAR.

            • Re: Obtain and Use InitialConditions Object
              Martin Herling

              Hi all,

               

              today I tried one last time and guess what? I got it to work It's not this complicated after all and looks like this:

               

                  ' Get EFD Project
                  Set FDAPrj = MC.GetFluidDynamicAnalysisProject
                      .
                      .
                  .
                  Dim GIC As NIKCommonApiLib.ParametrizedFeature
                  Dim Epar As NIKCommonApiLib.EnumParameters
                  Dim Param As NIKCommonApiLib.Parameter
                 
                  Set GIC = FDAPrj.GlobalInitialConditions
                  Set Epar = GIC.EnumParameters
                 
                  Set Param = Epar.Next
                 
                  Dim ptype As NIKCommonApiLib.nikParametersTypes_e
                  ptype = nikVelocityAlongXdirection
                  Dim NewValue As Double
                  NewValue = 21 'm/s
                 
                  While Not Param Is Nothing
                          If Param.Type = ptype Then
                                  Param.SetValue (NewValue)
                          End If
                          Set Param = Epar.Next
                  Wend

               

              Thanks anyway,

               

               

              Martin

                • Re: Obtain and Use InitialConditions Object
                  Jared Conway

                  martin, would you be willing to share what you're doing with the API? I've worked with a lot of customers that asked about it, but i've never seen any one follow through.

                   

                  At HRS we were going to write something to automate something similar to the parameter sweep function but SolidWorks came out with it in 2013!

                    • Re: Obtain and Use InitialConditions Object
                      Martin Herling

                      Hi Jared,

                       

                      there´s nothing too fancy about it: We did some windtunnel measurements for different angles of attack. All I´m trying to do is to change the initial external flow field and do a couple of simulations (successfully )to compare the results with the real data. As far as I know, the API also lets one change applied boundary conditions, some mesh and domain settings and the other initial conditions and enables access to all results. Sadly, since natural convection is also involved in my problem, I would need to change the gravitational vector too, or the global coordinate system, doesn't matter, this is where I'm stuck at the moment...

                       

                      If somebody knows how: Let me know. But I didn't find nothing in the documentation...

                       

                      So, after all, to me it seems the API is not really more powerful then the Parametric Study Tool and in the end I have to do everything by hand

                       

                      Was this helpful?

                       

                      Greetings,

                       

                       

                      Martin

                        • Re: Obtain and Use InitialConditions Object
                          Jared Conway

                          if you have forced flow (wind tunnel), do you think the natural convection is really strong enough to affect the results such that they need to be included?

                           

                          if you rotate the geometry instead of rotating the flow, you shouldn't need to change gravity.

                           

                          otherwise, i think that the parametric study (sweep) option in 2013 should solve all your problems!

                            • Re: Obtain and Use InitialConditions Object
                              Martin Herling

                              Hi Jared,

                               

                              my case is in principle a box with heat sources inside which gets cooled by the wind, so the inner natural convection isn't negligable. I kind of found a solution, but it's not really perfect:

                               

                              - use the FlowSimulation API to make new configurations from a starting one (like "clone project")

                              - change boundary conditions as needed

                              - still manual: insert table to rotate the configurations respectively

                              - run all the simulations (API again)

                              - get goal data and some plotting for all cases

                               

                              the starting configuration can be used to determine refining periods and control the initial mesh settings, which is quite handy. Also the main flow is always orthogonal to the cell faces, which should decrease numerical diffusion. On the other hand the cell count goes up, but I've got time, as long as I don't have to sit in front of the screen, just to press a button from time to time

                               

                              But still: After my opinion there's definitely a need for a more powerful API!

                               

                              greetings,

                               

                               

                              Martin