KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
1.05k stars 246 forks source link

StructuralMechanicsApplication #368

Closed PhilippeBussetta closed 7 years ago

PhilippeBussetta commented 7 years ago

I cannot execute the test examples from ‘StructuralMechanicsApplication’

I used 'Kratos 5.0.0-cab42cf'

Thanks in advance

loumalouomega commented 7 years ago

Sorry, but it is the same as in the SolidMechanicsApplication, the test_examples are deprecated and we use the Unitest that can be found in the folder tests

PhilippeBussetta commented 7 years ago

The tests are managed thanks to parameter files .json? Is it possible to generate/see the files .py similar to the one used in the tutorial?

loumalouomega commented 7 years ago

Which tutorial?, the Kratos for Dummies needs an update, and right now we use the json input, you can create an equivalent python file, but this input is not the official anymore

jcotela commented 7 years ago

Philippe, the python file for the tests is this one (at least for the tests that correspond to a 'full' simulation and not just some individual feature) https://github.com/KratosMultiphysics/Kratos/blob/master/applications/StructuralMechanicsApplication/tests/Kratos_Execute_Solid_Test.py We don't normally divide the script in __init__ and Solve functions (we just put all the code in a single file, as in the tutorial) but doing so is more convenient for tests.

PhilippeBussetta commented 7 years ago

Thanks, I was lost. Now, I have a better understanding of the computational procedure.

jcotela commented 7 years ago

You are welcome. Do not hesitate to ask if you have further questions. Sorry for the confusion regarding the test examples, we recently changed the way tests work, but we still have the old files lying around.

PhilippeBussetta commented 7 years ago

I computed the examples in “tests” with “Kratos_Execute_Solid_Test.py” but I did not understand how the solution is checked. The parameters of the file .json: "print_output_process", "check_json_results_process" or "check_analytic_results_process" are not used into “Kratos_Execute_Solid_Test.py”. What is the procedure to save and to verify the solution? “output_configuration” is used to write files to GiD postProcess?

loumalouomega commented 7 years ago

imagen Yes it is computed in the Kratos_Execute_Solid_Test.py

loumalouomega commented 7 years ago

There are some problems with analytical solution, in that case the check_analytical_result_process can be used. In more general problems we use the json files containing the results, for that in a first iteration we activate the json_output_process, then we can use the json_check_process

jcotela commented 7 years ago

To add to @loumalouomega's answers, tests do not generally print output files, because they are optimized for the verification, which is done dynamically at runtime. If you want to see the result of the tests in GiD, for the script above you should add the output_configuration field in the corresponding json file. This field is normally generated automatically from GiD if you use the GiD interface, but here it was removed to switch off the GiD output.

The syntax of the missing json field is as follows

"output_configuration"             : {
        "result_file_configuration" : {
            "gidpost_flags"       : {
                "GiDPostMode"           : "GiD_PostBinary",
                "WriteDeformedMeshFlag" : "WriteDeformed",
                "WriteConditionsFlag"   : "WriteConditions",
                "MultiFileFlag"         : "SingleFile"
            },
            "file_label"          : "time",
            "output_control_type" : "step",
            "output_frequency"    : 1,
            "body_output"         : true,
            "node_output"         : false,
            "skin_output"         : false,
            "plane_output"        : [],
            "nodal_results"       : ["DISPLACEMENT","REACTION"],
            "gauss_point_results" : []
        },
        "point_data_configuration"  : []
},

Just paste this as a new top-level field within json file and modify the nodal_results and gauss_point_results to select the variables you want. Maybe @loumalouomega can suggest which variables make sense to check for these tests?

loumalouomega commented 7 years ago

Usually I deactivate the output, changing output_configuration by _output_configuration, the same with the json output and check, depending what i want

loumalouomega commented 7 years ago

Right now the check can be done just with nodal values, I can change that.

PhilippeBussetta commented 7 years ago

Thanks a lot. I add the output_configuration into the json and I changed the file “Kratos_Execute_Solid_Test.py”. Now a bin file is created but I cannot read it correctly with GiD because of: _Error reading file 'dynamictest.post.bin': No mesh information found. The mesh have to be write thanks to another output process? Is it because of my configuration – file json?

I would like to mention, that the official version of “Kratos_Execute_Solid_Test.py” is different from yours. https://github.com/KratosMultiphysics/Kratos/blob/master/applications/StructuralMechanicsApplication/tests/Kratos_Execute_Solid_Test.py

PhilippeBussetta commented 7 years ago

With the test “patch_bending_test” everything is fine.

loumalouomega commented 7 years ago

Right now I am waiting for an approval of my PR #370, where the “Kratos_Execute_Solid_Test.py” have been updated

PhilippeBussetta commented 7 years ago

I would like to make an example with beam element -- SmallDisplacementBeamElement3D2N. An error stop the computation without message occur after "::[Mechanical Solver]:: -START-". Maybe I forget a basic instruction?

simple_beam_test.mdpa

Begin ModelPartData
//VARIABLE_NAME value
End ModelPartData

Begin Properties  0 
YOUNG_MODULUS          1.00000e+12 
POISSON_RATIO          2.50000e-01 
CROSS_AREA             2.00000e-01
End Properties

Begin Nodes
    1   0.0000   0.0000     0.00
    2   1.0000   0.0000     0.00
End Nodes

Begin Elements SmallDisplacementBeamElement3D2N
    1   0   1  2
End Elements

Begin SubModelPart Parts_Parts_Auto1 // Group Parts Auto1 // Subtree Parts
    Begin SubModelPartNodes
         1
         2
    End SubModelPartNodes
    Begin SubModelPartElements
         1
    End SubModelPartElements
    Begin SubModelPartConditions
    End SubModelPartConditions
End SubModelPart

Begin SubModelPart DISPLACEMENT_Displacement_Auto1 // Group Displacement Auto1 // Subtree DISPLACEMENT
    Begin SubModelPartNodes
         1
    End SubModelPartNodes
    Begin SubModelPartElements
    End SubModelPartElements
    Begin SubModelPartConditions
    End SubModelPartConditions
End SubModelPart

Begin SubModelPart DISPLACEMENT_Displacement_Auto2 // Group Displacement Auto1 // Subtree DISPLACEMENT
    Begin SubModelPartNodes
         2
    End SubModelPartNodes
    Begin SubModelPartElements
    End SubModelPartElements
    Begin SubModelPartConditions
    End SubModelPartConditions
End SubModelPart

simple_beam_test_bossak_parameters.json

{
    "problem_data"             : {
        "problem_name"    : "simple_beam_test",
        "model_part_name" : "Structure",
        "domain_size"     : 3,
        "time_step"       : 0.01,
        "start_time"      : 0.01,
        "end_time"        : 0.02,
        "echo_level"      : 0
    },
    "solver_settings"          : {
        "solver_type"                        : "solid_mechanics_implicit_dynamic_solver",
        "echo_level"                         : 0,
        "solution_type"                      : "Dynamic",
        "time_integration_method"            : "Implicit",
        "scheme_type"                        : "Bossak",
        "model_import_settings"              : {
            "input_type"     : "mdpa",
            "input_filename" : "simple_beam_test"
        },
        "line_search"                        : false,
        "convergence_criterion"              : "Residual_criterion",
        "displacement_relative_tolerance"    : 0.0001,
        "displacement_absolute_tolerance"    : 1e-9,
        "residual_relative_tolerance"        : 0.0001,
        "residual_absolute_tolerance"        : 1e-9,
        "max_iteration"                      : 10,
        "linear_solver_settings"             : {
                "solver_type": "SuperLUSolver",
                "max_iteration": 500,
                "tolerance": 1e-9,
                "scaling": false,
                "verbosity": 1
        },
        "problem_domain_sub_model_part_list" : ["Parts_Parts_Auto1"],
        "processes_sub_model_part_list"      : ["Parts_Parts_Auto1","DISPLACEMENT_Displacement_Auto1", "DISPLACEMENT_Displacement_Auto2"]
    },
    "constraints_process_list" : [
    {
        "python_module"   : "impose_vector_value_by_components_process",
        "kratos_module" : "KratosMultiphysics",
        "help"                  : "This process fixes the selected components of a given vector variable",
        "process_name"          : "ImposeVectorValueByComponentsProcess",
        "Parameters"            : {
            "mesh_id"         : 0,
            "model_part_name" : "DISPLACEMENT_Displacement_Auto1",
            "variable_name"   : "DISPLACEMENT",
            "is_fixed_x"      : true,
            "is_fixed_y"      : true,
            "is_fixed_z"      : true,
            "value"           : [0.0,0.0,0.0]
        }
    },
    {
        "python_module"   : "impose_vector_value_by_components_process",
        "kratos_module" : "KratosMultiphysics",
        "help"                  : "This process fixes the selected components of a given vector variable",
        "process_name"          : "ImposeVectorValueByComponentsProcess",
        "Parameters"            : {
            "mesh_id"         : 0,
            "model_part_name" : "DISPLACEMENT_Displacement_Auto2",
            "variable_name"   : "DISPLACEMENT",  
            "is_fixed_x"      : true,
            "is_fixed_y"      : false,
            "is_fixed_z"      : false,
            "value"           : [1.0,0.0,0.0]
        }
    }
    ],
    "loads_process_list" : [],
    "list_other_processes" :[],
    "_output_configuration"             : {
        "result_file_configuration" : {
            "gidpost_flags"       : {
                "GiDPostMode"           : "GiD_PostBinary",
                "WriteDeformedMeshFlag" : "WriteDeformed",
                "WriteConditionsFlag"   : "WriteConditions",
                "MultiFileFlag"         : "SingleFile"
            },
            "file_label"          : "time",
            "output_control_type" : "step",
            "output_frequency"    : 1,
            "body_output"         : true,
            "node_output"         : false,
            "skin_output"         : false,
            "plane_output"        : [],
            "nodal_results"       : ["DISPLACEMENT","REACTION"],
            "gauss_point_results" : []
        },
        "point_data_configuration"  : []
    },
    "restart_options"          : {
        "SaveRestart"      : false,
        "RestartFrequency" : 0,
        "LoadRestart"      : false,
        "Restart_Step"     : 0
    },
    "constraints_data"         : {
        "incremental_load"         : false,
        "incremental_displacement" : false
    }
}
loumalouomega commented 7 years ago

I will try to replicate

loumalouomega commented 7 years ago

But maybe is better to upload a zip or equivalent to the next time

loumalouomega commented 7 years ago

Which material are you considering?

PhilippeBussetta commented 7 years ago

Dummy material, linear elastic, just to check the element.

loumalouomega commented 7 years ago

Ok

loumalouomega commented 7 years ago

Same problem, I am going to compile in debug, sorry I don't have experience with beamsin Kratos

loumalouomega commented 7 years ago

Apparently is something related with the check, I need to leave now, just check that everything is defined (CROSS_AREA, etc....)

Check failed in file /home/vicente/bin/boost_1_62_0/boost/numeric/ublas/functional.hpp at line 1373:
i < size_i
Traceback (most recent call last):
  File "MainKratos.py", line 108, in <module>
    solver.Initialize()
  File "/home/vicente/bin/Kratos/applications/SolidMechanicsApplication/python_scripts/solid_mechanics_implicit_dynamic_solver.py", line 125, in Initialize
    self.Check();
  File "/home/vicente/bin/Kratos/applications/SolidMechanicsApplication/python_scripts/solid_mechanics_solver.py", line 276, in Check
    self.mechanical_solver.Check()
RuntimeError: Error: bad index

in /home/vicente/bin/Kratos/applications/StructuralMechanicsApplication/custom_elements/small_displacement_beam_element_3D2N.cpp:1526:virtual int SmallDisplacementBeamElement3D2N::Check(const ProcessInfo &)
   kratos/solving_strategies/strategies/solving_strategy.h:344:virtual int SolvingStrategy<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector >, LinearSolver<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector >, Reorderer<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector > > > >::Check() [TSparseSpace = UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, TDenseSpace = UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector >, TLinearSolver = LinearSolver<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector >, Reorderer<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector > > >]
   kratos/solving_strategies/strategies/residualbased_newton_raphson_strategy.h:1039:virtual int ResidualBasedNewtonRaphsonStrategy<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector >, LinearSolver<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector >, Reorderer<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector > > > >::Check() [TSparseSpace = UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, TDenseSpace = UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector >, TLinearSolver = LinearSolver<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector >, Reorderer<UblasSpace<double, boost::numeric::ublas::compressed_matrix<...>, boost::numeric::Vector >, UblasSpace<double, boost::numeric::Matrix, boost::numeric::Vector > > >]
PhilippeBussetta commented 7 years ago

Thanks, I add missing properties: DENSITY 1.00000e+00 LOCAL_INERTIA_TENSOR [2,2] ((0.1, 0.27),(0.27,0.3)) // matrix Error still occur but later

terminate called after throwing an instance of 'Kratos::Exception'
  what():  Error: Not existant DOF in node #1 for variable : ROTATION_X
loumalouomega commented 7 years ago

You need to set in the solver the rotation_dof as true.

El 9 may. 2017 7:14 p. m., "Philippe Bussetta" notifications@github.com escribió:

Thanks, I add missing properties: DENSITY 1.00000e+00 LOCAL_INERTIA_TENSOR [2,2] ((0.1, 0.27),(0.27,0.3)) // matrix Error still occur but later

terminate called after throwing an instance of 'Kratos::Exception' what(): Error: Not existant DOF in node #1 for variable : ROTATION_X

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/issues/368#issuecomment-300236634, or mute the thread https://github.com/notifications/unsubscribe-auth/ATEMgJh4GBLuOVE2TBnm24rvN3NoQqdyks5r4J7TgaJpZM4NQjBt .

PhilippeBussetta commented 7 years ago

Yes, but where? in the file "Kratos_Execute_Solid_Test.py", json or another?

loumalouomega commented 7 years ago

Sorry, in the json file.

El 10 may. 2017 10:28 a. m., "Philippe Bussetta" notifications@github.com escribió:

Yes, but where? in the file "Kratos_Execute_Solid_Test.py", json or another?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/issues/368#issuecomment-300412255, or mute the thread https://github.com/notifications/unsubscribe-auth/ATEMgNrHPRFDdhKF46OC3IyFuZPBheg5ks5r4XUQgaJpZM4NQjBt .

PhilippeBussetta commented 7 years ago

Thanks, everything is fine. I would like to use the truss, beam or membrane elements of "structural_application". These elements are out of date? I have to move the elements to "StructuralMechanicsApplication" and update it?

loumalouomega commented 7 years ago

I don't know about the current state of those elements. A membrane element is going to be available soon in the StructuralMechanicsApplication #384. People from TUM is developing a new corotational beam and a large displacement truss, I don't know when them will be available. If you want to move that elements you are free to do it, but I am not sure if they will work.

RiccardoRossi commented 7 years ago

Hi Philippe,

i would say that the MembraneElement is already in the StructuralMechanics.

Riccardo

On Wed, May 10, 2017 at 3:39 PM, Philippe Bussetta <notifications@github.com

wrote:

Thanks, everything is fine. I would like to use the truss, beam or membrane elements of "structural_application". These elements are out of date? I have to move the elements to "StructuralMechanicsApplication" and update it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/issues/368#issuecomment-300484827, or mute the thread https://github.com/notifications/unsubscribe-auth/AHr7Eea9UvR3c2ubQWuneicOMnALEY0zks5r4b4tgaJpZM4NQjBt .

--

Riccardo Rossi

PhD, Civil Engineer

member of the Kratos Team: www.cimne.com/kratos

Tenure Track Lecturer at Universitat Politècnica de Catalunya, BarcelonaTech (UPC)

Full Research Professor at International Center for Numerical Methods in Engineering (CIMNE)

C/ Gran Capità, s/n, Campus Nord UPC, Ed. B0, Despatx 102

(please deliver post to the porters of building C1)

08034 – Barcelona – Spain – www.cimne.com -

T.(+34) 93 401 56 96 skype: rougered4

http://www.cimne.com/

https://www.facebook.com/cimne http://blog.cimne.com/ http://vimeo.com/cimne http://www.youtube.com/user/CIMNEvideos http://www.linkedin.com/company/cimne https://twitter.com/cimne

Les dades personals contingudes en aquest missatge són tractades amb la finalitat de mantenir el contacte professional entre CIMNE i voste. Podra exercir els drets d'accés, rectificació, cancel·lació i oposició, dirigint-se a cimne@cimne.upc.edu. La utilització de la seva adreça de correu electronic per part de CIMNE queda subjecte a les disposicions de la Llei 34/2002, de Serveis de la Societat de la Informació i el Comerç Electronic.

Imprimiu aquest missatge, només si és estrictament necessari. http://www.cimne.com/

PhilippeBussetta commented 7 years ago

I would like to use an imposed boundary condition linear regarding time. Like the python_module : "impose_vector_value_by_components_process" used into the tests of StructuralMechanicsApplication but with a value increasing linearly with time.

I find the python_module : "impose_vector_value_by_components_over_time_process" into ContactStructuralMechanicsApplication but I cannot compile this module.

loumalouomega commented 7 years ago

I can move that process to them structural mechanics application.

El 11 may. 2017 1:07 p. m., "Philippe Bussetta" notifications@github.com escribió:

I would like to use an imposed boundary condition linear regarding time. Like the python_module : "impose_vector_value_by_components_process" used into the tests of StructuralMechanicsApplication but with a value increasing linearly with time.

I find the python_module : "impose_vector_value_by_components_over_time_process" into ContactStructuralMechanicsApplication but I cannot compile this module.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/issues/368#issuecomment-300757432, or mute the thread https://github.com/notifications/unsubscribe-auth/ATEMgG9h_4KgF3U99qMjLy8tTXU_0YlHks5r4uv6gaJpZM4NQjBt .

loumalouomega commented 7 years ago

I can move that process to them structural mechanics application.

El 11 may. 2017 1:07 p. m., "Philippe Bussetta" notifications@github.com escribió:

I would like to use an imposed boundary condition linear regarding time. Like the python_module : "impose_vector_value_by_components_process" used into the tests of StructuralMechanicsApplication but with a value increasing linearly with time.

I find the python_module : "impose_vector_value_by_components_over_time_process" into ContactStructuralMechanicsApplication but I cannot compile this module.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/issues/368#issuecomment-300757432, or mute the thread https://github.com/notifications/unsubscribe-auth/ATEMgG9h_4KgF3U99qMjLy8tTXU_0YlHks5r4uv6gaJpZM4NQjBt .

PhilippeBussetta commented 7 years ago

Thanks

loumalouomega commented 7 years ago

393 Besides you can custom your main script to do things not included in the processes

PhilippeBussetta commented 7 years ago

I moved "impose_vector_value_by_components_over_time_process.py" to impose displacement but I have problems because of the time steps. The value of the time step can change a little, consequently the last value can be superior that it should be. In this case the imposed value is zero. Then, I would like to custom, what script is the main one? "sprism_pan_test_local_process.py" is an example of main script? It is possible to impose displacement in this script?

loumalouomega commented 7 years ago

I recommend you to run your problem independently from the tests folders, and modify your MainKratos.py there. sprism_pan_test_local_process.py is just a process defined for running one test, because at that time was not possible to impose and check values analytically, it will be removed soon.

loumalouomega commented 7 years ago

beam.zip

I attach you an example, you can add things directly to the MainKratos.py

PhilippeBussetta commented 7 years ago

Thanks a lot. I fixed bug, I added verbose option and I put "math" rather than numpy. impose_vector_value_by_components_over_time_process.zip

loumalouomega commented 7 years ago

Thanks a lot, yes, better if we skip external dependencies

PhilippeBussetta commented 7 years ago

I fixed bug into "json_output_process.py" -- missing "if (count == 0):" on the initialization step.

json_output_process.zip

PhilippeBussetta commented 7 years ago

I would like to use the membrane element of StructuralMechanicsApplication. Is it possible to have an example: parameters used into the files .json and .mdpa?

loumalouomega commented 7 years ago

The membrane element is currently supported in the official release of Kratos, you can create a complete problem using the Kratos's interface from GiD.

PhilippeBussetta commented 7 years ago

I updated my sources – Kratos and GiD problem type – and the membrane element are not in the list with Solid Small Displacements, Solid Total Lagrangian, Solid Updated Lagrangian, Thin Shell and Thick Shell. The “MembraneElement” is well into the “GiDInterface\kratos.gid\apps\Structural\xml\Elements.xml” but only with triangular geometry. I would like to use quadrangular membrane element so I add into the file “applications\StructuralMechanicsApplication\structural_mechanics_application.cpp”:

    KRATOS_REGISTER_ELEMENT( "ShellThickElement3D4N", mShellThickElement3D4N )
    KRATOS_REGISTER_ELEMENT( "ShellThickElementCorotational3D4N", mShellThickCorotationalElement3D4N )
    KRATOS_REGISTER_ELEMENT( "MembraneElement3D4N", mMembraneElement3D4N )

and into .h

    const MembraneElement mMembraneElement3D4N;

I have a problem with the material law. I do not understand the way used to manage the material properties. Regarding some examples, I add into the file .json :“CONSTITUTIVE_LAW LinearElasticPlaneStress2DLaw” I have the message: Error: CONSTITUTIVE_LAW is not a valid variable!!! On the other hand, this variable is checked into the membrane element:

    //verify that the constitutive law exists
    if ( this->GetProperties().Has( CONSTITUTIVE_LAW ) == false )
    {
        KRATOS_THROW_ERROR( std::logic_error, "constitutive law not provided for property ", this->GetProperties().Id() )
    }

The material law have to be chosen into the .json or with materials.py file? In the case of the materials.py where the materials is called? In the .json or in MainKratos.py?

I try to solve a simple example with 1 membrane element: Simple_membrane_test.zip

Thanks in advance

loumalouomega commented 7 years ago

@PhilippeBussetta We will add you to the developer group, I think it is more productive if you create a Pull Request and you ask the things directly there. Otherwise I lose the whole picture of the changes

loumalouomega commented 7 years ago

@PhilippeBussetta , can we close this issue?, we can reopen or create new more specific discussions if needed in the future

PhilippeBussetta commented 7 years ago

Of course