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 simulation #94

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 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
4080f15
wrap for ogs simulation
tStehling Dec 11, 2024
d67c4f6
directory struct
tStehling Dec 11, 2024
56e66e0
directory struct
tStehling Dec 11, 2024
de8f8c3
.
tStehling Dec 11, 2024
24e54f4
.
tStehling Dec 11, 2024
6647a69
.
tStehling Jan 6, 2025
1fa03f0
.
tStehling Jan 13, 2025
41562aa
cleaned
tStehling Jan 15, 2025
6132c9d
macros and shed.yml changed
tStehling Jan 15, 2025
92efccf
.
tStehling Jan 15, 2025
4af5456
.
tStehling Jan 22, 2025
2f2c32c
wrap for ogs simulation
tStehling Jan 22, 2025
3a8c037
Merge branch 'Helmholtz-UFZ:main' into ogs_next
tStehling Jan 27, 2025
87a9e92
.
tStehling Feb 3, 2025
de66edb
:_
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:
- Ecology
tStehling marked this conversation as resolved.
Show resolved Hide resolved
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.
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>
117 changes: 117 additions & 0 deletions tools/ogs/ogs_simulation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<tool id="ogs_simulation" name="ogstools_ogs_simulation" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>
Runs an OGS simulation.
tStehling marked this conversation as resolved.
Show resolved Hide resolved
</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[
#import re

ln -s '$project_file' main_file.prj &&
#for $f in $project_files:
#set $identifier= re.sub(r'[^\w\-.]', '_', $f.element_identifier)
ln -s '$f' '$identifier' &&
#end for
#for $file in $xml_patch_files:
#set $identifier= re.sub(r'[^\w\-.]', '_', $file.element_identifier)
ln -s '$file' '$identifier' &&
#end for

ogs main_file.prj
#if $log_level:
--log-level '${log_level}'
#end if

#for $file in $xml_patch_files:
#set $identifier= re.sub(r'[^\w\-.]', '_', $file.element_identifier)
--xml-patch '$identifier'
#end for
-o output
]]></command>
<inputs>
<param name="project_file" format="prj" type="data" label="Project File (.prj)"/>
tStehling marked this conversation as resolved.
Show resolved Hide resolved
<param name="project_files" format="data" type="data_collection" collection_type="list" label="Project Files"/>
<param name="xml_patch_files" format="xml" type="data_collection" collection_type="list" label="XML Patch Files"/>
Comment on lines +39 to +40
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave some words (maybe in the tool help) on the correct naming of the files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct Naming?


<param name="log_level" type="select" label="Log Level" optional="true">
<option value="none">None</option>
<option value="error">Error</option>
<option value="warn">Warning</option>
<option value="info" selected="true">Info</option>
<option value="debug">Debug</option>
<option value="all">All</option>
</param>
</inputs>
<outputs>
<collection name="simulation_results" type="list" label="Simulation Results">
<discover_datasets pattern="(?P&lt;designation&gt;.*\.pvd)" directory="output" visible="true"/>
<discover_datasets pattern="(?P&lt;designation&gt;.*\.vtu)" format="vtkxml" directory="output" visible="true"/>

</collection>
</outputs>
<tests>
<test>
<param name="project_file" value="square_1e0_neumann.prj" />
<param name="project_files">
<collection type="list">
<element name="square_1x1_quad_1e0.vtu" value="square_1x1_quad_1e0.vtu"/>
<element name="square_1x1.gml" value="square_1x1.gml"/>
</collection>
</param>
<param name="xml_patch_files">
<collection type="list">
<element name="square_1e0.xml" value="square_1e0.xml" ftype="xml"/>
<element name="square_neumann.xml" value="square_neumann.xml" ftype="xml"/>
</collection>
</param>
<param name="log_level" value="info" />
<output_collection name="simulation_results" type="list" count="3">
<element name="square_1e0_neumann_neumann.pvd">
<assert_contents>
<has_text text="VTKFile type=&quot;Collection&quot;" />
<has_n_lines min="5" max="7"/>
</assert_contents>
</element>
<element name="square_1e0_neumann_neumann_ts_0_t_0.000000.vtu">
<assert_contents>
<has_text text="VTKFile type=&quot;UnstructuredGrid&quot;" />
<has_n_lines min="23" max="27"/>
</assert_contents>
</element>
<element name="square_1e0_neumann_neumann_ts_1_t_1.000000.vtu">
<assert_contents>
<has_text text="VTKFile type=&quot;UnstructuredGrid&quot;"/>
<has_n_lines min="23" max="27"/>
</assert_contents>
</element>

</output_collection>
</test>
</tests>

<help><![CDATA[
**Overview:**

This tool runs an OpenGeoSys (OGS) simulation with support for Python boundary conditions and enhanced CLI argument parsing. The simulation uses a project file and optional XML patch files to define and adjust simulation parameters dynamically.

**Inputs:**

1. **Project File:** The main project file (.prj) that defines the simulation setup.
tStehling marked this conversation as resolved.
Show resolved Hide resolved
2. **Output Directory:** The directory where the simulation results and logs will be saved. Default is `./output`.
3. **Log Level:** Sets the verbosity of logs. Options include `none`, `error`, `warn`, `info` (default), `debug`, and `all`.
4. **XML Patch Files:** Optional XML files for modifying the project file configuration at runtime.
5. **Enable Floating Point Exceptions:** Enables detection of floating-point exceptions (only for non-Windows platforms).

**Outputs:**

1. **Log File:** Contains all log messages generated during the simulation.
2. **Simulation Results:** Includes output files such as VTU and other simulation results saved in the specified output directory.
]]></help>
<expand macro="ogs_citation"/>
</tool>
125 changes: 125 additions & 0 deletions tools/ogs/test-data/square_1e0.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<OpenGeoSysProject>
<mesh>square_1x1_quad_1e0.vtu</mesh>
<geometry>square_1x1.gml</geometry>
<processes>
<process>
<name>SteadyStateDiffusion</name>
<type>STEADY_STATE_DIFFUSION</type>
<integration_order>2</integration_order>
<process_variables>
<process_variable>pressure</process_variable>
</process_variables>
<secondary_variables>
<secondary_variable internal_name="darcy_velocity" output_name="v"/>
</secondary_variables>
</process>
</processes>
<media>
<medium id="0">
<phases/>
<properties>
<property>
<name>diffusion</name>
<type>Constant</type>
<value>1</value>
</property>
<property>
<name>reference_temperature</name>
<type>Constant</type>
<value>293.15</value>
</property>
</properties>
</medium>
</media>
<time_loop>
<processes>
<process ref="SteadyStateDiffusion">
<nonlinear_solver>basic_picard</nonlinear_solver>
<convergence_criterion>
<type>DeltaX</type>
<norm_type>NORM2</norm_type>
<abstol>1.e-6</abstol>
</convergence_criterion>
<time_discretization>
<type>BackwardEuler</type>
</time_discretization>
<time_stepping>
<type>SingleStep</type>
</time_stepping>
</process>
</processes>
<output>
<type>VTK</type>
<prefix>square_1e0</prefix>
<variables>
<variable> pressure </variable>
<variable> v </variable>
</variables>
<suffix>_ts_{:timestep}_t_{:time}</suffix>
</output>
</time_loop>
<parameters>
<parameter>
<name>p0</name>
<type>Constant</type>
<value>0</value>
</parameter>
<parameter>
<name>p_Dirichlet_left</name>
<type>Constant</type>
<value>1</value>
</parameter>
<parameter>
<name>p_Dirichlet_right</name>
<type>Constant</type>
<value>-1</value>
</parameter>
</parameters>
<process_variables>
<process_variable>
<name>pressure</name>
<components>1</components>
<order>1</order>
<initial_condition>p0</initial_condition>
<boundary_conditions>
<boundary_condition>
<geometrical_set>square_1x1_geometry</geometrical_set>
<geometry>left</geometry>
<type>Dirichlet</type>
<parameter>p_Dirichlet_left</parameter>
</boundary_condition>
<boundary_condition>
<geometrical_set>square_1x1_geometry</geometrical_set>
<geometry>right</geometry>
<type>Dirichlet</type>
<parameter>p_Dirichlet_right</parameter>
</boundary_condition>
</boundary_conditions>
</process_variable>
</process_variables>
<nonlinear_solvers>
<nonlinear_solver>
<name>basic_picard</name>
<type>Picard</type>
<max_iter>10</max_iter>
<linear_solver>general_linear_solver</linear_solver>
</nonlinear_solver>
</nonlinear_solvers>
<linear_solvers>
<linear_solver>
<name>general_linear_solver</name>
<lis>-i cg -p jacobi -tol 1e-16 -maxiter 10000</lis>
<eigen>
<solver_type>CG</solver_type>
<precon_type>DIAGONAL</precon_type>
<max_iteration_step>10000</max_iteration_step>
<error_tolerance>1e-16</error_tolerance>
</eigen>
<petsc>
<prefix>gw</prefix>
<parameters>-gw_ksp_type cg -gw_pc_type bjacobi -gw_ksp_rtol 1e-16 -gw_ksp_max_it 10000</parameters>
</petsc>
</linear_solver>
</linear_solvers>
</OpenGeoSysProject>
5 changes: 5 additions & 0 deletions tools/ogs/test-data/square_1e0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<OpenGeoSysProjectDiff>
<!-- <replace sel="/*/mesh/text()">square_1x1_quad_1e0.vtu</replace> -->
<!-- <replace sel="/*/time_loop/output/prefix/text()">square_1e0</replace> -->
</OpenGeoSysProjectDiff>
Loading
Loading