Skip to content
Snippets Groups Projects
Commit aba53219 authored by Adrien Crovato's avatar Adrien Crovato
Browse files

Merge branch 'adri' into 'master'

Version 0.1.0 (setup)

See merge request !1
parents f5d6754a 98d9624b
No related branches found
No related tags found
1 merge request!1Version 0.1.0 (setup)
Pipeline #2354 passed
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: LLVM
UseTab: Never
IndentWidth: 4
BreakBeforeBraces: Allman
SortIncludes: false
ColumnLimit: 0
AccessModifierOffset: -4
# EditorConfig is awesome: https://EditorConfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
# Compiled Object files
*.slo
*.lo
*.o
# Compiled Dynamic libraries
*.so
*.dylib
# Compiled Static libraries
*.lai
*.la
*.a
# Misc
core
*.pyc
*.*~
# OS
.DS_Store
*.swp
*.bak
# Workspace
workspace
workspace.tar.gz
*.tar.gz
*.tgz
# build dir
build
# Gmsh
*.pos
*.msh # do not commit the mesh...
!*_lfs.msh # ... except in the lfs
#*.opt
# IDE
.project
.pydevproject
.settings
.vscode
.vscode/*
# gitlab-ci file for fpm
default:
image: rboman/waves-py3:2020.3
before_script:
- source /opt/intel/mkl/bin/mklvars.sh intel64
- source /opt/intel/tbb/bin/tbbvars.sh intel64
.global_tag: &global_tag_def
tags:
- mn2l
variables:
GIT_CLONE_PATH: /builds/$CI_PROJECT_PATH/FPM_BUILD/fpm # cannot work in /builds/$CI_PROJECT_PATH
stages:
- build
# - fmt_dox
build:
<<: *global_tag_def
stage: build
script:
- printenv | sort
- cd ..
# get and build waves
- rm -rf waves
- wget -q https://gitlab.uliege.be/am-dept/waves/-/archive/master/waves-master.tar.bz2
- tar xf waves-master.tar.bz2
- rm waves-master.tar.bz2
- mv waves-master waves
- cd waves
- mkdir build
- cd build
- cmake -Wno-dev -C ../CMake/disable-trilinos.cmake ..
- make -j $(nproc)
# check code format
- clang-format --version # we use clang-format-10 exclusively
- cd ../../fpm
- ${CI_PROJECT_DIR}/../waves/scripts/format_code.py
- mkdir -p patches
- if git diff --patch --exit-code > patches/clang-format.patch; then echo "Clang format changed nothing"; else echo "Clang format found changes to make!"; false; fi
# build fpm
- mkdir build
- cd build
- cmake -Wno-dev .. # -DCMAKE_PREFIX_PATH=${CI_PROJECT_DIR}/../waves (handled by default)
- make -j $(nproc)
# build documentation
- make dox
# test
- ctest -j $(nproc) --output-on-failure #--verbose
- mv ${CI_PROJECT_DIR}/../waves/scripts/format_code.py . # ulgy way to keep a script we need later...
#timeout: 10 hours # will be available in 12.3
artifacts:
paths:
- build/
- patches/
expire_in: 1 day
#format:
# <<: *global_tag_def
# stage: fmt_dox
# script:
# - clang-format --version # we use clang-format-10 exclusively
# - ./build/format_code.py
# - mkdir -p patches
# - if git diff --patch --exit-code > patches/clang-format.patch; then echo "Clang format changed nothing"; else echo "Clang format found changes to make!"; false; fi
# artifacts:
# paths:
# - patches/
# expire_in: 1 day
# when: on_failure
# dependencies:
# - build_test
# allow_failure: true
#
#
#doxygen:
# <<: *global_tag_def
# stage: fmt_dox
# script:
# - cd build
# - make dox
# artifacts:
# paths:
# - build/doxygen/
# expire_in: 1 day
# dependencies:
# - build_test
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# FindEIGEN.cmake - try to find Eigen 3 headers
# The logic that checks the version comes from FindEigen3.cmake (source dir)
# ----------------------------------------------------------------------------
# output:
# EIGEN_FOUND : TRUE/FALSE
# EIGEN_INCLUDE_DIRS : where the Eigen/*.h are [cached]
# EIGEN_VERSION : version number of Eigen
# ----------------------------------------------------------------------------
# autodetection:
# utiliser "CMAKE_PREFIX_PATH=c:\local"
# ou "CMAKE_INCLUDE_PATH=c:\local\include"
# ou "INCLUDE=c:\local\include"
# ----------------------------------------------------------------------------
# Check version (only for Eigen 3)
macro(_eigen3_check_version)
file(READ "${EIGEN_INCLUDE_DIRS}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN_VERSION ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})
if(${EIGEN_VERSION} VERSION_LESS ${EIGEN_FIND_VERSION})
message(FATAL_ERROR "Eigen version ${EIGEN_VERSION} found in ${EIGEN_INCLUDE_DIRS}, but at least version ${EIGEN_FIND_VERSION} is required!")
endif()
endmacro()
# Set a dummy version if not provided
if(NOT EIGEN_FIND_VERSION)
if(NOT EIGEN_FIND_VERSION_MAJOR)
set(EIGEN_FIND_VERSION_MAJOR 3)
endif()
if(NOT EIGEN_FIND_VERSION_MINOR)
set(EIGEN_FIND_VERSION_MINOR 3)
endif()
if(NOT EIGEN_FIND_VERSION_PATCH)
set(EIGEN_FIND_VERSION_PATCH 4)
endif()
set(EIGEN_FIND_VERSION "${EIGEN_FIND_VERSION_MAJOR}.${EIGEN_FIND_VERSION_MINOR}.${EIGEN_FIND_VERSION_PATCH}")
endif()
# Find the header and check the version
find_path(EIGEN_INCLUDE_DIRS "Eigen/Dense" PATHS "/usr/include/eigen3")
if (EIGEN_INCLUDE_DIRS)
_eigen3_check_version()
else()
message(FATAL_ERROR "Eigen3 headers not found! Define the path in the INCLUDE environment variable.")
endif()
# handle the QUIETLY and REQUIRED arguments and set EIGEN_FOUND to TRUE
# if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EIGEN
FOUND_VAR EIGEN_FOUND
REQUIRED_VARS EIGEN_INCLUDE_DIRS
VERSION_VAR EIGEN_VERSION)
#MESSAGE(STATUS "EIGEN_FOUND = ${EIGEN_FOUND}")
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# useful macros/fcts
MACRO(MACRO_AddTest srcDir)
FILE(GLOB tfiles RELATIVE ${srcDir} ${srcDir}/*)
FOREACH(tfile ${tfiles})
SET(spath ${srcDir}/${tfile})
IF(NOT IS_DIRECTORY ${spath} AND
${spath} MATCHES ".+\\.py$" AND
NOT ${tfile} STREQUAL "__init__.py")
STRING(REPLACE "${PROJECT_SOURCE_DIR}/" "" strip ${spath})
MESSAGE(STATUS "Adding test ${strip}")
ADD_TEST(NAME ${strip}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${PYTHON_EXECUTABLE} run_fpm.py --nogui --clean ${strip})
ELSE()
MACRO_AddTest(${srcDir}/${tfile})
ENDIF()
ENDFOREACH()
ENDMACRO()
MACRO(MACRO_DebugPostfix libname)
IF(MSVC)
SET_TARGET_PROPERTIES(${libname} PROPERTIES DEBUG_POSTFIX "_d")
ENDIF(MSVC)
ENDMACRO()
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# MSYS2 with MinGW (AC)
SET(CMAKE_GENERATOR "MSYS Makefiles" CACHE INTERNAL "" FORCE)
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------
PROJECT(fpm)
# ----------------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
IF(${CMAKE_VERSION} VERSION_GREATER "3.14.0") # we might want to update the project and use the NEW behavior here
cmake_policy(SET CMP0078 OLD)
cmake_policy(SET CMP0086 OLD)
ENDIF()
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH
"Single output directory for building all libraries.")
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH
"Single output directory for building all executables.")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
IF(NOT CMAKE_BUILD_TYPE)
SET( CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake")
# -- GENERAL OPTIONS
# print OS
MESSAGE(STATUS "CMAKE_SYSTEM_NAME=\"${CMAKE_SYSTEM_NAME}\"")
MESSAGE(STATUS "CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")
# -- macros/fcts
INCLUDE(fpmMacros)
# -- C++11
SET(CMAKE_CXX_STANDARD 11) # newer way to set C++11 (requires cmake>=3.1)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set specific compiler flags
IF((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Intel"))
IF(NOT APPLE)
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # add verbosity
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -Wno-unknown-pragmas -Wno-sign-compare") # merge trilinos
ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_USE_MATH_DEFINES) # otherwise M_PI is undefined
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # parallel build with MSVC
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") # add verbosity
ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything") # add verbosity
ENDIF()
# -- Search for Python
IF (CMAKE_VERSION VERSION_LESS 3.12.0)
FIND_PACKAGE(PythonInterp 3.6 REQUIRED)
FIND_PACKAGE(PythonLibs 3.6 REQUIRED)
ELSE()
find_package (Python3 COMPONENTS Interpreter Development)
# use Python3_ROOT_DIR if wrong python found (e.g. anaconda)
SET(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
SET(PYTHON_LIBRARIES ${Python3_LIBRARIES})
SET(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS})
SET(PYTHONLIBS_VERSION_STRING ${Python3_VERSION})
ENDIF()
MESSAGE(STATUS "PYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}")
MESSAGE(STATUS "PYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}")
MESSAGE(STATUS "PYTHON_INCLUDE_DIR:FILEPATH=${PYTHON_INCLUDE_DIR}")
MESSAGE(STATUS "PYTHON_FRAMEWORK_INCLUDES=${PYTHON_FRAMEWORK_INCLUDES}")
MESSAGE(STATUS "PYTHONLIBS_VERSION_STRING=${PYTHONLIBS_VERSION_STRING}")
MESSAGE(STATUS "Python_FRAMEWORKS=${Python_FRAMEWORKS}")
# -- Search for SWIG
FIND_PACKAGE(SWIG REQUIRED)
IF(CMAKE_GENERATOR MATCHES "Visual Studio") # not MSVC because of nmake & jom
SET(CMAKE_SWIG_OUTDIR "${EXECUTABLE_OUTPUT_PATH}/$(Configuration)/")
ELSE()
SET(CMAKE_SWIG_OUTDIR "${EXECUTABLE_OUTPUT_PATH}")
ENDIF()
# -- Doxygen (https://vicrucann.github.io/tutorials/quick-cmake-doxygen/)
# check if Doxygen is installed
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
# set input and output files
SET(DOXYGEN_IN ${PROJECT_SOURCE_DIR}/Doxyfile.in)
SET(DOXYGEN_OUT ${PROJECT_BINARY_DIR}/Doxyfile)
# request to configure the file
CONFIGURE_FILE(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
#message("Doxygen build started")
# note the option ALL which allows to build the docs together with the application
# "make dox" rebuilds the doc
ADD_CUSTOM_TARGET( dox #ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
ELSE()
MESSAGE("Doxygen need to be installed to generate the doxygen documentation")
ENDIF()
# -- CTest
ENABLE_TESTING()
# -- Modules
ADD_SUBDIRECTORY( fpm )
Doxyfile.in 0 → 100644
This diff is collapsed.
LICENSE 0 → 100644
This diff is collapsed.
# fpm
Field panel method for solving transonic flows using the full potential equation
![](/dox/img.png)
## Features
Set of python/C++ modules solving the linear potential equation and correcting it with source terms computed using third-party nonlinear solvers.
- [x] [gmsh](http://geuz.org/gmsh) support for meshing and post-processing
- [x] [eigen3](http://eigen.tuxfamily.org/) support for linear algebra
## Build
fpm is linked against [waves](https://gitlab.uliege.be/am-dept/waves). Once all the required packages and waves are installed:
```bash
git clone git@gitlab.uliege.be:am-dept/fpm.git # get the code
mkdir build && cd build
cmake -DCMAKE_PREFIX_PATH=/path/to/waves .. # configure and reference waves package
make # compile
ctest # test
```
## References
dox/img.png

151 KiB

dox/logo.jpg

10.6 KiB

# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# CMake input file of fwk.so
# Add source dir
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( _src )
# Add test dir
MACRO_AddTest(${CMAKE_CURRENT_SOURCE_DIR}/tests)
# -*- coding: utf-8 -*-
# fpm module initialization file
import fwk
import tbox # on windows, preloads tbox.dll so that it is found later by fpmw.dll
fwk.wutils.findbins('fpm', verb=False)
from fpmw import *
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# CMake file for the SWIG interface of fpm.so
INCLUDE(${SWIG_USE_FILE})
FILE(GLOB SRCS *.h *.cpp *.inl *.swg)
FILE(GLOB ISRCS *.i)
SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(${ISRCS} PROPERTIES CPLUSPLUS ON)
FOREACH(dir ${WAVES_INCLUDE_DIRS})
LIST(APPEND WAVES_SINCLUDE_DIRS "-I${dir}")
ENDFOREACH()
FOREACH(dir ${WAVES_SWIG_DIRS})
LIST(APPEND WAVES_SINCLUDE_DIRS "-I${dir}")
ENDFOREACH()
SET(SWINCFLAGS
-I${PROJECT_SOURCE_DIR}/fpm/src
${WAVES_SINCLUDE_DIRS}
)
SET_SOURCE_FILES_PROPERTIES(${ISRCS} PROPERTIES SWIG_FLAGS "${SWINCFLAGS}")
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
SWIG_ADD_MODULE(fpmw python ${ISRCS} ${SRCS})
else()
SWIG_ADD_LIBRARY(fpmw LANGUAGE python SOURCES ${ISRCS} ${SRCS})
endif()
MACRO_DebugPostfix(_fpmw)
TARGET_INCLUDE_DIRECTORIES(_fpmw PRIVATE ${PROJECT_SOURCE_DIR}/fpm/_src
${WAVES_SWIG_DIRS}
${PYTHON_INCLUDE_PATH}
)
SWIG_LINK_LIBRARIES(fpmw
fpm ${WAVES_LIBRARIES} ${PYTHON_LIBRARIES}
)
/*
* Copyright 2020 University of Liège
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "fBody.h"
#include "fBuilder.h"
#include "fField.h"
#include "fProblem.h"
#include "fSolver.h"
#include "fTimers.h"
#include "fWake.h"
/*
* Copyright 2020 University of Liège
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// fpm.i: SWIG input file of the fpm python interface
%feature("autodoc","1");
%module(docstring=
"'fpmw' module: field panel method
(c) ULg - A&M",
directors="1",
threads="1"
) fpmw
%{
//#if defined(_WIN32) && defined(__GNUC__)
#undef _hypot
#include <cmath>
//#endif
#include <memory>
#include <string>
#include <sstream>
#include <typeinfo>
#include "fwkw.h"
#include "tboxw.h"
#include "fpmw.h"
#include "fpm.h"
%}
%include "fwkw.swg"
%import "tboxw.i"
%include "fpm.h"
%include "fTimers.h"
namespace fpm {
%extend Timers {
Timer &getitem(std::string const &name)
{
return (*self)[name];
}
%pythoncode {
def __getitem__(self, name):
return self.getitem(name)
}
}
};
%include <std_shared_ptr.i>
%shared_ptr(fpm::Field);
%include "fField.h"
%shared_ptr(fpm::Body);
%immutable fpm::Body::wake; // avoids the creation of the setter method
%include "fBody.h"
%shared_ptr(fpm::Wake);
%include "fWake.h"
%shared_ptr(fpm::Problem);
%immutable fpm::Problem::msh;
%include "fProblem.h"
%shared_ptr(fpm::Builder);
%immutable fpm::Builder::pbl;
%include "fBuilder.h"
%shared_ptr(fpm::Solver);
%immutable fpm::Solver::aic;
%include "fSolver.h"
This diff is collapsed.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Naca 0012 model
# Adrien Crovato
import fpm
import tbox
import tbox.gmsh as gmsh
from fwk.coloring import ccolors
def main(p, tail=False, field=False):
# timer
tms = fpm.Timers()
tms['total'].start()
# mesh
print(ccolors.ANSI_BLUE + 'PyMeshing...' + ccolors.ANSI_RESET)
msh = gmsh.MeshLoader('n0012.geo', __file__).execute(**p['pars'])
# problem
pbl = fpm.Problem(msh, p['aoa'], p['aos'], p['mach'], p['spn'], 1, 0, 0, 0)
wing = fpm.Body(msh, 'wing', ['wTe'], 10)
pbl.add(wing)
if tail:
tail = fpm.Body(msh, 'tail', ['tTe'], 10)
pbl.add(tail)
if field:
field = fpm.Field(msh, 'field')
pbl.set(field)
# AIC builder
aic = fpm.Builder(pbl)
aic.run()
# solver
slv = fpm.Solver(aic)
slv.run()
slv.save(tbox.GmshExport(msh))
print('\n', slv)
# end timer
tms['total'].stop()
print(ccolors.ANSI_BLUE + 'PyTiming...' + ccolors.ANSI_RESET)
print(tms)
if __name__ == '__main__':
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment