1588 {
1589 TRACE();
1590
1591 const MString couplerType = Context::getBasicProperty<MString>(
"couplerType_" + std::to_string(couplerId), AT_);
1592
1593 cerr0 <<
"=== Create coupler #" << couplerId <<
" " << couplerType << std::endl;
1594
1595
1596
1598 std::vector<MInt> solversToCouple;
1599 for(
MInt solver = 0; solver < solverToCoupleLength; solver++) {
1600 solversToCouple.push_back(-1);
1602 solversToCouple[solver] =
1603 Context::getBasicProperty<MInt>("solversToCouple_" + std::to_string(couplerId), AT_, nullptr, solver);
1604 if(solversToCouple[solver] < 0 || solversToCouple[solver] >=
m_noSolvers) {
1605 TERMM(1, "Invalid solver id: " + std::to_string(solversToCouple[solver]));
1606 }
1607 } else {
1608 TERMM(1, "solversToCouple_" + std::to_string(couplerId) + " has to be specified!");
1609 }
1610 }
1611
1612
1613
1616 const MInt nDist = Context::getSolverProperty<MInt>(
"noDistributions", solversToCouple[0], AT_);
1617 switch(nDist) {
1618 case 19: {
1621 const auto dgSolver =
1623 m_couplers[couplerId] = make_unique<LbDgApe<3, 19, SysEqnLb>>(couplerId, lbSolver, dgSolver);
1624 break;
1625 }
1626 case 27: {
1629 const auto dgSolver =
1631 m_couplers[couplerId] = make_unique<LbDgApe<3, 27, SysEqnLb>>(couplerId, lbSolver, dgSolver);
1632 break;
1633 }
1634 default: {
1635 mTerm(1,
"Unknown number of distributions! Only working for q19 and q27, yet.");
1636 }
1637 }
1638 break;
1639 }
1643 fvSystemEquations =
1644 string2enum(Context::getSolverProperty<MString>(
"fvSystemEquations", solversToCouple[1], AT_));
1645 }
1646 switch(fvSystemEquations) {
1649 make_unique<typename LsFvMbXD<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>::type>(
1650 couplerId,
1651 static_cast<typename LsCartesianSolverXD<nDim>::type*
>(
m_solvers[solversToCouple[0]].get()),
1654 break;
1655 }
1657 default: {
1658 m_couplers[couplerId] = make_unique<typename LsFvMbXD<nDim, FvSysEqnNS<nDim>>::type>(
1659 couplerId,
1660 static_cast<typename LsCartesianSolverXD<nDim>::type*
>(
m_solvers[solversToCouple[0]].get()),
1662 break;
1663 }
1664 }
1665
1666 break;
1667 }
1671 ransMethod = Context::getSolverProperty<MString>("ransMethod", solversToCouple[0], AT_);
1672 }
1676 m_couplers[couplerId] = make_unique<FvZonalRTV<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
1677 couplerId,
1681 break;
1682 }
1684 m_couplers[couplerId] = make_unique<FvZonalRTV<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_FS>>>>(
1685 couplerId,
1689 break;
1690 }
1691 default: {
1692 TERMM(1, "Unknown RANS model for solver " + to_string(solversToCouple[0]));
1693 }
1694 }
1695 break;
1696 }
1700 ransMethod = Context::getSolverProperty<MString>("ransMethod", solversToCouple[0], AT_);
1701 }
1705 m_couplers[couplerId] = make_unique<FvZonalSTG<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
1706 couplerId,
1710 break;
1711 }
1713 m_couplers[couplerId] = make_unique<FvZonalSTG<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_FS>>>>(
1714 couplerId,
1718 break;
1719 }
1720 default: {
1721 TERMM(1, "Unknown RANS model for solver " + to_string(solversToCouple[0]));
1722 }
1723 }
1724 break;
1725 }
1729 fvSystemEquations =
1730 string2enum(Context::getSolverProperty<MString>(
"fvSystemEquations", solversToCouple[1], AT_));
1731 }
1732 switch(fvSystemEquations) {
1735 make_unique<CouplerFvMbZonal<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
1736 couplerId,
1741 break;
1742 }
1744 default: {
1745 m_couplers[couplerId] = make_unique<CouplerFvMbZonal<nDim, FvSysEqnNS<nDim>>>(
1746 couplerId,
1749 break;
1750 }
1751 }
1752 break;
1753 }
1754
1758 fvSystemEquations =
1759 string2enum(Context::getSolverProperty<MString>(
"fvSystemEquations", solversToCouple[1], AT_));
1760 }
1761 switch(fvSystemEquations) {
1764 make_unique<FvCartesianInterpolation<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>,
1766 couplerId,
1771 break;
1772 }
1774 default: {
1777 couplerId,
1781 break;
1782 }
1783 }
1784 break;
1785 }
1786
1788
1789 auto fvSolvers = std::vector<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>{};
1790 for(
MInt s = 0; s < (
MInt)solversToCouple.size(); s++) {
1791 fvSolvers.push_back(
1793 }
1794 m_couplers[couplerId] = make_unique<CouplerFvMultilevel<nDim, FvSysEqnNS<nDim>>>(couplerId, fvSolvers);
1795
1796 break;
1797 }
1798
1800
1801 auto fvSolvers = std::vector<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>{};
1802 for(
MInt s = 0; s < (
MInt)solversToCouple.size(); s++) {
1803 fvSolvers.push_back(
1805 }
1807 make_unique<CouplerFvMultilevelInterpolation<nDim, FvSysEqnNS<nDim>>>(couplerId, fvSolvers);
1808 break;
1809 }
1810
1812 m_couplers[couplerId] = make_unique<DgCcAcousticPerturb<nDim, FvSysEqnNS<nDim>>>(
1813 couplerId,
1816 break;
1817 }
1820 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[1], AT_, &nDist);
1821
1822 switch(nDist) {
1823 case 9: {
1824 auto lsSolver =
static_cast<typename LsCartesianSolverXD<2>::type*
>(
m_solvers[solversToCouple[0]].get());
1827 m_couplers[couplerId] = make_unique<LsLb<2, 9, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1828
1829 break;
1830 }
1831 case 19: {
1832 auto lsSolver =
static_cast<typename LsCartesianSolverXD<3>::type*
>(
m_solvers[solversToCouple[0]].get());
1835 m_couplers[couplerId] = make_unique<LsLb<3, 19, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1836
1837 break;
1838 }
1839 case 27: {
1840 auto lsSolver =
static_cast<typename LsCartesianSolverXD<3>::type*
>(
m_solvers[solversToCouple[0]].get());
1843 m_couplers[couplerId] = make_unique<LsLb<3, 27, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1844
1845 break;
1846 }
1847 default: {
1848 mTerm(1,
"Unknown number of distributions!");
1849 }
1850 }
1851
1852 break;
1853 }
1854
1857 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[0], AT_, &nDist);
1858
1859 switch(nDist) {
1860 case 9: {
1864 m_couplers[couplerId] = make_unique<LbRb<2, 9, SysEqnLb>>(couplerId, lbSolver, rigidBodies);
1865
1866 break;
1867 }
1868 case 19: {
1872 m_couplers[couplerId] = make_unique<LbRb<3, 19, SysEqnLb>>(couplerId, lbSolver, rigidBodies);
1873
1874 break;
1875 }
1876 case 27: {
1880 m_couplers[couplerId] = make_unique<LbRb<3, 27, SysEqnLb>>(couplerId, lbSolver, rigidBodies);
1881
1882 break;
1883 }
1884 default: {
1885 mTerm(1,
"Unknown number of distributions!");
1886 }
1887 }
1888 break;
1889 }
1890
1893 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[1], AT_, &nDist);
1894
1895 switch(nDist) {
1896 case 9: {
1897 IF_CONSTEXPR(nDim == 3) {
mTerm(1,
"LPT not supported in 2D!"); }
1898 break;
1899 }
1900 case 19: {
1903 auto particleSolver =
static_cast<LPT<3>*
>(
m_solvers[solversToCouple[1]].get());
1904 m_couplers[couplerId] = make_unique<LbLpt<3, 19, SysEqnLb>>(couplerId, particleSolver, lbSolver);
1905
1906 break;
1907 }
1908 case 27: {
1911 auto particleSolver =
static_cast<LPT<3>*
>(
m_solvers[solversToCouple[1]].get());
1912 m_couplers[couplerId] = make_unique<LbLpt<3, 27, SysEqnLb>>(couplerId, particleSolver, lbSolver);
1913
1914 break;
1915 }
1916 default: {
1917 mTerm(1,
"Unknown number of distributions!");
1918 }
1919 }
1920 break;
1921 }
1922
1925 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[1], AT_, &nDist);
1926
1927 switch(nDist) {
1928 case 9: {
1929 auto lsSolver =
static_cast<typename LsCartesianSolverXD<2>::type*
>(
m_solvers[solversToCouple[0]].get());
1932 m_couplers[couplerId] = make_unique<LsLbSurface<2, 9, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1933
1934 break;
1935 }
1936 case 19: {
1937 auto lsSolver =
static_cast<typename LsCartesianSolverXD<3>::type*
>(
m_solvers[solversToCouple[0]].get());
1940 m_couplers[couplerId] = make_unique<LsLbSurface<3, 19, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1941
1942 break;
1943 }
1944 case 27: {
1945 auto lsSolver =
static_cast<typename LsCartesianSolverXD<3>::type*
>(
m_solvers[solversToCouple[0]].get());
1948 m_couplers[couplerId] = make_unique<LsLbSurface<3, 27, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1949
1950 break;
1951 }
1952 default: {
1953 mTerm(1,
"Unknown number of distributions!");
1954 }
1955 }
1956
1957 break;
1958 }
1959
1961 auto lsSolver =
static_cast<typename LsCartesianSolverXD<nDim>::type*
>(
m_solvers[solversToCouple[0]].get());
1964 fvSystemEquations =
1965 string2enum(Context::getSolverProperty<MString>(
"fvSystemEquations", solversToCouple[1], AT_));
1966 }
1967 switch(fvSystemEquations) {
1971 .get();
1973 make_unique<typename CouplingLsFvXD<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>::type>(
1974 couplerId, lsSolver, fvSolvers);
1975 break;
1976 }
1977 default: {
1980 make_unique<typename CouplingLsFvXD<nDim, FvSysEqnNS<nDim>>::type>(couplerId, lsSolver, fvSolvers);
1981 }
1982 }
1983
1984 break;
1985 }
1986
1988 auto lsSolverId = solversToCouple[0];
1989 auto fvSolverId = solversToCouple[1];
1990
1991 m_couplers[couplerId] = make_unique<typename LsFvCombustionXD<nDim, FvSysEqnNS<nDim>>::type>(
1992 couplerId,
1993 static_cast<typename LsCartesianSolverXD<nDim>::type*
>(
m_solvers[lsSolverId].get()),
1995 break;
1996 }
1997
2001 fvSystemEquations =
2002 string2enum(Context::getSolverProperty<MString>(
"fvSystemEquations", solversToCouple[1], AT_));
2003 }
2004 if(nDim != 3)
mTerm(1, AT_,
"LB-FV-Euler-Euler-Multiphase only implemented for nDim = 3");
2005
2006 switch(fvSystemEquations) {
2008 mTerm(1, AT_,
"RANS not supported in combination with LB-FV-EE-Multiphase!");
2009 break;
2010 }
2013 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[0], AT_, &nDist);
2014
2015 switch(nDist) {
2016 case 9: {
2017 mTerm(1,
"nDist = 9 not supported with EE Multiphase!");
2018
2019 break;
2020 }
2021 case 19: {
2024 auto fvSolver =
2026
2027 m_couplers[couplerId] = make_unique<CouplerLbFvEEMultiphase<3, 19, SysEqnLb, FvSysEqnEEGas<3>>>(
2028 couplerId, lbSolver, fvSolver);
2029
2030 break;
2031 }
2032 case 27: {
2035 auto fvSolver =
2037
2038 m_couplers[couplerId] = make_unique<CouplerLbFvEEMultiphase<3, 27, SysEqnLb, FvSysEqnEEGas<3>>>(
2039 couplerId, lbSolver, fvSolver);
2040
2041 break;
2042 }
2043 default: {
2044 mTerm(1,
"Unknown number of distributions!");
2045 }
2046 }
2047 break;
2048 }
2050 default: {
2051 mTerm(1, AT_,
"This SysEqn is not supported in combination with LB-FV-EE-Multiphase!");
2052 break;
2053 }
2054 }
2055 break;
2056 }
2057
2060 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[0], AT_, &nDist);
2061 {
2062 const MInt tempNDist = Context::getSolverProperty<MInt>(
"noDistributions", solversToCouple[1], AT_, &nDist);
2063 if(nDist != tempNDist)
mTerm(1, AT_,
"Can't couple LB solvers with different noDistributions!");
2064 }
2065 switch(nDist) {
2066 case 9: {
2068 std::vector<LbSolverDxQy<2, 9, SysEqnLb>*> lbSolvers;
2071 m_couplers[couplerId] = make_unique<CouplerLbLb<2, 9, SysEqnLb>>(couplerId, lbSolvers);
2072 break;
2073 }
2074 case 19: {
2076 std::vector<LbSolverDxQy<3, 19, SysEqnLb>*> lbSolvers;
2079 m_couplers[couplerId] = make_unique<CouplerLbLb<3, 19, SysEqnLb>>(couplerId, lbSolvers);
2080 break;
2081 }
2082 case 27: {
2084 std::vector<LbSolverDxQy<3, 27, SysEqnLb>*> lbSolvers;
2087 m_couplers[couplerId] = make_unique<CouplerLbLb<3, 27, SysEqnLb>>(couplerId, lbSolvers);
2088 break;
2089 }
2090 default: {
2091 mTerm(1,
"Unknown number of distributions!");
2092 }
2093 }
2094 break;
2095 }
2096
2101 fvSystemEquations =
2102 string2enum(Context::getSolverProperty<MString>(
"fvSystemEquations", solversToCouple[1], AT_));
2103 }
2104 switch(fvSystemEquations) {
2108 if(nDim == 3) {
2110 make_unique<CouplerFvParticle<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
2111 couplerId, particleSolver, fvSolver);
2112 } else {
2113 mTerm(1, AT_,
"FV Particle not supported in 2D!");
2114 }
2115 break;
2116 }
2118 default: {
2119 auto fvSolver =
2121 if(nDim == 3) {
2123 make_unique<CouplerFvParticle<nDim, FvSysEqnNS<nDim>>>(couplerId, particleSolver, fvSolver);
2124 } else {
2125 mTerm(1, AT_,
"FV Particle not supported in 2D!");
2126 }
2127
2128 break;
2129 }
2130 }
2131 break;
2132 }
2133
2134 default: {
2135 TERMM(1, "Unknown coupler type '" + couplerType + "', exiting ... ");
2136 }
2137 }
2138
2139 m_log <<
"Created coupler #" << std::to_string(couplerId) <<
": " << couplerType <<
" for solvers";
2140 for(
MInt solver = 0; solver < 2; solver++) {
2141 m_log <<
" " << solversToCouple[solver];
2142 }
2144}
static MInt propertyLength(const MString &name, MInt solverId=m_noSolvers)
Returns the number of elements of a property.
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
This class represents all LB models.
MInt string2enum(MString theString)
This global function translates strings in their corresponding enum values (integer values)....
@ COUPLER_FV_MULTILEVEL_INTERPOLATION
@ COUPLER_LS_FV_COMBUSTION
@ COUPLER_LB_FV_EE_MULTIPHASE
@ COUPLER_CARTESIAN_INTERPOLATION
void mTerm(const MInt errorCode, const MString &location, const MString &message)