Skip to content

ASTE Turbine Tutorial #244

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

Merged
merged 30 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
36f4a19
Add turbine blade tutorials for ASTE
kursatyurt Nov 29, 2021
8824886
Add clean script
kursatyurt Nov 29, 2021
e4c3ace
Add permalink
kursatyurt Nov 29, 2021
0aed83a
Rename folder
kursatyurt Nov 29, 2021
a5e10b4
Fix markdown
kursatyurt Nov 29, 2021
dc09b0a
Update language
kursatyurt Nov 29, 2021
eb1d7f8
Remove verbosity from extraction
kursatyurt Nov 29, 2021
d89d961
Use more compact script
kursatyurt Nov 29, 2021
fe43e4c
Add line to end for GitHub
kursatyurt Nov 29, 2021
a566003
Rmove config xml file comments
kursatyurt Nov 30, 2021
1d92bb4
Merge branch 'aste_tutorial' of github.com:kursatyurt/tutorials into …
kursatyurt Nov 30, 2021
90cec2e
Update readme
kursatyurt Nov 30, 2021
6a01ee2
Remove ./ from scripts since they are in the path
kursatyurt Dec 1, 2021
d4d27fa
Expand cleaning script
kursatyurt Dec 1, 2021
d37981e
Update run.sh for new CLI
kursatyurt Jan 7, 2022
422c5a5
Fix MDLint
kursatyurt Jan 7, 2022
9cadd82
Update aste-turbine/precice.xml
kursatyurt Jan 29, 2022
84202e3
Change filename
kursatyurt Apr 24, 2022
cf024a1
Add recovery data
kursatyurt Apr 24, 2022
b766360
Merge branch 'precice:master' into aste_tutorial
kursatyurt Apr 24, 2022
0cde7d0
Update aste-turbine/README.md
kursatyurt Apr 24, 2022
a3dd5cf
Update aste-turbine/README.md
kursatyurt Apr 24, 2022
06e9587
Change to eggholder function
kursatyurt Apr 24, 2022
8c9552c
Fix for cleaning
kursatyurt Apr 24, 2022
83b9c95
test meshes exist
kursatyurt Apr 24, 2022
ec2aeb5
Update README
kursatyurt Apr 24, 2022
2874b70
Merge branches 'aste_tutorial' and 'aste_tutorial' of github.com:kurs…
kursatyurt Apr 24, 2022
8a773c4
Adapt naming convention
kursatyurt Apr 24, 2022
e61e05c
Fix typo
kursatyurt Apr 25, 2022
56e15e9
Config typo fix
kursatyurt Apr 25, 2022
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
29 changes: 29 additions & 0 deletions aste-turbine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: ASTE (Artificial Solver Testing Environment) Turbine Tutorial
permalink: tutorials-aste-turbine.html
keywords: ASTE, Testing, Turbine
summary: This tutorial is an example case for ASTE, showcasing basic features and usage of ASTE.
---

{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/aste-turbine). Read how in the [tutorials introduction](https://precice.org/tutorials.html)." %}

## Setup

This case is a simple usage scenario for ASTE. Some features demonstrated by this tutorial:

* Mapping from a fine grid (`0.009.vtk`) to a coarse grid (`0.01.vtk`).
* Usage of ASTE partitioner.
* Usage of ASTE mesh joiner.
* Usage of ASTE calculator for calculating a function on a given mesh.
* Usage of ASTE.

## Running ASTE

Run the `run.sh` script. It performs the following steps:

* Downloads the meshes from preCICE repository.
* Using `vtk_calculator.py` script, calculates function `eggholder` on a finer grid.
* Using `partition_mesh.py` script, partitions the coarse and fine mesh into 2 domains.
* Using `preciceMap` executable, maps the data from the fine grid to the coarse grid.
* Using `join_mesh.py`script, joins the result meshes into a final mesh.
* Using ``vtk_calculator.py` script, calculates difference between mapped and original function on coarse grid.
1 change: 1 addition & 0 deletions aste-turbine/clean-tutorial.sh
53 changes: 53 additions & 0 deletions aste-turbine/precice-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0"?>

<precice-configuration>

<log>
<sink
filter="%Severity% > debug and %Rank% = 0"
format="---[precice] %ColorizedSeverity% %Message%"
enabled="true" />
</log>

<solver-interface dimensions="3">

<data:scalar name="Data" />

<mesh name="A-Mesh">
<use-data name="Data" />
</mesh>

<mesh name="B-Mesh">
<use-data name="Data" />
</mesh>

<m2n:sockets from="A" to="B" exchange-directory="." />

<participant name="A">
<use-mesh name="A-Mesh" provide="yes" />
<write-data name="Data" mesh="A-Mesh" />
</participant>

<participant name="B">
<use-mesh name="A-Mesh" provide="no" from="A" />
<use-mesh name="B-Mesh" provide="yes" />
<read-data name="Data" mesh="B-Mesh" />

<mapping:nearest-neighbor constraint="consistent" direction="read" from="A-Mesh" to="B-Mesh" />
<!-- <mapping:nearest-projection constraint="consistent" direction="read" from="A-Mesh" to="B-Mesh" /> -->
<!-- <mapping:rbf-gaussian shape-parameter="4" constraint="consistent" direction="read" from="A-Mesh" to="B-Mesh" x-dead="false" y-dead="false" z-dead="false" /> -->
<!-- <mapping:rbf-gaussian shape-parameter="5600" solver-rtol="1e-9" constraint="consistent" direction="read" from="A-Mesh" to="B-Mesh" x-dead="true" y-dead="false" z-dead="false" polynomial="separate" preallocation="tree"/> -->
<!-- <mapping:rbf-volume-splines solver-rtol="1e-9" constraint="consistent" direction="read" from="A-Mesh" to="B-Mesh" x-dead="false" y-dead="false" z-dead="false" /> -->
<!-- <export:vtk every-n-time-windows="1" directory="vtkB/" normals="0"/> -->
</participant>

<coupling-scheme:parallel-explicit>
<participants first="A" second="B" />
<max-time value="1.0" />
<time-window-size value="1" />
<exchange data="Data" mesh="A-Mesh" from="A" to="B" />
</coupling-scheme:parallel-explicit>

</solver-interface>

</precice-configuration>
34 changes: 34 additions & 0 deletions aste-turbine/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -e -x

# This script assumes the ASTE binaries and python scripts are in $PATH or ASTE installed on your system

# Download the meshes
test -f meshes.tar.gz || wget https://gitlab.lrz.de/precice/precice2-ref-paper-setup/-/raw/main/meshes/meshes.tar.gz

# Extract the meshes
test -f 0.009.vtk -a 0.01.vtk ||tar -xf meshes.tar.gz

# Calculate on fine mesh
vtk_calculator.py -m 0.009.vtk -f "eggholder3d" -d "EggHolder"

# Decompose both meshes to two procesors
# Choose resolution 0.009 mesh as fine mesh
partition_mesh.py -m 0.009.vtk -n 2 -o fine_mesh --dir fine_mesh --algorithm topology
# Choose resolution 0.01 mesh as coarse mesh
partition_mesh.py -m 0.01.vtk -n 2 -o coarse_mesh --dir coarse_mesh --algorithm topology

# The result directory of preciceMap needs to exist beforehand
mkdir -p mapped

# Map from the finer mesh to coarser mesh
mpirun -n 2 preciceMap -v -p A --mesh fine_mesh/fine_mesh --data "EggHolder" &
mpirun -n 2 preciceMap -v -p B --mesh coarse_mesh/coarse_mesh --output mapped/mapped --data "InterpolatedData"

# Join the output files together to result.vtk,
# Recovery cannot be used since GlobalID's are not exist in mapped mesh
join_mesh.py -m mapped/mapped -o result.vtk --recovery coarse_mesh/coarse_mesh_recovery.json

# Measure the difference between the original function and the mapped values
# Save into data array called difference
vtk_calculator.py -m result.vtk -f "eggholder3d" -d difference --diffdata "InterpolatedData" --diff --stats
4 changes: 4 additions & 0 deletions tools/clean-tutorial-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ set -e -u
. ../tools/cleaning-tools.sh

clean_tutorial .
clean_aste
clean_precice_logs .
rm -fv *.log

9 changes: 9 additions & 0 deletions tools/cleaning-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ clean_su2() {
)
}

clean_aste() {
(
set -e -u
echo "--- Cleaning up ASTE results"
rm -fv result.vtk result.stats.json
rm -fvr fine_mesh coarse_mesh mapped
)
}

clean_dune() {
(
set -e -u
Expand Down