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

Ogs add layer generate mesh #75

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
29da0c5
wrap for msh2vtu
tStehling Oct 8, 2024
0fc4cc6
.
tStehling Oct 8, 2024
95dceab
shp2msh wrap
tStehling Oct 11, 2024
76842bb
...
tStehling Oct 23, 2024
005f107
...
tStehling Oct 23, 2024
31e00b8
finalization of shp2msh and msh2vtu wraps
tStehling Oct 30, 2024
ef2d9e4
Delete tools/ogs_tools directory
tStehling Oct 30, 2024
cd1871f
Delete tools/msh2vtu.xml
tStehling Oct 30, 2024
ad88581
Update msh2vtu.xml
tStehling Oct 30, 2024
b5abddd
Update shp2msh.xml
tStehling Oct 30, 2024
e6c40dd
Added macros
tStehling Nov 27, 2024
c881e3d
Wrapped AddLayer tool
tStehling Dec 7, 2024
0d225d8
fixes according to comments
tStehling Dec 9, 2024
9577071
fixes on shed.yml
tStehling Dec 9, 2024
0caf414
. deleted
tStehling Dec 9, 2024
bee79e7
remove work in progress tools
tStehling Dec 11, 2024
0d21443
removed work in progress files
tStehling Dec 11, 2024
ebf243b
wrap for generateStructuredMesh
tStehling Dec 11, 2024
4d6186e
wrapped addLayer and generateStructuredMesh
tStehling Dec 11, 2024
5bff2a6
updated .shed.yml
tStehling Dec 11, 2024
39eea27
cleaned
tStehling Dec 11, 2024
cba5d0b
cleaned test-data
tStehling Dec 11, 2024
867eb5a
test
tStehling Dec 11, 2024
77427de
cleaned
tStehling Dec 11, 2024
eea91ae
changed .shed
tStehling Dec 11, 2024
484183c
directory structure
tStehling Dec 11, 2024
69e4095
...
tStehling Dec 11, 2024
1f2ed18
requirement changed
tStehling Dec 11, 2024
9fd5933
-
tStehling Dec 11, 2024
e0b02e1
-
tStehling Dec 11, 2024
899ada2
.
tStehling Jan 6, 2025
742b61d
cleaned
tStehling Jan 15, 2025
13e306a
.
tStehling Jan 15, 2025
a4543c3
.
tStehling Jan 15, 2025
1a8ea84
:
tStehling Feb 3, 2025
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
18 changes: 18 additions & 0 deletions tools/ogs/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: suite_ogs
owner: ufz
description: A suite of tools for OpenGeoSys (ogs)
long_description: |
A suite of tools for ogs
categories:
- Geo Science
remote_repository_url: https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/ogs/
homepage_url: https://gitlab.opengeosys.org/ogs/ogs
type: unrestricted
auto_tool_repositories:
name_template: "{{ tool_id }}"
description_template: A suite of tools for OpenGeoSys (ogs)
suite:
name: suite_ogs
description: A suite of tools for ogs
long_description: |
A suite of tools for ogs
77 changes: 77 additions & 0 deletions tools/ogs/addLayer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<tool id="ogs_addlayer" name="OGS AddLayer" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>
Adds a layer to an existing mesh
</description>
<macros>
<import>macros.xml</import>
<token name="@VERSION_SUFFIX@">0</token>
</macros>
<requirements>
<expand macro="ogs_requirement"/>
</requirements>
<command detect_errors="exit_code"><![CDATA[
ln -s '$input_mesh' input.vtu &&
AddLayer -i input.vtu -o output.vtu -t '$layer_thickness'
$add_layer_on_bottom
#if str($material_option.material_id) == "copy":
$copy_material_ids
#end if
#if str($material_option.material_id) == "set":
--set-material-id $material_option.set_material_id
#end if

]]></command>
<inputs>
<param name="input_mesh" type="data" format="vtkxml" label="Input Mesh File" argument="-i"/>
<param name="layer_thickness" type="float" label="Layer Thickness" argument="-t"/>
<param name="add_layer_on_bottom" type="boolean" value="false" truevalue="--add-layer-on-bottom" falsevalue="" label="Add Layer To Bottom"/>
<conditional name="material_option">
<param name="material_id" type="select" label="Material ID Option">
<option value="none" selected="true">None</option>
<option value="copy">Copy existing material IDs</option>
<option value="set">Set a specific material ID</option>
</param>
<when value="none">
</when>
<when value="copy">
<param name="copy_material_ids" type="boolean" truevalue="--copy-material-ids" falsevalue="" label="Copy/Save Material IDs"/>
</when>
<when value="set">
<param name="set_material_id" type="integer" label="Set Material IDs"/>
</when>
</conditional>
</inputs>
<outputs>
<data name="output_mesh" format="vtkxml" label="Output Mesh File" from_work_dir="output.vtu" />
</outputs>
<tests>
<test>
<param name="input_mesh" value="tm_a_quad.vtu"/>
<param name="layer_thickness" value="15.0"/>
<param name="add_layer_on_bottom" value="false"/>
<param name="material_option|material_id" value="set"/>
<param name="material_option|set_material_id" value="1"/>
<output name="output_mesh" value="tm_a_quad_with_extra_layer.vtu"/>
</test>
</tests>
<help><![CDATA[
**Overview:**

This Galaxy tool adds a new layer to an existing mesh using the OpenGeoSys library. It processes meshes in the VTU (Visualization Toolkit Unstructured Grid) format.

**Inputs:**

1. **Input Mesh File (`input_mesh`)** The VTU file containing the existing mesh to which a new layer will be added.
2. **Layer Thickness (`layer_thickness`)** Specifies the thickness of the new layer to be added. The default value is `10.0`.
3. **Add Layer to Bottom (`add_layer_on_bottom`)** If selected, the layer is added to the bottom of the mesh. Otherwise, it is added to the top.
4. **Material ID Option (`material_option`)** Determines how material IDs for the new layer are managed:
- `None`: No material ID modifications are applied.
- `Copy`: Copies existing material IDs to the new layer.
- `Set`: Sets a specific material ID for the new layer.

**Outputs:**

1. **Output Mesh File (`output_mesh`)** The resulting mesh file in VTU format with the added layer.
]]></help>
<expand macro="ogs_citation"/>
</tool>
170 changes: 170 additions & 0 deletions tools/ogs/generateStructuredMesh.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<tool id="ogs_generatestructuredmesh" name="OGS GenerateStructuredMesh" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>
Generation of simple meshes
</description>
<macros>
<import>macros.xml</import>
<token name="@VERSION_SUFFIX@">0</token>
</macros>
<requirements>
<expand macro="ogs_requirement"/>
</requirements>
<expand macro="creator"/>
<command detect_errors="exit_code"><![CDATA[
generateStructuredMesh
-o output.$output_ext
-e $element_type
#if str($length_x) != "":
--lx $length_x
#end if
#if str($length_y) != "":
--ly $length_y
#end if
#if str($length_z) != "":
--lz $length_z
#end if
#if str($subdiv_x) != "":
--nx $subdiv_x
#end if
#if str($subdiv_y) != "":
--ny $subdiv_y
#end if
#if str($subdiv_z) != "":
--nz $subdiv_z
#end if
#if str($element_length_x) != "":
--dx0 $element_length_x
#end if
#if str($element_length_y) != "":
--dy0 $element_length_y
#end if
#if str($element_length_z) != "":
--dz0 $element_length_z
#end if
#if str($max_element_length_x) != "":
--dx-max $max_element_length_x
#end if
#if str($max_element_length_y) != "":
--dy-max $max_element_length_y
#end if
#if str($max_element_length_z) != "":
--dz-max $max_element_length_z
#end if
#if str($multiplier_x) != "":
--mx $multiplier_x
#end if
#if str($multiplier_y) != "":
--my $multiplier_y
#end if
#if str($multiplier_z) != "":
--mz $multiplier_z
#end if
&& mv output.$output_ext '$output'

]]></command>
<inputs>
<param name="output_ext" type="select" label="Output File Format" argument="-o">
<option value="vtu">VTK Unstructured Grid</option>
<option value="msh">GMSH</option>
</param>
<param name="element_type" type="select" label="Element Type" argument="-e">
<option value="line">Line</option>
<option value="tri">Triangle</option>
<option value="quad">Quadrilateral</option>
<option value="hex">Hexahedron</option>
<option value="prism">Prism</option>
<option value="tet">Tetrahedron</option>
<option value="pyramid">Pyramid</option>
</param>
<param name="length_x" type="float" min="0" optional="true" label="Length in X" help="Length of the domain in the X direction.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="length_y" type="float" min="0" optional="true" label="Length in Y" help="Length of the domain in the Y direction.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="length_z" type="float" min="0" optional="true" label="Length in Z" help="Length of the domain in the Z direction.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="subdiv_x" type="integer" min="1" optional="true" label="Subdivisions in X" help="Number of subdivisions in the X direction. Overrides element length argument."/>
<param name="subdiv_y" type="integer" min="1" optional="true" label="Subdivisions in Y" help="Number of subdivisions in the Y direction. Overrides element length argument."/>
<param name="subdiv_z" type="integer" min="1" optional="true" label="Subdivisions in Z" help="Number of subdivisions in the Z direction. Overrides element length argument."/>
<param name="element_length_x" type="float" min="0" optional="true" label="Initial Element Length X" help="Initial element length in the X direction. If the value of this parameter is smaller than subdivions or maximum length parameters it gets overridden.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="element_length_y" type="float" min="0" optional="true" label="Initial Element Length Y" help="Initial element length in the Y direction. If the value of this parameter is smaller than subdivions or maximum length parameters it gets overridden.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="element_length_z" type="float" min="0" optional="true" label="Initial Element Length Z" help="Initial element length in the Z direction. If the value of this parameter is smaller than subdivions or maximum length parameters it gets overridden.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="max_element_length_x" type="float" min="0" optional="true" label="Maximum Element Length X" help="Maximum element length in the X direction. Overrides element length argument.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="max_element_length_y" type="float" min="0" optional="true" label="Maximum Element Length Y" help="Maximum element length in the Y direction. Overrides element length argument.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="max_element_length_z" type="float" min="0" optional="true" label="Maximum Element Length Z" help="Maximum element length in the Z direction. Overrides element length argument.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="multiplier_x" type="float" min="0" optional="true" label="Multiplier X" help="Multiplier for element lengths in the X direction.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="multiplier_y" type="float" min="0" optional="true" label="Multiplier Y" help="Multiplier for element lengths in the Y direction.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
<param name="multiplier_z" type="float" min="0" optional="true" label="Multiplier Z" help="Multiplier for element lengths in the Z direction.">
<validator type="in_range" min="0" exclude_min="true"/>
</param>
</inputs>
<outputs>
<data format="vtkxml" name="output" label="Format: ${output_ext}">
<change_format>
<when input="output_ext" value="msh" format="gmsh.msh"/>
</change_format>
</data>
</outputs>
<tests>
<test>
<param name="output_ext" value="vtu"/>
<param name="element_type" value="quad"/>
<param name="length_x" value="3"/>
<param name="length_y" value="4"/>
<output name="output" value="quad_3x4.vtu" ftype="vtkxml"/>
</test>
<test>
<param name="output_ext" value="msh"/>
<param name="element_type" value="hex"/>
<param name="length_x" value="4"/>
<param name="length_y" value="5"/>
<param name="length_z" value="6"/>
<param name="multiplier_x" value="0.8"/>
<param name="multiplier_y" value="1.1"/>
<param name="multiplier_z" value="2"/>
<param name="max_element_length_z" value="1"/>
<param name="element_length_y" value="0.1"/>
<param name="element_length_z" value="0.1"/>
<output name="output" value="hex_4x5x6.msh"/>
</test>
</tests>
<help><![CDATA[

**Overview:**
This tool generates structured meshes using the OpenGeoSys Mesh Generator.
Users can define the element type, dimensions, subdivisions, and other parameters to create a customized mesh.
Output data is written in the specified format (VTU/ VTK Unstructured Grid or GMSH).

**Inputs:**
1. **Output Format:** The format of the output file (.vtu or .msh)
2. **Element Type:** The type of element to create (e.g., line, triangle, quadrilateral, etc.).
3. **Length (X, Y, Z):** The length of the mesh domain in the X, Y, and Z directions.
4. **Subdivisions (X, Y, Z):** Number of subdivisions in each direction to define mesh resolution.
5. **Initial Element Length (X, Y, Z):** Initial size of the elements in the X, Y, and Z directions.
6. **Maximum Element Length (X, Y, Z):** Maximum size of elements for gradual refinement.
7. **Multiplier (X, Y, Z):** Refinement multiplier for element lengths in each direction.

**Outputs:**

**Output Mesh File:** The generated structured mesh saved as a file in the specified format.
]]></help>
<expand macro="ogs_citation"/>
</tool>
22 changes: 22 additions & 0 deletions tools/ogs/macros.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<macros>
<token name="@TOOL_VERSION@">6.5.3</token>
<token name="@PROFILE@">23.0</token>
<token name="@VERSION_SUFFIX@">0</token>

<xml name="ogs_requirement">
<requirement type="package" version="@TOOL_VERSION@">ogs</requirement>
<yield/>
</xml>

<xml name="ogs_citation">
<citations>
<citation type="doi">10.5281/zenodo.13685289</citation>
</citations>
</xml>

<xml name="creator">
<creator>
<organization name="Helmholtz Centre for Environmental Research - UFZ" url ="https://www.ufz.de/"/>
</creator>
</xml>
</macros>
Loading
Loading