Author Topic: [SOLVED] non existent POINT_LOAD  (Read 966 times)

aditya

  • Newbie
  • *
  • Posts: 17
[SOLVED] non existent POINT_LOAD
« on: August 01, 2016, 10:53:43 AM »
Hello everyone

I have the following in a script with which I want to run a structural simulation

Code: [Select]
#import kratos core and applications
from KratosMultiphysics import *
from KratosMultiphysics.StructuralApplication import *
from KratosMultiphysics.SolidMechanicsApplication import *
from KratosMultiphysics.StructuralMechanicsApplication import *
from KratosMultiphysics.ExternalSolversApplication import *

Then at some point in the script I do

Code: [Select]
for node in main_model_part.Nodes:
  print(node.GetSolutionStepValue(POINT_LOAD))

Unfortunately I get the following error

 
Quote
File "Project.gid/MainKratos.py", line 116, in <module>
    print(node.GetSolutionStepValue(POINT_LOAD))
RuntimeError: Error: This container only can store the variables specified in its variables list. The variables list doesn't have this variable:POINT_LOAD variable #0


I do not understand why is this because when we import the applicaitons, the variables should already be there. But apparently this is not the case. Anyone has any Idea why this is happening ?

Thanks in advance.
« Last Edit: August 03, 2016, 12:04:04 PM by Josep Maria »

Josep Maria

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 50
Re: non existent POINT_LOAD
« Reply #1 on: August 01, 2016, 02:10:28 PM »
Hi Aditya,

   In the current version of the SolidMechanics application,  if you build the input from the problemtype,  the loads (i. e.  POINT_LOAD)  are set directly to the conditions data instead of the nodes. You can also set them in  nodes and it will work. In order to store and get the variable from nodes you must Add it as a nodal variable.  This is done in the solid_mechanics_solver. py,  AddVariables. If you take a look there,  the POINT_LOAD  is added, therefore you must be able to get it and print it.  Take into account that maybe it is zero because it was not assigned to nodes.

After explaining this.   The error you get  seems to be something related to a variables shadowing during the import of the applications.  Try to import them using this order:

#import kratos core and applications
from KratosMultiphysics import *
from KratosMultiphysics.ExternalSolversApplication import *
from KratosMultiphysics.SolidMechanicsApplication import *
from KratosMultiphysics.StructuralMechanicsApplication import *

Maybe you don't need to import the StructuralMechanics if you run a problem of solids only.

I hope this helps to solve your problem.

BR

Josep Maria
« Last Edit: August 01, 2016, 02:12:46 PM by Josep Maria »

aditya

  • Newbie
  • *
  • Posts: 17
Re: non existent POINT_LOAD
« Reply #2 on: August 03, 2016, 08:34:26 AM »
Hi Josep Maria

It works now. Thank you very much for your suggestion.

A curious question :
What happens when two applications register the same variable ?

Josep Maria

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 50
Re: non existent POINT_LOAD
« Reply #3 on: August 03, 2016, 12:03:00 PM »
That's a good question.

   Well,  rigth now,  if you use these applications independently  it works correctly.  If you use them together a conflict occurs.  In that cases is better to define,  create and register this variable in the kratos core. 

The good news are that we know how to surpass this problem and in a near future no conflict will be generated in these cases. Some implementation is needed, we are working on it.

Regards

Josep Maria

aditya

  • Newbie
  • *
  • Posts: 17
Re: [SOLVED] non existent POINT_LOAD
« Reply #4 on: August 03, 2016, 01:43:53 PM »
Thank you.

I played around a little bit and recognized that if there are two applications which have same variable ... and they are imported in same script, then the variable disappears  ... .I mean it complaints the variable does not exist.

May be this information is useful at some point.