Skip to content

Commit

Permalink
Merge branch 'master' into feature/add-pfem-fluid-thermic
Browse files Browse the repository at this point in the history
  • Loading branch information
jginternational committed Feb 10, 2022
2 parents e2e4d3d + d8606ea commit 91b4cbe
Show file tree
Hide file tree
Showing 734 changed files with 17,631 additions and 18,203 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
*.lnk

# Kratos execution folder
kratos.gid/exec/*
!kratos.gid/exec/README.md
kratos.gid/exec/Kratos*
# !kratos.gid/exec/README.md
!kratos.gid/exec/MainKratos.py
*.orig
.vscode/

custom_tools/*
.DS_Store
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
# GiDInterface
# KratosMultiphysics <-> GiD Interface

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/07a116949d2a437eb99b1423a18ecdb6)](https://app.codacy.com/app/jginternational/GiDInterface?utm_source=github.com&utm_medium=referral&utm_content=KratosMultiphysics/GiDInterface&utm_campaign=badger)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/36d3d305c87e4bb398bc87ea2e3b890e)](https://www.codacy.com/gh/KratosMultiphysics/GiDInterface/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=KratosMultiphysics/GiDInterface&amp;utm_campaign=Badge_Grade)

The interface of Kratos with [GiD](http://www.gidhome.com).
The user interface of Kratos with [GiD](http://www.gidhome.com).

If you need the latest release, launch your GiD, navigate to Data > Problemtype > Internet retrieve and download Kratos there. If you need the developer version, you are on the right place
If you need the latest stable release, launch your GiD, navigate to Data > Problemtype > Internet retrieve and download Kratos there.
Available for Linux. Windows, and macOS.

If you need the developer version, you are on the right place.

## First steps
* Install the latest GiD developer version -> [Developer version](http://www.gidhome.com/download/developer-versions)
* Navigate to GiD's problemtype folder and delete kratos.gid
* Create there a link to our [kratos.gid](./kratos.gid/)
* Navigate to kratos.gid/exec/
* Create there a symbolic link to the kratos installation folder (where runkratos is located)
* Unix : `ln -s ~/Kratos Kratos` or maybe `ln -s ~/Kratos/bin/Release Kratos` if that's the destination folder
* Windows : `mklink /J Kratos C:\kratos` or maybe `mklink /J Kratos C:\kratos\bin\Release` (choose actual Kratos installation folder)
* 1- Clone this repository, or install a stable [release](https://github.com/KratosMultiphysics/GiDInterface/releases)
* 2- Install the latest GiD developer version -> [Developer version](http://www.gidhome.com/download/developer-versions)
* 3- Navigate to GiD's problemtype folder and delete any previous kratos.gid
* Create there a link to our [kratos.gid](./kratos.gid/) downloaded in step 1
* Windows: Simple shortcut to kratos.gid folder
* 4- Navigate to kratos.gid/exec/
* Create there a symbolic link to the kratos installation folder (where runkratos is located)
* Unix : `ln -s ~/Kratos Kratos` or maybe `ln -s ~/Kratos/bin/Release Kratos` if that's the destination folder
* Windows : `mklink /J Kratos C:\kratos\bin\Release` (choose actual Kratos installation folder)

### Step by step video
https://www.youtube.com/watch?v=zZq7ypDdudo

## Launch modea
In Kratos preferences, select the execution mode:
* Pip packages: Kratos will be installed via `pip install`
* local compiled: If you are a developer and build your applications, use this one

## Usage
* Run GiD
* Go to: Data / Problem type / kratos
* kratos top menu / Developer mode (recommended)

### Examples
* [Fluid dynamics example](https://github.com/KratosMultiphysics/Kratos/wiki/Running-an-example-from-GiD#3-set-a-fluid-dynamics-problem)
* [Structural mechanics example](https://github.com/KratosMultiphysics/Kratos/wiki/Running-an-example-from-GiD#4-set-a-structural-mechanics-problem)
* [Fluid-Structure interaction example](https://github.com/KratosMultiphysics/Kratos/wiki/Running-an-example-from-GiD#5-set-a-fluid-structure-interaction-problem)
Expand Down
44 changes: 44 additions & 0 deletions kratos.gid/apps/Buoyancy/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"id": "Buoyancy",
"name": "Buoyancy",
"prefix": "Buoyancy_",
"themed": false,
"kratos_name": "Buoyancyapplication",
"python_packages": [
"KratosFluidDynamicsApplication",
"KratosConvectionDiffusionApplication"
],
"dimensions": [
"2D",
"3D"
],
"script_files": [
"start.tcl",
"examples/examples.tcl",
"examples/HeatedSquare.tcl",
"xml/XmlController.tcl",
"write/write.tcl",
"write/writeProjectParameters.tcl"
],
"start_script": "::Buoyancy::Init",
"requeriments": {
"apps": [
"Fluid",
"ConvectionDiffusion"
],
"minimum_gid_version": "15.1.3d"
},
"permissions": {
"open_tree": true,
"show_toolbar": true,
"intervals": true,
"wizard": false
},
"write": {
"coordinates": "all",
"properties_location": "json",
"model_part_name": "ThermalModelPart"
},
"main_launch_file": "../../exec/MainKratos.py",
"examples": "examples/examples.xml"
}
45 changes: 17 additions & 28 deletions kratos.gid/apps/Buoyancy/examples/HeatedSquare.tcl
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
namespace eval ::Buoyancy::examples::HeatedSquare {
namespace path ::Buoyancy::examples
Kratos::AddNamespace [namespace current]
}

proc ::Buoyancy::examples::HeatedSquare {args} {
proc ::Buoyancy::examples::HeatedSquare::Init {args} {
if {![Kratos::IsModelEmpty]} {
set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
if { $retval == "cancel" } { return }
}
DrawSquareGeometry$::Model::SpatialDimension
AssignSquareGeometryMeshSizes$::Model::SpatialDimension
DrawGeometry$::Model::SpatialDimension
AssignMeshSizes$::Model::SpatialDimension
AssignGroups$::Model::SpatialDimension
TreeAssignation$::Model::SpatialDimension

Expand All @@ -18,14 +22,14 @@ proc ::Buoyancy::examples::HeatedSquare {args} {


# Draw Geometry
proc Buoyancy::examples::DrawSquareGeometry3D {args} {
proc ::Buoyancy::examples::HeatedSquare::DrawGeometry3D {args} {
# DrawSquareGeometry2D
# GiD_Process Mescape Utilities Copy Surfaces Duplicate DoExtrude Volumes MaintainLayers Translation FNoJoin 0.0,0.0,0.0 FNoJoin 0.0,0.0,1.0 1 escape escape escape
# GiD_Layers edit opaque Fluid 0

# GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate obj x -150 y -30 escape escape
# GiD_Process escape escape 'Render Flat escape 'Rotate Angle 270 90 escape escape escape escape 'Rotate objaxes x -150 y -30 escape escape
}
proc Buoyancy::examples::DrawSquareGeometry2D {args} {
proc ::Buoyancy::examples::HeatedSquare::DrawGeometry2D {args} {
Kratos::ResetModel
GiD_Layers create Fluid
GiD_Layers edit to_use Fluid
Expand Down Expand Up @@ -53,18 +57,18 @@ proc Buoyancy::examples::DrawSquareGeometry2D {args} {
}

# Mesh sizes assign
proc Buoyancy::examples::AssignSquareGeometryMeshSizes2D {args} {
proc ::Buoyancy::examples::HeatedSquare::AssignMeshSizes2D {args} {
set default_mesh_size 0.0125
GiD_Process Mescape Meshing AssignSizes Surfaces $default_mesh_size 1 escape escape
GiD_Process Mescape Meshing AssignSizes Lines $default_mesh_size 1 2 3 4 escape escape
}

proc Buoyancy::examples::AssignSquareGeometryMeshSizes3D {args} {
proc ::Buoyancy::examples::HeatedSquare::AssignMeshSizes3D {args} {
# To be implemented
}

# Group assign
proc Buoyancy::examples::AssignGroups2D {args} {
proc ::Buoyancy::examples::HeatedSquare::AssignGroups2D {args} {
# Create the groups
GiD_Groups create Fluid
GiD_Groups edit color Fluid "#26d1a8ff"
Expand All @@ -91,7 +95,7 @@ proc Buoyancy::examples::AssignGroups2D {args} {
GiD_EntitiesGroups assign Pressure point 1

}
proc Buoyancy::examples::AssignGroups3D {args} {
proc ::Buoyancy::examples::HeatedSquare::AssignGroups3D {args} {
# Create the groups
# GiD_Groups create Fluid
# GiD_Groups edit color Fluid "#26d1a8ff"
Expand All @@ -115,11 +119,11 @@ proc Buoyancy::examples::AssignGroups3D {args} {
}

# Tree assign
proc Buoyancy::examples::TreeAssignation3D {args} {
proc ::Buoyancy::examples::HeatedSquare::TreeAssignation3D {args} {
# TreeAssignationCylinderInFlow2D
# AddCuts
}
proc Buoyancy::examples::TreeAssignation2D {args} {
proc ::Buoyancy::examples::HeatedSquare::TreeAssignation2D {args} {
set nd $::Model::SpatialDimension
set root [customlib::GetBaseRoot]

Expand All @@ -133,7 +137,7 @@ proc Buoyancy::examples::TreeAssignation2D {args} {
# Fluid Parts
set fluidParts [spdAux::getRoute "FLParts"]
set fluidNode [customlib::AddConditionGroupOnXPath $fluidParts Fluid]
set props [list Element Monolithic$nd ConstitutiveLaw Newtonian DENSITY 1.2039 DYNAMIC_VISCOSITY 0.000587 CONDUCTIVITY 0.83052 SPECIFIC_HEAT 1004.84]
set props [list Element QSVMS$nd ConstitutiveLaw Newtonian2DLaw DENSITY 1.2039 DYNAMIC_VISCOSITY 0.000587 CONDUCTIVITY 0.83052 SPECIFIC_HEAT 1004.84]
spdAux::SetValuesOnBaseNode $fluidNode $props

set fluidConditions [spdAux::getRoute "FLBC"]
Expand Down Expand Up @@ -189,18 +193,3 @@ proc Buoyancy::examples::TreeAssignation2D {args} {

spdAux::RequestRefresh
}

proc Buoyancy::examples::ErasePreviousIntervals { } {
set root [customlib::GetBaseRoot]
set interval_base [spdAux::getRoute "Intervals"]
foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] {
if {[$int @name] ni [list Initial Total Custom1]} {$int delete}
}
}

proc Buoyancy::examples::AddCuts { } {
# Cuts
set results "[spdAux::getRoute Results]/container\[@n='GiDOutput'\]"
set cp [[customlib::GetBaseRoot] selectNodes "$results/container\[@n = 'CutPlanes'\]/blockdata\[@name = 'CutPlane'\]"]
[$cp selectNodes "./value\[@n = 'point'\]"] setAttribute v "0.0,0.5,0.0"
}
26 changes: 15 additions & 11 deletions kratos.gid/apps/Buoyancy/examples/examples.tcl
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
namespace eval Buoyancy::examples {

}

proc Buoyancy::examples::Init { } {
uplevel #0 [list source [file join $::Buoyancy::dir examples HeatedSquare.tcl]]
namespace eval ::Buoyancy::examples {
namespace path ::Buoyancy
Kratos::AddNamespace [namespace current]
}

proc Buoyancy::examples::UpdateMenus { } {
GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter =
GiDMenu::InsertOption "Kratos" [list "Heated square" ] 8 PRE [list ::Buoyancy::examples::HeatedSquare] "" "" insertafter =
GiDMenu::UpdateMenus
proc ::Buoyancy::examples::ErasePreviousIntervals { } {
set root [customlib::GetBaseRoot]
set interval_base [spdAux::getRoute "Intervals"]
foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] {
if {[$int @name] ni [list Initial Total Custom1]} {$int delete}
}
}

Buoyancy::examples::Init
proc ::Buoyancy::examples::AddCuts { } {
# Cuts
set results "[spdAux::getRoute Results]/container\[@n='GiDOutput'\]"
set cp [[customlib::GetBaseRoot] selectNodes "$results/container\[@n = 'CutPlanes'\]/blockdata\[@name = 'CutPlane'\]"]
[$cp selectNodes "./value\[@n = 'point'\]"] setAttribute v "0.0,0.5,0.0"
}
6 changes: 6 additions & 0 deletions kratos.gid/apps/Buoyancy/examples/examples.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Group id="Thermic" name="Thermic examples">
<Example id="BuoyancyHeatedSquare2D" app="Buoyancy" logo="HeatedSquare2D.png" name="Buoyancy heated\nsquare 2D" dim="2D" cmd="::Buoyancy::examples::HeatedSquare::Init">
<Description></Description>
</Example>
</Group>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 0 additions & 32 deletions kratos.gid/apps/Buoyancy/python/KratosFluid.py

This file was deleted.

34 changes: 0 additions & 34 deletions kratos.gid/apps/Buoyancy/python/MainKratos.py

This file was deleted.

Loading

0 comments on commit 91b4cbe

Please sign in to comment.