Skip to content

Commit

Permalink
Merge pull request #40 from dominik-kern/example_optimize_coupling_sc…
Browse files Browse the repository at this point in the history
…heme_parameter

add example optimize coupling scheme parameter
  • Loading branch information
joergbuchwald authored Feb 12, 2022
2 parents 073ec1e + c3d6c68 commit 4baa492
Show file tree
Hide file tree
Showing 12 changed files with 648 additions and 7 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,10 @@ df = model.parse_out("examples/out_thm.log")

which returns a pandas dataframe.

## 5. FAQ/Troubleshooting
## 5. Examples
There are examples that have been used in OGS workflows and may be generalized to other use cases
- generating an input file (prj) from a file template by reading parameters from a data file (csv),
- finding the optimal coupling scheme parameter for the staggered scheme.

## 6. FAQ/Troubleshooting
- _OGS exectution fails and nothing is written to the logfile._ Please check whether OGS is executed correctly from the terminal. A common issue is related to the fact that the interactive python environment differs from the environment in the terminal. Usually, this can be fixed by setting the required environment variables via a wrapper command. E.g., `model.run_model(wrapper="source /opt/intel/oneapi/setvars.sh intel64 &&")`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
<?xml version='1.0' encoding='ISO-8859-1'?>
<OpenGeoSysProject>
<meshes>
<mesh>mesh_domain.vtu</mesh>
<mesh>mesh_production.vtu</mesh>
<mesh>mesh_injection.vtu</mesh>
<mesh>mesh_top.vtu</mesh>
<mesh>mesh_bottom.vtu</mesh>
<mesh>mesh_left.vtu</mesh>
<mesh>mesh_right.vtu</mesh>
</meshes>
<processes>
<process>
<name>InjectionProduction1D</name>
<type>HYDRO_MECHANICS</type>
<coupling_scheme>staggered</coupling_scheme>
<coupling_scheme_parameter> 0.336 </coupling_scheme_parameter>
<integration_order>3</integration_order>
<dimension>2</dimension>
<constitutive_relation>
<type>LinearElasticIsotropic</type>
<youngs_modulus>E</youngs_modulus>
<poissons_ratio>nu</poissons_ratio>
</constitutive_relation>
<process_variables>
<pressure>pressure</pressure>
<displacement>displacement</displacement>
</process_variables>
<secondary_variables>
<secondary_variable internal_name="sigma" output_name="sigma"/>
<secondary_variable internal_name="epsilon" output_name="epsilon"/>
<secondary_variable internal_name="velocity" output_name="velocity"/>
</secondary_variables>
<specific_body_force>0 0</specific_body_force>
</process>
</processes>
<media>
<medium>
<phases>
<phase>
<type>Gas</type>
<properties>
<property>
<name>viscosity</name>
<type>Constant</type>
<value>1.0e-3</value>
</property>
<property>
<name>density</name>
<type>Linear</type>
<reference_value>1.0e3</reference_value>
<independent_variable>
<variable_name>phase_pressure</variable_name>
<reference_condition>2.125e6</reference_condition>
<slope>2.75e-8</slope>
</independent_variable>
</property>
</properties>
</phase>
<phase>
<type>Solid</type>
<properties>
<property>
<name>density</name>
<type>Constant</type>
<value>3.0e3</value>
</property>
</properties>
</phase>
</phases>
<properties>
<property>
<name>porosity</name>
<type>Constant</type>
<value>0.3</value>
</property>
<property>
<name>biot_coefficient</name>
<type>Constant</type>
<value>1.0</value>
</property>
<property>
<name>reference_temperature</name>
<type>Constant</type>
<value>293.15</value>
</property>
<property>
<name>permeability</name>
<type>Constant</type>
<value>493.5e-16</value>
</property>
</properties>
</medium>
</media>
<time_loop>
<global_process_coupling>
<max_iter> 100 </max_iter>
<convergence_criteria>
<!-- convergence criterion for the first process -->
<convergence_criterion>
<type>DeltaX</type>
<norm_type>NORM2</norm_type>
<abstol>1.e-6</abstol>
</convergence_criterion>
<!-- convergence criterion for the second process -->
<convergence_criterion>
<type>DeltaX</type>
<norm_type>NORM2</norm_type>
<abstol>1.e-12</abstol>
</convergence_criterion>
</convergence_criteria>
</global_process_coupling>

<processes>
<!--For the equations of hydraulics-->
<process ref="InjectionProduction1D">
<nonlinear_solver>basic_newton_p</nonlinear_solver>
<convergence_criterion>
<type>DeltaX</type>
<norm_type>NORM2</norm_type>
<abstol> 1e-8 </abstol>
</convergence_criterion>
<time_discretization>
<type>BackwardEuler</type>
</time_discretization>
<time_stepping>
<type>FixedTimeStepping</type>
<t_initial>0</t_initial>
<t_end>86.4e4</t_end>
<timesteps>
<pair>
<repeat>10</repeat>
<delta_t>86.4e3</delta_t>
</pair>
</timesteps>
</time_stepping>
</process>
<!--For the equations of deformation-->
<process ref="InjectionProduction1D">
<nonlinear_solver>basic_newton_u</nonlinear_solver>
<convergence_criterion>
<type>PerComponentDeltaX</type>
<norm_type>NORM2</norm_type>
<abstols> 1e-14 1e-14 </abstols>
</convergence_criterion>
<time_discretization>
<type>BackwardEuler</type>
</time_discretization>
<time_stepping>
<type>FixedTimeStepping</type>
<t_initial>0</t_initial>
<t_end>86.4e4</t_end>
<timesteps>
<pair>
<repeat>10</repeat>
<delta_t>86.4e3</delta_t>
</pair>
</timesteps>
</time_stepping>
</process>
</processes>
<output>
<type>VTK</type>
<prefix>InjectionProduction1D</prefix>
<variables>
<variable>displacement</variable>
<variable>pressure</variable>
<variable>sigma</variable>
<variable>epsilon</variable>
<variable>velocity</variable>
</variables>
<suffix>_ts_{:timestep}_t_{:time}</suffix>
</output>
</time_loop>
<parameters>
<!-- Mechanics -->
<parameter>
<name>E</name>
<type>Constant</type>
<value>300.0e6</value>
</parameter>
<parameter>
<name>nu</name>
<type>Constant</type>
<value>0.0</value>
</parameter>
<!-- Model parameters -->
<parameter>
<name>zero_vector_2d</name>
<type>Constant</type>
<values>0 0</values>
</parameter>
<parameter>
<name>pressure_ic</name>
<type>Constant</type>
<values>2.125e6</values>
</parameter>
<parameter>
<name>dirichlet0</name>
<type>Constant</type>
<value>0</value>
</parameter>
<parameter>
<name>overburden</name>
<type>Constant</type>
<value>-2.125e6</value>
</parameter>
<parameter>
<name>source_term_production</name>
<type>Constant</type>
<value>-1.16e-4</value>
</parameter>
<parameter>
<name>source_term_injection</name>
<type>Constant</type>
<value>1.16e-4</value>
</parameter>
</parameters>
<process_variables>
<process_variable>
<name>pressure</name>
<components>1</components>
<order>1</order>
<initial_condition>pressure_ic</initial_condition>
<source_terms>
<source_term>
<mesh>mesh_production</mesh>
<type>Volumetric</type>
<parameter>source_term_production</parameter>
</source_term>
<source_term>
<mesh>mesh_injection</mesh>
<type>Volumetric</type>
<parameter>source_term_injection</parameter>
</source_term>
</source_terms>
</process_variable>
<process_variable>
<name>displacement</name>
<components>2</components>
<order>2</order>
<initial_condition>zero_vector_2d</initial_condition>
<boundary_conditions>
<boundary_condition>
<mesh>mesh_left</mesh>
<type>Dirichlet</type>
<component>0</component>
<parameter>dirichlet0</parameter>
</boundary_condition>
<boundary_condition>
<mesh>mesh_right</mesh>
<type>Dirichlet</type>
<component>0</component>
<parameter>dirichlet0</parameter>
</boundary_condition>
<boundary_condition>
<mesh>mesh_bottom</mesh>
<type>Dirichlet</type>
<component>1</component>
<parameter>dirichlet0</parameter>
</boundary_condition>
<boundary_condition>
<mesh>mesh_top</mesh>
<type>Neumann</type>
<component>1</component>
<parameter>overburden</parameter>
</boundary_condition>
</boundary_conditions>
</process_variable>
</process_variables>
<nonlinear_solvers>
<nonlinear_solver>
<name>basic_newton_p</name>
<type>Newton</type>
<max_iter>100</max_iter>
<linear_solver>linear_solver_p</linear_solver>
</nonlinear_solver>
<nonlinear_solver>
<name>basic_newton_u</name>
<type>Newton</type>
<max_iter>100</max_iter>
<linear_solver>linear_solver_u</linear_solver>
</nonlinear_solver>
</nonlinear_solvers>
<linear_solvers>
<linear_solver>
<name>linear_solver_p</name>
<eigen>
<solver_type>SparseLU</solver_type>
<precon_type>DIAGONAL</precon_type>
</eigen>
</linear_solver>
<linear_solver>
<name>linear_solver_u</name>
<eigen>
<solver_type>SparseLU</solver_type>
<precon_type>DIAGONAL</precon_type>
</eigen>
</linear_solver>
</linear_solvers>
</OpenGeoSysProject>
27 changes: 27 additions & 0 deletions examples/optimize_coupling_scheme_parameter/mesh_bottom.vtu
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="1.0" byte_order="LittleEndian" header_type="UInt64">
<UnstructuredGrid>
<Piece NumberOfPoints="3" NumberOfCells="1" >
<PointData>
<DataArray type="UInt64" Name="bulk_node_ids" format="appended" RangeMin="0" RangeMax="47" offset="0" />
<DataArray type="Int64" Name="vtkOriginalPointIds" format="appended" RangeMin="0" RangeMax="47" offset="44" />
</PointData>
<CellData>
<DataArray type="UInt64" Name="bulk_element_ids" format="appended" RangeMin="0" RangeMax="0" offset="88" />
<DataArray type="UInt64" Name="bulk_face_ids" format="appended" RangeMin="0" RangeMax="0" offset="112" />
<DataArray type="Int64" Name="vtkOriginalCellIds" format="appended" RangeMin="0" RangeMax="0" offset="136" />
</CellData>
<Points>
<DataArray type="Float64" Name="Points" NumberOfComponents="3" format="appended" RangeMin="0" RangeMax="10" offset="160" />
</Points>
<Cells>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="268" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="312" />
<DataArray type="UInt8" Name="types" format="appended" RangeMin="" RangeMax="" offset="336" />
</Cells>
</Piece>
</UnstructuredGrid>
<AppendedData encoding="base64">
_GAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAALwAAAAAAAAA=GAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAALwAAAAAAAAA=CAAAAAAAAAAAAAAAAAAAAA==CAAAAAAAAAAAAAAAAAAAAA==CAAAAAAAAAAAAAAAAAAAAA==SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUQAAAAAAAAAAAAAAAAAAAAAA=GAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAgAAAAAAAAA=CAAAAAAAAAADAAAAAAAAAA==AQAAAAAAAAAV
</AppendedData>
</VTKFile>
22 changes: 22 additions & 0 deletions examples/optimize_coupling_scheme_parameter/mesh_domain.vtu
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="1.0" byte_order="LittleEndian" header_type="UInt64">
<UnstructuredGrid>
<Piece NumberOfPoints="78" NumberOfCells="15" >
<PointData>
</PointData>
<CellData>
</CellData>
<Points>
<DataArray type="Float64" Name="Points" NumberOfComponents="3" format="appended" RangeMin="0" RangeMax="150.33296378" offset="0" />
</Points>
<Cells>
<DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="2508" />
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="3800" />
<DataArray type="UInt8" Name="types" format="appended" RangeMin="" RangeMax="" offset="3972" />
</Cells>
</Piece>
</UnstructuredGrid>
<AppendedData encoding="base64">
_UAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACRAAAAAAAAAAAAAAAAAAAAkQAAAAAAAACRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADRAAAAAAAAAAAAAAAAAAAAkQAAAAAAAADRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD5AAAAAAAAAAAAAAAAAAAAkQAAAAAAAAD5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAERAAAAAAAAAAAAAAAAAAAAkQAAAAAAAAERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAElAAAAAAAAAAAAAAAAAAAAkQAAAAAAAAElAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE5AAAAAAAAAAAAAAAAAAAAkQAAAAAAAAE5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAgFFAAAAAAAAAAAAAAAAAAAAkQAAAAAAAgFFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFRAAAAAAAAAAAAAAAAAAAAkQAAAAAAAAFRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgFZAAAAAAAAAAAAAAAAAAAAkQAAAAAAAgFZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFlAAAAAAAAAAAAAAAAAAAAkQAAAAAAAAFlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgFtAAAAAAAAAAAAAAAAAA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