Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solid and Pfem developments #157

Merged
merged 26 commits into from
Oct 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
833a8cc
trying to write json format for materials
josep-m-carbonell Jul 26, 2017
46ade21
Merge branch 'master' into feature-solid-mechanics-update
josep-m-carbonell Jul 26, 2017
38af069
Merge branch 'master' into feature-solid-mechanics-update
josep-m-carbonell Aug 1, 2017
74abb11
Merge branch 'master' into feature-solid-mechanics-update
josep-m-carbonell Aug 17, 2017
ee8d1b6
adding new conditions
josep-m-carbonell Aug 17, 2017
f5f1c8b
inserting beam elements
josep-m-carbonell Aug 23, 2017
0b80d96
analysing strategy changes
josep-m-carbonell Aug 24, 2017
fb97179
prediction level 1 by default for explicit strategy
josep-m-carbonell Aug 24, 2017
2bc15af
domain_size to dimension
josep-m-carbonell Aug 24, 2017
45eed0f
updating material write for beams
josep-m-carbonell Aug 29, 2017
94c1f05
Merge branch 'master' into feature-solid-mechanics-update
josep-m-carbonell Aug 29, 2017
6f9cfbd
bbar elements active
josep-m-carbonell Sep 11, 2017
ed3ddd5
start updating material models
josep-m-carbonell Sep 11, 2017
f554cc4
sections to json input
josep-m-carbonell Sep 12, 2017
92ea81c
Merge branch 'fix-rename-conditions-processes' into feature-material-…
josep-m-carbonell Sep 15, 2017
c9afc01
update of strategies and modules
josep-m-carbonell Oct 4, 2017
b2989b1
Merge branch 'master' into feature-pfem-develop
josep-m-carbonell Oct 4, 2017
6acc76d
update strategies for solids
josep-m-carbonell Oct 4, 2017
72cc818
Merge branch 'feature-material-models-update' into feature-solid-mech…
josep-m-carbonell Oct 4, 2017
7da5cb1
Merge branch 'feature-pfem-develop' into feature-solid-develop
josep-m-carbonell Oct 4, 2017
c93ab06
delete not needed mesh_id
josep-m-carbonell Oct 11, 2017
d16a2a4
Merge branch 'master' into feature-solid-develop
josep-m-carbonell Oct 11, 2017
4b8e38a
write mesh id tcl process definition cloned in the pfem and solid apps
josep-m-carbonell Oct 11, 2017
f4b9f51
damage law name correction
josep-m-carbonell Oct 11, 2017
8bcf281
small change in logo
josep-m-carbonell Oct 14, 2017
c19afe9
move menu/nodes upwards
josep-m-carbonell Oct 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified kratos.gid/apps/Pfem/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified kratos.gid/apps/Pfem/images/timeIntervals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added kratos.gid/apps/Pfem/images/timeParams.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion kratos.gid/apps/Pfem/python/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def GetParallelSize():
# Defining the model_part
main_model_part = KratosMultiphysics.ModelPart(ProjectParameters["problem_data"]["model_part_name"].GetString())

main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DOMAIN_SIZE, ProjectParameters["problem_data"]["domain_size"].GetInt())
main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DIMENSION, ProjectParameters["problem_data"]["dimension"].GetInt())
main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DOMAIN_SIZE, ProjectParameters["problem_data"]["dimension"].GetInt())
main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DELTA_TIME, ProjectParameters["problem_data"]["time_step"].GetDouble())
main_model_part.ProcessInfo.SetValue(KratosMultiphysics.TIME, ProjectParameters["problem_data"]["start_time"].GetDouble())
if( ProjectParameters["problem_data"].Has("gravity_vector") ):
Expand Down
7 changes: 1 addition & 6 deletions kratos.gid/apps/Pfem/write/ProjectParameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"problem_data" : {
"problem_name" : "problem_name",
"model_part_name" : "Main Model",
"domain_size" : 3,
"dimension" : 3,
"time_step" : 0.001,
"start_time" : 0.0,
"end_time" : 0.002,
Expand Down Expand Up @@ -58,7 +58,6 @@
"meshing_domains" : [
{
"python_module": "meshing_domain",
"mesh_id": 1,
"model_part_name": "body_1",
"alpha_shape": 2.4,
"offset_factor": 0.0,
Expand Down Expand Up @@ -136,7 +135,6 @@
"parametric_walls" : [
{
"python_module": "parametric_wall",
"mesh_id": 0,
"model_part_name" : "model_part_name",
"rigid_body_settings":{
"rigid_body_element_type": "TranslatoryRigidElement3D1N",
Expand Down Expand Up @@ -227,7 +225,6 @@
"help" : "This process applies contact domain search by remeshing outer boundaries",
"process_name" : "ContactDomainProcess",
"Parameters" : {
"mesh_id" : 0,
"model_part_name" : "model_part_name",
"meshing_control_type" : "step",
"meshing_frequency" : 1.0,
Expand Down Expand Up @@ -269,7 +266,6 @@
"help" : "This process imposes a constraint",
"process_name" : "AssignValueToVectorComponentsProcess",
"Parameters" : {
"mesh_id" : 0,
"model_part_name" : "DISPLACEMENT_Displacement_Auto1",
"variable_name" : "DISPLACEMENT",
"interval" : [0.0, 100],
Expand All @@ -284,7 +280,6 @@
"help" : "This process assigns a load value on conditions",
"process_name" : "AssignVectorToConditionsProcess",
"Parameters" : {
"mesh_id" : 0,
"model_part_name" : "load_y",
"variable_name" : "LINE_LOAD",
"interval" : [0.0, 100],
Expand Down
123 changes: 123 additions & 0 deletions kratos.gid/apps/Pfem/write/write.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,127 @@ proc Pfem::write::writeCustomFilesEvent { } {
#write::RenameFileInModel "ProjectParameters.json" "ProjectParameters.py"
}


proc Pfem::write::getConditionsParametersDict {un {condition_type "Condition"}} {

set root [customlib::GetBaseRoot]

set bcCondsDict [list ]

set xp1 "[spdAux::getRoute $un]/condition/group"
set groups [$root selectNodes $xp1]
if {$groups eq ""} {
set xp1 "[spdAux::getRoute $un]/group"
set groups [$root selectNodes $xp1]
}
foreach group $groups {
set groupName [$group @n]
set cid [[$group parent] @n]
set groupName [write::GetWriteGroupName $groupName]
set groupId [::write::getMeshId $cid $groupName]
set condId [[$group parent] @n]
if {$condition_type eq "Condition"} {
set condition [::Model::getCondition $condId]
} {
set condition [::Model::getNodalConditionbyId $condId]
}
set processName [$condition getProcessName]
set process [::Model::GetProcess $processName]
set processDict [dict create]
set paramDict [dict create]
dict set paramDict model_part_name $groupId

set process_attributes [$process getAttributes]
set process_parameters [$process getInputs]

dict set process_attributes process_name [dict get $process_attributes n]
dict unset process_attributes n
dict unset process_attributes pn

set processDict [dict merge $processDict $process_attributes]
if {[$condition hasAttribute VariableName]} {
set variable_name [$condition getAttribute VariableName]
# "lindex" is a rough solution. Look for a better one.
if {$variable_name ne ""} {dict set paramDict variable_name [lindex $variable_name 0]}
}
foreach {inputName in_obj} $process_parameters {
set in_type [$in_obj getType]
if {$in_type eq "vector"} {
set vector_type [$in_obj getAttribute "vectorType"]
if {$vector_type eq "bool"} {
set ValX [expr [get_domnode_attribute [$group find n ${inputName}X] v] ? True : False]
set ValY [expr [get_domnode_attribute [$group find n ${inputName}Y] v] ? True : False]
set ValZ [expr False]
if {[$group find n ${inputName}Z] ne ""} {set ValZ [expr [get_domnode_attribute [$group find n ${inputName}Z] v] ? True : False]}
dict set paramDict $inputName [list $ValX $ValY $ValZ]
} {
if {[$in_obj getAttribute "enabled"] in [list "1" "0"]} {
foreach i [list "X" "Y" "Z"] {
if {[expr [get_domnode_attribute [$group find n Enabled_$i] v] ] ne "Yes"} {
set Val$i null
} else {
set printed 0
if {[$in_obj getAttribute "function"] eq "1"} {
if {[get_domnode_attribute [$group find n "ByFunction$i"] v] eq "Yes"} {
set funcinputName "${i}function_$inputName"
set value [get_domnode_attribute [$group find n $funcinputName] v]
set Val$i $value
set printed 1
}
}
if {!$printed} {
set value [expr [gid_groups_conds::convert_value_to_default [$group find n ${inputName}$i] ] ]
set Val$i $value
}
}
}
} elseif {$vector_type eq "tablefile" || $vector_type eq "file"} {
set ValX "[get_domnode_attribute [$group find n ${inputName}X] v]"
set ValY "[get_domnode_attribute [$group find n ${inputName}Y] v]"
set ValZ "0"
if {[$group find n ${inputName}Z] ne ""} {set ValZ "[get_domnode_attribute [$group find n ${inputName}Z] v]"}
} else {
set ValX [expr [gid_groups_conds::convert_value_to_default [$group find n ${inputName}X] ] ]
set ValY [expr [gid_groups_conds::convert_value_to_default [$group find n ${inputName}Y] ] ]
set ValZ [expr 0.0]
if {[$group find n ${inputName}Z] ne ""} {set ValZ [expr [gid_groups_conds::convert_value_to_default [$group find n ${inputName}Z] ]]}
}
dict set paramDict $inputName [list $ValX $ValY $ValZ]
}
} elseif {$in_type eq "double" || $in_type eq "integer"} {
set printed 0
if {[$in_obj getAttribute "function"] eq "1"} {
if {[get_domnode_attribute [$group find n "ByFunction"] v] eq "Yes"} {
set funcinputName "function_$inputName"
set value [get_domnode_attribute [$group find n $funcinputName] v]
dict set paramDict $inputName $value
set printed 1
}
}
if {!$printed} {
set value [gid_groups_conds::convert_value_to_default [$group find n $inputName]]
#set value [get_domnode_attribute [$group find n $inputName] v]
dict set paramDict $inputName [expr $value]
}
} elseif {$in_type eq "bool"} {
set value [get_domnode_attribute [$group find n $inputName] v]
set value [expr $value ? True : False]
dict set paramDict $inputName [expr $value]
} elseif {$in_type eq "tablefile"} {
set value [get_domnode_attribute [$group find n $inputName] v]
dict set paramDict $inputName $value
} else {
if {[get_domnode_attribute [$group find n $inputName] state] ne "hidden" } {
set value [get_domnode_attribute [$group find n $inputName] v]
dict set paramDict $inputName $value
}
}
}
if {[$group find n Interval] ne ""} {dict set paramDict interval [write::getInterval [get_domnode_attribute [$group find n Interval] v]] }
dict set processDict Parameters $paramDict
lappend bcCondsDict $processDict
}
return $bcCondsDict
}

Pfem::write::Init
12 changes: 4 additions & 8 deletions kratos.gid/apps/Pfem/write/writeProjectParameters.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ proc Pfem::write::getParametersDict { } {
dict set projectParametersDict problem_process_list $problemProcessList

##### constraints_process_list
set group_constraints [write::getConditionsParametersDict PFEM_NodalConditions "Nodal"]
set group_constraints [Pfem::write::getConditionsParametersDict PFEM_NodalConditions "Nodal"]
set body_constraints [Pfem::write::getBodyConditionsParametersDict PFEM_NodalConditions "Nodal"]
dict set projectParametersDict constraints_process_list [concat $group_constraints $body_constraints]

##### loads_process_list
dict set projectParametersDict loads_process_list [write::getConditionsParametersDict PFEM_Loads]
dict set projectParametersDict loads_process_list [Pfem::write::getConditionsParametersDict PFEM_Loads]

##### Restart
set output_process_list [GetPFEM_OutputProcessList]
Expand All @@ -48,7 +48,7 @@ proc Pfem::write::GetPFEM_ProblemDataDict { } {
dict set problemDataDict model_part_name "Main Domain"
set nDim $::Model::SpatialDimension
set nDim [expr [string range [write::getValue nDim] 0 0] ]
dict set problemDataDict domain_size $nDim
dict set problemDataDict dimension $nDim

dict set problemDataDict time_step [write::getValue PFEM_TimeParameters DeltaTime]
dict set problemDataDict start_time [write::getValue PFEM_TimeParameters StartTime]
Expand All @@ -68,7 +68,7 @@ proc Pfem::write::GetPFEM_SolverSettingsDict { } {

set solverSettingsDict [dict create]
set currentStrategyId [write::getValue PFEM_SolStrat]
set strategy_write_name [[::Model::GetSolutionStrategy $currentStrategyId] getAttribute "ImplementedInPythonFile"]
set strategy_write_name [[::Model::GetSolutionStrategy $currentStrategyId] getAttribute "python_module"]
dict set solverSettingsDict solver_type $strategy_write_name

set problemtype [write::getValue PFEM_DomainType]
Expand Down Expand Up @@ -147,7 +147,6 @@ proc Pfem::write::GetPFEM_ContactDict { } {
dict set contact_dict "help" "This process applies contact domain search by remeshing outer boundaries"
dict set contact_dict "process_name" "ContactDomainProcess"
set params [dict create]
dict set params "mesh_id" 0
dict set params "model_part_name" "model_part_name"
dict set params "meshing_control_type" "step"
dict set params "meshing_frequency" 1.0
Expand Down Expand Up @@ -223,7 +222,6 @@ proc Pfem::write::GetPFEM_RemeshDict { } {
set bodyDict [dict create ]
set body_name [dict get $body body_name]
dict set bodyDict "python_module" "meshing_domain"
dict set bodyDict "mesh_id" 0
dict set bodyDict "model_part_name" $body_name
dict set bodyDict "alpha_shape" 2.4
dict set bodyDict "offset_factor" 0.0
Expand Down Expand Up @@ -337,7 +335,6 @@ proc Pfem::write::GetPFEM_FluidRemeshDict { } {
foreach body $bodies_list {
set bodyDict [dict create ]
set body_name [dict get $body body_name]
dict set bodyDict "mesh_id" 0
dict set bodyDict "model_part_name" $body_name
dict set bodyDict "python_module" "fluid_meshing_domain"
set nDim $::Model::SpatialDimension
Expand Down Expand Up @@ -571,7 +568,6 @@ proc Pfem::write::getBodyConditionsParametersDict {un {condition_type "Condition
set process [::Model::GetProcess $processName]
set processDict [dict create]
set paramDict [dict create]
dict set paramDict mesh_id 0
dict set paramDict model_part_name $bodyId
set vatiable_name [$condition getAttribute VariableName]
dict set paramDict variable_name [lindex $vatiable_name 0]
Expand Down
4 changes: 2 additions & 2 deletions kratos.gid/apps/Pfem/xml/ConstitutiveLaws.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ConstitutiveLaws>
<!--linear elastic laws-->
<CLaw n="Newtonian" pn="Newtonian" ProductionReady="ProductionReady" help="Newtonian fluid" App="Pfem" ImplementedInApplication="PfemFluidDynamicsApplication">
<CLaw n="Newtonian" pn="Newtonian" ProductionReady="ProductionReady" help="Newtonian fluid" App="Pfem" kratos_module="PfemFluidDynamicsApplication">
<inputs>
<parameter n="DENSITY" pn="Density" unit_magnitude="Density" units="kg/m^3" v="1000"/>
<parameter n="VISCOSITY" pn="Dynamic viscosity" unit_magnitude="P*T" units="Pa*s" v="1e-3" help="Set the dynamic viscosity."/>
Expand All @@ -10,7 +10,7 @@
<outputs>
</outputs>
</CLaw>
<CLaw n="Hypoelastic" pn="Hypoelastic" ProductionReady="ProductionReady" help="Hypoelastic solid" App="Pfem" ImplementedInApplication="PfemFluidDynamicsApplication">
<CLaw n="Hypoelastic" pn="Hypoelastic" ProductionReady="ProductionReady" help="Hypoelastic solid" App="Pfem" kratos_module="PfemFluidDynamicsApplication">
<inputs>
<parameter n="DENSITY" pn="Density" unit_magnitude="Density" units="kg/m^3" v="1000"/>
<parameter n="YOUNG_MODULUS" pn="Young modulus" unit_magnitude="P" units="Pa" v="2.1e+11" help="Set the Young modulus."/>
Expand Down
Loading