├── .gitignore ├── .hgtags ├── AUTHORS.md ├── CITATION.cff ├── LICENSE.md ├── README.md ├── docs ├── Makefile ├── README.md ├── _static │ ├── docstring_main_block_formatting.png │ ├── docstring_multiline_args.png │ ├── docstring_multiline_main_block.png │ ├── docstring_multiline_multiple_returns.png │ ├── docstring_multiline_single_return.png │ ├── docstring_multiple_returns.png │ ├── tutorial_1.png │ ├── tutorial_10.png │ ├── tutorial_2.png │ ├── tutorial_3.png │ ├── tutorial_4_a.png │ ├── tutorial_4_b.png │ ├── tutorial_5_a.png │ ├── tutorial_5_b.png │ ├── tutorial_5_c.png │ ├── tutorial_5_d.png │ ├── tutorial_6.mp4 │ ├── tutorial_8_a.png │ ├── tutorial_8_b.png │ ├── tutorial_8_c.png │ ├── tutorial_8_d.png │ ├── tutorial_9_cross_section.png │ └── tutorial_9_geometry.png ├── conf.py ├── contributing │ ├── adding_models.rst │ ├── adding_time_schemes.rst │ ├── contributor_guidelines.rst │ ├── example_code.rst │ └── index.rst ├── getting_started │ ├── CHANGELOG.rst │ ├── getting_help.rst │ ├── index.rst │ ├── installation_guide.rst │ └── user_interface.rst ├── helpers │ ├── Using Gmsh with NGSolve.rst │ ├── Using Sphinx.rst │ ├── index.rst │ └── writing_docstrings.rst ├── index.rst ├── mathematical_notes │ ├── index.rst │ ├── models.rst │ └── time_discretization_schemes.rst ├── source │ ├── modules.rst │ ├── opencmp.config_functions.rst │ ├── opencmp.controllers.rst │ ├── opencmp.diffuse_interface.rst │ ├── opencmp.helpers.rst │ ├── opencmp.models.rst │ ├── opencmp.rst │ ├── opencmp.solvers.adaptive_transient_solvers.rst │ └── opencmp.solvers.rst └── tutorials │ ├── example_config.rst │ ├── index.rst │ ├── syntax.rst │ ├── tutorial_1.rst │ ├── tutorial_10.rst │ ├── tutorial_2.rst │ ├── tutorial_3.rst │ ├── tutorial_4.rst │ ├── tutorial_5.rst │ ├── tutorial_6.rst │ ├── tutorial_7.rst │ ├── tutorial_8.rst │ └── tutorial_9.rst ├── examples ├── Control │ ├── bc_dir │ │ └── bc_config │ ├── config │ ├── control_dir │ │ └── config_1 │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ ├── ref_sol_dir │ │ └── ref_sol_config │ └── unit_square_coarse.vol ├── INS │ ├── bc_dir │ │ └── bc_config │ ├── coarse_large_square_4bcs.vol │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── MCINS │ ├── bc_dir │ │ └── bc_config │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ ├── ref_sol_dir │ │ └── ref_sol_config │ └── unit_square_coarse.vol ├── Poisson │ ├── bc_dir │ │ └── bc_config │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ ├── ref_sol_dir │ │ └── ref_sol_config │ └── unit_square_coarse.vol ├── Stokes │ ├── bc_dir │ │ └── bc_config │ ├── channel_3bcs.vol │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── UI │ ├── bc_dir │ │ └── bc_config │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_1 │ ├── bc_dir │ │ └── bc_config │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ ├── ref_sol_dir │ │ └── ref_sol_config │ └── unit_square_4bcs.vol ├── tutorial_10 │ ├── bc_dir │ │ └── bc_config │ ├── config │ ├── config_DG │ ├── config_DG_IC │ ├── config_IC │ ├── flow_past_cyl_3d.geo │ ├── flow_past_cyl_3d.msh │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_2 │ ├── bc_dir │ │ └── bc_config │ ├── coarse_unit_square_1bc.msh │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_3 │ ├── bc_dir │ │ └── bc_config │ ├── channel_3bcs.vol │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_4 │ ├── bc_dir │ │ └── bc_config │ ├── coarse_channel_3bcs.vol │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_5 │ ├── bc_dir │ │ └── bc_config │ ├── coarse_channel_3bcs.vol │ ├── config │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_6 │ ├── bc_dir │ │ └── bc_config │ ├── channel_w_cyl.vol │ ├── config │ ├── config_IC │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_7 │ ├── bc_dir │ │ └── bc_config │ ├── channel_w_cyl.vol │ ├── config │ ├── config_IC │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_8a │ ├── bc_dir │ │ └── bc_config │ ├── config │ ├── convert.py │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ ├── reaction.vol │ └── ref_sol_dir │ │ └── ref_sol_config ├── tutorial_8b │ ├── bc_dir │ │ └── bc_config │ ├── config │ ├── config_IC │ ├── convert.py │ ├── ic_dir │ │ └── ic_config │ ├── model_dir │ │ └── model_config │ ├── reaction.vol │ └── ref_sol_dir │ │ └── ref_sol_config └── tutorial_9 │ ├── bc_dir │ └── bc_config │ ├── config │ ├── dim_dir │ ├── bc_dir │ │ ├── bottom_bc.sol │ │ ├── dim_bc_config │ │ └── led_bottom.msh │ ├── dim_config │ ├── led.stl │ └── ng.ini │ ├── ic_dir │ └── ic_config │ ├── model_dir │ └── model_config │ ├── ref_sol_dir │ └── ref_sol_config │ └── visualization.py ├── opencmp ├── __init__.py ├── __main__.py ├── config_functions │ ├── __init__.py │ ├── base_config_functions.py │ ├── boundary_conditions.py │ ├── controller_functions.py │ ├── expanded_config_parser.py │ ├── initial_conditions.py │ ├── load_config.py │ ├── model_functions.py │ ├── parse_arithmetic.py │ └── reference_solutions.py ├── controllers │ ├── __init__.py │ ├── base_controller.py │ ├── controller_group.py │ ├── misc.py │ └── pid_controller.py ├── diffuse_interface │ ├── __init__.py │ ├── dim.py │ ├── interface.py │ ├── mesh_helpers.py │ └── mesh_quality_metrics.py ├── entry_points.py ├── helpers │ ├── __init__.py │ ├── dg.py │ ├── error.py │ ├── io.py │ ├── math.py │ ├── mesh.py │ ├── misc.py │ ├── ngsolve_.py │ ├── saving.py │ └── testing.py ├── models │ ├── __init__.py │ ├── base_model.py │ ├── ins.py │ ├── ins_dim.py │ ├── misc.py │ ├── multi_component_ins.py │ ├── poisson.py │ ├── poisson_dim.py │ ├── stokes.py │ └── stokes_dim.py ├── post_processing │ ├── __init__.py │ ├── error_analysis.py │ └── output_conversions.py ├── run.py └── solvers │ ├── __init__.py │ ├── adaptive_transient_solvers │ ├── __init__.py │ ├── adaptive_IMEX.py │ ├── adaptive_three_step.py │ ├── adaptive_two_step.py │ ├── base_adaptive_transient_RK.py │ └── base_adaptive_transient_multistep.py │ ├── base_solver.py │ ├── misc.py │ ├── stationary.py │ ├── time_integration_schemes.py │ ├── transient_RK.py │ └── transient_multistep.py ├── publications └── 2108_JOSS │ ├── cover_letter.txt │ ├── images │ ├── tutorial_10_combined.png │ ├── tutorial_10_side_view.png │ ├── tutorial_10_streamlines.png │ ├── tutorial_10_top_view.png │ ├── tutorial_8_results_3s_a.png │ ├── tutorial_8_results_3s_b.png │ ├── tutorial_8_results_3s_combined.png │ ├── tutorial_9_combined.png │ ├── tutorial_9_cross_section.png │ ├── tutorial_9_geometry.png │ ├── user_interface.pdf │ ├── user_interface.svg │ └── uw_logo.png │ ├── paper.bib │ └── paper.md ├── pyproject.toml ├── pytests ├── README.md ├── config_functions │ ├── example_config │ ├── test_base_config_functions.py │ └── test_load_config.py ├── conftest.py ├── full_system │ ├── control │ │ ├── pid_poisson_1d │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── control_dir │ │ │ │ └── config_1 │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ └── test_control.py │ ├── dim │ │ ├── dim_poisson_1 │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── dim_dir │ │ │ │ ├── bc_dir │ │ │ │ │ └── dim_bc_config │ │ │ │ └── dim_config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── dim_poisson_2 │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── dim_dir │ │ │ │ ├── bc_dir │ │ │ │ │ ├── bottom_mask.sol │ │ │ │ │ ├── dim_bc_config │ │ │ │ │ └── top_mask.sol │ │ │ │ ├── dim_config │ │ │ │ ├── mesh.vol │ │ │ │ └── phi.sol │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── dim_poisson_3 │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── dim_dir │ │ │ │ ├── bc_dir │ │ │ │ │ └── dim_bc_config │ │ │ │ └── dim_config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── dim_poisson_4 │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── dim_dir │ │ │ │ ├── bc_dir │ │ │ │ │ └── dim_bc_config │ │ │ │ ├── dim_1 │ │ │ │ ├── dim_2 │ │ │ │ └── dim_config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── dim_poisson_5 │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── dim_dir │ │ │ │ ├── bc_dir │ │ │ │ │ └── dim_bc_config │ │ │ │ └── dim_config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── dim_poisson_6 │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── dim_dir │ │ │ │ ├── bc_dir │ │ │ │ │ └── dim_bc_config │ │ │ │ └── dim_config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── dim_stokes_1 │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── dim_dir │ │ │ │ ├── bc_dir │ │ │ │ │ └── dim_bc_config │ │ │ │ └── dim_config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── dim_stokes_2 │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── dim_dir │ │ │ │ ├── bc_dir │ │ │ │ │ └── dim_bc_config │ │ │ │ ├── dim_config │ │ │ │ ├── mesh.vol │ │ │ │ └── phi.sol │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ └── test_dim.py │ ├── ins │ │ ├── pressure_flow_in_pipe_stress │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── pressure_flow_in_pipe_velocity │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── sinusoidal_transient │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ └── test_ins.py │ ├── mcins │ │ ├── 0th_rxn │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── 1st_rxn │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── 1st_rxn_coupled │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── diffusion │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── diffusion_convection │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── purely_convective │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ └── test_mcins.py │ ├── poisson │ │ ├── h_convergence │ │ │ ├── bc_dir │ │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ │ └── ref_sol_config │ │ ├── test_poisson.py │ │ └── transient_coarse │ │ │ ├── bc_dir │ │ │ └── bc_config │ │ │ ├── config │ │ │ ├── ic_dir │ │ │ └── ic_config │ │ │ ├── model_dir │ │ │ └── model_config │ │ │ └── ref_sol_dir │ │ │ └── ref_sol_config │ └── stokes │ │ ├── stationary_pipe │ │ ├── bc_dir │ │ │ └── bc_config │ │ ├── config │ │ ├── ic_dir │ │ │ └── ic_config │ │ ├── model_dir │ │ │ └── model_config │ │ └── ref_sol_dir │ │ │ └── ref_sol_config │ │ └── test_stokes.py ├── helpers │ ├── .pytest_cache │ │ └── v │ │ │ └── cache │ │ │ ├── lastfailed │ │ │ ├── nodeids │ │ │ └── stepwise │ ├── mesh │ │ └── config_blank │ ├── test_io.py │ ├── test_math.py │ └── test_misc.py └── mesh_files │ ├── channel_3bcs.vol │ ├── circle_nd.stl │ ├── coarse_large_square_4bcs.vol │ ├── offset_circle_1.stl │ ├── offset_circle_2.stl │ ├── square.msh │ └── unit_square_coarse.vol └── setup.cfg /.gitignore: -------------------------------------------------------------------------------- 1 | /*\.pyc 2 | **/__pycache__/ 3 | /*\.ipynb_checkpoints 4 | /*\.vtk 5 | /*\.vtu 6 | /*\.pvd 7 | /*\.sol 8 | /*\.xml 9 | /*\.iml 10 | /*\.ini 11 | /*\.pytest_cache 12 | .mypy_cache/* 13 | .idea/* 14 | jupyter/* 15 | .dmypy.json 16 | .hg/* 17 | .hgignore 18 | docs/_build/* 19 | **/output/ 20 | CFD2021/* 21 | Example\ Runs/* 22 | build 23 | opencmp.egg-info 24 | -------------------------------------------------------------------------------- /.hgtags: -------------------------------------------------------------------------------- 1 | 54be464d465736652cbc534a5210dc3acd8d311e v1.0.1 2 | 54be464d465736652cbc534a5210dc3acd8d311e v1.0.1 3 | 0000000000000000000000000000000000000000 v1.0.1 4 | 0000000000000000000000000000000000000000 v1.0.1 5 | 8144bb5cec6b85ddc2d02c27c4cc8f5cdce777c8 v1.0.1 6 | 8144bb5cec6b85ddc2d02c27c4cc8f5cdce777c8 v1.0.1 7 | 0000000000000000000000000000000000000000 v1.0.1 8 | 0000000000000000000000000000000000000000 v1.0.1 9 | ecaee3ea34ca7bde3b199413b1e64ec3d4fab065 v1.0.1 10 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | OpenCMP Authors 2 | 3 | Elizabeth Monte 4 | Alex Vasile 5 | James Lowman 6 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | message: Please cite the following works when using this software. 3 | type: software 4 | authors: 5 | - family-names: Monte 6 | given-names: Elizabeth Julia 7 | - family-names: Vasile 8 | given-names: Alexandru Andrei 9 | - family-names: Lowman 10 | given-names: James 11 | - family-names: Abukhdeir 12 | given-names: Nasser Mohieddin 13 | doi: 10.21105/joss.03742 14 | identifiers: 15 | - type: doi 16 | value: 10.21105/joss.03742 17 | - type: url 18 | value: http://dx.doi.org/10.21105/joss.03742 19 | - type: other 20 | value: urn:issn:2475-9066 21 | title: |- 22 | OpenCMP: An Open-Source Computational Multiphysics 23 | Package 24 | url: http://dx.doi.org/10.21105/joss.03742 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenCMP 2 | 3 | [![DOI](https://joss.theoj.org/papers/10.21105/joss.03742/status.svg)](https://doi.org/10.21105/joss.03742) 4 | 5 | OpenCMP is a computational multiphysics software package based on the finite element method. It is primarily intended for physicochemical processes involving significant convective flow. OpenCMP uses the NGSolve finite element library for spatial discretization and provides a configuration file-based interface to pre-implemented models and time discretization schemes. It provides built-in post-processing and error analysis and also integrates with Netgen, Gmsh, and ParaView for meshing and visualization of simulation results. 6 | 7 | OpenCMP development follows the principles of ease of use, performance, and extensibility. The configuration file-based user interface is intended to be concise, readable, and intuitive. Similarly, the code base is structured such that experienced users can add their own models with minimal modifications to existing code. Inclusion of the finite element method enables the use of high-order polynomial interpolants for increased simulation accuracy. OpenCMP also offers the discontinuous Galerkin method which is locally conservative and improves simulation stability for convection-dominated problems. Finally, OpenCMP implements the diffuse interface method, a form of immersed boundary method which allows the use of non-conforming structured meshes for even complex simulation domains to improve simulation stability and sometimes speed. 8 | 9 | Examples and tutorial files can be found in the "Examples" directory. For more information on how to use and contribute to OpenCMP visit our website . 10 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | To build the documentation install, 2 | 3 | > pip3 install sphinx sphinxcontrib-aafig sphinx-autodoc-typehints recommonmark sphinx-rtd-theme 4 | 5 | then build using the Makefile, 6 | 7 | > make html 8 | 9 | If Sphinx is displaying old docstrings or failing to find renamed/removed modules, 10 | 11 | > sphinx-apidoc -o source/ ../ 12 | 13 | then recompile. 14 | -------------------------------------------------------------------------------- /docs/_static/docstring_main_block_formatting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/docstring_main_block_formatting.png -------------------------------------------------------------------------------- /docs/_static/docstring_multiline_args.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/docstring_multiline_args.png -------------------------------------------------------------------------------- /docs/_static/docstring_multiline_main_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/docstring_multiline_main_block.png -------------------------------------------------------------------------------- /docs/_static/docstring_multiline_multiple_returns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/docstring_multiline_multiple_returns.png -------------------------------------------------------------------------------- /docs/_static/docstring_multiline_single_return.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/docstring_multiline_single_return.png -------------------------------------------------------------------------------- /docs/_static/docstring_multiple_returns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/docstring_multiple_returns.png -------------------------------------------------------------------------------- /docs/_static/tutorial_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_1.png -------------------------------------------------------------------------------- /docs/_static/tutorial_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_10.png -------------------------------------------------------------------------------- /docs/_static/tutorial_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_2.png -------------------------------------------------------------------------------- /docs/_static/tutorial_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_3.png -------------------------------------------------------------------------------- /docs/_static/tutorial_4_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_4_a.png -------------------------------------------------------------------------------- /docs/_static/tutorial_4_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_4_b.png -------------------------------------------------------------------------------- /docs/_static/tutorial_5_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_5_a.png -------------------------------------------------------------------------------- /docs/_static/tutorial_5_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_5_b.png -------------------------------------------------------------------------------- /docs/_static/tutorial_5_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_5_c.png -------------------------------------------------------------------------------- /docs/_static/tutorial_5_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_5_d.png -------------------------------------------------------------------------------- /docs/_static/tutorial_6.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_6.mp4 -------------------------------------------------------------------------------- /docs/_static/tutorial_8_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_8_a.png -------------------------------------------------------------------------------- /docs/_static/tutorial_8_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_8_b.png -------------------------------------------------------------------------------- /docs/_static/tutorial_8_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_8_c.png -------------------------------------------------------------------------------- /docs/_static/tutorial_8_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_8_d.png -------------------------------------------------------------------------------- /docs/_static/tutorial_9_cross_section.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_9_cross_section.png -------------------------------------------------------------------------------- /docs/_static/tutorial_9_geometry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/docs/_static/tutorial_9_geometry.png -------------------------------------------------------------------------------- /docs/contributing/adding_time_schemes.rst: -------------------------------------------------------------------------------- 1 | .. Notes on how to add new time discretization schemes to OpenCMP. 2 | .. _adding_time_schemes: 3 | 4 | Adding Time Discretization Schemes to OpenCMP 5 | ============================================= 6 | 7 | The OpenCMP code base is designed such that new time discretization schemes can be added without significantly modifying the main code base. The time discretization schemes are defined in "time_integration_schemes.py", but the actual simulation run is controlled by a solver, the general hierarchy of which is shown below: 8 | 9 | .. aafig:: 10 | "Solver" 11 | | 12 | +-- "StationarySolver" 13 | | 14 | +-- "TransientMultiStepSolver" 15 | | | 16 | | +-- "BaseAdaptiveTransientMultiStepSolver" 17 | | | 18 | | +-- "AdaptiveTwoStep" 19 | | | 20 | | +-- "AdaptiveIMEX" 21 | | 22 | +-- "TransientRKSolver" 23 | | 24 | +-- "BaseAdaptiveTransientRKSolver" 25 | | 26 | +-- "AdaptiveThreeStep" 27 | 28 | For more information on the differences between multi-step and Runge-Kutta time discretization schemes see :ref:`time_schemes`. 29 | 30 | To add a new time discretization scheme, add it as a new function in "time_integration_schemes.py". Then determine whether it is a multi-step or Runge-Kutta scheme and modify the initialization of "solvers/base_solver.py" appropriately. Add the order of the scheme and its time step coefficients to :code:`scheme_order` and :code:`scheme_dt_coef` at the top of "solvers/base_solver.py". The order of the scheme is the number of previous time steps used by the scheme. For example, Crank-Nicolson uses only the one previous time step to solve for the next time step so has a scheme order of 1. The time step coefficients are only non-unity for Runge-Kutta schemes and indicate the portion of the full time step to use during each intermediate step. Fixed time step schemes can then simply be added to the :code:`_create_linear_and_bilinear_forms` method of :code:`TransientMultiStepSolver` or :code:`TransientRKSolver`. Finally, add the scheme to "solvers/misc.py". 31 | 32 | Adaptive time-stepping schemes should inherit from either :code:`BaseAdaptiveTransientMultiStepSolver` or :code:`BaseAdaptiveTransientMultiStepSolver`. The exact implementation will vary depending on the scheme, but existing adaptive time-stepping schemes may provide some guide. The final class must be added to "solvers/adaptive_transient_solvers/__init__.py" and to "solvers/misc.py". 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/contributing/index.rst: -------------------------------------------------------------------------------- 1 | .. Contains the toctree for the contributing directory. 2 | 3 | Guide for Contributors 4 | ====================== 5 | 6 | The OpenCMP developers welcome any contributions. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | contributor_guidelines 12 | adding_models 13 | adding_time_schemes 14 | example_code 15 | 16 | -------------------------------------------------------------------------------- /docs/getting_started/getting_help.rst: -------------------------------------------------------------------------------- 1 | .. Guide for how users can get support/report problems. 2 | .. _getting_help: 3 | 4 | Support 5 | ======= 6 | 7 | Please report any bugs as issues at the `GitHub repository `_. 8 | 9 | -------------------------------------------------------------------------------- /docs/getting_started/index.rst: -------------------------------------------------------------------------------- 1 | .. Contains the toctree for the getting_started directory. 2 | .. _getting_started: 3 | 4 | Getting Started 5 | =============== 6 | 7 | New users please read through the following for installation instructions, how to get help, and the latest changes to OpenCMP. 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | installation_guide 13 | user_interface 14 | getting_help 15 | CHANGELOG 16 | -------------------------------------------------------------------------------- /docs/getting_started/user_interface.rst: -------------------------------------------------------------------------------- 1 | .. Contains the guide to the user interface. 2 | .. _user_interface: 3 | 4 | Introducing the User Interface 5 | =========================================== 6 | 7 | The files for this tutorial can be found in "Examples/UI". 8 | 9 | Directory Structure 10 | ------------------- 11 | 12 | Drawing inspiration from packages like OpenFOAM and SU2, OpenCMP's user interface is organized around configuration files and the command line. Each simulation requires its own directory to hold its configuration files and outputs. This is known as the run directory or run_dir. The standard layout of this directory is shown below. 13 | 14 | .. aafig:: 15 | simulation 16 | | 17 | +-- config 18 | | 19 | +-- "bc_dir" 20 | | | 21 | | +-- "bc_config" 22 | | 23 | +-- "ic_dir" 24 | | | 25 | | +-- "ic_config" 26 | | 27 | +-- "model_dir" 28 | | | 29 | | +-- "model_config" 30 | | 31 | +-- "ref_sol_dir" 32 | | | 33 | | +-- "ref_sol_config" 34 | | 35 | +-- output 36 | 37 | The main directory and each subdirectory contain a configuration file - "< >_config". These are plaintext files that specify the simulation parameters and run conditions. 38 | 39 | The Main Directory 40 | ------------------ 41 | 42 | The configuration file in the main directory holds general information about the simulation including which model, mesh, finite elements, and solver should be used. It also holds information about how the simulation should be run such as the level of detail in the output messages and the amount of multi-threading to use. 43 | 44 | The Boundary Condition Subdirectory 45 | ----------------------------------- 46 | 47 | The "bc_dir" subdirectory holds information about the boundary conditions. Its configuration file specifies the type and value of each boundary condition. This subdirectory can also hold files containing boundary condition data if a boundary condition value is to be loaded from file instead of given in closed form. 48 | 49 | The Initial Condition Subdirectory 50 | ---------------------------------- 51 | 52 | The "ic_dir" subdirectory holds information about the initial conditions. Its configuration file specifies the value of the initial condition for each model variable. Like "bc_dir", "ic_dir" may contain additional files from which the initial condition data is loaded during the simulation. 53 | 54 | The Model Subdirectory 55 | ---------------------- 56 | 57 | The "model_dir" subdirectory holds information about model parameters and model functions. Its configuration file specifies the values of any model parameters or functions for each model variable and the subdirectory may hold additional data files to be loaded during the simulation. 58 | 59 | The Error Analysis Subdirectory 60 | ------------------------------- 61 | 62 | The "ref_sol_dir" subdirectory holds information about the error analysis to be conducted on the final simulation result. Its configuration file specifies what error metrics should be computed during post-processing. This configuration file also contains the reference solutions the results should be compared against, either in closed form or as references to other files in the subdirectory that are loaded during post-processing. 63 | 64 | The Output Subdirectory 65 | ----------------------- 66 | 67 | The output subdirectory holds any saved simulation results. It does not need to be created before running the simulation, it will be generated automatically if results should be saved to file. 68 | -------------------------------------------------------------------------------- /docs/helpers/Using Gmsh with NGSolve.rst: -------------------------------------------------------------------------------- 1 | .. Some tips for making Gmsh meshes that are compatible with NGSolve. 2 | .. _gmsh_tips: 3 | 4 | Using Gmsh with NGSolve 5 | ======================= 6 | 7 | Reading in Gmsh Files 8 | --------------------- 9 | 10 | Gmsh mesh files (.msh) can be read into Netgen using the :code:`netgen.read_gmsh` module. Note that the result will be a Netgen mesh, not an NGSolve mesh. 11 | 12 | .. code-block:: python 13 | 14 | from netgen.read_gmsh import ReadGmsh 15 | ngmesh = ReadGmsh(mesh_filename) 16 | 17 | Marking Boundaries 18 | ------------------ 19 | 20 | One of the benefits of meshing in Gmsh instead of Netgen is how much easier it is to mark different boundary locations. This is done by adding physical groups to the mesh. 21 | 22 | .. note:: 23 | If you are using physical groups to mark boundaries you must add them in the following order or Netgen will not be able to load them (ignore volumes if in 2D). 24 | 25 | 1. Volumes 26 | 2. Surfaces 27 | 3. Lines 28 | 4. Points 29 | 30 | Once you have loaded your GMSH mesh into Netgen and converted it into an NGSolve mesh you can use :code:`mesh.GetBoundaries()` to see a list of the marked boundary sections. You may see the same name multiple times if that boundary section encompassed multiple surfaces in Gmsh. This will not affect the NGSolve solve as any boundary conditions assigned to that name will be applied on all mesh elements with that name. 31 | -------------------------------------------------------------------------------- /docs/helpers/Using Sphinx.rst: -------------------------------------------------------------------------------- 1 | .. Notes on how to get started with and use Sphinx. 2 | .. _using_sphinx: 3 | 4 | Using Sphinx 5 | ============ 6 | 7 | Getting Started 8 | --------------- 9 | 10 | The official guide to Sphinx can be found `here `_. 11 | `This `_ is another helpful guide. 12 | 13 | If you have cloned the OpenCMP repository, you should have all the necessary Sphinx configuration files already set up. Try the following steps: 14 | 15 | 1. Install Sphinx with :code:`apt-get install python3-sphinx`. Make sure you install for Python 3.6+. 16 | 2. Check if you have "docs/_static" and "docs/_templates/" directories. If you don't, create empty directories with these names. 17 | 3. Within the "docs" directory in the main OpenCMP directory run :code:`make html`. 18 | 4. Move to the "docs/_build/html" directory and open any of the .html files ("index.html" is a good one to start with). 19 | 20 | If any of the above steps don't work, run :code:`sphinx-quickstart` as detailed in the `official guide `_ then modify the "conf.py" file as described in the next section. 21 | 22 | Configuring "conf.py" 23 | --------------------- 24 | 25 | The following lines must be uncommented or added to the top of the file. 26 | 27 | .. code-block:: python 28 | 29 | import os 30 | import sys 31 | sys.path.insert(0, os.path.abspath('.')) 32 | sys.path.insert(0, os.path.abspath('../')) 33 | 34 | Add :code:`sphinx.ext.napoleon` to the end of :code:`extensions` so Sphinx can parse Google-style docstrings. The following lines also need to be added directly below :code:`extensions`. 35 | 36 | .. code-block:: python 37 | 38 | napoleon_google_docstring = True 39 | napoleon_include_private_with_doc = True 40 | napoleon_use_param = True 41 | napoleon_use_rtype = True 42 | 43 | To make Sphinx play nicely with typing add :code:`sphinx_autodoc_typehints` to :code:`extensions`. This must be included after :code:`sphinx.ext.napoleon` or it won't work. 44 | 45 | Set the Sphinx theme to the ReadTheDocs theme with :code:`html_theme = 'sphinx_rtd_theme'`. The theme can be installed with :code:`pip3 install sphinx_rdt_theme`. 46 | 47 | Some OpenCMP documentation uses Markdown, which must be parsed into reStructuredText using recommonmark before it can be read by Sphinx. Install recommonmark with :code:`pip3 install --upgrade recommonmark` then add :code:`recommonmark` to :code:`extensions`. Finally, add :code:`.md` to the :code:`source_suffix` list/dictionary. 48 | 49 | ASCII art is made with aafigure. Install aafigure with :code:`pip3 install aafigure` then add :code:`aafigure.sphinxext` to :code:`extensions`. 50 | 51 | Helpful Tips 52 | ------------ 53 | 54 | * If using Markdown, the file titles must be denoted by underlining with "=". Sphinx doesn't recognize "#" and will give an error about a missing title. 55 | * If Sphinx is displaying old docstrings or failing to find modules that have been renamed or removed, delete the "source" directory and then run :code:`sphinx-apidoc -o source/ ../` from within the "docs" directory. This will recreate the automatic docstring documentation from the current code base. 56 | * Running :code:`make clean` clears anything cached in the "_build" directory. 57 | -------------------------------------------------------------------------------- /docs/helpers/index.rst: -------------------------------------------------------------------------------- 1 | .. Contains the toctree for the helpers directory. 2 | 3 | Tips and Tricks 4 | =============== 5 | 6 | The following document some tips and tricks for software commonly used with OpenCMP. They may be of interest to those who wish to contribute to OpenCMP. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | Using Sphinx 12 | Using Gmsh with NGSolve 13 | writing_docstrings 14 | 15 | -------------------------------------------------------------------------------- /docs/helpers/writing_docstrings.rst: -------------------------------------------------------------------------------- 1 | .. Some tips for formatting docstrings. 2 | .. _writing_documentation: 3 | 4 | Formatting Docstrings 5 | ===================== 6 | 7 | To specify that a function returns multiple values do the following within the docstring: 8 | 9 | .. image:: ../_static/docstring_multiple_returns.png 10 | :width: 600px 11 | :align: center 12 | :alt: Example docstring for a function that returns multiple values. 13 | 14 | Normal reStructuredText blocks can be used within docstrings: 15 | 16 | .. image:: ../_static/docstring_main_block_formatting.png 17 | :width: 600px 18 | :align: center 19 | :alt: Example docstring for a function with fancy whitespace formatting within the main docstring block. 20 | 21 | Multi-line descriptions must be formatted differently depending on where they lie in the docstring. 22 | In the main block, each subsequent line should remain flush with the first line: 23 | 24 | .. image:: ../_static/docstring_multiline_main_block.png 25 | :width: 600px 26 | :align: center 27 | :alt: Example of a multi-line description within the main text block of a docstring. 28 | 29 | In the arguments, each subsequent line should be indented a few spaces (or a tab) from the first line: 30 | 31 | .. image:: ../_static/docstring_multiline_args.png 32 | :width: 600px 33 | :align: center 34 | :alt: Example of a multi-line description for a function argument. 35 | 36 | In the returns, each subsequent line should remain flush with the text of the first line (not the hyphen in the case of multiple return values): 37 | 38 | .. image:: ../_static/docstring_multiline_single_return.png 39 | :width: 600px 40 | :align: center 41 | :alt: Example of a multi-line description for a single return value. 42 | 43 | .. image:: ../_static/docstring_multiline_multiple_returns.png 44 | :width: 600px 45 | :align: center 46 | :alt: Example of a multi-line description for multiple return values. 47 | 48 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. OpenCMP documentation master file, created by 2 | sphinx-quickstart on Fri Apr 16 18:31:40 2021. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to OpenCMP's documentation! 7 | =================================== 8 | 9 | OpenCMP is a computational multiphysics software package based on the finite element method. It is primarily intended for physicochemical processes involving significant convective flow. OpenCMP uses the NGSolve finite element library for spatial discretization and provides a configuration file-based interface to pre-implemented models and time discretization schemes. It provides built-in post-processing and error analysis and also integrates with Netgen, Gmsh, and ParaView for meshing and visualization of simulation results. 10 | 11 | OpenCMP development follows the principles of ease of use, performance, and extensibility. The configuration file-based user interface is intended to be concise, readable, and intuitive. Similarly, the code base is structured such that experienced users can add their own models with minimal modifications to existing code. Inclusion of the finite element method enables the use of high-order polynomial interpolants for increased simulation accuracy. OpenCMP also offers the discontinuous Galerkin method which is locally conservative and improves simulation stability for convection-dominated problems. Finally, OpenCMP implements the diffuse interface method, a form of immersed boundary method which allows the use of non-conforming structured meshes for even complex simulation domains to improve simulation stability and sometimes speed. 12 | 13 | The OpenCMP source code and examples and tutorial files are available on GitHub ``_ subject to the GNU LGPL v2.1 open-source license. 14 | 15 | .. toctree:: 16 | :maxdepth: 1 17 | 18 | getting_started/index 19 | tutorials/index 20 | contributing/index 21 | mathematical_notes/index 22 | helpers/index 23 | source/modules 24 | -------------------------------------------------------------------------------- /docs/mathematical_notes/index.rst: -------------------------------------------------------------------------------- 1 | .. Contains the toctree for the mathematical_notes directory. 2 | 3 | Mathematical Notes 4 | ================== 5 | 6 | The following provide the finite element weak forms used in OpenCMP in standard mathematical notation. They may be of interest to those using OpenCMP who wish to understand the exact numerical methods. Users who wish to add/modify OpenCMP models are also advised to read through these notes before jumping into the code implementation. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | models 12 | time_discretization_schemes 13 | 14 | -------------------------------------------------------------------------------- /docs/source/modules.rst: -------------------------------------------------------------------------------- 1 | opencmp 2 | ======= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | opencmp 8 | -------------------------------------------------------------------------------- /docs/source/opencmp.config_functions.rst: -------------------------------------------------------------------------------- 1 | opencmp.config\_functions package 2 | ================================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | opencmp.config\_functions.base\_config\_functions module 8 | -------------------------------------------------------- 9 | 10 | .. automodule:: opencmp.config_functions.base_config_functions 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | opencmp.config\_functions.boundary\_conditions module 16 | ----------------------------------------------------- 17 | 18 | .. automodule:: opencmp.config_functions.boundary_conditions 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | opencmp.config\_functions.controller\_functions module 24 | ------------------------------------------------------ 25 | 26 | .. automodule:: opencmp.config_functions.controller_functions 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | opencmp.config\_functions.expanded\_config\_parser module 32 | --------------------------------------------------------- 33 | 34 | .. automodule:: opencmp.config_functions.expanded_config_parser 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | opencmp.config\_functions.initial\_conditions module 40 | ---------------------------------------------------- 41 | 42 | .. automodule:: opencmp.config_functions.initial_conditions 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | opencmp.config\_functions.load\_config module 48 | --------------------------------------------- 49 | 50 | .. automodule:: opencmp.config_functions.load_config 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | opencmp.config\_functions.model\_functions module 56 | ------------------------------------------------- 57 | 58 | .. automodule:: opencmp.config_functions.model_functions 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | opencmp.config\_functions.parse\_arithmetic module 64 | -------------------------------------------------- 65 | 66 | .. automodule:: opencmp.config_functions.parse_arithmetic 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | opencmp.config\_functions.reference\_solutions module 72 | ----------------------------------------------------- 73 | 74 | .. automodule:: opencmp.config_functions.reference_solutions 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | Module contents 80 | --------------- 81 | 82 | .. automodule:: opencmp.config_functions 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | -------------------------------------------------------------------------------- /docs/source/opencmp.controllers.rst: -------------------------------------------------------------------------------- 1 | opencmp.controllers package 2 | =========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | opencmp.controllers.base\_controller module 8 | ------------------------------------------- 9 | 10 | .. automodule:: opencmp.controllers.base_controller 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | opencmp.controllers.controller\_group module 16 | -------------------------------------------- 17 | 18 | .. automodule:: opencmp.controllers.controller_group 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | opencmp.controllers.misc module 24 | ------------------------------- 25 | 26 | .. automodule:: opencmp.controllers.misc 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | opencmp.controllers.pid\_controller module 32 | ------------------------------------------ 33 | 34 | .. automodule:: opencmp.controllers.pid_controller 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | Module contents 40 | --------------- 41 | 42 | .. automodule:: opencmp.controllers 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | -------------------------------------------------------------------------------- /docs/source/opencmp.diffuse_interface.rst: -------------------------------------------------------------------------------- 1 | opencmp.diffuse\_interface package 2 | ================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | opencmp.diffuse\_interface.dim module 8 | ------------------------------------- 9 | 10 | .. automodule:: opencmp.diffuse_interface.dim 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | opencmp.diffuse\_interface.interface module 16 | ------------------------------------------- 17 | 18 | .. automodule:: opencmp.diffuse_interface.interface 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | opencmp.diffuse\_interface.mesh\_helpers module 24 | ----------------------------------------------- 25 | 26 | .. automodule:: opencmp.diffuse_interface.mesh_helpers 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | opencmp.diffuse\_interface.mesh\_quality\_metrics module 32 | -------------------------------------------------------- 33 | 34 | .. automodule:: opencmp.diffuse_interface.mesh_quality_metrics 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | Module contents 40 | --------------- 41 | 42 | .. automodule:: opencmp.diffuse_interface 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | -------------------------------------------------------------------------------- /docs/source/opencmp.helpers.rst: -------------------------------------------------------------------------------- 1 | opencmp.helpers package 2 | ======================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | opencmp.helpers.dg module 8 | ------------------------- 9 | 10 | .. automodule:: opencmp.helpers.dg 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | opencmp.helpers.error module 16 | ---------------------------- 17 | 18 | .. automodule:: opencmp.helpers.error 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | opencmp.helpers.error\_analysis module 24 | -------------------------------------- 25 | 26 | .. automodule:: opencmp.helpers.error_analysis 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | opencmp.helpers.io module 32 | ------------------------- 33 | 34 | .. automodule:: opencmp.helpers.io 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | opencmp.helpers.math module 40 | --------------------------- 41 | 42 | .. automodule:: opencmp.helpers.math 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | opencmp.helpers.mesh module 48 | --------------------------- 49 | 50 | .. automodule:: opencmp.helpers.mesh 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | opencmp.helpers.misc module 56 | --------------------------- 57 | 58 | .. automodule:: opencmp.helpers.misc 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | opencmp.helpers.ngsolve\_ module 64 | -------------------------------- 65 | 66 | .. automodule:: opencmp.helpers.ngsolve_ 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | opencmp.helpers.post\_processing module 72 | --------------------------------------- 73 | 74 | .. automodule:: opencmp.helpers.post_processing 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | opencmp.helpers.saving module 80 | ----------------------------- 81 | 82 | .. automodule:: opencmp.helpers.saving 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | 87 | Module contents 88 | --------------- 89 | 90 | .. automodule:: opencmp.helpers 91 | :members: 92 | :undoc-members: 93 | :show-inheritance: 94 | -------------------------------------------------------------------------------- /docs/source/opencmp.models.rst: -------------------------------------------------------------------------------- 1 | opencmp.models package 2 | ====================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | opencmp.models.base\_model module 8 | --------------------------------- 9 | 10 | .. automodule:: opencmp.models.base_model 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | opencmp.models.ins module 16 | ------------------------- 17 | 18 | .. automodule:: opencmp.models.ins 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | opencmp.models.misc module 24 | -------------------------- 25 | 26 | .. automodule:: opencmp.models.misc 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | opencmp.models.multi\_component\_ins module 32 | ------------------------------------------- 33 | 34 | .. automodule:: opencmp.models.multi_component_ins 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | opencmp.models.poisson module 40 | ----------------------------- 41 | 42 | .. automodule:: opencmp.models.poisson 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | opencmp.models.stokes module 48 | ---------------------------- 49 | 50 | .. automodule:: opencmp.models.stokes 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | Module contents 56 | --------------- 57 | 58 | .. automodule:: opencmp.models 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | -------------------------------------------------------------------------------- /docs/source/opencmp.rst: -------------------------------------------------------------------------------- 1 | opencmp package 2 | =============== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | opencmp.config_functions 11 | opencmp.controllers 12 | opencmp.diffuse_interface 13 | opencmp.helpers 14 | opencmp.models 15 | opencmp.solvers 16 | 17 | Submodules 18 | ---------- 19 | 20 | opencmp.run module 21 | ------------------ 22 | 23 | .. automodule:: opencmp.run 24 | :members: 25 | :undoc-members: 26 | :show-inheritance: 27 | 28 | Module contents 29 | --------------- 30 | 31 | .. automodule:: opencmp 32 | :members: 33 | :undoc-members: 34 | :show-inheritance: 35 | -------------------------------------------------------------------------------- /docs/source/opencmp.solvers.adaptive_transient_solvers.rst: -------------------------------------------------------------------------------- 1 | opencmp.solvers.adaptive\_transient\_solvers package 2 | ==================================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | opencmp.solvers.adaptive\_transient\_solvers.adaptive\_IMEX module 8 | ------------------------------------------------------------------ 9 | 10 | .. automodule:: opencmp.solvers.adaptive_transient_solvers.adaptive_IMEX 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | opencmp.solvers.adaptive\_transient\_solvers.adaptive\_three\_step module 16 | ------------------------------------------------------------------------- 17 | 18 | .. automodule:: opencmp.solvers.adaptive_transient_solvers.adaptive_three_step 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | opencmp.solvers.adaptive\_transient\_solvers.adaptive\_two\_step module 24 | ----------------------------------------------------------------------- 25 | 26 | .. automodule:: opencmp.solvers.adaptive_transient_solvers.adaptive_two_step 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | opencmp.solvers.adaptive\_transient\_solvers.base\_adaptive\_transient\_RK module 32 | --------------------------------------------------------------------------------- 33 | 34 | .. automodule:: opencmp.solvers.adaptive_transient_solvers.base_adaptive_transient_RK 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | opencmp.solvers.adaptive\_transient\_solvers.base\_adaptive\_transient\_multistep module 40 | ---------------------------------------------------------------------------------------- 41 | 42 | .. automodule:: opencmp.solvers.adaptive_transient_solvers.base_adaptive_transient_multistep 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | Module contents 48 | --------------- 49 | 50 | .. automodule:: opencmp.solvers.adaptive_transient_solvers 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | -------------------------------------------------------------------------------- /docs/source/opencmp.solvers.rst: -------------------------------------------------------------------------------- 1 | opencmp.solvers package 2 | ======================= 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | opencmp.solvers.adaptive_transient_solvers 11 | 12 | Submodules 13 | ---------- 14 | 15 | opencmp.solvers.base\_solver module 16 | ----------------------------------- 17 | 18 | .. automodule:: opencmp.solvers.base_solver 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | opencmp.solvers.misc module 24 | --------------------------- 25 | 26 | .. automodule:: opencmp.solvers.misc 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | opencmp.solvers.stationary module 32 | --------------------------------- 33 | 34 | .. automodule:: opencmp.solvers.stationary 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | opencmp.solvers.time\_integration\_schemes module 40 | ------------------------------------------------- 41 | 42 | .. automodule:: opencmp.solvers.time_integration_schemes 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | opencmp.solvers.transient\_RK module 48 | ------------------------------------ 49 | 50 | .. automodule:: opencmp.solvers.transient_RK 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | opencmp.solvers.transient\_multistep module 56 | ------------------------------------------- 57 | 58 | .. automodule:: opencmp.solvers.transient_multistep 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | Module contents 64 | --------------- 65 | 66 | .. automodule:: opencmp.solvers 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | -------------------------------------------------------------------------------- /docs/tutorials/index.rst: -------------------------------------------------------------------------------- 1 | .. Contains the toctree for the tutorials directory. 2 | 3 | Tutorials 4 | ========= 5 | 6 | These tutorials are inspired by the excellent deal.ii tutorials and similarly aim to provide a roadmap for OpenCMP's general functionality. The files needed to run the tutorials can be found in the "Examples" folder under the given tutorial name. Before beginning the tutorials the user should install OpenCMP following the instructions given in the :ref:`installation_guide`. 7 | 8 | The beginner user is advised to follow the tutorials in order at least until their model of interest is discussed. After completing the tutorials the user can refer to the various other examples in the "Examples" folder for templates of each model. 9 | 10 | Before attempting the tutorials, make sure to review :ref:`getting_started` and, for reference, :ref:`example_config` and :ref:`syntax`. 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | 15 | gett 16 | tutorial_1 17 | tutorial_2 18 | tutorial_3 19 | tutorial_4 20 | tutorial_5 21 | tutorial_6 22 | tutorial_7 23 | tutorial_8 24 | tutorial_9 25 | tutorial_10 26 | -------------------------------------------------------------------------------- /docs/tutorials/tutorial_5.rst: -------------------------------------------------------------------------------- 1 | .. Contains the fifth tutorial. 2 | .. _tutorial_5: 3 | 4 | Tutorial 5 - Adaptive Time-Stepping 5 | =================================== 6 | 7 | The files for this tutorial can be found in "examples/tutorial_5". 8 | 9 | Governing Equations 10 | ------------------- 11 | 12 | This tutorial will demonstrate how to solve the transient Stokes equation using an adaptive time-stepping scheme. The governing equations are the same as those used in :ref:`tutorial_4`. 13 | 14 | The Main Configuration File 15 | --------------------------- 16 | 17 | The only changes are to the transient solve section. The time discretization scheme must be changed to one of the adaptive time-stepping schemes and additional parameters must be specified to control the changes in time step. 18 | 19 | In this tutorial, the adaptive two step scheme will be used. This is a first order time discretization scheme formed from a combination of implicit Euler and Crank-Nicolson. For a full list of the available time discretization schemes see :ref:`example_config`. 20 | 21 | "dt" now specifies the initial time step and "dt_range" controls the minimum and maximum allowed time step. "dt_tolerance" sets the local error tolerance at each time step. A relative tolerance must be given and an absolute tolerance is optional. At each time step the local error will be estimated and the time step will only be accepted if the local error meets the specified tolerance. If the local error exceeds the tolerance the time step will be repeated with a smaller dt. :: 22 | 23 | [TRANSIENT] 24 | transient = True 25 | scheme = adaptive two step 26 | time_range = 0, 2 27 | dt = 0.005 28 | dt_range = 1e-10, 0.1 29 | dt_tolerance = relative -> 1e-3 30 | absolute -> 1e-3 31 | 32 | Running the Simulation 33 | ---------------------- 34 | 35 | The simulation can be run from the command line; within the directory "examples/tutorial_5/" execute :code:`python3 -m opencmp config`. 36 | 37 | After each time step a print out gives the current time, whether or not the time step was accepted, estimates of the maximum local error at the time step, and the size of the next time step. 38 | 39 | The first several time steps flip back and forth between accepting (or keeping) and rejecting the time step. 40 | 41 | .. image:: ../_static/tutorial_5_a.png 42 | :width: 225 43 | :align: center 44 | :alt: Time step progression for the first few time steps. 45 | 46 | After ~0.015s a reasonable time step size has been found and all subsequent time steps are accepted. However, the time step size continues to slowly decrease as the local error in the pressure is still very close to the specified tolerance. 47 | 48 | .. image:: ../_static/tutorial_5_b.png 49 | :width: 225 50 | :align: center 51 | :alt: Time step progression while local error is levelling out. 52 | 53 | By ~0.5s the inlet ramp has finished and the time step size can rapidly increase. 54 | 55 | .. image:: ../_static/tutorial_5_c.png 56 | :width: 225 57 | :align: center 58 | :alt: Time step progression after dynamics have ended. 59 | 60 | The error metrics for the final solution again match the known exact solution well. 61 | 62 | .. image:: ../_static/tutorial_5_d.png 63 | :width: 400 64 | :align: center 65 | :alt: Output of error analysis. 66 | -------------------------------------------------------------------------------- /docs/tutorials/tutorial_7.rst: -------------------------------------------------------------------------------- 1 | .. Contains the seventh tutorial. 2 | .. _tutorial_7: 3 | 4 | Tutorial 7 - IMEX Schemes 5 | ========================= 6 | 7 | The files for this tutorial can be found in "examples/tutorial_7". 8 | 9 | Governing Equations 10 | ------------------- 11 | 12 | This tutorial will solve the same governing equations as :ref:`tutorial_6`, but use an IMEX scheme to handle the nonlinearity in the incompressible Navier-Stokes equations. The governing equations are split up into nonlinear terms (in this case the convection term) which are treated explicitly, and linear terms which are treated implicitly. For more details on the implementation of IMEX schemes in OpenCMP see :ref:`time_schemes`. 13 | 14 | The Main Configuration Files 15 | ---------------------------- 16 | 17 | There are still two main configuration files: "config_IC" for the Stokes solve and "config" for the incompressible Navier-Stokes solve. "config_IC" is identical to that used in :ref:`tutorial_7`. 18 | 19 | "config" differs in the solver section. The linearization method is now "IMEX" and the Picard iteration parameters are no longer needed. :: 20 | 21 | [SOLVER] 22 | linear_solver = default 23 | preconditioner = default 24 | linearization_method = IMEX 25 | 26 | The time discretization scheme must also be changed to an IMEX scheme. For this tutorial the Euler IMEX time discretization scheme is used, which is a combination of implicit and explicit Euler. :: 27 | 28 | [TRANSIENT] 29 | transient = True 30 | scheme = euler IMEX 31 | time_range = 0.0, 1.0 32 | dt = 1e-2 33 | 34 | Running the Simulation 35 | ---------------------- 36 | 37 | The simulation can be run from the command line; within the directory examples/tutorial_7/ execute :code:`python3 -m opencmp config`. 38 | 39 | The simulation can be run from the command line; within the directory "examples/tutorial_7/:: 40 | 41 | 1) Run the Stokes solve by calling :code:`python3 -m opencmp config_IC` 42 | 2) Run the incompressible Navier-Stokes solve by calling :code:`python3 -m opencmp config`. 43 | 44 | As usual, the progress of the transient simulation can be tracked from the print outs at each time step. Once the simulation has finished the results can be visualized in ParaView. They should be identical to those obtained in :ref:`tutorial_7`. 45 | -------------------------------------------------------------------------------- /examples/Control/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = left -> 10.0 - H(t, 0.1) 3 | right -> 5.0 4 | 5 | [NEUMANN] 6 | u = top -> 0.0 7 | bottom -> 0.0 8 | 9 | [ROBIN] 10 | -------------------------------------------------------------------------------- /examples/Control/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = False 13 | interior_penalty_coefficient = 10.0 14 | 15 | [SOLVER] 16 | linear_solver = default 17 | preconditioner = default 18 | 19 | [TRANSIENT] 20 | transient = True 21 | scheme = adaptive three step 22 | time_range = 0.0, 8.0 23 | dt = 0.05 24 | dt_tolerance = relative -> 1e-6 25 | absolute -> 1e-4 26 | dt_range = 1e-15, 0.5 27 | 28 | [VISUALIZATION] 29 | save_to_file = False 30 | save_type = .vtu 31 | save_frequency = 1, numit 32 | subdivision = 3 33 | 34 | [ERROR ANALYSIS] 35 | check_error = True 36 | 37 | [CONTROLLER] 38 | active = True 39 | type = PID 40 | config = config_1 41 | 42 | [OTHER] 43 | num_threads = 2 44 | model = Poisson 45 | run_dir = . 46 | messaging_level = 0 47 | -------------------------------------------------------------------------------- /examples/Control/control_dir/config_1: -------------------------------------------------------------------------------- 1 | [CONTROL_VARIABLES] 2 | variable_names = u 3 | location_positions = <0.5, 0.5> 4 | values = 7.5 5 | index = 0 6 | 7 | [MANIPULATED_VARIABLES] 8 | types = dirichlet 9 | variable_names = u 10 | location_names = right 11 | 12 | [PARAMETERS] 13 | # Time between each control action of the discrete controller, in seconds 14 | dt_control = 0.1 15 | # Time over which the control action occurs 16 | t_ramp = 0.03 17 | # Bias term 18 | bias = 5.0 19 | # Proportional term 20 | k_c = 0.5 21 | # Integral term 22 | tau_i = 0.0906440 23 | # Derivative term 24 | tau_d = 0 -------------------------------------------------------------------------------- /examples/Control/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> 10.0*(1-x) + 5*(x) 3 | -------------------------------------------------------------------------------- /examples/Control/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 0.0 6 | -------------------------------------------------------------------------------- /examples/Control/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = 9 - 3*x 3 | 4 | [METRICS] 5 | l2_norm = u 6 | l1_norm = u 7 | linfinity_norm = u -------------------------------------------------------------------------------- /examples/Control/unit_square_coarse.vol: -------------------------------------------------------------------------------- 1 | # Generated by NETGEN v6.2.2009 2 | 3 | mesh3d 4 | dimension 5 | 2 6 | geomtype 7 | 0 8 | 9 | # surfnr bcnr domin domout np p1 p2 p3 10 | surfaceelements 11 | 6 12 | 2 1 0 0 3 1 5 8 13 | 2 1 0 0 3 2 6 5 14 | 2 1 0 0 3 3 7 6 15 | 2 1 0 0 3 4 8 7 16 | 2 1 0 0 3 5 6 7 17 | 2 1 0 0 3 5 7 8 18 | 19 | 20 | # matnr np p1 p2 p3 p4 21 | volumeelements 22 | 0 23 | 24 | 25 | # surfid 0 p1 p2 trignum1 trignum2 domin/surfnr1 domout/surfnr2 ednr1 dist1 ednr2 dist2 26 | edgesegmentsgi2 27 | 8 28 | 1 0 1 5 -1 -1 1 0 1 0 1 0.5 29 | 1 0 5 2 -1 -1 1 0 1 0.5 1 1 30 | 2 0 2 6 -1 -1 1 0 2 0 2 0.5 31 | 2 0 6 3 -1 -1 1 0 2 0.5 2 1 32 | 3 0 3 7 -1 -1 1 0 3 0 3 0.5 33 | 3 0 7 4 -1 -1 1 0 3 0.5 3 1 34 | 4 0 4 8 -1 -1 1 0 4 0 4 0.5 35 | 4 0 8 1 -1 -1 1 0 4 0.5 4 1 36 | 37 | 38 | # X Y Z 39 | points 40 | 8 41 | 0.0000000000000000 0.0000000000000000 0.0000000000000000 42 | 1.0000000000000000 0.0000000000000000 0.0000000000000000 43 | 1.0000000000000000 1.0000000000000000 0.0000000000000000 44 | 0.0000000000000000 1.0000000000000000 0.0000000000000000 45 | 0.5000000000000000 0.0000000000000000 0.0000000000000000 46 | 1.0000000000000000 0.5000000000000000 0.0000000000000000 47 | 0.5000000000000000 1.0000000000000000 0.0000000000000000 48 | 0.0000000000000000 0.5000000000000000 0.0000000000000000 49 | 50 | 51 | # pnum index 52 | pointelements 53 | 0 54 | 55 | 56 | bcnames 57 | 4 58 | 1 bottom 59 | 2 right 60 | 3 top 61 | 4 left 62 | 63 | 64 | 65 | 66 | # Surfnr Red Green Blue 67 | face_colours 68 | 1 69 | 2 0.00000000 1.00000000 0.00000000 70 | 71 | 72 | endmesh 73 | 74 | -------------------------------------------------------------------------------- /examples/INS/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = top -> [0.0, -sin(x)*exp(-2*t)] 3 | bottom -> [0.0, sin(x)*exp(-2*t)] 4 | right -> [sin(y)*exp(-2*t), 0.0] 5 | left -> [-sin(y)*exp(-2*t), 0.0] 6 | -------------------------------------------------------------------------------- /examples/INS/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = coarse_large_square_4bcs.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> HDiv 9 | p -> L2 10 | interpolant_order = 3 11 | 12 | [DG] 13 | DG = True 14 | interior_penalty_coefficient = 10.0 15 | 16 | [SOLVER] 17 | linear_solver = default 18 | preconditioner = default 19 | linearization_method = Oseen 20 | nonlinear_tolerance = relative -> 1e-4 21 | absolute -> 1e-6 22 | nonlinear_max_iterations = 3 23 | 24 | [TRANSIENT] 25 | transient = True 26 | scheme = adaptive two step 27 | time_range = 0.0, 0.1 28 | dt = 0.001 29 | dt_range = 1e-12, 0.01 30 | dt_tolerance = relative -> 1e-3 31 | absolute -> 1e-3 32 | 33 | [VISUALIZATION] 34 | save_to_file = False 35 | 36 | [ERROR ANALYSIS] 37 | check_error = True 38 | error_average = p 39 | 40 | [OTHER] 41 | num_threads = 1 42 | model = INS 43 | run_dir = . 44 | -------------------------------------------------------------------------------- /examples/INS/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [INS] 2 | u = all -> [-cos(x)*sin(y), sin(x)*cos(y)] 3 | p = all -> -0.25*(cos(2*x) + cos(2*y)) 4 | -------------------------------------------------------------------------------- /examples/INS/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /examples/INS/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [-cos(x)*sin(y)*exp(-2*t), sin(x)*cos(y)*exp(-2*t)] 3 | p = -0.25*(cos(2*x) + cos(2*y))*exp(-4*t) 4 | 5 | [METRICS] 6 | l2_norm = u, p 7 | l1_norm = u, p 8 | linfinity_norm = u, p 9 | divergence = u 10 | facet_jumps = u, p 11 | -------------------------------------------------------------------------------- /examples/MCINS/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = top -> [0.0, 0.0] 3 | bottom -> [0.0, 0.0] 4 | left -> [0.0, 0.0] 5 | 6 | [NEUMANN] 7 | a = top -> 0 8 | bottom -> 0 9 | left -> 0 10 | right -> 0 11 | b = top -> 0 12 | bottom -> 0 13 | left -> 0 14 | right -> 0 15 | 16 | [STRESS] 17 | u = right -> [0.0, 0.0] 18 | -------------------------------------------------------------------------------- /examples/MCINS/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | a -> H1 11 | b -> H1 12 | interpolant_order = 3 13 | 14 | [DG] 15 | DG = False 16 | 17 | [SOLVER] 18 | linear_solver = default 19 | preconditioner = default 20 | linearization_method = IMEX 21 | 22 | [TRANSIENT] 23 | transient = True 24 | scheme = euler IMEX 25 | time_range = 0.0, 10 26 | dt = 0.003 27 | 28 | [VISUALIZATION] 29 | save_to_file = True 30 | save_type = .vtu 31 | save_frequency = 1, numit 32 | subdivision = 3 33 | 34 | [ERROR ANALYSIS] 35 | check_error = True 36 | 37 | [OTHER] 38 | num_threads = 1 39 | model = MultiComponentINS 40 | component_names = a, b 41 | component_in_error_calc = a -> True 42 | b -> True 43 | component_in_time_deriv = a -> True 44 | b -> True 45 | run_dir = . 46 | -------------------------------------------------------------------------------- /examples/MCINS/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [MultiComponentINS] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0 4 | a = all -> 1 5 | b = all -> 0 -------------------------------------------------------------------------------- /examples/MCINS/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 1 4 | b -> 1 5 | 6 | [FUNCTIONS] 7 | source = u -> [0.0, 0.0] 8 | a -> -0.1 9 | b -> 0.1 10 | -------------------------------------------------------------------------------- /examples/MCINS/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [0.0, 0.0] 3 | a = 0.0 4 | b = 1.0 5 | 6 | [METRICS] 7 | L2_norm = u, a, b 8 | divergence = u 9 | -------------------------------------------------------------------------------- /examples/MCINS/unit_square_coarse.vol: -------------------------------------------------------------------------------- 1 | # Generated by NETGEN v6.2.2009 2 | 3 | mesh3d 4 | dimension 5 | 2 6 | geomtype 7 | 0 8 | 9 | # surfnr bcnr domin domout np p1 p2 p3 10 | surfaceelements 11 | 6 12 | 2 1 0 0 3 1 5 8 13 | 2 1 0 0 3 2 6 5 14 | 2 1 0 0 3 3 7 6 15 | 2 1 0 0 3 4 8 7 16 | 2 1 0 0 3 5 6 7 17 | 2 1 0 0 3 5 7 8 18 | 19 | 20 | # matnr np p1 p2 p3 p4 21 | volumeelements 22 | 0 23 | 24 | 25 | # surfid 0 p1 p2 trignum1 trignum2 domin/surfnr1 domout/surfnr2 ednr1 dist1 ednr2 dist2 26 | edgesegmentsgi2 27 | 8 28 | 1 0 1 5 -1 -1 1 0 1 0 1 0.5 29 | 1 0 5 2 -1 -1 1 0 1 0.5 1 1 30 | 2 0 2 6 -1 -1 1 0 2 0 2 0.5 31 | 2 0 6 3 -1 -1 1 0 2 0.5 2 1 32 | 3 0 3 7 -1 -1 1 0 3 0 3 0.5 33 | 3 0 7 4 -1 -1 1 0 3 0.5 3 1 34 | 4 0 4 8 -1 -1 1 0 4 0 4 0.5 35 | 4 0 8 1 -1 -1 1 0 4 0.5 4 1 36 | 37 | 38 | # X Y Z 39 | points 40 | 8 41 | 0.0000000000000000 0.0000000000000000 0.0000000000000000 42 | 1.0000000000000000 0.0000000000000000 0.0000000000000000 43 | 1.0000000000000000 1.0000000000000000 0.0000000000000000 44 | 0.0000000000000000 1.0000000000000000 0.0000000000000000 45 | 0.5000000000000000 0.0000000000000000 0.0000000000000000 46 | 1.0000000000000000 0.5000000000000000 0.0000000000000000 47 | 0.5000000000000000 1.0000000000000000 0.0000000000000000 48 | 0.0000000000000000 0.5000000000000000 0.0000000000000000 49 | 50 | 51 | # pnum index 52 | pointelements 53 | 0 54 | 55 | 56 | bcnames 57 | 4 58 | 1 bottom 59 | 2 right 60 | 3 top 61 | 4 left 62 | 63 | 64 | 65 | 66 | # Surfnr Red Green Blue 67 | face_colours 68 | 1 69 | 2 0.00000000 1.00000000 0.00000000 70 | 71 | 72 | endmesh 73 | 74 | -------------------------------------------------------------------------------- /examples/Poisson/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = left -> sin(pi * x) * cos(pi * y) 3 | right -> sin(pi * x) * cos(pi * y) 4 | 5 | [NEUMANN] 6 | u = top -> -pi * sin(pi * x) * sin(pi * y) 7 | bottom -> pi * sin(pi * x) * sin(pi * y) 8 | 9 | [ROBIN] 10 | -------------------------------------------------------------------------------- /examples/Poisson/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = False 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | 18 | [TRANSIENT] 19 | transient = False 20 | 21 | [VISUALIZATION] 22 | save_to_file = False 23 | 24 | [ERROR ANALYSIS] 25 | check_error = False 26 | convergence_test = h -> u 27 | num_refinements = 5 28 | 29 | [OTHER] 30 | num_threads = 2 31 | model = Poisson 32 | run_dir = . 33 | -------------------------------------------------------------------------------- /examples/Poisson/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /examples/Poisson/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 0.5 3 | 4 | [FUNCTIONS] 5 | source = all -> pi^2*sin(pi*x)*cos(pi*y) 6 | -------------------------------------------------------------------------------- /examples/Poisson/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = sin(pi * x) * cos(pi * y) 3 | 4 | [METRICS] 5 | L2_norm = u 6 | -------------------------------------------------------------------------------- /examples/Poisson/unit_square_coarse.vol: -------------------------------------------------------------------------------- 1 | # Generated by NETGEN v6.2.2009 2 | 3 | mesh3d 4 | dimension 5 | 2 6 | geomtype 7 | 0 8 | 9 | # surfnr bcnr domin domout np p1 p2 p3 10 | surfaceelements 11 | 6 12 | 2 1 0 0 3 1 5 8 13 | 2 1 0 0 3 2 6 5 14 | 2 1 0 0 3 3 7 6 15 | 2 1 0 0 3 4 8 7 16 | 2 1 0 0 3 5 6 7 17 | 2 1 0 0 3 5 7 8 18 | 19 | 20 | # matnr np p1 p2 p3 p4 21 | volumeelements 22 | 0 23 | 24 | 25 | # surfid 0 p1 p2 trignum1 trignum2 domin/surfnr1 domout/surfnr2 ednr1 dist1 ednr2 dist2 26 | edgesegmentsgi2 27 | 8 28 | 1 0 1 5 -1 -1 1 0 1 0 1 0.5 29 | 1 0 5 2 -1 -1 1 0 1 0.5 1 1 30 | 2 0 2 6 -1 -1 1 0 2 0 2 0.5 31 | 2 0 6 3 -1 -1 1 0 2 0.5 2 1 32 | 3 0 3 7 -1 -1 1 0 3 0 3 0.5 33 | 3 0 7 4 -1 -1 1 0 3 0.5 3 1 34 | 4 0 4 8 -1 -1 1 0 4 0 4 0.5 35 | 4 0 8 1 -1 -1 1 0 4 0.5 4 1 36 | 37 | 38 | # X Y Z 39 | points 40 | 8 41 | 0.0000000000000000 0.0000000000000000 0.0000000000000000 42 | 1.0000000000000000 0.0000000000000000 0.0000000000000000 43 | 1.0000000000000000 1.0000000000000000 0.0000000000000000 44 | 0.0000000000000000 1.0000000000000000 0.0000000000000000 45 | 0.5000000000000000 0.0000000000000000 0.0000000000000000 46 | 1.0000000000000000 0.5000000000000000 0.0000000000000000 47 | 0.5000000000000000 1.0000000000000000 0.0000000000000000 48 | 0.0000000000000000 0.5000000000000000 0.0000000000000000 49 | 50 | 51 | # pnum index 52 | pointelements 53 | 0 54 | 55 | 56 | bcnames 57 | 4 58 | 1 bottom 59 | 2 right 60 | 3 top 61 | 4 left 62 | 63 | 64 | 65 | 66 | # Surfnr Red Green Blue 67 | face_colours 68 | 1 69 | 2 0.00000000 1.00000000 0.00000000 70 | 71 | 72 | endmesh 73 | 74 | -------------------------------------------------------------------------------- /examples/Stokes/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = wall -> [0.0, 0.0] 3 | 4 | [STRESS] 5 | u = inlet -> [10.0, 0.0] 6 | outlet -> [-5.0, 0.0] 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/Stokes/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = channel_3bcs.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> HDiv 9 | p -> L2 10 | interpolant_order = 3 11 | 12 | [DG] 13 | DG = True 14 | interior_penalty_coefficient = 10.0 15 | 16 | [SOLVER] 17 | linear_solver = default 18 | preconditioner = default 19 | 20 | [TRANSIENT] 21 | transient = False 22 | 23 | [VISUALIZATION] 24 | save_to_file = False 25 | 26 | [ERROR ANALYSIS] 27 | check_error = True 28 | error_average = p 29 | 30 | [OTHER] 31 | num_threads = 2 32 | model = Stokes 33 | run_dir = . 34 | -------------------------------------------------------------------------------- /examples/Stokes/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0.0 4 | -------------------------------------------------------------------------------- /examples/Stokes/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.001 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /examples/Stokes/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [5.0/(2.0*0.001)*(0.2*y - y^2), 0.0] 3 | p = 5.0*(1.0 - x) + 5.0 4 | 5 | [METRICS] 6 | L2_norm = u, p 7 | L1_norm = u, p 8 | Linfinity_norm = u, p 9 | divergence = u 10 | # TODO: Turn back on once NGSolve updates and it not longer crashes 11 | ;facet_jumps = u, p 12 | -------------------------------------------------------------------------------- /examples/UI/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | 3 | [NEUMANN] 4 | 5 | [ROBIN] 6 | -------------------------------------------------------------------------------- /examples/UI/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | 3 | [DIM] 4 | 5 | [FINITE ELEMENT SPACE] 6 | 7 | [DG] 8 | 9 | [SOLVER] 10 | 11 | [TRANSIENT] 12 | 13 | [VISUALIZATION] 14 | 15 | [ERROR ANALYSIS] 16 | 17 | [OTHER] 18 | -------------------------------------------------------------------------------- /examples/UI/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | -------------------------------------------------------------------------------- /examples/UI/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | 3 | [FUNCTIONS] 4 | -------------------------------------------------------------------------------- /examples/UI/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | 3 | [METRICS] 4 | -------------------------------------------------------------------------------- /examples/tutorial_1/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = top -> 0 3 | bottom -> 0 4 | 5 | [NEUMANN] 6 | u = right -> (1-2*x)*y*(1-y) 7 | left -> -(1-2*x)*y*(1-y) 8 | -------------------------------------------------------------------------------- /examples/tutorial_1/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = unit_square_4bcs.vol 3 | 4 | [FINITE ELEMENT SPACE] 5 | elements = u -> H1 6 | interpolant_order = 2 7 | 8 | [SOLVER] 9 | linear_solver = direct 10 | preconditioner = None 11 | 12 | [VISUALIZATION] 13 | save_to_file = True 14 | save_type = .vtu 15 | 16 | [OTHER] 17 | model = Poisson 18 | run_dir = . 19 | num_threads = 2 20 | 21 | -------------------------------------------------------------------------------- /examples/tutorial_1/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /examples/tutorial_1/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 2*(x*(1-x) + y*(1-y)) 6 | -------------------------------------------------------------------------------- /examples/tutorial_1/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/examples/tutorial_1/ref_sol_dir/ref_sol_config -------------------------------------------------------------------------------- /examples/tutorial_10/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = wall -> [0.0, 0.0, 0.0] 3 | cyl -> [0.0, 0.0, 0.0] 4 | inlet -> [0.0, 0.0, 36.0*0.45*x*y*(0.41-x)*(0.41-y)/0.41^4] 5 | 6 | [STRESS] 7 | u = outlet -> [0.0, 0.0, 0.0] 8 | -------------------------------------------------------------------------------- /examples/tutorial_10/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = flow_past_cyl_3d.msh 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> VectorH1 7 | p -> H1 8 | interpolant_order = 2 9 | 10 | [DG] 11 | DG = False 12 | 13 | [SOLVER] 14 | linear_solver = direct 15 | preconditioner = direct 16 | linearization_method = Oseen 17 | nonlinear_solver = default 18 | nonlinear_tolerance = relative -> 1e-3 19 | absolute -> 1e-3 20 | nonlinear_max_iterations = 500 21 | 22 | [TRANSIENT] 23 | transient = False 24 | 25 | [VISUALIZATION] 26 | save_to_file = True 27 | save_type = .vtu 28 | 29 | [ERROR ANALYSIS] 30 | check_error = True 31 | 32 | [OTHER] 33 | model = INS 34 | run_dir = . 35 | num_threads = 6 36 | messaging_level = 2 37 | -------------------------------------------------------------------------------- /examples/tutorial_10/config_DG: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = flow_past_cyl_3d.msh 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> HDiv 7 | p -> L2 8 | interpolant_order = 1 9 | 10 | [DG] 11 | DG = True 12 | interior_penalty_coefficient = 10.0 13 | 14 | [SOLVER] 15 | linear_solver = direct 16 | preconditioner = direct 17 | linearization_method = Oseen 18 | 19 | nonlinear_solver = default 20 | nonlinear_tolerance = relative -> 1e-6 21 | absolute -> 1e-6 22 | nonlinear_max_iterations = 10 23 | 24 | [TRANSIENT] 25 | transient = False 26 | 27 | [VISUALIZATION] 28 | save_to_file = True 29 | save_type = .vtu 30 | 31 | [ERROR ANALYSIS] 32 | check_error = True 33 | 34 | [OTHER] 35 | model = INS 36 | run_dir = . 37 | num_threads = 6 38 | messaging_level = 2 39 | -------------------------------------------------------------------------------- /examples/tutorial_10/config_DG_IC: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = flow_past_cyl_3d.msh 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> HDiv 7 | p -> L2 8 | interpolant_order = 1 9 | 10 | [DG] 11 | DG = True 12 | interior_penalty_coefficient = 10.0 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | 18 | [VISUALIZATION] 19 | save_type = .vtu 20 | save_to_file = True 21 | 22 | [ERROR ANALYSIS] 23 | check_error = True 24 | 25 | [OTHER] 26 | num_threads = 6 27 | model = Stokes 28 | run_dir = . 29 | messaging_level = 2 30 | -------------------------------------------------------------------------------- /examples/tutorial_10/config_IC: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = flow_past_cyl_3d.msh 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> VectorH1 7 | p -> H1 8 | interpolant_order = 2 9 | 10 | [DG] 11 | DG = False 12 | interior_penalty_coefficient = 10.0 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | 18 | [VISUALIZATION] 19 | save_type = .vtu 20 | save_to_file = True 21 | 22 | [ERROR ANALYSIS] 23 | check_error = True 24 | 25 | [OTHER] 26 | num_threads = 6 27 | model = Stokes 28 | run_dir = . 29 | messaging_level = 2 30 | -------------------------------------------------------------------------------- /examples/tutorial_10/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | all = all -> None 3 | 4 | [INS] 5 | all = all -> output/stokes_sol/stokes_0.0.sol 6 | -------------------------------------------------------------------------------- /examples/tutorial_10/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1e-3 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0, 0.0] 6 | -------------------------------------------------------------------------------- /examples/tutorial_10/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | 3 | [METRICS] 4 | surface_traction = cyl 5 | -------------------------------------------------------------------------------- /examples/tutorial_2/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = bc -> 0.0 3 | -------------------------------------------------------------------------------- /examples/tutorial_2/coarse_unit_square_1bc.msh: -------------------------------------------------------------------------------- 1 | $MeshFormat 2 | 2.2 0 8 3 | $EndMeshFormat 4 | $PhysicalNames 5 | 3 6 | 0 3 "bc" 7 | 1 2 "bc" 8 | 2 1 "bc" 9 | $EndPhysicalNames 10 | $Nodes 11 | 13 12 | 1 0 0 0 13 | 2 0 1 0 14 | 3 1 1 0 15 | 4 1 0 0 16 | 5 0.4999999999986718 0 0 17 | 6 1 0.4999999999986718 0 18 | 7 0.5000000000013305 1 0 19 | 8 0 0.5000000000013305 0 20 | 9 0.5 0.5 0 21 | 10 0.25 0.25 0 22 | 11 0.25 0.75 0 23 | 12 0.75 0.25 0 24 | 13 0.75 0.75 0 25 | $EndNodes 26 | $Elements 27 | 28 28 | 1 15 2 3 1 1 29 | 2 15 2 3 2 2 30 | 3 15 2 3 3 3 31 | 4 15 2 3 4 4 32 | 5 1 2 2 1 1 5 33 | 6 1 2 2 1 5 4 34 | 7 1 2 2 2 4 6 35 | 8 1 2 2 2 6 3 36 | 9 1 2 2 3 3 7 37 | 10 1 2 2 3 7 2 38 | 11 1 2 2 4 2 8 39 | 12 1 2 2 4 8 1 40 | 13 2 2 1 1 2 8 11 41 | 14 2 2 1 1 8 10 11 42 | 15 2 2 1 1 8 1 10 43 | 16 2 2 1 1 11 10 9 44 | 17 2 2 1 1 1 5 10 45 | 18 2 2 1 1 5 12 10 46 | 19 2 2 1 1 5 4 12 47 | 20 2 2 1 1 10 12 9 48 | 21 2 2 1 1 3 7 13 49 | 22 2 2 1 1 7 11 13 50 | 23 2 2 1 1 7 2 11 51 | 24 2 2 1 1 13 11 9 52 | 25 2 2 1 1 4 6 12 53 | 26 2 2 1 1 6 13 12 54 | 27 2 2 1 1 6 3 13 55 | 28 2 2 1 1 12 13 9 56 | $EndElements 57 | -------------------------------------------------------------------------------- /examples/tutorial_2/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = coarse_unit_square_1bc.msh 3 | 4 | [FINITE ELEMENT SPACE] 5 | elements = u -> H1 6 | interpolant_order = 2 7 | 8 | [SOLVER] 9 | linear_solver = direct 10 | preconditioner = None 11 | 12 | [TRANSIENT] 13 | transient = False 14 | 15 | [VISUALIZATION] 16 | save_to_file = False 17 | 18 | [ERROR ANALYSIS] 19 | convergence_test = h -> u 20 | num_refinements = 5 21 | 22 | [OTHER] 23 | model = Poisson 24 | run_dir = . 25 | num_threads = 2 26 | -------------------------------------------------------------------------------- /examples/tutorial_2/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /examples/tutorial_2/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 2*(x*(1-x) + y*(1-y)) 6 | -------------------------------------------------------------------------------- /examples/tutorial_2/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = x*(1-x)*y*(1-y) 3 | 4 | [METRICS] 5 | -------------------------------------------------------------------------------- /examples/tutorial_3/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = inlet -> [50*y*(0.2 - y), 0.0] 3 | wall -> [0.0, 0.0] 4 | 5 | [STRESS] 6 | u = outlet -> [0.0, 0.0] 7 | -------------------------------------------------------------------------------- /examples/tutorial_3/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = channel_3bcs.vol 3 | 4 | [FINITE ELEMENT SPACE] 5 | elements = u -> HDiv 6 | p -> L2 7 | interpolant_order = 3 8 | 9 | [DG] 10 | DG = True 11 | interior_penalty_coefficient = 10.0 12 | 13 | [SOLVER] 14 | linear_solver = CG 15 | preconditioner = direct 16 | linear_tolerance = 1e-12 17 | linear_max_iterations = 100 18 | 19 | [ERROR ANALYSIS] 20 | check_error = True 21 | 22 | [OTHER] 23 | model = Stokes 24 | run_dir = . 25 | num_threads = 2 26 | -------------------------------------------------------------------------------- /examples/tutorial_3/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0.0 4 | -------------------------------------------------------------------------------- /examples/tutorial_3/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.1 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /examples/tutorial_3/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [50*y*(0.2 - y), 0.0] 3 | p = 10.0*(1.0 - x) 4 | 5 | [METRICS] 6 | L2_norm = u, p 7 | L1_norm = u, p 8 | Linfinity_norm = u, p 9 | divergence = u 10 | facet_jumps = u, p 11 | -------------------------------------------------------------------------------- /examples/tutorial_4/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = inlet -> [ramp(t, 0.0, 50*y*(0.2 - y), 0.5), 0.0] 3 | wall -> [0.0, 0.0] 4 | 5 | [STRESS] 6 | u = outlet -> [0.0, 0.0] 7 | -------------------------------------------------------------------------------- /examples/tutorial_4/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = coarse_channel_3bcs.vol 3 | 4 | [FINITE ELEMENT SPACE] 5 | elements = u -> HDiv 6 | p -> L2 7 | interpolant_order = 3 8 | 9 | [DG] 10 | DG = True 11 | interior_penalty_coefficient = 10.0 12 | 13 | [SOLVER] 14 | linear_solver = direct 15 | preconditioner = None 16 | 17 | [TRANSIENT] 18 | transient = True 19 | scheme = implicit euler 20 | time_range = 0, 2 21 | dt = 0.005 22 | 23 | [VISUALIZATION] 24 | save_to_file = True 25 | save_type = .vtu 26 | save_frequency = 0.1, time 27 | 28 | [ERROR ANALYSIS] 29 | check_error = True 30 | 31 | [OTHER] 32 | model = Stokes 33 | run_dir = . 34 | num_threads = 2 35 | -------------------------------------------------------------------------------- /examples/tutorial_4/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0.0 4 | -------------------------------------------------------------------------------- /examples/tutorial_4/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.1 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /examples/tutorial_4/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [50*y*(0.2 - y), 0.0] 3 | p = 10.0*(1.0 - x) 4 | 5 | [METRICS] 6 | L2_norm = u, p 7 | L1_norm = u, p 8 | Linfinity_norm = u, p 9 | divergence = u 10 | facet_jumps = u, p 11 | -------------------------------------------------------------------------------- /examples/tutorial_5/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = inlet -> [ramp(t, 0.0, 50*y*(0.2 - y), 0.5), 0.0] 3 | wall -> [0.0, 0.0] 4 | 5 | [STRESS] 6 | u = outlet -> [0.0, 0.0] 7 | -------------------------------------------------------------------------------- /examples/tutorial_5/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = coarse_channel_3bcs.vol 3 | 4 | [FINITE ELEMENT SPACE] 5 | elements = u -> HDiv 6 | p -> L2 7 | interpolant_order = 3 8 | 9 | [DG] 10 | DG = True 11 | interior_penalty_coefficient = 10.0 12 | 13 | [SOLVER] 14 | linear_solver = direct 15 | preconditioner = None 16 | 17 | [TRANSIENT] 18 | transient = True 19 | scheme = adaptive two step 20 | time_range = 0, 2 21 | dt = 0.005 22 | dt_range = 1e-10, 0.1 23 | dt_tolerance = relative -> 1e-3 24 | absolute -> 1e-3 25 | 26 | [VISUALIZATION] 27 | save_to_file = True 28 | save_type = .vtu 29 | save_frequency = 0.1, time 30 | 31 | [ERROR ANALYSIS] 32 | check_error = True 33 | 34 | [OTHER] 35 | model = Stokes 36 | run_dir = . 37 | num_threads = 2 38 | -------------------------------------------------------------------------------- /examples/tutorial_5/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0.0 4 | -------------------------------------------------------------------------------- /examples/tutorial_5/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.1 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /examples/tutorial_5/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [50*y*(0.2 - y), 0.0] 3 | p = 10.0*(1.0 - x) 4 | 5 | [METRICS] 6 | L2_norm = u, p 7 | L1_norm = u, p 8 | Linfinity_norm = u, p 9 | divergence = u 10 | facet_jumps = u, p 11 | -------------------------------------------------------------------------------- /examples/tutorial_6/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = wall -> [0.0, 0.0] 3 | inlet -> [6*y*(0.41-y)/(0.41*0.41), 0.0] 4 | cyl -> [0.0, 0.0] 5 | 6 | [STRESS] 7 | u = outlet -> [0.0, 0.0] 8 | -------------------------------------------------------------------------------- /examples/tutorial_6/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = channel_w_cyl.vol 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> HDiv 7 | p -> L2 8 | interpolant_order = 3 9 | 10 | [DG] 11 | DG = True 12 | interior_penalty_coefficient = 10.0 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | linearization_method = Oseen 18 | nonlinear_solver = default 19 | nonlinear_tolerance = relative -> 1e-6 20 | absolute -> 1e-6 21 | nonlinear_max_iterations = 3 22 | 23 | [TRANSIENT] 24 | transient = True 25 | scheme = implicit euler 26 | time_range = 0.0, 1.0 27 | dt = 1e-2 28 | 29 | [VISUALIZATION] 30 | save_to_file = True 31 | save_type = .vtu 32 | save_frequency = 0.1, time 33 | 34 | [OTHER] 35 | model = INS 36 | run_dir = . 37 | num_threads = 6 38 | -------------------------------------------------------------------------------- /examples/tutorial_6/config_IC: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = channel_w_cyl.vol 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> HDiv 7 | p -> L2 8 | interpolant_order = 3 9 | 10 | [DG] 11 | DG = True 12 | interior_penalty_coefficient = 10.0 13 | 14 | [SOLVER] 15 | linear_solver = CG 16 | preconditioner = default 17 | 18 | [VISUALIZATION] 19 | save_to_file = True 20 | 21 | [OTHER] 22 | num_threads = 2 23 | model = Stokes 24 | run_dir = . 25 | -------------------------------------------------------------------------------- /examples/tutorial_6/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | all = all -> None 3 | 4 | [INS] 5 | all = all -> output/stokes_sol/stokes_0.0.sol 6 | -------------------------------------------------------------------------------- /examples/tutorial_6/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.001 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /examples/tutorial_6/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/examples/tutorial_6/ref_sol_dir/ref_sol_config -------------------------------------------------------------------------------- /examples/tutorial_7/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = wall -> [0.0, 0.0] 3 | inlet -> [6*y*(0.41-y)/(0.41*0.41), 0.0] 4 | cyl -> [0.0, 0.0] 5 | 6 | [STRESS] 7 | u = outlet -> [0.0, 0.0] 8 | -------------------------------------------------------------------------------- /examples/tutorial_7/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = channel_w_cyl.vol 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> HDiv 7 | p -> L2 8 | interpolant_order = 3 9 | 10 | [DG] 11 | DG = True 12 | interior_penalty_coefficient = 10.0 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | linearization_method = IMEX 18 | 19 | [TRANSIENT] 20 | transient = True 21 | scheme = euler IMEX 22 | time_range = 0.0, 1.0 23 | dt = 1e-2 24 | 25 | [VISUALIZATION] 26 | save_to_file = True 27 | save_type = .vtu 28 | save_frequency = 0.1, time 29 | 30 | [OTHER] 31 | model = INS 32 | run_dir = . 33 | num_threads = 2 34 | -------------------------------------------------------------------------------- /examples/tutorial_7/config_IC: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = channel_w_cyl.vol 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> HDiv 7 | p -> L2 8 | interpolant_order = 3 9 | 10 | [DG] 11 | DG = True 12 | interior_penalty_coefficient = 10.0 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | 18 | [VISUALIZATION] 19 | save_to_file = True 20 | 21 | [OTHER] 22 | num_threads = 2 23 | model = Stokes 24 | run_dir = . 25 | -------------------------------------------------------------------------------- /examples/tutorial_7/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | all = all -> None 3 | 4 | [INS] 5 | all = all -> output/stokes_sol/stokes_0.0.sol 6 | -------------------------------------------------------------------------------- /examples/tutorial_7/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.001 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /examples/tutorial_7/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/examples/tutorial_7/ref_sol_dir/ref_sol_config -------------------------------------------------------------------------------- /examples/tutorial_8a/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = inlet -> [ramp(t, 0.0, 1.0, 1.0)*y*(0.5-y)/0.5^2, 0.0] 3 | wall -> [0.0, 0.0] 4 | circle -> [0.0, 0.0] 5 | a = inlet -> ramp(t, 0.0, 1.0, 2.5)*1.0 6 | b = inlet -> 0.0 7 | 8 | [STRESS] 9 | u = outlet -> [0.0, 0.0] 10 | 11 | [TOTAL_FLUX] 12 | a = outlet -> 0.0 13 | wall -> 0.0 14 | b = outlet -> 0.0 15 | wall -> 0.0 16 | 17 | [SURFACE_RXN] 18 | a = circle -> -a 19 | b = circle -> a 20 | -------------------------------------------------------------------------------- /examples/tutorial_8a/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = reaction.vol 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> VectorH1 7 | p -> H1 8 | a -> H1 9 | b -> H1 10 | interpolant_order = 2 11 | 12 | [DG] 13 | DG = False 14 | 15 | [SOLVER] 16 | linear_solver = default 17 | preconditioner = default 18 | linearization_method = Oseen 19 | nonlinear_solver = default 20 | nonlinear_tolerance = relative -> 1e-5 21 | absolute -> 1e-6 22 | nonlinear_max_iterations = 10 23 | 24 | [TRANSIENT] 25 | transient = True 26 | scheme = adaptive three step 27 | time_range = 0, 3 28 | dt = 1e-3 29 | dt_range = 1e-6, 0.5 30 | dt_tolerance = relative -> 1e-3 31 | absolute -> 1e-4 32 | 33 | [VISUALIZATION] 34 | save_to_file = True 35 | save_type = .vtu 36 | save_frequency = 0.1, time 37 | 38 | [OTHER] 39 | model = MultiComponentINS 40 | component_names = a, b 41 | component_in_error_calc = a -> True 42 | b -> True 43 | component_in_time_deriv = a -> True 44 | b -> True 45 | run_dir = . 46 | num_threads = 6 47 | -------------------------------------------------------------------------------- /examples/tutorial_8a/convert.py: -------------------------------------------------------------------------------- 1 | from opencmp.post_processing import sol_to_vtu_direct 2 | from opencmp.config_functions import ConfigParser 3 | 4 | path_to_config_file = "config" 5 | path_to_output_director = "output/" 6 | 7 | sol_to_vtu_direct(ConfigParser(path_to_config_file), path_to_output_director) 8 | -------------------------------------------------------------------------------- /examples/tutorial_8a/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [MultiComponentINS] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0.0 4 | a = all -> 0.0 5 | b = all -> 0.0 6 | -------------------------------------------------------------------------------- /examples/tutorial_8a/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 1 4 | b -> 1 5 | 6 | [FUNCTIONS] 7 | source = u -> [0.0, 0.0] 8 | a -> 0 9 | b -> 0 10 | -------------------------------------------------------------------------------- /examples/tutorial_8a/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/examples/tutorial_8a/ref_sol_dir/ref_sol_config -------------------------------------------------------------------------------- /examples/tutorial_8b/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = inlet -> [ramp(t, 0.0, 1.0, 1.0)*y*(0.5-y)/0.5^2, 0.0] 3 | wall -> [0.0, 0.0] 4 | circle -> [0.0, 0.0] 5 | a = inlet -> ramp(t, 0.0, 1.0, 1.0)*1.0 6 | b = inlet -> 0.0 7 | 8 | [STRESS] 9 | u = outlet -> [0.0, 0.0] 10 | 11 | [TOTAL_FLUX] 12 | a = outlet -> 0.0 13 | wall -> 0.0 14 | b = outlet -> 0.0 15 | wall -> 0.0 16 | 17 | [SURFACE_RXN] 18 | a = circle -> -a 19 | b = circle -> a 20 | -------------------------------------------------------------------------------- /examples/tutorial_8b/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = reaction.vol 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> VectorH1 7 | p -> H1 8 | a -> H1 9 | b -> H1 10 | interpolant_order = 2 11 | 12 | [DG] 13 | DG = False 14 | 15 | [SOLVER] 16 | linear_solver = default 17 | preconditioner = default 18 | linearization_method = Oseen 19 | nonlinear_solver = default 20 | nonlinear_tolerance = relative -> 1e-5 21 | absolute -> 1e-6 22 | nonlinear_max_iterations = 10 23 | 24 | [TRANSIENT] 25 | transient = True 26 | scheme = adaptive three step 27 | time_range = 0, 3 28 | dt = 1e-3 29 | dt_range = 1e-6, 0.5 30 | dt_tolerance = relative -> 1e-3 31 | absolute -> 1e-4 32 | 33 | [VISUALIZATION] 34 | save_to_file = True 35 | save_type = .vtu 36 | save_frequency = 0.1, time 37 | 38 | [OTHER] 39 | model = MultiComponentINS 40 | component_names = a, b 41 | component_in_error_calc = a -> True 42 | b -> True 43 | component_in_time_deriv = a -> True 44 | b -> True 45 | run_dir = . 46 | num_threads = 6 47 | velocity_fixed = True 48 | -------------------------------------------------------------------------------- /examples/tutorial_8b/config_IC: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = reaction.vol 3 | curved_elements = True 4 | 5 | [FINITE ELEMENT SPACE] 6 | elements = u -> VectorH1 7 | p -> H1 8 | interpolant_order = 2 9 | 10 | [DG] 11 | DG = False 12 | 13 | [SOLVER] 14 | linear_solver = default 15 | preconditioner = default 16 | linearization_method = Oseen 17 | nonlinear_tolerance = relative -> 1e-5 18 | absolute -> 1e-6 19 | nonlinear_max_iterations = 10 20 | 21 | [TRANSIENT] 22 | transient = True 23 | scheme = adaptive three step 24 | time_range = 0, 20 25 | dt = 1e-3 26 | dt_range = 1e-6, 20 27 | dt_tolerance = relative -> 1e-3 28 | absolute -> 1e-4 29 | 30 | [VISUALIZATION] 31 | save_to_file = True 32 | save_type = .sol 33 | save_frequency = 1, numit 34 | split_components = True 35 | 36 | [OTHER] 37 | model = INS 38 | run_dir = . 39 | num_threads = 6 40 | -------------------------------------------------------------------------------- /examples/tutorial_8b/convert.py: -------------------------------------------------------------------------------- 1 | from opencmp.post_processing import sol_to_vtu_direct 2 | from opencmp.config_functions import ConfigParser 3 | 4 | path_to_config_file = "config" 5 | path_to_output_director = "output/" 6 | 7 | sol_to_vtu_direct(ConfigParser(path_to_config_file), path_to_output_director) 8 | -------------------------------------------------------------------------------- /examples/tutorial_8b/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [INS] 2 | all = all -> None 3 | 4 | [MultiComponentINS] 5 | u = all -> output/components_sol/u.sol 6 | p = all -> output/components_sol/p.sol 7 | a = all -> 0.0 8 | b = all -> 0.0 -------------------------------------------------------------------------------- /examples/tutorial_8b/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 1 4 | b -> 1 5 | 6 | [FUNCTIONS] 7 | source = u -> [0.0, 0.0] 8 | a -> 0 9 | b -> 0 10 | -------------------------------------------------------------------------------- /examples/tutorial_8b/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/examples/tutorial_8b/ref_sol_dir/ref_sol_config -------------------------------------------------------------------------------- /examples/tutorial_9/bc_dir/bc_config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/examples/tutorial_9/bc_dir/bc_config -------------------------------------------------------------------------------- /examples/tutorial_9/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | 3 | [DIM] 4 | diffuse_interface_method = True 5 | dim_dir = dim_dir 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 2 10 | 11 | [DG] 12 | DG = False 13 | 14 | [SOLVER] 15 | linear_solver = GMRes 16 | preconditioner = None 17 | 18 | [TRANSIENT] 19 | transient = False 20 | 21 | [ERROR ANALYSIS] 22 | check_error = False 23 | 24 | [OTHER] 25 | num_threads = 8 26 | model = Poisson 27 | run_dir = . 28 | 29 | [VISUALIZATION] 30 | save_to_file = True 31 | save_type = .sol 32 | -------------------------------------------------------------------------------- /examples/tutorial_9/dim_dir/bc_dir/bottom_bc.sol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/examples/tutorial_9/dim_dir/bc_dir/bottom_bc.sol -------------------------------------------------------------------------------- /examples/tutorial_9/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | bottom = dim_dir/bc_dir/led_bottom.msh 3 | 4 | [CENTROIDS] 5 | bottom = <0.0, 0.0, 2.0> 6 | 7 | [DIRICHLET] 8 | 9 | [NEUMANN] 10 | u = bottom -> dim_dir/bc_dir/bottom_bc.sol 11 | 12 | [ROBIN] 13 | u = remainder -> 0.00124, 0.0 14 | -------------------------------------------------------------------------------- /examples/tutorial_9/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | mesh_dimension = 3 3 | num_mesh_elements = x -> 80 4 | y -> 80 5 | z -> 80 6 | mesh_scale = x -> 5 7 | y -> 5 8 | z -> 2.6 9 | mesh_offset = x -> 2.5 10 | y -> 2.5 11 | z -> 0.2 12 | interface_width_parameter = 0.01 13 | 14 | [DIM BOUNDARY CONDITIONS] 15 | multiple_bcs = True 16 | remainder = True 17 | 18 | [PHASE FIELDS] 19 | load_method = generate 20 | stl_filename = dim_dir/led.stl 21 | save_to_file = False 22 | -------------------------------------------------------------------------------- /examples/tutorial_9/dim_dir/ng.ini: -------------------------------------------------------------------------------- 1 | recentfile "led.stl" 2 | -------------------------------------------------------------------------------- /examples/tutorial_9/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /examples/tutorial_9/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 0.0 6 | -------------------------------------------------------------------------------- /examples/tutorial_9/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | 3 | [METRICS] 4 | -------------------------------------------------------------------------------- /examples/tutorial_9/visualization.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | import matplotlib.cm as cm 4 | 5 | import ngsolve as ngs 6 | 7 | from opencmp.diffuse_interface import interface, mesh_helpers 8 | from opencmp.helpers.ngsolve_ import ngsolve_to_numpy 9 | 10 | N = [80, 80, 80] 11 | scale = [5.0, 5.0, 2.6] 12 | offset = [2.5, 2.5, 0.2] 13 | dim = 3 14 | interp_ord = 2 15 | 16 | mesh = mesh_helpers.get_Netgen_nonconformal(N, scale, offset, dim, True) 17 | mesh = ngs.Mesh(mesh) 18 | 19 | fes = ngs.H1(mesh, order=interp_ord) 20 | 21 | stl_filename = 'dim_dir/led.stl' 22 | boundary_lst, bounds_lst = mesh_helpers.get_stl_faces(stl_filename) 23 | binary = interface.get_binary_3d(boundary_lst, N, scale, offset, mnum=1, close=False) 24 | 25 | data_filename = 'output/poisson_sol/poisson_0.0.sol' 26 | data_gfu = ngs.GridFunction(fes) 27 | data_gfu.Load(data_filename) 28 | 29 | x = np.linspace(-2.5, 2.5, N[0]) 30 | y = np.linspace(-2.5, 2.5, N[1]) 31 | xx, yy = np.meshgrid(x, y) 32 | 33 | data = ngsolve_to_numpy(mesh, data_gfu, N, scale, offset, dim, None)[0] * binary 34 | 35 | z_grid = [20, 40, 60, 70] 36 | z_vals = [z*(scale[2]/N[2]) - offset[2] for z in z_grid] 37 | zz = [data[:,:,z] for z in z_grid] 38 | 39 | mymap = cm.get_cmap('hot_r') 40 | 41 | fig = plt.figure(figsize=(12,10)) 42 | ax = fig.gca(projection='3d') 43 | for i in range(len(z_grid)): 44 | Z = np.zeros(xx.shape) + z_vals[i] 45 | t = zz[i] 46 | tt = mymap(t) 47 | surf = ax.plot_surface(xx, yy, Z, facecolors=tt, linewidth=0, alpha=0.5, rcount=N[0], ccount=N[1]) 48 | 49 | ax.invert_zaxis() 50 | ax.grid(False) 51 | ax.set_xticks([]) 52 | ax.set_yticks([]) 53 | ax.set_zticks([]) 54 | m = cm.ScalarMappable(cmap='hot_r') 55 | m.set_array([298, 305]) 56 | cbaxes = fig.add_axes([0.85, 0.35, 0.03, 0.4]) 57 | cbar = plt.colorbar(m, cax = cbaxes) 58 | cbar.ax.tick_params(labelsize=16) 59 | cbar.set_label('Temperature (K)', rotation=270, labelpad=30, fontsize=20) 60 | plt.show() 61 | -------------------------------------------------------------------------------- /opencmp/__init__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | from . import models 19 | from . import solvers 20 | from . import helpers 21 | from . import config_functions 22 | -------------------------------------------------------------------------------- /opencmp/__main__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | import sys 19 | 20 | from .run import run 21 | 22 | if __name__ == '__main__': 23 | 24 | if len(sys.argv) == 1: 25 | print("ERROR: Provide configuration file path.") 26 | exit(0) 27 | 28 | config_file_path = sys.argv[1] 29 | run(config_file_path) -------------------------------------------------------------------------------- /opencmp/config_functions/__init__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | # Superclass 19 | # Expanded ConfigParser 20 | from .expanded_config_parser import ConfigParser 21 | 22 | # Superclass 23 | from .base_config_functions import ConfigFunctions 24 | from .boundary_conditions import BCFunctions 25 | 26 | # Implemented subclasses 27 | from .initial_conditions import ICFunctions 28 | from .model_functions import ModelFunctions 29 | from .reference_solutions import RefSolFunctions 30 | from .controller_functions import ControllerFunctions 31 | -------------------------------------------------------------------------------- /opencmp/controllers/__init__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | # Superclass 19 | from .base_controller import Controller 20 | 21 | # Implemented controllers 22 | from .pid_controller import PID 23 | 24 | controllers_dict = {'PID' : PID} 25 | -------------------------------------------------------------------------------- /opencmp/controllers/misc.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | """ 18 | Module containing helper functions related to models 19 | """ 20 | from typing import List 21 | 22 | from . import controllers_dict 23 | from ..models import Model 24 | from .base_controller import Controller 25 | from ngsolve import Parameter 26 | 27 | 28 | def get_controller(controller_type: str, t_params: List[Parameter], model: Model, config_rel_path: str) -> Controller: 29 | """ 30 | Function to get the controller to use. 31 | 32 | Args: 33 | controller_type: The name of the controller to initialize 34 | t_params: An ngsolve Parameter representing the current time 35 | model: The model to hook the controller up to 36 | config_rel_path: The filename, and relative path, for the config file for this controller 37 | 38 | Returns: 39 | ~: An initialized controller of the type specified. 40 | """ 41 | 42 | # Find the controller by its name 43 | controller_class = controllers_dict[controller_type] 44 | 45 | # Check that whatever we found is actually a model 46 | if not issubclass(controller_class, Controller): 47 | # Raise an error if it isn't 48 | raise AttributeError("Provided class is not a controller") 49 | 50 | # Initialize and return the controller 51 | return controller_class(t_params, model, config_rel_path, model.run_dir) 52 | 53 | -------------------------------------------------------------------------------- /opencmp/diffuse_interface/__init__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | from .dim import DIM 19 | -------------------------------------------------------------------------------- /opencmp/entry_points.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | import os, sys, platform 19 | from .run import run 20 | 21 | def run_opencmp(): 22 | """ 23 | Main function that runs OpenCMP. 24 | 25 | Args (from command line): 26 | config_file_path: Filename of the config file to load. Required parameter. 27 | 28 | """ 29 | 30 | # Arguments for command line use 31 | 32 | if len(sys.argv) == 1: # if user did not provide any configuration path (which is required) 33 | print("ERROR: Provide configuration file path.") 34 | exit(0) 35 | 36 | elif len(sys.argv) == 2: # if user did provide a configuration path 37 | config_file_path = sys.argv[1] 38 | 39 | else: # if the user provides more than 1 argument (in addition to opencmp). Print error messages and quit. 40 | print('ERROR: More than one argument was provided.') 41 | print('** OpenCMP supports up to one (1) argument. The argument is a required configuration file path.') 42 | print('Please re-try with "opencmp config" where "config" is the name of the configuration file in the current directory. **') 43 | exit(0) 44 | 45 | # call the function in run.py 46 | run(config_file_path) 47 | 48 | return 49 | 50 | 51 | def pytest_tests(): 52 | 53 | print("Now will run the pytests...") 54 | 55 | user_os = str(platform.system()) 56 | 57 | if user_os == 'Windows': 58 | os.system("py -m pytest pytests//") 59 | 60 | else: # macOS or linux (and WSL) 61 | os.system("python3 -m pytest pytests//") 62 | -------------------------------------------------------------------------------- /opencmp/helpers/__init__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | from .misc import merge_bc_dict 18 | -------------------------------------------------------------------------------- /opencmp/models/__init__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | # Superclass 19 | from .base_model import Model 20 | 21 | # Implemented models 22 | from .ins import INS 23 | from .ins_dim import INSDIM 24 | from .poisson import Poisson 25 | from .poisson_dim import PoissonDIM 26 | from .stokes import Stokes 27 | from .stokes_dim import StokesDIM 28 | from .multi_component_ins import MultiComponentINS 29 | 30 | models_dict = {"INS": INS, 31 | "INS-DIM": INSDIM, 32 | "Poisson": Poisson, 33 | "Poisson-DIM": PoissonDIM, 34 | "Stokes": Stokes, 35 | "Stokes-DIM": StokesDIM, 36 | "MultiComponentINS": MultiComponentINS} 37 | 38 | # Helper functions 39 | from .misc import get_model_class 40 | -------------------------------------------------------------------------------- /opencmp/models/misc.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | from . import Model, models_dict 19 | 20 | from typing import Type 21 | 22 | """ 23 | Module containing helper functions related to models. 24 | """ 25 | 26 | 27 | def get_model_class(model_name: str, dim_used: bool) -> Type[Model]: 28 | """ 29 | Function to find the correct model to to find, initialize, and return an instance of the desired model class(es). 30 | 31 | Will raise a ValueError if a model could not be found. 32 | 33 | Args: 34 | model_name: String representing the model to use, must be the name of the model class. 35 | dim_used: bool indicating if the Diffuse Interface Method implemetation of a class should be used. 36 | 37 | Returns: 38 | An initialized instance of the desired model. 39 | """ 40 | 41 | if dim_used: 42 | model_name += "-DIM" 43 | 44 | # Find the class by its name 45 | try: 46 | model_class = models_dict[model_name] 47 | except KeyError: 48 | raise KeyError("Tried to run with class {" + model_name + "}. \n" 49 | "The available models are " + str(list(models_dict.keys()))) 50 | 51 | return model_class 52 | -------------------------------------------------------------------------------- /opencmp/solvers/__init__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | # Superclass 19 | from .base_solver import Solver 20 | 21 | # Implemented solvers 22 | from .stationary import StationarySolver 23 | from .transient_multistep import TransientMultiStepSolver 24 | from .transient_RK import TransientRKSolver 25 | from .adaptive_transient_solvers import AdaptiveIMEX 26 | from .adaptive_transient_solvers import AdaptiveThreeStep 27 | from .adaptive_transient_solvers import AdaptiveTwoStep 28 | 29 | # Helper functions 30 | from .misc import get_solver_class 31 | 32 | -------------------------------------------------------------------------------- /opencmp/solvers/adaptive_transient_solvers/__init__.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | # Base solver classes 19 | from .base_adaptive_transient_multistep import BaseAdaptiveTransientMultiStepSolver 20 | from .base_adaptive_transient_RK import BaseAdaptiveTransientRKSolver 21 | 22 | # Implemented solvers 23 | from .adaptive_IMEX import AdaptiveIMEX 24 | from .adaptive_two_step import AdaptiveTwoStep 25 | from .adaptive_three_step import AdaptiveThreeStep 26 | -------------------------------------------------------------------------------- /opencmp/solvers/misc.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | from . import * 19 | from .adaptive_transient_solvers import * 20 | from typing import Type 21 | from ..config_functions import ConfigParser 22 | 23 | """ 24 | Module containing helper functions related to solvers. 25 | """ 26 | 27 | def get_solver_class(config: ConfigParser) -> Type[Solver]: 28 | """ 29 | Function to get the solver to use. 30 | 31 | Args: 32 | config: The config file from which to get information for which solver to use. 33 | 34 | Returns: 35 | The solver to use. 36 | """ 37 | solver_class: Type[Solver] 38 | 39 | transient = config.get_item(['TRANSIENT', 'transient'], bool, quiet=True) 40 | scheme = config.get_item(['TRANSIENT', 'scheme'], str, quiet=True) 41 | adaptive = 'adaptive' in scheme 42 | 43 | if transient: 44 | if adaptive: 45 | if scheme == 'adaptive two step': 46 | solver_class = AdaptiveTwoStep 47 | elif scheme == 'adaptive three step': 48 | solver_class = AdaptiveThreeStep 49 | elif scheme == 'adaptive IMEX': 50 | solver_class = AdaptiveIMEX 51 | else: 52 | raise TypeError('Have not implemented {} time integration yet.'.format(scheme)) 53 | else: 54 | if scheme in ['explicit euler', 'implicit euler', 'crank nicolson', 'euler IMEX', 'CNLF', 'SBDF']: 55 | solver_class = TransientMultiStepSolver 56 | elif scheme in ['RK 222', 'RK 232']: 57 | solver_class = TransientRKSolver 58 | else: 59 | raise TypeError('Have not implemented {} time integration yet.'.format(scheme)) 60 | else: 61 | solver_class = StationarySolver 62 | 63 | return solver_class 64 | -------------------------------------------------------------------------------- /publications/2108_JOSS/cover_letter.txt: -------------------------------------------------------------------------------- 1 | Dear Editor, 2 | Please find our manuscript entitled "OpenCMP: An Open-Source Computational Multiphysics Package" that we are submitting for consideration as a new submission to the Journal of Open Source Software. OpenCMP is a computational multiphysics software package based on the finite element method and is primarily intended for physicochemical processes in which fluid convection plays a significant role. OpenCMP uses the NGSolve finite element library for spatial discretization and provides a configuration file-based interface for pre-implemented models and time discretization schemes. It also integrates with Netgen and Gmsh for geometry construction and meshing. Additionally, it provides users with built-in functionality for post-processing, error analysis, and data export for visualisation using Netgen or ParaView. 3 | 4 | Please note that, until recently, only one of the authors (E.J. Monte) has been committing to the public Github repository due to our research group primarily using internally-hosted version control. All listed authors have made significant contributions to the software and we are able to provide proof through our internal (Mercurial) version control logs, if needed. 5 | 6 | We confirm that the submitted work is original and unpublished/unsubmitted to another peer-reviewed publication venue. 7 | 8 | We look forward to hearing from you at your earliest convenience, 9 | 10 | Sincerely, 11 | 12 | -- 13 | Nasser Mohieddin Abukhdeir, PEng 14 | Associate Professor 15 | Department of Chemical Engineering 16 | Department of Physics and Astronomy 17 | University of Waterloo, Waterloo, Ontario, Canada 18 | (P) 519.888.4567 x31306 (F) 519.888.4347 19 | http://chemeng.uwaterloo.ca/abukhdeir 20 | -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_10_combined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_10_combined.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_10_side_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_10_side_view.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_10_streamlines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_10_streamlines.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_10_top_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_10_top_view.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_8_results_3s_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_8_results_3s_a.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_8_results_3s_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_8_results_3s_b.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_8_results_3s_combined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_8_results_3s_combined.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_9_combined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_9_combined.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_9_cross_section.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_9_cross_section.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/tutorial_9_geometry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/tutorial_9_geometry.png -------------------------------------------------------------------------------- /publications/2108_JOSS/images/user_interface.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/user_interface.pdf -------------------------------------------------------------------------------- /publications/2108_JOSS/images/user_interface.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | bc_dir 7 | 8 | 9 | bc_config 10 | 11 | 12 | ic_dir 13 | 14 | 15 | ic_config 16 | 17 | 18 | model_dir 19 | 20 | 21 | model_config 22 | 23 | 24 | ref_sol_dir 25 | 26 | 27 | ref_sol_config 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | simulation 51 | 52 | 53 | config 54 | 55 | 56 | output 57 | 58 | 59 | -------------------------------------------------------------------------------- /publications/2108_JOSS/images/uw_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/publications/2108_JOSS/images/uw_logo.png -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel"] 3 | build-backend = "setuptools.build_meta" 4 | -------------------------------------------------------------------------------- /pytests/README.md: -------------------------------------------------------------------------------- 1 | ## README 2 | 3 | This folder contains the scripts for the pytest unit tests and integration tests. 4 | 5 | 6 | 7 | ### Running Tests 8 | 9 | **!!! Important Note !!!** 10 | 11 | Your working directory is assumed to be `/path/to/opencmp`. 12 | If you call pytest from within `opencmp/tests` or elsewhere any tests that use relative file paths (most notably the integration tests) will fail. 13 | 14 | pytest can be used to run the tests in a specific file 15 | 16 | `pytest ` or `python -m pytest ` 17 | 18 | pytest can also be used to run the tests in any file whose name includes "test" 19 | 20 | `pytest ` or `python -m pytest ` 21 | 22 | However, the above command will skip running any tests that are marked as "slow" (ex: transient examples that take several minutes to run). 23 | Include these tests as follows 24 | 25 | `pytest --runslow ` or `python -m pytest --runslow ` 26 | 27 | It is also recommended that the package `pytest-xdist` be installed using `pip install pytest-xdist`. 28 | This allows for the tests to be run in parallel over `N` threads using the following command: 29 | 30 | `pytest -n ` or `python -m pytest -n ` 31 | 32 | ### Creating New Tests 33 | 34 | pytest will automatically find any files whose names include "test" and will run any functions whose names begin with "test" (unless marked as "slow"). 35 | 36 | Markers can be added to test functions with the decorator 37 | 38 | `@pytest.mark.` 39 | 40 | Currently, the only defined marker is "slow", which indicates tests that are too slow to run by default. New markers should be defined in conftest.py. 41 | 42 | -------------------------------------------------------------------------------- /pytests/config_functions/example_config: -------------------------------------------------------------------------------- 1 | [TEST LOAD CONFIG] 2 | test_1 = a -> 3*4 3 | b -> mesh.vol 4 | c -> u + p 5 | 6 | test_2 = a -> 3*4 b -> mesh.vol c -> u + p 7 | 8 | test_3 = a - 3*4 9 | b = mesh.vol 10 | c . u + p 11 | -------------------------------------------------------------------------------- /pytests/conftest.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | import pytest 19 | from configparser import ConfigParser 20 | 21 | 22 | def pytest_addoption(parser): 23 | parser.addoption("--runslow", action="store_true", default=False, help="run slow tests") 24 | 25 | def pytest_configure(config): 26 | config.addinivalue_line("markers", "slow: mark test as slow to run") 27 | 28 | def pytest_collection_modifyitems(config, items): 29 | if config.getoption("--runslow"): 30 | # --runslow given in cli: do not skip slow tests 31 | return 32 | skip_slow = pytest.mark.skip(reason="need --runslow option to run") 33 | for item in items: 34 | if "slow" in item.keywords: 35 | item.add_marker(skip_slow) 36 | 37 | @pytest.fixture(scope='session') 38 | def load_configfile(): 39 | """ Fixture to load config files. """ 40 | def load(filename): 41 | config = ConfigParser() 42 | config.read(filename) 43 | return config 44 | return load -------------------------------------------------------------------------------- /pytests/full_system/control/pid_poisson_1d/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = left -> 10.0 - H(t, 0.1) 3 | right -> 5.0 4 | 5 | [NEUMANN] 6 | u = top -> 0.0 7 | bottom -> 0.0 8 | 9 | [ROBIN] 10 | -------------------------------------------------------------------------------- /pytests/full_system/control/pid_poisson_1d/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = False 13 | interior_penalty_coefficient = 10.0 14 | 15 | [SOLVER] 16 | linear_solver = default 17 | preconditioner = default 18 | 19 | [TRANSIENT] 20 | transient = True 21 | scheme = explicit euler 22 | time_range = 0.0, 8.0 23 | dt = 0.002 24 | dt_tolerance = relative -> 1e-6 25 | absolute -> 1e-4 26 | dt_range = 1e-15, 0.5 27 | 28 | [VISUALIZATION] 29 | save_to_file = False 30 | save_type = .vtu 31 | save_frequency = 1, numit 32 | subdivision = 3 33 | 34 | [ERROR ANALYSIS] 35 | check_error = True 36 | 37 | [CONTROLLER] 38 | active = True 39 | type = PID 40 | config = config_1 41 | 42 | [OTHER] 43 | num_threads = 1 44 | model = Poisson 45 | run_dir = pytests/full_system/control/pid_poisson_1d 46 | messaging_level = 0 47 | -------------------------------------------------------------------------------- /pytests/full_system/control/pid_poisson_1d/control_dir/config_1: -------------------------------------------------------------------------------- 1 | [CONTROL_VARIABLES] 2 | variable_names = u 3 | location_positions = <0.5, 0.5> 4 | values = 7.5 5 | index = 0 6 | 7 | [MANIPULATED_VARIABLES] 8 | types = dirichlet 9 | variable_names = u 10 | location_names = right 11 | 12 | [PARAMETERS] 13 | # Time between each control action of the discrete controller, in seconds 14 | dt_control = 0.1 15 | # Time over which the control action occurs 16 | t_ramp = 0.03 17 | # Bias term 18 | bias = 5.0 19 | # Proportional term 20 | k_c = 0.5 21 | # Integral term 22 | tau_i = 0.0906440 23 | # Derivative term 24 | tau_d = 0 -------------------------------------------------------------------------------- /pytests/full_system/control/pid_poisson_1d/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> 10.0*(1-x) + 5*(x) 3 | -------------------------------------------------------------------------------- /pytests/full_system/control/pid_poisson_1d/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 0.0 6 | -------------------------------------------------------------------------------- /pytests/full_system/control/pid_poisson_1d/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = 9 - 3*x 3 | 4 | [METRICS] 5 | l2_norm = u 6 | l1_norm = u 7 | linfinity_norm = u -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_1/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | 3 | [NEUMANN] 4 | 5 | [ROBIN] 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_1/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | 3 | [DIM] 4 | diffuse_interface_method = True 5 | dim_dir = pytests/full_system/dim/dim_poisson_1/dim_dir 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = False 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | 18 | [TRANSIENT] 19 | transient = False 20 | 21 | [ERROR ANALYSIS] 22 | check_error = True 23 | 24 | [OTHER] 25 | num_threads = 1 26 | model = Poisson 27 | run_dir = pytests/full_system/dim/dim_poisson_1 28 | 29 | [VISUALIZATION] 30 | save_to_file = False 31 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_1/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | top = <1.0, 0.0>, <-1.0, 0.0> 3 | bottom = <-1.0, 0.0>, <1.0, 0.0> 4 | 5 | [CENTROIDS] 6 | top = <0.0, 0.0> 7 | bottom = None 8 | 9 | [DIRICHLET] 10 | u = top -> sin(pi * x) * cos(pi * y) 11 | bottom -> sin(pi * x) * cos(pi * y) 12 | 13 | [NEUMANN] 14 | 15 | [ROBIN] 16 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_1/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | mesh_dimension = 2 3 | num_mesh_elements = x -> 59 4 | y -> 59 5 | mesh_scale = x -> 3 6 | y -> 3 7 | mesh_offset = x -> 1.5 8 | y -> 1.5 9 | interface_width_parameter = 0.1 10 | 11 | [DIM BOUNDARY CONDITIONS] 12 | multiple_bcs = True 13 | remainder = False 14 | 15 | [PHASE FIELDS] 16 | load_method = generate 17 | stl_filename = pytests/mesh_files/circle_nd.stl 18 | save_to_file = False 19 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_1/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_1/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 0.5 3 | 4 | [FUNCTIONS] 5 | source = all -> pi^2*sin(pi*x)*cos(pi*y) 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_1/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = sin(pi * x) * cos(pi * y) 3 | 4 | [METRICS] 5 | l2_norm = u 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | 3 | [NEUMANN] 4 | 5 | [ROBIN] 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/full_system/dim/dim_poisson_2/dim_dir/mesh.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = True 6 | dim_dir = pytests/full_system/dim/dim_poisson_2/dim_dir 7 | 8 | [FINITE ELEMENT SPACE] 9 | elements = u -> H1 10 | interpolant_order = 3 11 | 12 | [DG] 13 | DG = False 14 | 15 | [SOLVER] 16 | linear_solver = default 17 | preconditioner = default 18 | 19 | [TRANSIENT] 20 | transient = False 21 | 22 | [ERROR ANALYSIS] 23 | check_error = True 24 | 25 | [OTHER] 26 | num_threads = 1 27 | model = Poisson 28 | run_dir = pytests/full_system/dim/dim_poisson_2 29 | 30 | [VISUALIZATION] 31 | save_to_file = False 32 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/dim_dir/bc_dir/bottom_mask.sol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/pytests/full_system/dim/dim_poisson_2/dim_dir/bc_dir/bottom_mask.sol -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | top = pytests/full_system/dim/dim_poisson_2/dim_dir/bc_dir/top_mask.sol 3 | bottom = pytests/full_system/dim/dim_poisson_2/dim_dir/bc_dir/bottom_mask.sol 4 | 5 | [CENTROIDS] 6 | top = <0.0, 0.0> 7 | bottom = None 8 | 9 | [DIRICHLET] 10 | u = top -> sin(pi * x) * cos(pi * y) 11 | bottom -> sin(pi * x) * cos(pi * y) 12 | 13 | [NEUMANN] 14 | 15 | [ROBIN] 16 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/dim_dir/bc_dir/top_mask.sol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/pytests/full_system/dim/dim_poisson_2/dim_dir/bc_dir/top_mask.sol -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | 3 | [DIM BOUNDARY CONDITIONS] 4 | multiple_bcs = True 5 | 6 | [PHASE FIELDS] 7 | load_method = file 8 | phase_field_filename = phi -> phi.sol 9 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/dim_dir/phi.sol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/pytests/full_system/dim/dim_poisson_2/dim_dir/phi.sol -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 2.0*pi^2*sin(pi*x)*cos(pi*y) 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_2/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = sin(pi * x) * cos(pi * y) 3 | 4 | [METRICS] 5 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_3/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = top -> sin(pi * x) * cos(pi * y) 3 | bottom -> sin(pi * x) * cos(pi * y) 4 | right -> sin(pi * x) * cos(pi * y) 5 | left -> sin(pi * x) * cos(pi * y) 6 | 7 | [NEUMANN] 8 | 9 | [ROBIN] 10 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_3/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | 3 | [DIM] 4 | diffuse_interface_method = True 5 | dim_dir = pytests/full_system/dim/dim_poisson_3/dim_dir 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = False 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | 18 | [TRANSIENT] 19 | transient = False 20 | 21 | [ERROR ANALYSIS] 22 | check_error = True 23 | 24 | [OTHER] 25 | num_threads = 1 26 | model = Poisson 27 | run_dir = pytests/full_system/dim/dim_poisson_3 28 | 29 | [VISUALIZATION] 30 | save_to_file = False 31 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_3/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | top = <1.0, 0.0>, <-1.0, 0.0> 3 | bottom = <-1.0, 0.0>, <1.0, 0.0> 4 | 5 | [CENTROIDS] 6 | top = <0.0, 0.0> 7 | bottom = None 8 | 9 | [DIRICHLET] 10 | u = top -> sin(pi * x) * cos(pi * y) 11 | bottom -> sin(pi * x) * cos(pi * y) 12 | 13 | [NEUMANN] 14 | 15 | [ROBIN] 16 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_3/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | mesh_dimension = 2 3 | num_mesh_elements = x -> 29 4 | y -> 29 5 | mesh_scale = x -> 3 6 | y -> 3 7 | mesh_offset = x -> 1.5 8 | y -> 1.5 9 | interface_width_parameter = 0.1 10 | 11 | [DIM BOUNDARY CONDITIONS] 12 | multiple_bcs = True 13 | remainder = False 14 | 15 | [PHASE FIELDS] 16 | load_method = generate 17 | stl_filename = pytests/mesh_files/circle_nd.stl 18 | invert_phi = True 19 | save_to_file = False 20 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_3/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_3/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 2.0*pi^2*sin(pi*x)*cos(pi*y) 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_3/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = sin(pi * x) * cos(pi * y) 3 | 4 | [METRICS] 5 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | 3 | [NEUMANN] 4 | 5 | [ROBIN] 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | 3 | [DIM] 4 | diffuse_interface_method = True 5 | dim_dir = pytests/full_system/dim/dim_poisson_4/dim_dir 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = False 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | 18 | [TRANSIENT] 19 | transient = False 20 | 21 | [ERROR ANALYSIS] 22 | check_error = True 23 | 24 | [OTHER] 25 | num_threads = 1 26 | model = Poisson 27 | run_dir = pytests/full_system/dim/dim_poisson_4 28 | 29 | [VISUALIZATION] 30 | save_to_file = False 31 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | 3 | [CENTROIDS] 4 | 5 | [DIRICHLET] 6 | u = top_1 -> sin(pi * x) * cos(pi * y) 7 | bottom_1 -> sin(pi * x) * cos(pi * y) 8 | dim_2 -> sin(pi * x) * cos(pi * y) 9 | 10 | [NEUMANN] 11 | 12 | [ROBIN] 13 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/dim_dir/dim_1: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | top_1 = <2.0, 0.0>, <-2.0, 0.0> 3 | bottom_1 = <-2.0, 0.0>, <2.0, 0.0> 4 | 5 | [CENTROIDS] 6 | top_1 = None 7 | bottom_1 = None 8 | 9 | [DIM BOUNDARY CONDITIONS] 10 | multiple_bcs = True 11 | remainder = False 12 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/dim_dir/dim_2: -------------------------------------------------------------------------------- 1 | [DIM BOUNDARY CONDITIONS] 2 | multiple_bcs = False 3 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | mesh_dimension = 2 3 | num_mesh_elements = x -> 39 4 | y -> 39 5 | mesh_scale = x -> 4 6 | y -> 4 7 | mesh_offset = x -> 1 8 | y -> 1.5 9 | interface_width_parameter = 0.1 10 | 11 | [DIM BOUNDARY CONDITIONS] 12 | multiple_bcs = True 13 | remainder = False 14 | 15 | [PHASE FIELDS] 16 | load_method = combine 17 | stl_filename = dim_1 -> pytests/mesh_files/offset_circle_1.stl 18 | dim_2 -> pytests/mesh_files/offset_circle_2.stl 19 | save_to_file = False 20 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 2.0*pi^2*sin(pi*x)*cos(pi*y) 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_4/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = sin(pi * x) * cos(pi * y) 3 | 4 | [METRICS] 5 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_5/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | 3 | [NEUMANN] 4 | 5 | [ROBIN] 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_5/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | 3 | [DIM] 4 | diffuse_interface_method = True 5 | dim_dir = pytests/full_system/dim/dim_poisson_5/dim_dir 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 2 10 | 11 | [DG] 12 | DG = False 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | 18 | [TRANSIENT] 19 | transient = False 20 | 21 | [ERROR ANALYSIS] 22 | check_error = True 23 | 24 | [OTHER] 25 | num_threads = 1 26 | model = Poisson 27 | run_dir = pytests/full_system/dim/dim_poisson_5 28 | 29 | [VISUALIZATION] 30 | save_to_file = False 31 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_5/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | 3 | [CENTROIDS] 4 | 5 | [DIRICHLET] 6 | u = all -> sin(pi * x) * cos(pi * y) 7 | 8 | [NEUMANN] 9 | 10 | [ROBIN] 11 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_5/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | mesh_dimension = 2 3 | num_mesh_elements = x -> 19 4 | y -> 19 5 | num_phi_mesh_elements = x -> 59 6 | y -> 59 7 | mesh_scale = x -> 3 8 | y -> 3 9 | mesh_offset = x -> 1.5 10 | y -> 1.5 11 | interface_width_parameter = 0.05 12 | 13 | [DIM BOUNDARY CONDITIONS] 14 | multiple_bcs = False 15 | 16 | [PHASE FIELDS] 17 | load_method = generate 18 | stl_filename = pytests/mesh_files/circle_nd.stl 19 | save_to_file = False 20 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_5/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_5/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 0.5 3 | 4 | [FUNCTIONS] 5 | source = all -> pi^2*sin(pi*x)*cos(pi*y) 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_5/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = sin(pi * x) * cos(pi * y) 3 | 4 | [METRICS] 5 | l2_norm = u 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_6/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | 3 | [NEUMANN] 4 | 5 | [ROBIN] 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_6/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | 3 | [DIM] 4 | diffuse_interface_method = True 5 | dim_dir = pytests/full_system/dim/dim_poisson_6/dim_dir 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = True 13 | interior_penalty_coefficient = 10.0 14 | 15 | [SOLVER] 16 | linear_solver = default 17 | preconditioner = default 18 | 19 | [TRANSIENT] 20 | transient = False 21 | 22 | [ERROR ANALYSIS] 23 | check_error = True 24 | 25 | [OTHER] 26 | num_threads = 1 27 | model = Poisson 28 | run_dir = pytests/full_system/dim/dim_poisson_6 29 | 30 | [VISUALIZATION] 31 | save_to_file = False 32 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_6/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | top = <1.0, 0.0>, <-1.0, 0.0> 3 | bottom = <-1.0, 0.0>, <1.0, 0.0> 4 | 5 | [CENTROIDS] 6 | top = <0.0, 0.0> 7 | bottom = None 8 | 9 | [DIRICHLET] 10 | u = top -> sin(pi * x) * cos(pi * y) 11 | bottom -> sin(pi * x) * cos(pi * y) 12 | 13 | [NEUMANN] 14 | 15 | [ROBIN] 16 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_6/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | mesh_dimension = 2 3 | num_mesh_elements = x -> 29 4 | y -> 29 5 | mesh_scale = x -> 3 6 | y -> 3 7 | mesh_offset = x -> 1.5 8 | y -> 1.5 9 | interface_width_parameter = 0.1 10 | 11 | [DIM BOUNDARY CONDITIONS] 12 | multiple_bcs = True 13 | remainder = False 14 | 15 | [PHASE FIELDS] 16 | load_method = generate 17 | stl_filename = pytests/mesh_files/circle_nd.stl 18 | save_to_file = False 19 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_6/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_6/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 0.5 3 | 4 | [FUNCTIONS] 5 | source = all -> pi^2*sin(pi*x)*cos(pi*y) 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_poisson_6/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = sin(pi * x) * cos(pi * y) 3 | 4 | [METRICS] 5 | l2_norm = u 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_1/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = top -> [0.0, 0.0] 3 | bottom -> [0.0, 0.0] 4 | left -> [1.5*(2-y)*(y+2)/16, 0.0] 5 | right -> [1.5*(2-y)*(y+2)/16, 0.0] -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_1/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | 3 | [DIM] 4 | diffuse_interface_method = True 5 | dim_dir = pytests/full_system/dim/dim_stokes_1/dim_dir 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> HDiv 9 | p -> L2 10 | interpolant_order = 2 11 | 12 | [DG] 13 | DG = True 14 | interior_penalty_coefficient = 10.0 15 | 16 | [SOLVER] 17 | linear_solver = default 18 | preconditioner = default 19 | 20 | [TRANSIENT] 21 | transient = False 22 | 23 | [ERROR ANALYSIS] 24 | check_error = True 25 | 26 | [OTHER] 27 | num_threads = 1 28 | model = Stokes 29 | run_dir = pytests/full_system/dim/dim_stokes_1 30 | 31 | [VISUALIZATION] 32 | save_to_file = False 33 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_1/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | 3 | [CENTROIDS] 4 | 5 | [DIRICHLET] 6 | u = all -> [0.0, 0.0] 7 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_1/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | mesh_dimension = 2 3 | num_mesh_elements = x -> 29 4 | y -> 29 5 | num_phi_mesh_elements = x -> 59 6 | y -> 59 7 | mesh_scale = x -> 4 8 | y -> 4 9 | mesh_offset = x -> 2 10 | y -> 2 11 | interface_width_parameter = 0.1 12 | 13 | [DIM BOUNDARY CONDITIONS] 14 | multiple_bcs = False 15 | 16 | [PHASE FIELDS] 17 | load_method = generate 18 | stl_filename = pytests/mesh_files/circle_nd.stl 19 | save_to_file = False 20 | invert_phi = True 21 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_1/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | u = all -> None 3 | p = all -> None 4 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_1/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.001 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_1/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | 3 | [METRICS] 4 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_2/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = top -> [0.0, 0.0] 3 | bottom -> [0.0, 0.0] 4 | left -> [1.5*(2-y)*(y+2)/16, 0.0] 5 | 6 | [STRESS] 7 | u = right -> [0.0, 0.0] 8 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_2/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/full_system/dim/dim_stokes_2/dim_dir/mesh.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = True 6 | dim_dir = pytests/full_system/dim/dim_stokes_2/dim_dir 7 | 8 | [FINITE ELEMENT SPACE] 9 | elements = u -> HDiv 10 | p -> L2 11 | interpolant_order = 2 12 | 13 | [DG] 14 | DG = True 15 | interior_penalty_coefficient = 10.0 16 | 17 | [SOLVER] 18 | linear_solver = default 19 | preconditioner = default 20 | 21 | [TRANSIENT] 22 | transient = False 23 | 24 | [ERROR ANALYSIS] 25 | check_error = True 26 | 27 | [OTHER] 28 | num_threads = 1 29 | model = Stokes 30 | run_dir = pytests/full_system/dim/dim_stokes_2 31 | 32 | [VISUALIZATION] 33 | save_to_file = False 34 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_2/dim_dir/bc_dir/dim_bc_config: -------------------------------------------------------------------------------- 1 | [VERTICES] 2 | 3 | [CENTROIDS] 4 | 5 | [DIRICHLET] 6 | u = all -> [0.0, 0.0] 7 | 8 | [NEUMANN] 9 | 10 | [ROBIN] 11 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_2/dim_dir/dim_config: -------------------------------------------------------------------------------- 1 | [DIM] 2 | 3 | [DIM BOUNDARY CONDITIONS] 4 | multiple_bcs = False 5 | 6 | [PHASE FIELDS] 7 | load_method = file 8 | phase_field_filename = phi -> phi.sol 9 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_2/dim_dir/phi.sol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/pytests/full_system/dim/dim_stokes_2/dim_dir/phi.sol -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_2/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | u = all -> None 3 | p = all -> None 4 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_2/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.001 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /pytests/full_system/dim/dim_stokes_2/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | 3 | [METRICS] 4 | -------------------------------------------------------------------------------- /pytests/full_system/dim/test_dim.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | from opencmp.helpers.testing import run_example 19 | from opencmp.config_functions import ConfigParser 20 | 21 | 22 | class TestStationary: 23 | def test_DIM_poisson_1(self) -> None: 24 | run_example(ConfigParser('pytests/full_system/dim/dim_poisson_1/config')) 25 | 26 | def test_DIM_poisson_2(self) -> None: 27 | run_example(ConfigParser('pytests/full_system/dim/dim_poisson_2/config')) 28 | 29 | def test_DIM_poisson_3(self) -> None: 30 | run_example(ConfigParser('pytests/full_system/dim/dim_poisson_3/config')) 31 | 32 | def test_DIM_poisson_4(self) -> None: 33 | run_example(ConfigParser('pytests/full_system/dim/dim_poisson_4/config')) 34 | 35 | def test_DIM_poisson_5(self) -> None: 36 | run_example(ConfigParser('pytests/full_system/dim/dim_poisson_5/config')) 37 | 38 | def test_DIM_poisson_6(self) -> None: 39 | run_example(ConfigParser('pytests/full_system/dim/dim_poisson_6/config')) 40 | 41 | def test_DIM_stokes_1(self) -> None: 42 | run_example(ConfigParser('pytests/full_system/dim/dim_stokes_1/config')) 43 | 44 | def test_DIM_stokes_2(self) -> None: 45 | run_example(ConfigParser('pytests/full_system/dim/dim_stokes_2/config')) 46 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_stress/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = wall -> [0.0, 0.0] 3 | 4 | [STRESS] 5 | u = inlet -> [10.0, 0.0] 6 | outlet -> [-5.0, 0.0] 7 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_stress/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/channel_3bcs.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | interpolant_order = 2 11 | 12 | [DG] 13 | DG = False 14 | interior_penalty_coefficient = 10.0 15 | 16 | [SOLVER] 17 | linear_solver = default 18 | preconditioner = default 19 | linearization_method = Oseen 20 | nonlinear_solver = default 21 | nonlinear_tolerance = relative -> 1e-4 22 | absolute -> 1e-8 23 | nonlinear_max_iterations = 200 24 | 25 | [TRANSIENT] 26 | transient = False 27 | 28 | [VISUALIZATION] 29 | save_to_file = False 30 | 31 | [ERROR ANALYSIS] 32 | check_error = True 33 | 34 | [OTHER] 35 | num_threads = 6 36 | model = INS 37 | run_dir = pytests/full_system/ins/pressure_flow_in_pipe_stress 38 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_stress/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [INS] 2 | all = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_stress/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.001 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_stress/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [5.0/(2.0*0.001)*(0.2*y - y^2), 0.0] 3 | 4 | [METRICS] 5 | L2_norm = u 6 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_velocity/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = wall -> [0.0, 0.0] 3 | inlet -> [(2.0/0.2^2)*y*(0.2 - y), 0.0] 4 | 5 | [STRESS] 6 | u = outlet -> [0.0, 0.0] 7 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_velocity/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/channel_3bcs.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | interpolant_order = 2 11 | 12 | [DG] 13 | DG = True 14 | interior_penalty_coefficient = 10.0 15 | 16 | [SOLVER] 17 | linear_solver = default 18 | preconditioner = default 19 | linearization_method = Oseen 20 | nonlinear_solver = default 21 | nonlinear_tolerance = relative -> 1e-8 22 | absolute -> 1e-8 23 | nonlinear_max_iterations = 200 24 | 25 | [TRANSIENT] 26 | transient = False 27 | 28 | [VISUALIZATION] 29 | save_to_file = False 30 | 31 | [ERROR ANALYSIS] 32 | check_error = True 33 | 34 | [OTHER] 35 | num_threads = 6 36 | model = INS 37 | run_dir = pytests/full_system/ins/pressure_flow_in_pipe_velocity 38 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_velocity/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [INS] 2 | all = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_velocity/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.001 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /pytests/full_system/ins/pressure_flow_in_pipe_velocity/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [(2.0/0.2^2)*y*(0.2 - y), 0.0] 3 | 4 | [METRICS] 5 | L2_norm = u 6 | L1_norm = u 7 | Linfinity_norm = u 8 | divergence = u 9 | ;facet_jumps = u, p 10 | -------------------------------------------------------------------------------- /pytests/full_system/ins/sinusoidal_transient/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = top -> [0.0, -sin(x)*exp(-2*t)] 3 | bottom -> [0.0, sin(x)*exp(-2*t)] 4 | right -> [sin(y)*exp(-2*t), 0.0] 5 | left -> [-sin(y)*exp(-2*t), 0.0] 6 | -------------------------------------------------------------------------------- /pytests/full_system/ins/sinusoidal_transient/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/coarse_large_square_4bcs.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | interpolant_order = 3 11 | 12 | [DG] 13 | DG = False 14 | interior_penalty_coefficient = 10.0 15 | 16 | [SOLVER] 17 | linear_solver = default 18 | preconditioner = default 19 | linearization_method = Oseen 20 | nonlinear_solver = default 21 | nonlinear_tolerance = relative -> 1e-4 22 | absolute -> 1e-8 23 | nonlinear_max_iterations = 20 24 | 25 | [TRANSIENT] 26 | transient = True 27 | scheme = implicit euler 28 | time_range = 0.0, 0.1 29 | dt = 0.001 30 | dt_range = 1e-12, 0.01 31 | dt_tolerance = relative -> 1e-6 32 | absolute -> 1e-3 33 | 34 | [VISUALIZATION] 35 | save_to_file = False 36 | 37 | [ERROR ANALYSIS] 38 | check_error = True 39 | 40 | [OTHER] 41 | num_threads = 1 42 | model = INS 43 | run_dir = pytests/full_system/ins/sinusoidal_transient 44 | -------------------------------------------------------------------------------- /pytests/full_system/ins/sinusoidal_transient/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [INS] 2 | u = all -> [-cos(x)*sin(y), sin(x)*cos(y)] 3 | p = all -> -0.25*(cos(2*x) + cos(2*y)) 4 | -------------------------------------------------------------------------------- /pytests/full_system/ins/sinusoidal_transient/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /pytests/full_system/ins/sinusoidal_transient/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [-cos(x)*sin(y)*exp(-2*t), sin(x)*cos(y)*exp(-2*t)] 3 | p = -0.25*(cos(2*x) + cos(2*y))*exp(-4*t) 4 | 5 | [METRICS] 6 | l2_norm = u 7 | ;l1_norm = u, p 8 | ;linfinity_norm = u, p 9 | divergence = u 10 | ;facet_jumps = u, p 11 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/0th_rxn/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | # NOTE: using exp instead of step change to avoid strange oscillation behaviour. 3 | ;a = right -> exp(-t*10) 4 | ;b = left -> 1 - exp(-t*10) 5 | 6 | [NEUMANN] 7 | a = top -> 0 8 | bottom -> 0 9 | left -> 0 10 | right -> 0 11 | b = top -> 0 12 | bottom -> 0 13 | left -> 0 14 | right -> 0 15 | 16 | [STRESS] 17 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/0th_rxn/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | a -> H1 11 | b -> H1 12 | interpolant_order = 3 13 | 14 | [DG] 15 | DG = False 16 | interior_penalty_coefficient = 10.0 17 | 18 | [SOLVER] 19 | linear_solver = default 20 | preconditioner = default 21 | linearization_method = Oseen 22 | nonlinear_solver = default 23 | nonlinear_tolerance = relative -> 1e-4 24 | absolute -> 1e-8 25 | nonlinear_max_iterations = 10 26 | 27 | [TRANSIENT] 28 | transient = True 29 | scheme = implicit euler 30 | time_range = 0.0, 10 31 | dt = 0.05 32 | dt_range = 1e-16, 5 33 | dt_tolerance = relative -> 1e-6 34 | absolute -> 5e-4 35 | 36 | [VISUALIZATION] 37 | save_to_file = False 38 | save_type = .vtu 39 | save_frequency = 1, numit 40 | subdivision = 3 41 | 42 | [ERROR ANALYSIS] 43 | check_error = True 44 | 45 | [OTHER] 46 | num_threads = 1 47 | model = MultiComponentINS 48 | component_names = a, b 49 | component_in_error_calc = a -> True 50 | b -> True 51 | component_in_time_deriv = a -> True 52 | b -> True 53 | velocity_fixed = True 54 | run_dir = pytests/full_system/mcins/0th_rxn 55 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/0th_rxn/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [MultiComponentINS] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0 4 | a = all -> 1 5 | b = all -> 0 -------------------------------------------------------------------------------- /pytests/full_system/mcins/0th_rxn/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 1 4 | b -> 1 5 | 6 | [FUNCTIONS] 7 | source = a -> -0.1 8 | b -> 0.1 9 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/0th_rxn/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [0.0, 0.0] 3 | a = 0.0 4 | b = 1.0 5 | 6 | [METRICS] 7 | L2_norm = a, b 8 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | 3 | [NEUMANN] 4 | a = top -> 0 5 | bottom -> 0 6 | left -> 0 7 | right -> 0 8 | b = top -> 0 9 | bottom -> 0 10 | left -> 0 11 | right -> 0 12 | 13 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | a -> H1 11 | b -> H1 12 | interpolant_order = 3 13 | 14 | [DG] 15 | DG = False 16 | interior_penalty_coefficient = 10.0 17 | 18 | [SOLVER] 19 | linear_solver = default 20 | preconditioner = default 21 | linearization_method = Oseen 22 | nonlinear_solver = default 23 | nonlinear_tolerance = relative -> 1e-4 24 | absolute -> 1e-8 25 | nonlinear_max_iterations = 10 26 | 27 | [TRANSIENT] 28 | transient = True 29 | scheme = implicit euler 30 | time_range = 0.0, 20 31 | dt = 0.04 32 | dt_range = 1e-16, 50 33 | dt_tolerance = relative -> 1e-6 34 | absolute -> 5e-4 35 | 36 | [VISUALIZATION] 37 | save_to_file = False 38 | save_type = .vtu 39 | save_frequency = 1, numit 40 | subdivision = 3 41 | 42 | [ERROR ANALYSIS] 43 | check_error = True 44 | 45 | [OTHER] 46 | num_threads = 1 47 | model = MultiComponentINS 48 | component_names = a, b 49 | component_in_error_calc = a -> True 50 | b -> True 51 | component_in_time_deriv = a -> True 52 | b -> True 53 | velocity_fixed = True 54 | run_dir = pytests/full_system/mcins/1st_rxn 55 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [MultiComponentINS] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0 4 | a = all -> 1 5 | b = all -> 1 -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 1 4 | b -> 1 5 | 6 | [FUNCTIONS] 7 | source = a -> - 1*a 8 | b -> -10*b 9 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [0.0, 0.0] 3 | a = exp(- 1*t) 4 | b = exp(- 10*t) 5 | 6 | [METRICS] 7 | L2_norm = a, b 8 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn_coupled/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | 3 | [NEUMANN] 4 | a = top -> 0 5 | bottom -> 0 6 | left -> 0 7 | right -> 0 8 | b = top -> 0 9 | bottom -> 0 10 | left -> 0 11 | right -> 0 12 | c = top -> 0 13 | bottom -> 0 14 | left -> 0 15 | right -> 0 16 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn_coupled/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | a -> H1 11 | b -> H1 12 | c -> H1 13 | interpolant_order = 3 14 | 15 | [DG] 16 | DG = False 17 | interior_penalty_coefficient = 10.0 18 | 19 | [SOLVER] 20 | linear_solver = default 21 | preconditioner = default 22 | linearization_method = Oseen 23 | nonlinear_solver = default 24 | nonlinear_tolerance = relative -> 1e-5 25 | absolute -> 1e-8 26 | nonlinear_max_iterations = 20 27 | 28 | [TRANSIENT] 29 | transient = True 30 | scheme = implicit euler 31 | time_range = 0.0, 0.5 32 | dt = 1e-3 33 | dt_range = 1e-16, 5 34 | dt_tolerance = relative -> 1e-9 35 | absolute -> 1e-6 36 | 37 | [VISUALIZATION] 38 | save_to_file = False 39 | save_type = .vtu 40 | save_frequency = 1, numit 41 | subdivision = 3 42 | 43 | [ERROR ANALYSIS] 44 | check_error = True 45 | 46 | [OTHER] 47 | num_threads = 1 48 | model = MultiComponentINS 49 | component_names = a, b, c 50 | component_in_error_calc = a -> True 51 | b -> True 52 | c -> True 53 | component_in_time_deriv = a -> True 54 | b -> True 55 | c -> True 56 | velocity_fixed = True 57 | run_dir = pytests/full_system/mcins/1st_rxn_coupled 58 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn_coupled/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [MultiComponentINS] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0 4 | a = all -> 1 5 | b = all -> 0 6 | c = all -> 0 -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn_coupled/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 1 4 | b -> 1 5 | c -> 1 6 | 7 | [FUNCTIONS] 8 | source = a -> -5*a + 0.9*5*b 9 | b -> 5*a - 5*b 10 | c -> 5*0.1*b 11 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/1st_rxn_coupled/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [0.0, 0.0] 3 | # k = 5 4 | a = exp(-5*(1-3/sqrt(10))*t) * (5 - 5*(1+3/sqrt(10)))/(-3*sqrt(10)) * 1 - exp(-5*(1+3/sqrt(10))*t) * (5 - 5*(1-3/sqrt(10)))/(-3*sqrt(10)) * 1 5 | b = exp(-5*(1-3/sqrt(10))*t) * (5 - 5*(1+3/sqrt(10)))/(-3*sqrt(10)) * (5 - 5*(1-3/sqrt(10))) / (0.9*5) - exp(-5*(1+3/sqrt(10))*t) * (5 - 5*(1-3/sqrt(10)))/(-3*sqrt(10)) * (5 - 5*(1+3/sqrt(10))) / (0.9*5) 6 | c = 1 - exp(-5*(1-3/sqrt(10))*t) * (5 - 5*(1+3/sqrt(10)))/(-3*sqrt(10)) * (1.9*5 - 5*(1-3/sqrt(10))) / (0.9*5) + exp(-5*(1+3/sqrt(10))*t) * (5 - 5*(1-3/sqrt(10)))/(-3*sqrt(10)) * (1.9*5 - 5*(1+3/sqrt(10))) / (0.9*5) 7 | 8 | [METRICS] 9 | L2_norm = a, b, c 10 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | # NOTE: using exp instead of step change to avoid strange oscilation behaviour. 3 | a = right -> ramp(t, 1.0, 0.0, 1.0) 4 | b = right -> ramp(t, 0.0, 1.0, 1.0) 5 | c = right -> ramp(t, 0.5, 0.0, 1.0) 6 | left -> ramp(t, 0.5, 1.0, 1.0) 7 | 8 | [NEUMANN] 9 | a = top -> 0 10 | bottom -> 0 11 | left -> 0 12 | b = top -> 0 13 | bottom -> 0 14 | left -> 0 15 | c = top -> 0 16 | bottom -> 0 17 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | a -> H1 11 | b -> H1 12 | c -> H1 13 | interpolant_order = 3 14 | 15 | [DG] 16 | DG = False 17 | interior_penalty_coefficient = 10.0 18 | 19 | [SOLVER] 20 | linear_solver = default 21 | preconditioner = default 22 | linearization_method = Oseen 23 | nonlinear_solver = default 24 | nonlinear_tolerance = relative -> 1e-5 25 | absolute -> 1e-9 26 | nonlinear_max_iterations = 20 27 | 28 | [TRANSIENT] 29 | transient = True 30 | scheme = implicit euler 31 | time_range = 0.0, 8 32 | dt = 0.01 33 | dt_range = 1e-16, 5 34 | dt_tolerance = relative -> 1e-8 35 | absolute -> 1e-6 36 | 37 | [VISUALIZATION] 38 | save_to_file = False 39 | save_type = .vtu 40 | save_frequency = 1, numit 41 | subdivision = 3 42 | 43 | [ERROR ANALYSIS] 44 | check_error = True 45 | 46 | [OTHER] 47 | num_threads = 1 48 | model = MultiComponentINS 49 | component_names = a, b, c 50 | component_in_error_calc = a -> True 51 | b -> True 52 | c -> True 53 | component_in_time_deriv = a -> True 54 | b -> True 55 | c -> True 56 | velocity_fixed = True 57 | run_dir = pytests/full_system/mcins/diffusion 58 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [MultiComponentINS] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0 4 | a = all -> 1 5 | b = all -> 0 6 | c = all -> 0.5 -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 1 4 | b -> 1 5 | c -> 1 6 | 7 | [FUNCTIONS] 8 | source = a -> 0 9 | b -> 0 10 | c -> 0 11 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [0.0, 0.0] 3 | p = 0.0 4 | a = 0.0 5 | b = 1.0 6 | c = 1 - x 7 | 8 | [METRICS] 9 | L2_norm = a, b, c -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion_convection/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | a = left -> 1.1 - ramp(t) 3 | b = left -> ramp(t) 4 | 5 | [NEUMANN] 6 | a = top -> 0 7 | bottom -> 0 8 | right -> 0 9 | b = top -> 0 10 | bottom -> 0 11 | right -> 0 -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion_convection/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | interior_penalty_coefficient = 10.0 7 | 8 | [FINITE ELEMENT SPACE] 9 | elements = u -> VectorH1 10 | p -> H1 11 | a -> H1 12 | b -> H1 13 | interpolant_order = 3 14 | 15 | [DG] 16 | DG = False 17 | interior_penalty_coefficient = 10.0 18 | 19 | [SOLVER] 20 | linear_solver = default 21 | preconditioner = default 22 | linearization_method = Oseen 23 | nonlinear_solver = default 24 | nonlinear_tolerance = relative -> 1e-4 25 | absolute -> 1e-8 26 | nonlinear_max_iterations = 10 27 | 28 | [TRANSIENT] 29 | transient = True 30 | scheme = implicit euler 31 | time_range = 0.0, 10 32 | dt = 0.01 33 | dt_range = 1e-16, 5 34 | dt_tolerance = relative -> 1e-6 35 | absolute -> 1e-5 36 | 37 | [VISUALIZATION] 38 | save_to_file = False 39 | save_type = .vtu 40 | save_frequency = 1, numit 41 | subdivision = 3 42 | 43 | [ERROR ANALYSIS] 44 | check_error = True 45 | 46 | [OTHER] 47 | num_threads = 1 48 | model = MultiComponentINS 49 | component_names = a, b 50 | component_in_error_calc = a -> True 51 | b -> True 52 | component_in_time_deriv = a -> True 53 | b -> True 54 | velocity_fixed = True 55 | run_dir = pytests/full_system/mcins/diffusion_convection 56 | 57 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion_convection/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [MultiComponentINS] 2 | u = all -> [1.0, 0.0] 3 | p = all -> 0 4 | a = all -> 1.1 5 | b = all -> 0 -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion_convection/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 0.1 4 | b -> 0.1 5 | 6 | [FUNCTIONS] 7 | source = a -> 0 8 | b -> 0 9 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/diffusion_convection/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | a = 0.1 3 | b = 1.0 4 | 5 | [METRICS] 6 | L2_norm = a, b 7 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/purely_convective/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | a = left -> -4*(y-0.5)*(y+0.5) * ramp(t) 3 | 4 | [TOTAL_FLUX] 5 | a = right -> 0 6 | top -> 0 7 | bottom -> 0 -------------------------------------------------------------------------------- /pytests/full_system/mcins/purely_convective/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/square.msh 3 | 4 | [FINITE ELEMENT SPACE] 5 | elements = u -> HDiv 6 | p -> L2 7 | a -> L2 8 | interpolant_order = 3 9 | 10 | [DG] 11 | DG = True 12 | interior_penalty_coefficient = 10 13 | 14 | [SOLVER] 15 | linear_solver = default 16 | preconditioner = default 17 | linearization_method = Oseen 18 | nonlinear_solver = default 19 | nonlinear_tolerance = relative -> 1e-4 20 | absolute -> 1e-8 21 | nonlinear_max_iterations = 10 22 | 23 | [TRANSIENT] 24 | transient = True 25 | scheme = implicit euler 26 | time_range = 0.0, 20 27 | dt = 5e-2 28 | dt_range = 1e-16, 5 29 | dt_tolerance = relative -> 0 30 | absolute -> 1e-4 31 | 32 | [VISUALIZATION] 33 | save_to_file = False 34 | save_type = .vtu 35 | save_frequency = 0.2, time 36 | subdivision = 3 37 | 38 | [ERROR ANALYSIS] 39 | check_error = True 40 | 41 | [OTHER] 42 | num_threads = 1 43 | model = MultiComponentINS 44 | component_names = a 45 | component_in_error_calc = a -> True 46 | component_in_time_deriv = a -> True 47 | velocity_fixed = True 48 | run_dir = pytests/full_system/mcins/purely_convective 49 | 50 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/purely_convective/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [MultiComponentINS] 2 | u = all -> [0.1, 0.0] 3 | p = all -> 0 4 | a = all -> 0 -------------------------------------------------------------------------------- /pytests/full_system/mcins/purely_convective/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 1 3 | diffusion_coefficients = a -> 0 4 | 5 | [FUNCTIONS] 6 | source = a -> 0 7 | -------------------------------------------------------------------------------- /pytests/full_system/mcins/purely_convective/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | a = -4*(y-0.5)*(y+0.5) 3 | 4 | [METRICS] 5 | L2_norm = a 6 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/h_convergence/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = left -> sin(pi * x) * cos(pi * y) 3 | right -> sin(pi * x) * cos(pi * y) 4 | 5 | [NEUMANN] 6 | u = top -> -pi * sin(pi * x) * sin(pi * y) 7 | bottom -> pi * sin(pi * x) * sin(pi * y) 8 | 9 | [ROBIN] 10 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/h_convergence/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = False 13 | interior_penalty_coefficient = 10.0 14 | 15 | [SOLVER] 16 | linear_solver = default 17 | preconditioner = default 18 | 19 | [TRANSIENT] 20 | transient = False 21 | 22 | [VISUALIZATION] 23 | save_to_file = False 24 | 25 | [ERROR ANALYSIS] 26 | check_error = False 27 | convergence_test = h -> u 28 | num_refinements = 5 29 | 30 | [OTHER] 31 | num_threads = 6 32 | model = Poisson 33 | run_dir = pytests/full_system/poisson/h_convergence 34 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/h_convergence/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> None 3 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/h_convergence/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 0.5 3 | 4 | [FUNCTIONS] 5 | source = all -> pi^2*sin(pi*x)*cos(pi*y) 6 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/h_convergence/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = sin(pi * x) * cos(pi * y) 3 | 4 | [METRICS] 5 | L2_norm = u 6 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/transient_coarse/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = left -> 0.0 3 | right -> 0.0 4 | 5 | [NEUMANN] 6 | u = top -> 0.0 7 | bottom -> 0.0 8 | 9 | [ROBIN] 10 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/transient_coarse/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/unit_square_coarse.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> H1 9 | interpolant_order = 3 10 | 11 | [DG] 12 | DG = False 13 | interior_penalty_coefficient = 10.0 14 | 15 | [SOLVER] 16 | linear_solver = default 17 | preconditioner = default 18 | 19 | [TRANSIENT] 20 | transient = True 21 | scheme = explicit euler 22 | time_range = 0.0, 1.0 23 | dt = 1e-3 24 | dt_tolerance = relative -> 1e-5 25 | absolute -> 1e-7 26 | dt_range = 1e-8, 0.01 27 | 28 | [VISUALIZATION] 29 | save_to_file = False 30 | 31 | [ERROR ANALYSIS] 32 | check_error = True 33 | 34 | [OTHER] 35 | num_threads = 1 36 | model = Poisson 37 | run_dir = pytests/full_system/poisson/transient_coarse 38 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/transient_coarse/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [POISSON] 2 | u = all -> x*(1 - x) 3 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/transient_coarse/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | diffusion_coefficient = all -> 1.0 3 | 4 | [FUNCTIONS] 5 | source = all -> 0.0 6 | -------------------------------------------------------------------------------- /pytests/full_system/poisson/transient_coarse/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = 0.0 3 | 4 | [METRICS] 5 | L2_norm = u 6 | -------------------------------------------------------------------------------- /pytests/full_system/stokes/stationary_pipe/bc_dir/bc_config: -------------------------------------------------------------------------------- 1 | [DIRICHLET] 2 | u = wall -> [0.0, 0.0] 3 | 4 | [STRESS] 5 | u = inlet -> [10.0, 0.0] 6 | outlet -> [-5.0, 0.0] 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /pytests/full_system/stokes/stationary_pipe/config: -------------------------------------------------------------------------------- 1 | [MESH] 2 | filename = pytests/mesh_files/channel_3bcs.vol 3 | 4 | [DIM] 5 | diffuse_interface_method = False 6 | 7 | [FINITE ELEMENT SPACE] 8 | elements = u -> VectorH1 9 | p -> H1 10 | interpolant_order = 3 11 | 12 | [DG] 13 | DG = False 14 | interior_penalty_coefficient = 10.0 15 | 16 | [SOLVER] 17 | linear_solver = default 18 | preconditioner = direct 19 | 20 | [TRANSIENT] 21 | transient = False 22 | 23 | [VISUALIZATION] 24 | save_to_file = False 25 | 26 | [ERROR ANALYSIS] 27 | check_error = True 28 | error_average = p 29 | 30 | [OTHER] 31 | num_threads = 1 32 | model = Stokes 33 | run_dir = pytests/full_system/stokes/stationary_pipe 34 | -------------------------------------------------------------------------------- /pytests/full_system/stokes/stationary_pipe/ic_dir/ic_config: -------------------------------------------------------------------------------- 1 | [STOKES] 2 | u = all -> [0.0, 0.0] 3 | p = all -> 0.0 4 | -------------------------------------------------------------------------------- /pytests/full_system/stokes/stationary_pipe/model_dir/model_config: -------------------------------------------------------------------------------- 1 | [PARAMETERS] 2 | kinematic_viscosity = all -> 0.001 3 | 4 | [FUNCTIONS] 5 | source = u -> [0.0, 0.0] 6 | -------------------------------------------------------------------------------- /pytests/full_system/stokes/stationary_pipe/ref_sol_dir/ref_sol_config: -------------------------------------------------------------------------------- 1 | [REFERENCE SOLUTIONS] 2 | u = [5.0/(2.0*0.001)*(0.2*y - y^2), 0.0] 3 | p = 5.0*(1.0 - x) + 5.0 4 | 5 | [METRICS] 6 | L2_norm = u, p 7 | L1_norm = u, p 8 | Linfinity_norm = u, p 9 | divergence = u 10 | # TODO: Turn back on once NGSolve updates and it not longer crashes 11 | ;facet_jumps = u, p 12 | -------------------------------------------------------------------------------- /pytests/full_system/stokes/test_stokes.py: -------------------------------------------------------------------------------- 1 | ######################################################################################################################## 2 | # Copyright 2021 the authors (see AUTHORS file for full list). # 3 | # # 4 | # This file is part of OpenCMP. # 5 | # # 6 | # OpenCMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public # 7 | # License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any # 8 | # later version. # 9 | # # 10 | # OpenCMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # 11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 12 | # details. # 13 | # # 14 | # You should have received a copy of the GNU Lesser General Public License along with OpenCMP. If not, see # 15 | # . # 16 | ######################################################################################################################## 17 | 18 | from pytest import CaptureFixture, fixture 19 | from opencmp.helpers.testing import automated_output_check 20 | from opencmp.config_functions import ConfigParser 21 | 22 | 23 | @fixture 24 | def pipe_unstructured_stationary() -> ConfigParser: 25 | """ 26 | Fixture to return a ConfigParser loaded with a base config for stationary solves in a pipe. 27 | 28 | Returns: 29 | The config parser loaded with the config 30 | """ 31 | return ConfigParser('pytests/full_system/stokes/stationary_pipe/config') 32 | 33 | 34 | class TestStationary: 35 | def test_stationary_cg(self, capsys: CaptureFixture, pipe_unstructured_stationary: ConfigParser) -> None: 36 | # Run 37 | automated_output_check(capsys, pipe_unstructured_stationary, [1e-10, 6e-12, 3e-11, 2e-12, 6e-10, 2e-11, 3e-10]) 38 | 39 | def test_stationary_dg(self, capsys: CaptureFixture, pipe_unstructured_stationary: ConfigParser) -> None: 40 | # Change from CG to DG 41 | pipe_unstructured_stationary['DG']['DG'] = 'True' 42 | # Change function spaces 43 | pipe_unstructured_stationary['FINITE ELEMENT SPACE']['elements'] = 'u -> HDiv\np -> L2' 44 | # Run 45 | automated_output_check(capsys, pipe_unstructured_stationary, [1e-10, 6e-12, 3e-11, 2e-12, 1e-11, 2e-11, 3e-10]) 46 | -------------------------------------------------------------------------------- /pytests/helpers/.pytest_cache/v/cache/lastfailed: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pytests/helpers/.pytest_cache/v/cache/nodeids: -------------------------------------------------------------------------------- 1 | [ 2 | "test_misc.py::TestMergeBCDict::test_1_layer_non_overlapping_keys", 3 | "test_misc.py::TestMergeBCDict::test_1_layer_overlapping_keys_non_overlapping_vals", 4 | "test_misc.py::TestMergeBCDict::test_1_layer_overlapping_keys_overlapping_vals", 5 | "test_misc.py::TestMergeBCDict::test_2_layer_non_overlapping_keys", 6 | "test_misc.py::TestMergeBCDict::test_2_layer_overlapping_keys", 7 | "test_misc.py::TestMergeBCDict::test_empty_empty" 8 | ] -------------------------------------------------------------------------------- /pytests/helpers/.pytest_cache/v/cache/stepwise: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /pytests/helpers/mesh/config_blank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-comphys/opencmp/4e1339a9e1face0e07b5fc0941207c3c47c0e183/pytests/helpers/mesh/config_blank -------------------------------------------------------------------------------- /pytests/mesh_files/unit_square_coarse.vol: -------------------------------------------------------------------------------- 1 | # Generated by NETGEN v6.2.2009 2 | 3 | mesh3d 4 | dimension 5 | 2 6 | geomtype 7 | 0 8 | 9 | # surfnr bcnr domin domout np p1 p2 p3 10 | surfaceelements 11 | 6 12 | 2 1 0 0 3 1 5 8 13 | 2 1 0 0 3 2 6 5 14 | 2 1 0 0 3 3 7 6 15 | 2 1 0 0 3 4 8 7 16 | 2 1 0 0 3 5 6 7 17 | 2 1 0 0 3 5 7 8 18 | 19 | 20 | # matnr np p1 p2 p3 p4 21 | volumeelements 22 | 0 23 | 24 | 25 | # surfid 0 p1 p2 trignum1 trignum2 domin/surfnr1 domout/surfnr2 ednr1 dist1 ednr2 dist2 26 | edgesegmentsgi2 27 | 8 28 | 1 0 1 5 -1 -1 1 0 1 0 1 0.5 29 | 1 0 5 2 -1 -1 1 0 1 0.5 1 1 30 | 2 0 2 6 -1 -1 1 0 2 0 2 0.5 31 | 2 0 6 3 -1 -1 1 0 2 0.5 2 1 32 | 3 0 3 7 -1 -1 1 0 3 0 3 0.5 33 | 3 0 7 4 -1 -1 1 0 3 0.5 3 1 34 | 4 0 4 8 -1 -1 1 0 4 0 4 0.5 35 | 4 0 8 1 -1 -1 1 0 4 0.5 4 1 36 | 37 | 38 | # X Y Z 39 | points 40 | 8 41 | 0.0000000000000000 0.0000000000000000 0.0000000000000000 42 | 1.0000000000000000 0.0000000000000000 0.0000000000000000 43 | 1.0000000000000000 1.0000000000000000 0.0000000000000000 44 | 0.0000000000000000 1.0000000000000000 0.0000000000000000 45 | 0.5000000000000000 0.0000000000000000 0.0000000000000000 46 | 1.0000000000000000 0.5000000000000000 0.0000000000000000 47 | 0.5000000000000000 1.0000000000000000 0.0000000000000000 48 | 0.0000000000000000 0.5000000000000000 0.0000000000000000 49 | 50 | 51 | # pnum index 52 | pointelements 53 | 0 54 | 55 | 56 | bcnames 57 | 4 58 | 1 bottom 59 | 2 right 60 | 3 top 61 | 4 left 62 | 63 | 64 | 65 | 66 | # Surfnr Red Green Blue 67 | face_colours 68 | 1 69 | 2 0.00000000 1.00000000 0.00000000 70 | 71 | 72 | endmesh 73 | 74 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = opencmp 3 | version = 1.0.2 4 | description = OpenCMP is a computational multiphysics software package based on the finite element method. It is primarily intended for physicochemical processes involving significant convective flow. 5 | long_description = file: README.md, LICENSE.md 6 | keywords = multiphysics, simulation 7 | license = BSD 3-Clause License 8 | classifiers = 9 | Topic :: Scientific/Engineering :: Physics 10 | License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) 11 | Programming Language :: Python :: 3 :: Only 12 | 13 | [options] 14 | zip_safe = False 15 | include_package_data = False 16 | packages = find: 17 | install_requires = 18 | numpy;python_version>'3.7.0' 19 | scipy;python_version>'3.7.0' 20 | ngsolve;python_version>'3.7.0' 21 | configparser;python_version>'3.7.0' 22 | pyparsing;python_version>'3.7.0' 23 | 24 | [options.package_data] 25 | 26 | 27 | [options.entry_points] 28 | console_scripts = 29 | pytesting = opencmp.entry_points:pytest_tests 30 | opencmp = opencmp.entry_points:run_opencmp 31 | 32 | [options.extras_require] 33 | test = 34 | pytest;python_version>'3.7' 35 | test_ext = 36 | pytest;python_version>'3.7' 37 | pytest-xdist;python_version>'3.7' 38 | tab = 39 | tabulate;python_version>'3.7' 40 | edt = 41 | edt;python_version>'3.7' 42 | all = 43 | pytest;python_version>'3.7' 44 | pytest-xdist;python_version>'3.7' 45 | tabulate;python_version>'3.7' 46 | edt;python_version>'3.7' 47 | 48 | [options.packages.find] 49 | --------------------------------------------------------------------------------