Coder Social home page Coder Social logo

andrsd / godzilla Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 12.87 MB

FEM framework

Home Page: https://andrsd.github.io/godzilla/

License: MIT License

C++ 98.64% C 0.24% CMake 1.13%
finite-element-analysis finite-element-methods finite-elements petsc

godzilla's Introduction

Software engineer for scientific projects and not only.

Languages

C++ C Python

Stats

Find me

Gmail Github

godzilla's People

Contributors

andrsd avatar

Stargazers

 avatar

Watchers

 avatar  avatar

godzilla's Issues

Adaptive time stepping

Use case

  • compute CFL
  • used that as dt

Syntax

problem:
  type: XYZTransientProblem
  ts_adapt:
      type: XYZTSAdapt
      params

Design

  • Use this PETSc TSAdapt for CFL code to write a new PETSc TSAdapt class called "godzilla".
  • There should be a callback in TransientInterface that will be called from TSAdaptChoose_godzilla. It will look like:
     PetscErrorCode ts_adapt_choose(PetscReal h,PetscInt *next_sc,PetscReal *next_h,PetscBool *accept,PetscReal *wlte,PetscReal *wltea,PetscReal *wlter)
    
    • We will need to extract the application context from the TS object and call ts_adapt_choose (the usual)
  • TransientInterface will extract TSAdapt from its TS object

Notes

CFL time adaptation is already in PETSc, so also be able to use the schemes in PETSc. Maybe via this syntax:

problem:
  type: XYZTransientProblem
  ts_adapt:
    scheme: <PETSc TSAdapt scheme>
    min: <value>
    max: <value>

Boolean input parameter

Allow boolean-valued input parameters.

params.add_param<bool>("name", ...);
params.add_param<PetscBool>("name", ...); (?)

User should be able to do:

param: [on | off | true | false | yes | no]

Label-restricted aux fields

So we can do things like:

  • aux field a defined over the whole domain
  • a part of the field a is restricted to label1 and set using an aux field object
  • another part of the field a is restricted to label2 and set using some other aux field object

Adaptive mesh refinement

Enable adaptive mesh refinements

Info:

Tasks:

  • Add adaptivity capability for steady-state problems
    • use case: mesh convergence study
  • Add adaptivity to transient problems
    • implicit
    • explicit

ExodusIIMesh: Generate labels with sideset IDs as names

When an ExodusII file is loaded, it contains labels for named side sets. However, user can refer to the boundary (side set) via its ID.

We want to create labels that will be named using the ID, i.e. if there is a side set with ID 1000, its name will be "1000". Then, we will keep a map from IDs to names around, so we will have 1000 -> "name" and also "name" -> 1000.

Then, we will need API to get label given a side set name. It will look for the name first, and if there is no such name, it will try to use the "ID" version.

CSVOutput

Output object to store time-dependent scalar values as a CSV file.

Something like this:

time,pps1,pps2
0,val1,val2
...
t,valX,valY

Allow users to select time integration scheme

Allow users to select time integration scheme for implicit and explicit solvers.

Implicit:

  • beuler
  • cn

Explicit:

  • euler
  • ssp
  • rk [1fe,2a,3,3bs,4,5f,5dp,5bs]
    • Will need to call TSRKSetType to set the type, default is 3BS

There is more in PETSc. Some types will need extra parameters specified -> stronger input parameter validation will be needed.

ExodusIIOutput crashes in PETSc

When trying to do this:

ierr = PetscViewerCreate(comm(), &this->viewer);
ierr = PetscViewerSetType(this->viewer, PETSCVIEWEREXODUSII);
ierr = PetscViewerFileSetMode(this->viewer, FILE_MODE_WRITE);

ierr = DMView(dm, this->viewer);
ierr = VecView(vec, this->viewer);

The code crashes inside PETSc with a segfault.

Functions

Allow things like this:

functions:
  linipol1:
    type: LinearInterpolation
    x: [0, 1, 2, 3]
    y: [10, 5, 6, 2]
...
bcs:
  left:
    type: DirichletBC
    boundary: ...
    value: '10*linipol1(t)'

Wherever we expect parsed expression we should be able to use function specified via functions block, with their names.

Design

  1. Take muParser and modify callbacks such they take void * ctx as a last argument.
  2. Maintain list of known functions in some container
  3. Every time we build a muparser instance, register all known functions form the container with the parser (note: we will want to wrap the parser into our class, so this happens every time somebody uses the parsed capability)
  4. Each function will need to specify a C callback that it will need to register with the parser

Note functions will have to be build quite early, but that should not be a problem.

Add mesh iterators

I want to be able to do:

for (auto & : mesh.get_element_range()) {
  // e is now cell ID
}

The same for vertices.

Support code coverage for gcc

gcc needs different flags than clang.

Make cmake/CodeCoverage.cmakeaware of the compiler used and set the correct flags.

Enable code coverage

Figure out how or where is llvm-profdata is on home brew, then turn code coverage for macOS on again.

Figure out how to generate code coverage on linux

Vector-valued parameter specified as scalar crashes the code

If parameter is defined as std::vector<T> and is specified as a scalar value T in the input file, the code crashes.

Add check into GYMLFile if the param exists as vector and if not, then load is as a scalar value and turn it into an array.

Rename InputParameters

  • rename InputParameters to Parameters (we are using namespaces, so we can avoid name collisions easily)
  • rename valid_params to parameters

ExodusII output

  • write element blocks (i.e. blocks with different block number and potentially even element type)
  • write element block names
  • write node set name
  • write side set name
  • write elemental variables

Note: node sets are not really being used ATM, so not doing that.

ExodusII: allow only selected variables to be stored

Allow users to specify which variables should be stored into the output file.

By variables we really mean field variables and postprocessor values. In ExodusII lingo, those are all referred to as variables.

Improve "Created by" in `ExodusIIOutput`

ExodusIIOutput::write_info() should query application name and version. It should not hardcode "godzilla" and its version.

Files are created by applications, so they need to take credit/blame.

Fix linking in the build system

On Mac, we have to do this in the build system

if (DEFINED ENV{CONDA_PREFIX})
    set(CMAKE_BUILD_RPATH $ENV{CONDA_PREFIX}/lib)
endif()

This is a dirty hack to get installed godzilla link properly to a godzilla-based application.

However, this is causing a problem for developers of the godzilla library, since the build binaries like tests or examples are picking up the installed lib instead of the one we built.

So, developers have to do make install in their workflow, which is tedious and sometimes they (i.e. I) forget and weird problems can occur.

Create `PiecewiseConstant` function

Like we have PiecewiseLinear function, we want a piecewise constant one.

This simplifies the setup of problems with discontinuities, where we had to fake the discontinuity via piecewise linear function.

Warn about unused input file parameters

It is really ๐Ÿ˜ž when you think your input file parameter is correct, and you think the code is using it, but actually it does not.

Can spend hours on debugging your code when a proper warning would save you right there!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.