Ejemplo n.º 1
0
  private void fixPIMPLE_PISOSolver(Model model) {
    State state = model.getState();
    if (state.isTransient() && state.isIncompressible()) {
      SystemFolder systemFolder = model.getProject().getSystemFolder();
      Dictionary fvSolution = systemFolder.getFvSolution();

      Dictionary stateData = model.getDefaults().getDefaultStateData();
      Dictionary pisoSolution =
          stateData.subDict("pisoFoamRAS").subDict(SYSTEM).subDict(FV_SOLUTION);
      Dictionary pimpleSolution =
          stateData.subDict("pimpleFoamRAS").subDict(SYSTEM).subDict(FV_SOLUTION);

      if (isPISO() && fvSolution.found(SolverFamily.PIMPLE.getKey())) {
        systemFolder.setFvSolution(pisoSolution);
        state.setSolverFamily(SolverFamily.PISO);
        solversTable.updateSolver(state);
        ModulesUtil.updateSolver(modules, state);
        model.solverChanged();
      } else if (isPIMPLE() && fvSolution.found(SolverFamily.PISO.getKey())) {
        systemFolder.setFvSolution(pimpleSolution);
        state.setSolverFamily(SolverFamily.PIMPLE);
        solversTable.updateSolver(state);
        ModulesUtil.updateSolver(modules, state);
        model.solverChanged();
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  public Dictionary getDefaultsFor(State state) {
    String primalState = toPrimalState(state);
    if (primalState == null) {
      String msg = "[ {} provider ]: No defaults for state: {}";
      logger.warn(msg, getName(), state.state2String());
      return new Dictionary("");
    } else {
      logger.info("[ {} provider ]: Defaults FOUND for state: {}", getName(), state.state2String());
    }

    return mergeBase(primalState);
  }
Ejemplo n.º 3
0
  private void fixPIMPLE_CENTRALSolver(Model model) {
    State state = model.getState();
    if (state.isTransient() && state.isCompressible() && state.isHighMach()) {
      SystemFolder systemFolder = model.getProject().getSystemFolder();
      if (isCENTRAL() && state.getSolverFamily().isPimple()) {
        state.setSolverFamily(SolverFamily.CENTRAL);
        solversTable.updateSolver(state);
        ModulesUtil.updateSolver(modules, state);

        Dictionary stateData = model.getDefaults().getDefaultsFor(state);
        Dictionary solutionDict = stateData.subDict(SYSTEM).subDict(FV_SOLUTION);
        Dictionary schemesDict = stateData.subDict(SYSTEM).subDict(FV_SCHEMES);

        systemFolder.setFvSolution(solutionDict);
        systemFolder.setFvSchemes(schemesDict);

        model.solverChanged();
      } else if (isPIMPLE() && state.getSolverFamily().isCentral()) {
        state.setSolverFamily(SolverFamily.PIMPLE);
        solversTable.updateSolver(state);
        ModulesUtil.updateSolver(modules, state);

        Dictionary stateData = model.getDefaults().getDefaultsFor(state);
        Dictionary solutionDict = stateData.subDict(SYSTEM).subDict(FV_SOLUTION);
        Dictionary schemesDict = stateData.subDict(SYSTEM).subDict(FV_SCHEMES);

        systemFolder.setFvSolution(solutionDict);
        systemFolder.setFvSchemes(schemesDict);

        model.solverChanged();
      }
    }
  }
Ejemplo n.º 4
0
 private boolean stateHasChanged() {
   State state = model.getState();
   SolverFamily family = state.getSolverFamily();
   if (state.isTransient() && state.isIncompressible()) {
     return family.isPiso() && isPIMPLE() || family.isPimple() && isPISO();
   }
   if (state.isTransient() && state.isCompressible() && state.isHighMach()) {
     return family.isCentral() && isPIMPLE() || family.isPimple() && isCENTRAL();
   }
   return false;
 }
Ejemplo n.º 5
0
  /**
   * @param stringOfState for example "(steady incompressible ras)"
   * @return for example "simpleFoam"
   */
  public String toPrimalState(State state) {
    String state2String = state.state2String();

    Dictionary statesDict = getStates();

    // System.out.println("AbstractDefaultsProvider.toPrimalState() "+statesDict);

    if (statesDict != null) {
      Map<String, String> STATES = Util.invertMap(statesDict.getFieldsMap());

      if (STATES.containsKey(state2String)) {
        return STATES.get(state2String);
      } else {
        logger.warn("[ {} Provider ]: State '{}' NOT AVAILABLE", getName(), state2String);
        return null;
      }
    } else {
      logger.warn("[ {} Provider ]: State '{}' NOT AVAILABLE", getName(), state2String);
      return null;
    }
  }